agent-claw: automated task changes

This commit is contained in:
daniel
2026-05-06 18:55:16 -05:00
parent 38905bb1e9
commit 732b00fb66
8494 changed files with 2018127 additions and 4 deletions

View File

@@ -0,0 +1,46 @@
import type { Construct } from 'constructs';
import type { ProductStack } from './product-stack';
import type { IBucket } from '../../aws-s3';
import * as s3_assets from '../../aws-s3-assets';
/**
* Represents the Product Provisioning Artifact Template.
*/
export declare abstract class CloudFormationTemplate {
/**
* Template from URL
* @param url The url that points to the provisioning artifacts template
*/
static fromUrl(url: string): CloudFormationTemplate;
/**
* Loads the provisioning artifacts template from a local disk path.
*
* @param path A file containing the provisioning artifacts
*/
static fromAsset(path: string, options?: s3_assets.AssetOptions): CloudFormationTemplate;
/**
* Creates a product with the resources defined in the given product stack.
*/
static fromProductStack(productStack: ProductStack): CloudFormationTemplate;
/**
* Called when the product is initialized to allow this object to bind
* to the stack, add resources and have fun.
*
* @param scope The binding scope. Don't be smart about trying to down-cast or
* assume it's initialized. You may just use it as a construct scope.
*/
abstract bind(scope: Construct): CloudFormationTemplateConfig;
}
/**
* Result of binding `Template` into a `Product`.
*/
export interface CloudFormationTemplateConfig {
/**
* The http url of the template in S3.
*/
readonly httpUrl: string;
/**
* The S3 bucket containing product stack assets.
* @default - None - no assets are used in this product
*/
readonly assetBucket?: IBucket;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.CloudFormationTemplate=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var util_1=()=>{var tmp=require("./private/util");return util_1=()=>tmp,tmp},s3_assets=()=>{var tmp=require("../../aws-s3-assets");return s3_assets=()=>tmp,tmp};class CloudFormationTemplate{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_servicecatalog.CloudFormationTemplate",version:"2.252.0"};static fromUrl(url){return new CloudFormationUrlTemplate(url)}static fromAsset(path,options){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_s3_assets_AssetOptions(options)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromAsset),error}return new CloudFormationAssetTemplate(path,options)}static fromProductStack(productStack){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_servicecatalog_ProductStack(productStack)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.fromProductStack),error}return new CloudFormationProductStackTemplate(productStack)}}exports.CloudFormationTemplate=CloudFormationTemplate;class CloudFormationUrlTemplate extends CloudFormationTemplate{url;constructor(url){super(),this.url=url}bind(_scope){return{httpUrl:this.url}}}class CloudFormationAssetTemplate extends CloudFormationTemplate{path;options;asset;constructor(path,options={}){super(),this.path=path,this.options=options}bind(scope){return this.asset||(this.asset=new(s3_assets()).Asset(scope,`Template${(0,util_1().hashValues)(this.path)}`,{path:this.path,...this.options})),{httpUrl:this.asset.httpUrl}}}class CloudFormationProductStackTemplate extends CloudFormationTemplate{productStack;constructor(productStack){super(),this.productStack=productStack}bind(_scope){return{httpUrl:this.productStack._getTemplateUrl(),assetBucket:this.productStack._getAssetBucket()}}}

View File

@@ -0,0 +1,23 @@
/**
* Constant for the default directory to store ProductStack snapshots.
*/
export declare const DEFAULT_PRODUCT_STACK_SNAPSHOT_DIRECTORY = "product-stack-snapshots";
/**
* The language code.
* Used for error and logging messages for end users.
* The default behavior if not specified is English.
*/
export declare enum MessageLanguage {
/**
* English
*/
EN = "en",
/**
* Japanese
*/
JP = "jp",
/**
* Chinese
*/
ZH = "zh"
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MessageLanguage=exports.DEFAULT_PRODUCT_STACK_SNAPSHOT_DIRECTORY=void 0,exports.DEFAULT_PRODUCT_STACK_SNAPSHOT_DIRECTORY="product-stack-snapshots";var MessageLanguage;(function(MessageLanguage2){MessageLanguage2.EN="en",MessageLanguage2.JP="jp",MessageLanguage2.ZH="zh"})(MessageLanguage||(exports.MessageLanguage=MessageLanguage={}));

View File

@@ -0,0 +1,99 @@
import type { MessageLanguage } from './common';
import type * as iam from '../../aws-iam';
import type * as cdk from '../../core';
/**
* Properties for governance mechanisms and constraints.
*/
export interface CommonConstraintOptions {
/**
* The language code.
* Configures the language for error messages from service catalog.
*
* @default - English
*/
readonly messageLanguage?: MessageLanguage;
/**
* The description of the constraint.
*
* @default - No description provided
*/
readonly description?: string;
}
/**
* Properties for deploying with Stackset, which creates a StackSet constraint.
*/
export interface StackSetsConstraintOptions extends CommonConstraintOptions {
/**
* List of accounts to deploy stacks to.
*/
readonly accounts: string[];
/**
* List of regions to deploy stacks to.
*/
readonly regions: string[];
/**
* IAM role used to administer the StackSets configuration.
*/
readonly adminRole: iam.IRoleRef;
/**
* IAM role used to provision the products in the Stacks.
*/
readonly executionRoleName: string;
/**
* Whether to allow end users to create, update, and delete stacks.
*
* @default false
*/
readonly allowStackSetInstanceOperations?: boolean;
}
/**
* Properties for ResourceUpdateConstraint.
*/
export interface TagUpdateConstraintOptions extends CommonConstraintOptions {
/**
* Toggle for if users should be allowed to change/update tags on provisioned products.
* @default true
*/
readonly allow?: boolean;
}
/**
* An assertion within a template rule, defined by intrinsic functions.
*/
export interface TemplateRuleAssertion {
/**
* The assertion condition.
*/
readonly assert: cdk.ICfnRuleConditionExpression;
/**
* The description for the asssertion.
* @default - no description provided for the assertion.
*/
readonly description?: string;
}
/**
* Defines the provisioning template constraints.
*/
export interface TemplateRule {
/**
* Name of the rule.
*/
readonly ruleName: string;
/**
* Specify when to apply rule with a rule-specific intrinsic function.
* @default - no rule condition provided
*/
readonly condition?: cdk.ICfnRuleConditionExpression;
/**
* A list of assertions that make up the rule.
*/
readonly assertions: TemplateRuleAssertion[];
}
/**
* Properties for provisoning rule constraint.
*/
export interface CloudFormationRuleConstraintOptions extends CommonConstraintOptions {
/**
* The rule with condition and assertions to apply to template.
*/
readonly rule: TemplateRule;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});

View File

@@ -0,0 +1,9 @@
export * from './common';
export * from './constraints';
export * from './cloudformation-template';
export * from './portfolio';
export * from './product';
export * from './product-stack';
export * from './product-stack-history';
export * from './tag-options';
export * from './servicecatalog.generated';

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,218 @@
import type { Construct } from 'constructs';
import type { MessageLanguage } from './common';
import type { CloudFormationRuleConstraintOptions, CommonConstraintOptions, StackSetsConstraintOptions, TagUpdateConstraintOptions } from './constraints';
import type { IProduct } from './product';
import type { TagOptions } from './tag-options';
import * as iam from '../../aws-iam';
import type * as sns from '../../aws-sns';
import * as cdk from '../../core';
import type { IPortfolioRef, PortfolioReference } from '../../interfaces/generated/aws-servicecatalog-interfaces.generated';
/**
* Options for portfolio share.
*/
export interface PortfolioShareOptions {
/**
* Whether to share tagOptions as a part of the portfolio share
*
* @default - share not specified
*/
readonly shareTagOptions?: boolean;
/**
* The message language of the share.
* Controls status and error message language for share.
*
* @default - English
*/
readonly messageLanguage?: MessageLanguage;
}
/**
* A Service Catalog portfolio.
*/
export interface IPortfolio extends cdk.IResource, IPortfolioRef {
/**
* The ARN of the portfolio.
* @attribute
*/
readonly portfolioArn: string;
/**
* The ID of the portfolio.
* @attribute
*/
readonly portfolioId: string;
/**
* Associate portfolio with an IAM Role.
* @param role an IAM role
*/
giveAccessToRole(role: iam.IRole): void;
/**
* Associate portfolio with an IAM User.
* @param user an IAM user
*/
giveAccessToUser(user: iam.IUser): void;
/**
* Associate portfolio with an IAM Group.
* @param group an IAM Group
*/
giveAccessToGroup(group: iam.IGroup): void;
/**
* Initiate a portfolio share with another account.
* @param accountId AWS account to share portfolio with
* @param options Options for the initiate share
*/
shareWithAccount(accountId: string, options?: PortfolioShareOptions): void;
/**
* Associate portfolio with the given product.
* @param product A service catalog produt.
*/
addProduct(product: IProduct): void;
/**
* Associate Tag Options.
* A TagOption is a key-value pair managed in AWS Service Catalog.
* It is not an AWS tag, but serves as a template for creating an AWS tag based on the TagOption.
*/
associateTagOptions(tagOptions: TagOptions): void;
/**
* Add a Resource Update Constraint.
*/
constrainTagUpdates(product: IProduct, options?: TagUpdateConstraintOptions): void;
/**
* Add notifications for supplied topics on the provisioned product.
* @param product A service catalog product.
* @param topic A SNS Topic to receive notifications on events related to the provisioned product.
*/
notifyOnStackEvents(product: IProduct, topic: sns.ITopic, options?: CommonConstraintOptions): void;
/**
* Set provisioning rules for the product.
* @param product A service catalog product.
* @param options options for the constraint.
*/
constrainCloudFormationParameters(product: IProduct, options: CloudFormationRuleConstraintOptions): void;
/**
* Force users to assume a certain role when launching a product.
* This sets the launch role using the role arn which is tied to the account this role exists in.
* This is useful if you will be provisioning products from the account where this role exists.
* If you intend to share the portfolio across accounts, use a local launch role.
*
* @param product A service catalog product.
* @param launchRole The IAM role a user must assume when provisioning the product.
* @param options options for the constraint.
*/
setLaunchRole(product: IProduct, launchRole: iam.IRole, options?: CommonConstraintOptions): void;
/**
* Force users to assume a certain role when launching a product.
* The role will be referenced by name in the local account instead of a static role arn.
* A role with this name will automatically be created and assumable by Service Catalog in this account.
* This is useful when sharing the portfolio with multiple accounts.
*
* @param product A service catalog product.
* @param launchRoleName The name of the IAM role a user must assume when provisioning the product. A role with this name must exist in the account where the portolio is created and the accounts it is shared with.
* @param options options for the constraint.
*/
setLocalLaunchRoleName(product: IProduct, launchRoleName: string, options?: CommonConstraintOptions): iam.IRole;
/**
* Force users to assume a certain role when launching a product.
* The role name will be referenced by in the local account and must be set explicitly.
* This is useful when sharing the portfolio with multiple accounts.
*
* @param product A service catalog product.
* @param launchRole The IAM role a user must assume when provisioning the product. A role with this name must exist in the account where the portolio is created and the accounts it is shared with. The role name must be set explicitly.
* @param options options for the constraint.
*/
setLocalLaunchRole(product: IProduct, launchRole: iam.IRole, options?: CommonConstraintOptions): void;
/**
* Configure deployment options using AWS Cloudformation StackSets
*
* @param product A service catalog product.
* @param options Configuration options for the constraint.
*/
deployWithStackSets(product: IProduct, options: StackSetsConstraintOptions): void;
}
declare abstract class PortfolioBase extends cdk.Resource implements IPortfolio {
abstract readonly portfolioArn: string;
abstract readonly portfolioId: string;
private readonly associatedPrincipals;
private readonly assetBuckets;
private readonly sharedAccounts;
get portfolioRef(): PortfolioReference;
giveAccessToRole(role: iam.IRole): void;
giveAccessToUser(user: iam.IUser): void;
giveAccessToGroup(group: iam.IGroup): void;
addProduct(product: IProduct): void;
shareWithAccount(accountId: string, options?: PortfolioShareOptions): void;
associateTagOptions(tagOptions: TagOptions): void;
constrainTagUpdates(product: IProduct, options?: TagUpdateConstraintOptions): void;
notifyOnStackEvents(product: IProduct, topic: sns.ITopic, options?: CommonConstraintOptions): void;
constrainCloudFormationParameters(product: IProduct, options: CloudFormationRuleConstraintOptions): void;
setLaunchRole(product: IProduct, launchRole: iam.IRole, options?: CommonConstraintOptions): void;
setLocalLaunchRoleName(product: IProduct, launchRoleName: string, options?: CommonConstraintOptions): iam.IRole;
setLocalLaunchRole(product: IProduct, launchRole: iam.IRole, options?: CommonConstraintOptions): void;
deployWithStackSets(product: IProduct, options: StackSetsConstraintOptions): void;
/**
* Associate a principal with the portfolio.
* If the principal is already associated, it will skip.
*/
private associatePrincipal;
/**
* Gives access to Asset Buckets to Shared Accounts.
*
*/
protected addBucketPermissionsToSharedAccounts(): void;
/**
* Create a unique id based off the L1 CfnPortfolio or the arn of an imported portfolio.
*/
protected abstract generateUniqueHash(value: string): string;
}
/**
* Properties for a Portfolio.
*/
export interface PortfolioProps {
/**
* The name of the portfolio.
*/
readonly displayName: string;
/**
* The provider name.
*/
readonly providerName: string;
/**
* The message language. Controls language for
* status logging and errors.
*
* @default - English
*/
readonly messageLanguage?: MessageLanguage;
/**
* Description for portfolio.
*
* @default - No description provided
*/
readonly description?: string;
/**
* TagOptions associated directly to a portfolio.
*
* @default - No tagOptions provided
*/
readonly tagOptions?: TagOptions;
}
/**
* A Service Catalog portfolio.
*/
export declare class Portfolio extends PortfolioBase {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* Creates a Portfolio construct that represents an external portfolio.
*
* @param scope The parent creating construct (usually `this`).
* @param id The construct's name.
* @param portfolioArn the Amazon Resource Name of the existing portfolio.
*/
static fromPortfolioArn(scope: Construct, id: string, portfolioArn: string): IPortfolio;
readonly portfolioArn: string;
readonly portfolioId: string;
private readonly portfolio;
constructor(scope: Construct, id: string, props: PortfolioProps);
protected generateUniqueHash(value: string): string;
private validatePortfolioProps;
}
export {};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,27 @@
import type * as iam from '../../../aws-iam';
import type * as sns from '../../../aws-sns';
import type * as cdk from '../../../core';
import type { CloudFormationRuleConstraintOptions, CommonConstraintOptions, StackSetsConstraintOptions, TagUpdateConstraintOptions } from '../constraints';
import type { IPortfolio } from '../portfolio';
import type { IProduct } from '../product';
import { CfnPortfolioProductAssociation } from '../servicecatalog.generated';
import type { TagOptions } from '../tag-options';
export declare class AssociationManager {
static associateProductWithPortfolio(portfolio: IPortfolio, product: IProduct, options: CommonConstraintOptions | undefined): {
associationKey: string;
cfnPortfolioProductAssociation: CfnPortfolioProductAssociation;
};
static constrainTagUpdates(portfolio: IPortfolio, product: IProduct, options: TagUpdateConstraintOptions): void;
static notifyOnStackEvents(portfolio: IPortfolio, product: IProduct, topic: sns.ITopic, options: CommonConstraintOptions): void;
static constrainCloudFormationParameters(portfolio: IPortfolio, product: IProduct, options: CloudFormationRuleConstraintOptions): void;
static setLaunchRole(portfolio: IPortfolio, product: IProduct, launchRole: iam.IRoleRef, options: CommonConstraintOptions): void;
static setLocalLaunchRoleName(portfolio: IPortfolio, product: IProduct, launchRoleName: string, options: CommonConstraintOptions): void;
static deployWithStackSets(portfolio: IPortfolio, product: IProduct, options: StackSetsConstraintOptions): void;
static associateTagOptions(resource: cdk.IResource, resourceId: string, tagOptions: TagOptions): void;
private static setLaunchRoleConstraint;
private static stackSetConstraintLogicalId;
private static launchRoleConstraintLogicalId;
private static prettyPrintAssociation;
private static formatTemplateRule;
private static formatAssertions;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,58 @@
import type { IBucket } from '../../../aws-s3';
import { ServerSideEncryption } from '../../../aws-s3-deployment';
import * as cdk from '../../../core';
/**
* Product stack synthesizer props.
*/
export interface ProductStackSynthesizerProps {
/**
* The parent stack of the stack that this synthesizer is bound to.
*/
readonly parentStack: cdk.Stack;
/**
* The bucket used to store assets and enable ProductStack asset support.
*
* @default - No bucket provided and assets will not be supported
*/
readonly assetBucket?: IBucket;
/**
* A ServerSideEncryption can be enabled to encrypt assets that are put into assetBucket.
*
* @default - No encryption is used
*/
readonly serverSideEncryption?: ServerSideEncryption;
/**
* For AWS_KMS ServerSideEncryption a KMS KeyId must be provided which will be used to encrypt assets.
*
* @default - No KMS KeyId and SSE_KMS encryption cannot be used
*/
readonly serverSideEncryptionAwsKmsKeyId?: string;
/**
* The amount of memory (in MiB) to allocate to the AWS Lambda function which
* replicates the files from the CDK bucket to the destination bucket.
*
* If you are deploying large files, you will need to increase this number
* accordingly.
*
* @default 128
*/
readonly memoryLimit?: number;
}
/**
* Deployment environment for an AWS Service Catalog product stack.
*
* Interoperates with the StackSynthesizer of the parent stack.
*/
export declare class ProductStackSynthesizer extends cdk.StackSynthesizer {
private readonly parentStack;
private readonly assetBucket?;
private readonly serverSideEncryption?;
private readonly serverSideEncryptionAwsKmsKeyId?;
private readonly memoryLimit?;
private parentAssetBucket?;
constructor(props: ProductStackSynthesizerProps);
addFileAsset(asset: cdk.FileAssetSource): cdk.FileAssetLocation;
private physicalNameOfBucket;
addDockerImageAsset(_asset: cdk.DockerImageAssetSource): cdk.DockerImageAssetLocation;
synthesize(session: cdk.ISynthesisSession): void;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProductStackSynthesizer=void 0;var aws_s3_1=()=>{var tmp=require("../../../aws-s3");return aws_s3_1=()=>tmp,tmp},aws_s3_deployment_1=()=>{var tmp=require("../../../aws-s3-deployment");return aws_s3_deployment_1=()=>tmp,tmp},cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class ProductStackSynthesizer extends cdk().StackSynthesizer{parentStack;assetBucket;serverSideEncryption;serverSideEncryptionAwsKmsKeyId;memoryLimit;parentAssetBucket;constructor(props){super(),this.parentStack=props.parentStack,this.assetBucket=props.assetBucket,this.serverSideEncryption=props.serverSideEncryption,this.serverSideEncryptionAwsKmsKeyId=props.serverSideEncryptionAwsKmsKeyId,this.memoryLimit=props.memoryLimit,this.assetBucket&&!cdk().Resource.isOwnedResource(this.assetBucket)&&cdk().Annotations.of(this.parentStack).addWarningV2("@aws-cdk/aws-servicecatalog:assetsManuallyAddBucketPermissions","[WARNING] Bucket Policy Permissions cannot be added to referenced Bucket. Please make sure your bucket has the correct permissions")}addFileAsset(asset){if(!this.assetBucket)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`AssetBucketRequired`,"An Asset Bucket must be provided to use Assets");const location=this.parentStack.synthesizer.addFileAsset(asset);this.parentAssetBucket||(this.parentAssetBucket=aws_s3_1().Bucket.fromBucketName(this.boundStack,"ParentAssetBucket",location.bucketName));const objectKey=location.objectKey,source=aws_s3_deployment_1().Source.bucket(this.parentAssetBucket,location.objectKey);if(this.serverSideEncryption===aws_s3_deployment_1().ServerSideEncryption.AWS_KMS&&!this.serverSideEncryptionAwsKmsKeyId)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`KmsKeyRequiredForSseKms`,"A KMS Key must be provided to use SSE_KMS");if(this.serverSideEncryption!==aws_s3_deployment_1().ServerSideEncryption.AWS_KMS&&this.serverSideEncryptionAwsKmsKeyId)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`SseKmsRequiredForKmsKey`,"A SSE_KMS encryption must be enabled if you provide KMS Key");const deploymentScope=this.assetBucket,deploymentCid="ProductAssetsDeployment";(deploymentScope.node.tryFindChild(deploymentCid)??new(aws_s3_deployment_1()).BucketDeployment(deploymentScope,deploymentCid,{sources:[source],destinationBucket:this.assetBucket,extract:!1,prune:!1,retainOnDelete:!0,serverSideEncryption:this.serverSideEncryption,serverSideEncryptionAwsKmsKeyId:this.serverSideEncryptionAwsKmsKeyId,memoryLimit:this.memoryLimit,outputObjectKeys:!1})).addSource(source);const bucketName=this.physicalNameOfBucket(this.assetBucket);if(!asset.fileName)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`AssetFileNameRequired`,"Asset file name is undefined");const s3ObjectUrl=`s3://${bucketName}/${objectKey}`,httpUrl=`https://s3.${bucketName}/${objectKey}`;return{bucketName,objectKey,httpUrl,s3ObjectUrl,s3Url:httpUrl}}physicalNameOfBucket(bucket){let resolvedName;if(cdk().Resource.isOwnedResource(bucket)?resolvedName=cdk().Stack.of(bucket).resolve(bucket.node.defaultChild.bucketName):resolvedName=bucket.bucketName,resolvedName===void 0)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`BucketNameRequiredForAssets`,"A bucketName must be provided to use Assets");return resolvedName}addDockerImageAsset(_asset){throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`DockerAssetsNotSupported`,"Service Catalog Product Stacks cannot use Assets")}synthesize(session){this.synthesizeTemplate(session)}}exports.ProductStackSynthesizer=ProductStackSynthesizer;

View File

@@ -0,0 +1,4 @@
/**
* Generates a unique hash identfifer using SHA256 encryption algorithm
*/
export declare function hashValues(...ids: string[]): string;

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.hashValues=hashValues;var crypto=()=>{var tmp=require("crypto");return crypto=()=>tmp,tmp};function hashValues(...ids){const sha256=crypto().createHash("sha256");return ids.forEach(val=>sha256.update(val)),sha256.digest("hex").slice(0,12)}

View File

@@ -0,0 +1,27 @@
import type * as iam from '../../../aws-iam';
/**
* Class to validate that inputs match requirements.
*/
export declare class InputValidator {
/**
* Validates length is between allowed min and max lengths.
*/
static validateLength(resourceName: string, inputName: string, minLength: number, maxLength: number, inputString?: string): void;
/**
* Validates string matches the allowed regex pattern.
*/
static validateRegex(resourceName: string, inputName: string, regexp: RegExp, inputString?: string): void;
/**
* Validates string matches the valid URL regex pattern.
*/
static validateUrl(resourceName: string, inputName: string, inputString?: string): void;
/**
* Validates string matches the valid email regex pattern.
*/
static validateEmail(resourceName: string, inputName: string, inputString?: string): void;
/**
* Validates that a role being used as a local launch role has the role name set
*/
static validateRoleNameSetForLocalLaunchRole(role: iam.IRole): void;
private static truncateString;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.InputValidator=void 0;var cdk=()=>{var tmp=require("../../../core");return cdk=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class InputValidator{static validateLength(resourceName,inputName,minLength,maxLength,inputString){if(!cdk().Token.isUnresolved(inputString)&&inputString!==void 0&&(inputString.length<minLength||inputString.length>maxLength))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`InvalidInputLength`,`Invalid ${inputName} for resource ${resourceName}, must have length between ${minLength} and ${maxLength}, got: '${this.truncateString(inputString,100)}'`)}static validateRegex(resourceName,inputName,regexp,inputString){if(!cdk().Token.isUnresolved(inputString)&&inputString!==void 0&&!regexp.test(inputString))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`InvalidInputPattern`,`Invalid ${inputName} for resource ${resourceName}, must match regex pattern ${regexp}, got: '${this.truncateString(inputString,100)}'`)}static validateUrl(resourceName,inputName,inputString){this.validateRegex(resourceName,inputName,/^https?:\/\/.*/,inputString)}static validateEmail(resourceName,inputName,inputString){this.validateRegex(resourceName,inputName,/^[\w\d.%+\-]+@[a-z\d.\-]+\.[a-z]{2,4}$/i,inputString)}static validateRoleNameSetForLocalLaunchRole(role){if(role.node.defaultChild&&cdk().Token.isUnresolved(role.node.defaultChild.roleName))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`LocalLaunchRoleMustHaveRoleName`,`Role ${role.node.id} used for Local Launch Role must have roleName explicitly set`)}static truncateString(string,maxLength){return string.length>maxLength?string.substring(0,maxLength)+"[truncated]":string}}exports.InputValidator=InputValidator;

View File

@@ -0,0 +1,62 @@
import { Construct } from 'constructs';
import type { CloudFormationProductVersion } from './product';
import type { ProductStack } from './product-stack';
/**
* Properties for a ProductStackHistory.
*/
export interface ProductStackHistoryProps {
/**
* The ProductStack whose history will be retained as a snapshot
*/
readonly productStack: ProductStack;
/**
* The current version name of the ProductStack.
*/
readonly currentVersionName: string;
/**
* If this is set to true, the ProductStack will not be overwritten if a snapshot is found for the currentVersionName.
*/
readonly currentVersionLocked: boolean;
/**
* The description of the product version
* @default - No description provided
*/
readonly description?: string;
/**
* Whether the specified product template will be validated by CloudFormation.
* If turned off, an invalid template configuration can be stored.
* @default true
*/
readonly validateTemplate?: boolean;
/**
* The directory where template snapshots will be stored
* @default 'product-stack-snapshots'
*/
readonly directory?: string;
}
/**
* A Construct that contains a Service Catalog product stack with its previous deployments maintained.
*/
export declare class ProductStackHistory extends Construct {
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
private readonly props;
constructor(scope: Construct, id: string, props: ProductStackHistoryProps);
/**
* Retains product stack template as a snapshot when deployed and
* retrieves a CloudFormationProductVersion for the current product version.
*/
currentVersion(): CloudFormationProductVersion;
/**
* Retrieves a CloudFormationProductVersion from a previously deployed productVersionName.
*/
versionFromSnapshot(productVersionName: string): CloudFormationProductVersion;
/**
* Writes current template generated from Product Stack to a snapshot directory.
*
* @internal
*/
_writeTemplateToSnapshot(cfn: string): void;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,101 @@
import type { Construct } from 'constructs';
import type { ProductStackHistory } from './product-stack-history';
import type { IBucket } from '../../aws-s3';
import type { ServerSideEncryption } from '../../aws-s3-deployment';
import * as cdk from '../../core';
/**
* Product stack props.
*/
export interface ProductStackProps {
/**
* A Bucket can be passed to store assets, enabling ProductStack Asset support
*
* @default - No Bucket provided and Assets will not be supported.
*/
readonly assetBucket?: IBucket;
/**
* A ServerSideEncryption can be enabled to encrypt assets that are put into assetBucket
*
* @default - No encryption is used
*/
readonly serverSideEncryption?: ServerSideEncryption;
/**
* For AWS_KMS ServerSideEncryption a KMS KeyId must be provided which will be used to encrypt assets
*
* @default - No KMS KeyId and SSE_KMS encryption cannot be used
*/
readonly serverSideEncryptionAwsKmsKeyId?: string;
/**
* The amount of memory (in MiB) to allocate to the AWS Lambda function which
* replicates the files from the CDK bucket to the destination bucket.
*
* If you are deploying large files, you will need to increase this number
* accordingly.
*
* @default 128
*/
readonly memoryLimit?: number;
/**
* A description of the stack.
*
* @default - No description.
*/
readonly description?: string;
/**
* Include runtime versioning information in this Stack
*
* @default - `analyticsReporting` setting of containing `App`, or value of
* 'aws:cdk:version-reporting' context key
*/
readonly analyticsReporting?: boolean;
}
/**
* A Service Catalog product stack, which is similar in form to a Cloudformation nested stack.
* You can add the resources to this stack that you want to define for your service catalog product.
*
* This stack will not be treated as an independent deployment
* artifact (won't be listed in "cdk list" or deployable through "cdk deploy"),
* but rather only synthesized as a template and uploaded as an asset to S3.
*
*/
export declare class ProductStack extends cdk.Stack {
readonly templateFile: string;
private _parentProductStackHistory?;
private _templateUrl?;
private _parentStack;
private assetBucket?;
constructor(scope: Construct, id: string, props?: ProductStackProps);
/**
* Set the parent product stack history
*
* @internal
*/
_setParentProductStackHistory(parentProductStackHistory: ProductStackHistory): ProductStackHistory;
/**
* Fetch the template URL.
*
* @internal
*/
_getTemplateUrl(): string;
/**
* Fetch the asset bucket.
*
* @internal
*/
_getAssetBucket(): IBucket | undefined;
/**
* Fetch the parent Stack.
*
* @internal
*/
_getParentStack(): cdk.Stack;
/**
* Synthesize the product stack template, overrides the `super` class method.
*
* Defines an asset at the parent stack which represents the template of this
* product stack.
*
* @internal
*/
_synthesizeTemplate(session: cdk.ISynthesisSession): void;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProductStack=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var crypto=()=>{var tmp=require("crypto");return crypto=()=>tmp,tmp},fs=()=>{var tmp=require("fs");return fs=()=>tmp,tmp},path=()=>{var tmp=require("path");return path=()=>tmp,tmp},product_stack_synthesizer_1=()=>{var tmp=require("./private/product-stack-synthesizer");return product_stack_synthesizer_1=()=>tmp,tmp},cdk=()=>{var tmp=require("../../core");return cdk=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class ProductStack extends cdk().Stack{static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_servicecatalog.ProductStack",version:"2.252.0"};templateFile;_parentProductStackHistory;_templateUrl;_parentStack;assetBucket;constructor(scope,id,props={}){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_servicecatalog_ProductStackProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,ProductStack),error}const parentStack=findParentStack(scope);super(scope,id,{analyticsReporting:props.analyticsReporting,description:props.description,synthesizer:new(product_stack_synthesizer_1()).ProductStackSynthesizer({parentStack,assetBucket:props.assetBucket,serverSideEncryption:props.serverSideEncryption,serverSideEncryptionAwsKmsKeyId:props.serverSideEncryptionAwsKmsKeyId,memoryLimit:props.memoryLimit})}),this._parentStack=parentStack,this.templateFile=`${cdk().Names.uniqueId(this)}.product.template.json`,this.assetBucket=props.assetBucket}_setParentProductStackHistory(parentProductStackHistory){return this._parentProductStackHistory=parentProductStackHistory}_getTemplateUrl(){return cdk().Lazy.uncachedString({produce:()=>this._templateUrl})}_getAssetBucket(){return this.assetBucket}_getParentStack(){return this._parentStack}_synthesizeTemplate(session){const cfn=JSON.stringify(this._toCloudFormation(),void 0,2),templateHash=crypto().createHash("sha256").update(cfn).digest("hex");this._templateUrl=this._parentStack.synthesizer.addFileAsset({packaging:cdk().FileAssetPackaging.FILE,sourceHash:templateHash,fileName:this.templateFile,displayName:`${this.node.path} Template`}).httpUrl,this._parentProductStackHistory&&this._parentProductStackHistory._writeTemplateToSnapshot(cfn),fs().writeFileSync(path().join(session.assembly.outdir,this.templateFile),cfn)}}exports.ProductStack=ProductStack;function findParentStack(scope){try{return cdk().Stack.of(scope)}catch{throw new(core_1()).ValidationError((0,literal_string_1().lit)`ProductStackMustBeDefinedWithinStack`,"Product stacks must be defined within scope of another non-product stack",scope)}}

View File

@@ -0,0 +1,156 @@
import type { Construct } from 'constructs';
import type { CloudFormationTemplate } from './cloudformation-template';
import type { MessageLanguage } from './common';
import type { TagOptions } from './tag-options';
import type { IBucket } from '../../aws-s3';
import type { IResource } from '../../core';
import { Resource } from '../../core';
import type { CloudFormationProductReference, ICloudFormationProductRef } from '../../interfaces/generated/aws-servicecatalog-interfaces.generated';
/**
* A Service Catalog product, currently only supports type CloudFormationProduct
*/
export interface IProduct extends IResource, ICloudFormationProductRef {
/**
* The ARN of the product.
* @attribute
*/
readonly productArn: string;
/**
* The id of the product
* @attribute
*/
readonly productId: string;
/**
* The asset buckets of a product created via product stack.
* @attribute
*/
readonly assetBuckets: IBucket[];
/**
* Associate Tag Options.
* A TagOption is a key-value pair managed in AWS Service Catalog.
* It is not an AWS tag, but serves as a template for creating an AWS tag based on the TagOption.
*/
associateTagOptions(tagOptions: TagOptions): void;
}
declare abstract class ProductBase extends Resource implements IProduct {
abstract readonly productArn: string;
abstract readonly productId: string;
abstract readonly assetBuckets: IBucket[];
get cloudFormationProductRef(): CloudFormationProductReference;
associateTagOptions(tagOptions: TagOptions): void;
}
/**
* Properties of product version (also known as a provisioning artifact).
*/
export interface CloudFormationProductVersion {
/**
* The description of the product version
* @default - No description provided
*/
readonly description?: string;
/**
* Whether the specified product template will be validated by CloudFormation.
* If turned off, an invalid template configuration can be stored.
* @default true
*/
readonly validateTemplate?: boolean;
/**
* The S3 template that points to the provisioning version template
*/
readonly cloudFormationTemplate: CloudFormationTemplate;
/**
* The name of the product version.
* @default - No product version name provided
*/
readonly productVersionName?: string;
}
/**
* Properties for a Cloudformation Product
*/
export interface CloudFormationProductProps {
/**
* The owner of the product.
*/
readonly owner: string;
/**
* The name of the product.
*/
readonly productName: string;
/**
* The configuration of the product version.
*/
readonly productVersions: CloudFormationProductVersion[];
/**
* The language code.
* Controls language for logging and errors.
*
* @default - English
*/
readonly messageLanguage?: MessageLanguage;
/**
* The description of the product.
* @default - No description provided
*/
readonly description?: string;
/**
* The distributor of the product.
* @default - No distributor provided
*/
readonly distributor?: string;
/**
* Whether to give provisioning artifacts a new unique identifier when the product attributes or provisioning artifacts is updated
* @default false
*/
readonly replaceProductVersionIds?: boolean;
/**
* The support information about the product
* @default - No support description provided
*/
readonly supportDescription?: string;
/**
* The contact email for product support.
* @default - No support email provided
*/
readonly supportEmail?: string;
/**
* The contact URL for product support.
* @default - No support URL provided
*/
readonly supportUrl?: string;
/**
* TagOptions associated directly to a product.
*
* @default - No tagOptions provided
*/
readonly tagOptions?: TagOptions;
}
/**
* Abstract class for Service Catalog Product.
*/
export declare abstract class Product extends ProductBase {
/**
* Creates a Product construct that represents an external product.
* @param scope The parent creating construct (usually `this`).
* @param id The construct's name.
* @param productArn Product Arn
*/
static fromProductArn(scope: Construct, id: string, productArn: string): IProduct;
}
/**
* A Service Catalog Cloudformation Product.
*/
export declare class CloudFormationProduct extends Product {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
readonly productArn: string;
readonly productId: string;
/**
* The asset bucket of a product created via product stack.
* @default - Empty - no assets are used in this product
*/
readonly assetBuckets: IBucket[];
constructor(scope: Construct, id: string, props: CloudFormationProductProps);
private renderProvisioningArtifacts;
private validateProductProps;
}
export {};

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,13 @@
export interface MetricWithDims<D> {
readonly namespace: string;
readonly metricName: string;
readonly statistic: string;
readonly dimensionsMap: D;
}
export declare class ServiceCatalogMetrics {
static provisionedProductLaunchSum(this: void, dimensions: {
ProductId: string;
}): MetricWithDims<{
ProductId: string;
}>;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ServiceCatalogMetrics=void 0;class ServiceCatalogMetrics{static provisionedProductLaunchSum(dimensions){return{namespace:"AWS/ServiceCatalog",metricName:"ProvisionedProductLaunch",dimensionsMap:dimensions,statistic:"Sum"}}}exports.ServiceCatalogMetrics=ServiceCatalogMetrics;

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,35 @@
import type { Construct } from 'constructs';
import { CfnTagOption } from './servicecatalog.generated';
import * as cdk from '../../core';
/**
* Properties for TagOptions.
*/
export interface TagOptionsProps {
/**
* The values that are allowed to be set for specific tags.
* The keys of the map represent the tag keys,
* and the values of the map are a list of allowed values for that particular tag key.
*/
readonly allowedValuesForTags: {
[tagKey: string]: string[];
};
}
/**
* Defines a set of TagOptions, which are a list of key-value pairs managed in AWS Service Catalog.
* It is not an AWS tag, but serves as a template for creating an AWS tag based on the TagOption.
* See https://docs.aws.amazon.com/servicecatalog/latest/adminguide/tagoptions.html
*
* @resource AWS::ServiceCatalog::TagOption
*/
export declare class TagOptions extends cdk.Resource {
/** Uniquely identifies this class. */
static readonly PROPERTY_INJECTION_ID: string;
/**
* List of underlying CfnTagOption resources.
*
* @internal
*/
_cfnTagOptions: CfnTagOption[];
constructor(scope: Construct, id: string, props: TagOptionsProps);
private createUnderlyingTagOptions;
}

File diff suppressed because one or more lines are too long