UNPKG

@aws-cdk/aws-ecs

Version:

The CDK Construct Library for AWS::ECS

935 lines 1.27 MB
"use strict"; var _a, _b, _c, _d, _e, _f, _g; Object.defineProperty(exports, "__esModule", { value: true }); exports.CfnTaskSet = exports.CfnTaskDefinition = exports.CfnService = exports.CfnPrimaryTaskSet = exports.CfnClusterCapacityProviderAssociations = exports.CfnCluster = exports.CfnCapacityProvider = void 0; const jsiiDeprecationWarnings = require("../.warnings.jsii.js"); const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti"); // Copyright 2012-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Generated from the AWS CloudFormation Resource Specification // See: docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cfn-resource-specification.html // @cfn2ts:meta@ {"generated":"2023-06-19T15:21:32.416Z","fingerprint":"xTJPmCaq2v7nK3mRM5KxvnfckBQA0TXjUqjQy38bw/4="} /* eslint-disable max-len */ // This is generated code - line lengths are difficult to control const cdk = require("@aws-cdk/core"); const cfn_parse = require("@aws-cdk/core/lib/helpers-internal"); /** * Determine whether the given properties match those of a `CfnCapacityProviderProps` * * @param properties - the TypeScript properties of a `CfnCapacityProviderProps` * * @returns the result of the validation. */ function CfnCapacityProviderPropsValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('autoScalingGroupProvider', cdk.requiredValidator)(properties.autoScalingGroupProvider)); errors.collect(cdk.propertyValidator('autoScalingGroupProvider', CfnCapacityProvider_AutoScalingGroupProviderPropertyValidator)(properties.autoScalingGroupProvider)); errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name)); errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateCfnTag))(properties.tags)); return errors.wrap('supplied properties not correct for "CfnCapacityProviderProps"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::CapacityProvider` resource * * @param properties - the TypeScript properties of a `CfnCapacityProviderProps` * * @returns the AWS CloudFormation properties of an `AWS::ECS::CapacityProvider` resource. */ // @ts-ignore TS6133 function cfnCapacityProviderPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCapacityProviderPropsValidator(properties).assertSuccess(); return { AutoScalingGroupProvider: cfnCapacityProviderAutoScalingGroupProviderPropertyToCloudFormation(properties.autoScalingGroupProvider), Name: cdk.stringToCloudFormation(properties.name), Tags: cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags), }; } // @ts-ignore TS6133 function CfnCapacityProviderPropsFromCloudFormation(properties) { properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('autoScalingGroupProvider', 'AutoScalingGroupProvider', CfnCapacityProviderAutoScalingGroupProviderPropertyFromCloudFormation(properties.AutoScalingGroupProvider)); ret.addPropertyResult('name', 'Name', properties.Name != null ? cfn_parse.FromCloudFormation.getString(properties.Name) : undefined); ret.addPropertyResult('tags', 'Tags', properties.Tags != null ? cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * A CloudFormation `AWS::ECS::CapacityProvider` * * Creates a new capacity provider. Capacity providers are associated with an Amazon ECS cluster and are used in capacity provider strategies to facilitate cluster auto scaling. * * Only capacity providers that use an Auto Scaling group can be created. Amazon ECS tasks on AWS Fargate use the `FARGATE` and `FARGATE_SPOT` capacity providers. These providers are available to all accounts in the AWS Regions that AWS Fargate supports. * * @cloudformationResource AWS::ECS::CapacityProvider * @stability external * * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-capacityprovider.html */ class CfnCapacityProvider extends cdk.CfnResource { /** * Create a new `AWS::ECS::CapacityProvider`. * * @param scope - scope in which this resource is defined * @param id - scoped id of the resource * @param props - resource properties */ constructor(scope, id, props) { super(scope, id, { type: CfnCapacityProvider.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings._aws_cdk_aws_ecs_CfnCapacityProviderProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, CfnCapacityProvider); } throw error; } cdk.requireProperty(props, 'autoScalingGroupProvider', this); this.autoScalingGroupProvider = props.autoScalingGroupProvider; this.name = props.name; this.tags = new cdk.TagManager(cdk.TagType.STANDARD, "AWS::ECS::CapacityProvider", props.tags, { tagPropertyName: 'tags' }); } /** * A factory method that creates a new instance of this class from an object * containing the CloudFormation properties of this resource. * Used in the @aws-cdk/cloudformation-include module. * * @internal */ static _fromCloudFormation(scope, id, resourceAttributes, options) { resourceAttributes = resourceAttributes || {}; const resourceProperties = options.parser.parseValue(resourceAttributes.Properties); const propsResult = CfnCapacityProviderPropsFromCloudFormation(resourceProperties); const ret = new CfnCapacityProvider(scope, id, propsResult.value); for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) { ret.addPropertyOverride(propKey, propVal); } options.parser.handleAttributes(ret, resourceAttributes, id); return ret; } /** * Examines the CloudFormation resource and discloses attributes. * * @param inspector - tree inspector to collect and process attributes * */ inspect(inspector) { inspector.addAttribute("aws:cdk:cloudformation:type", CfnCapacityProvider.CFN_RESOURCE_TYPE_NAME); inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties); } get cfnProperties() { return { autoScalingGroupProvider: this.autoScalingGroupProvider, name: this.name, tags: this.tags.renderTags(), }; } renderProperties(props) { return cfnCapacityProviderPropsToCloudFormation(props); } } exports.CfnCapacityProvider = CfnCapacityProvider; _a = JSII_RTTI_SYMBOL_1; CfnCapacityProvider[_a] = { fqn: "@aws-cdk/aws-ecs.CfnCapacityProvider", version: "1.204.0" }; /** * The CloudFormation resource type name for this resource class. */ CfnCapacityProvider.CFN_RESOURCE_TYPE_NAME = "AWS::ECS::CapacityProvider"; /** * Determine whether the given properties match those of a `AutoScalingGroupProviderProperty` * * @param properties - the TypeScript properties of a `AutoScalingGroupProviderProperty` * * @returns the result of the validation. */ function CfnCapacityProvider_AutoScalingGroupProviderPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('autoScalingGroupArn', cdk.requiredValidator)(properties.autoScalingGroupArn)); errors.collect(cdk.propertyValidator('autoScalingGroupArn', cdk.validateString)(properties.autoScalingGroupArn)); errors.collect(cdk.propertyValidator('managedScaling', CfnCapacityProvider_ManagedScalingPropertyValidator)(properties.managedScaling)); errors.collect(cdk.propertyValidator('managedTerminationProtection', cdk.validateString)(properties.managedTerminationProtection)); return errors.wrap('supplied properties not correct for "AutoScalingGroupProviderProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::CapacityProvider.AutoScalingGroupProvider` resource * * @param properties - the TypeScript properties of a `AutoScalingGroupProviderProperty` * * @returns the AWS CloudFormation properties of an `AWS::ECS::CapacityProvider.AutoScalingGroupProvider` resource. */ // @ts-ignore TS6133 function cfnCapacityProviderAutoScalingGroupProviderPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCapacityProvider_AutoScalingGroupProviderPropertyValidator(properties).assertSuccess(); return { AutoScalingGroupArn: cdk.stringToCloudFormation(properties.autoScalingGroupArn), ManagedScaling: cfnCapacityProviderManagedScalingPropertyToCloudFormation(properties.managedScaling), ManagedTerminationProtection: cdk.stringToCloudFormation(properties.managedTerminationProtection), }; } // @ts-ignore TS6133 function CfnCapacityProviderAutoScalingGroupProviderPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('autoScalingGroupArn', 'AutoScalingGroupArn', cfn_parse.FromCloudFormation.getString(properties.AutoScalingGroupArn)); ret.addPropertyResult('managedScaling', 'ManagedScaling', properties.ManagedScaling != null ? CfnCapacityProviderManagedScalingPropertyFromCloudFormation(properties.ManagedScaling) : undefined); ret.addPropertyResult('managedTerminationProtection', 'ManagedTerminationProtection', properties.ManagedTerminationProtection != null ? cfn_parse.FromCloudFormation.getString(properties.ManagedTerminationProtection) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ManagedScalingProperty` * * @param properties - the TypeScript properties of a `ManagedScalingProperty` * * @returns the result of the validation. */ function CfnCapacityProvider_ManagedScalingPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('instanceWarmupPeriod', cdk.validateNumber)(properties.instanceWarmupPeriod)); errors.collect(cdk.propertyValidator('maximumScalingStepSize', cdk.validateNumber)(properties.maximumScalingStepSize)); errors.collect(cdk.propertyValidator('minimumScalingStepSize', cdk.validateNumber)(properties.minimumScalingStepSize)); errors.collect(cdk.propertyValidator('status', cdk.validateString)(properties.status)); errors.collect(cdk.propertyValidator('targetCapacity', cdk.validateNumber)(properties.targetCapacity)); return errors.wrap('supplied properties not correct for "ManagedScalingProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::CapacityProvider.ManagedScaling` resource * * @param properties - the TypeScript properties of a `ManagedScalingProperty` * * @returns the AWS CloudFormation properties of an `AWS::ECS::CapacityProvider.ManagedScaling` resource. */ // @ts-ignore TS6133 function cfnCapacityProviderManagedScalingPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCapacityProvider_ManagedScalingPropertyValidator(properties).assertSuccess(); return { InstanceWarmupPeriod: cdk.numberToCloudFormation(properties.instanceWarmupPeriod), MaximumScalingStepSize: cdk.numberToCloudFormation(properties.maximumScalingStepSize), MinimumScalingStepSize: cdk.numberToCloudFormation(properties.minimumScalingStepSize), Status: cdk.stringToCloudFormation(properties.status), TargetCapacity: cdk.numberToCloudFormation(properties.targetCapacity), }; } // @ts-ignore TS6133 function CfnCapacityProviderManagedScalingPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('instanceWarmupPeriod', 'InstanceWarmupPeriod', properties.InstanceWarmupPeriod != null ? cfn_parse.FromCloudFormation.getNumber(properties.InstanceWarmupPeriod) : undefined); ret.addPropertyResult('maximumScalingStepSize', 'MaximumScalingStepSize', properties.MaximumScalingStepSize != null ? cfn_parse.FromCloudFormation.getNumber(properties.MaximumScalingStepSize) : undefined); ret.addPropertyResult('minimumScalingStepSize', 'MinimumScalingStepSize', properties.MinimumScalingStepSize != null ? cfn_parse.FromCloudFormation.getNumber(properties.MinimumScalingStepSize) : undefined); ret.addPropertyResult('status', 'Status', properties.Status != null ? cfn_parse.FromCloudFormation.getString(properties.Status) : undefined); ret.addPropertyResult('targetCapacity', 'TargetCapacity', properties.TargetCapacity != null ? cfn_parse.FromCloudFormation.getNumber(properties.TargetCapacity) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `CfnClusterProps` * * @param properties - the TypeScript properties of a `CfnClusterProps` * * @returns the result of the validation. */ function CfnClusterPropsValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('capacityProviders', cdk.listValidator(cdk.validateString))(properties.capacityProviders)); errors.collect(cdk.propertyValidator('clusterName', cdk.validateString)(properties.clusterName)); errors.collect(cdk.propertyValidator('clusterSettings', cdk.listValidator(CfnCluster_ClusterSettingsPropertyValidator))(properties.clusterSettings)); errors.collect(cdk.propertyValidator('configuration', CfnCluster_ClusterConfigurationPropertyValidator)(properties.configuration)); errors.collect(cdk.propertyValidator('defaultCapacityProviderStrategy', cdk.listValidator(CfnCluster_CapacityProviderStrategyItemPropertyValidator))(properties.defaultCapacityProviderStrategy)); errors.collect(cdk.propertyValidator('serviceConnectDefaults', CfnCluster_ServiceConnectDefaultsPropertyValidator)(properties.serviceConnectDefaults)); errors.collect(cdk.propertyValidator('tags', cdk.listValidator(cdk.validateCfnTag))(properties.tags)); return errors.wrap('supplied properties not correct for "CfnClusterProps"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::Cluster` resource * * @param properties - the TypeScript properties of a `CfnClusterProps` * * @returns the AWS CloudFormation properties of an `AWS::ECS::Cluster` resource. */ // @ts-ignore TS6133 function cfnClusterPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnClusterPropsValidator(properties).assertSuccess(); return { CapacityProviders: cdk.listMapper(cdk.stringToCloudFormation)(properties.capacityProviders), ClusterName: cdk.stringToCloudFormation(properties.clusterName), ClusterSettings: cdk.listMapper(cfnClusterClusterSettingsPropertyToCloudFormation)(properties.clusterSettings), Configuration: cfnClusterClusterConfigurationPropertyToCloudFormation(properties.configuration), DefaultCapacityProviderStrategy: cdk.listMapper(cfnClusterCapacityProviderStrategyItemPropertyToCloudFormation)(properties.defaultCapacityProviderStrategy), ServiceConnectDefaults: cfnClusterServiceConnectDefaultsPropertyToCloudFormation(properties.serviceConnectDefaults), Tags: cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags), }; } // @ts-ignore TS6133 function CfnClusterPropsFromCloudFormation(properties) { properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('capacityProviders', 'CapacityProviders', properties.CapacityProviders != null ? cfn_parse.FromCloudFormation.getStringArray(properties.CapacityProviders) : undefined); ret.addPropertyResult('clusterName', 'ClusterName', properties.ClusterName != null ? cfn_parse.FromCloudFormation.getString(properties.ClusterName) : undefined); ret.addPropertyResult('clusterSettings', 'ClusterSettings', properties.ClusterSettings != null ? cfn_parse.FromCloudFormation.getArray(CfnClusterClusterSettingsPropertyFromCloudFormation)(properties.ClusterSettings) : undefined); ret.addPropertyResult('configuration', 'Configuration', properties.Configuration != null ? CfnClusterClusterConfigurationPropertyFromCloudFormation(properties.Configuration) : undefined); ret.addPropertyResult('defaultCapacityProviderStrategy', 'DefaultCapacityProviderStrategy', properties.DefaultCapacityProviderStrategy != null ? cfn_parse.FromCloudFormation.getArray(CfnClusterCapacityProviderStrategyItemPropertyFromCloudFormation)(properties.DefaultCapacityProviderStrategy) : undefined); ret.addPropertyResult('serviceConnectDefaults', 'ServiceConnectDefaults', properties.ServiceConnectDefaults != null ? CfnClusterServiceConnectDefaultsPropertyFromCloudFormation(properties.ServiceConnectDefaults) : undefined); ret.addPropertyResult('tags', 'Tags', properties.Tags != null ? cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * A CloudFormation `AWS::ECS::Cluster` * * The `AWS::ECS::Cluster` resource creates an Amazon Elastic Container Service (Amazon ECS) cluster. * * @cloudformationResource AWS::ECS::Cluster * @stability external * * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-cluster.html */ class CfnCluster extends cdk.CfnResource { /** * Create a new `AWS::ECS::Cluster`. * * @param scope - scope in which this resource is defined * @param id - scoped id of the resource * @param props - resource properties */ constructor(scope, id, props = {}) { super(scope, id, { type: CfnCluster.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings._aws_cdk_aws_ecs_CfnClusterProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, CfnCluster); } throw error; } this.attrArn = cdk.Token.asString(this.getAtt('Arn')); this.capacityProviders = props.capacityProviders; this.clusterName = props.clusterName; this.clusterSettings = props.clusterSettings; this.configuration = props.configuration; this.defaultCapacityProviderStrategy = props.defaultCapacityProviderStrategy; this.serviceConnectDefaults = props.serviceConnectDefaults; this.tags = new cdk.TagManager(cdk.TagType.STANDARD, "AWS::ECS::Cluster", props.tags, { tagPropertyName: 'tags' }); } /** * A factory method that creates a new instance of this class from an object * containing the CloudFormation properties of this resource. * Used in the @aws-cdk/cloudformation-include module. * * @internal */ static _fromCloudFormation(scope, id, resourceAttributes, options) { resourceAttributes = resourceAttributes || {}; const resourceProperties = options.parser.parseValue(resourceAttributes.Properties); const propsResult = CfnClusterPropsFromCloudFormation(resourceProperties); const ret = new CfnCluster(scope, id, propsResult.value); for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) { ret.addPropertyOverride(propKey, propVal); } options.parser.handleAttributes(ret, resourceAttributes, id); return ret; } /** * Examines the CloudFormation resource and discloses attributes. * * @param inspector - tree inspector to collect and process attributes * */ inspect(inspector) { inspector.addAttribute("aws:cdk:cloudformation:type", CfnCluster.CFN_RESOURCE_TYPE_NAME); inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties); } get cfnProperties() { return { capacityProviders: this.capacityProviders, clusterName: this.clusterName, clusterSettings: this.clusterSettings, configuration: this.configuration, defaultCapacityProviderStrategy: this.defaultCapacityProviderStrategy, serviceConnectDefaults: this.serviceConnectDefaults, tags: this.tags.renderTags(), }; } renderProperties(props) { return cfnClusterPropsToCloudFormation(props); } } exports.CfnCluster = CfnCluster; _b = JSII_RTTI_SYMBOL_1; CfnCluster[_b] = { fqn: "@aws-cdk/aws-ecs.CfnCluster", version: "1.204.0" }; /** * The CloudFormation resource type name for this resource class. */ CfnCluster.CFN_RESOURCE_TYPE_NAME = "AWS::ECS::Cluster"; /** * Determine whether the given properties match those of a `CapacityProviderStrategyItemProperty` * * @param properties - the TypeScript properties of a `CapacityProviderStrategyItemProperty` * * @returns the result of the validation. */ function CfnCluster_CapacityProviderStrategyItemPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('base', cdk.validateNumber)(properties.base)); errors.collect(cdk.propertyValidator('capacityProvider', cdk.validateString)(properties.capacityProvider)); errors.collect(cdk.propertyValidator('weight', cdk.validateNumber)(properties.weight)); return errors.wrap('supplied properties not correct for "CapacityProviderStrategyItemProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::Cluster.CapacityProviderStrategyItem` resource * * @param properties - the TypeScript properties of a `CapacityProviderStrategyItemProperty` * * @returns the AWS CloudFormation properties of an `AWS::ECS::Cluster.CapacityProviderStrategyItem` resource. */ // @ts-ignore TS6133 function cfnClusterCapacityProviderStrategyItemPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCluster_CapacityProviderStrategyItemPropertyValidator(properties).assertSuccess(); return { Base: cdk.numberToCloudFormation(properties.base), CapacityProvider: cdk.stringToCloudFormation(properties.capacityProvider), Weight: cdk.numberToCloudFormation(properties.weight), }; } // @ts-ignore TS6133 function CfnClusterCapacityProviderStrategyItemPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('base', 'Base', properties.Base != null ? cfn_parse.FromCloudFormation.getNumber(properties.Base) : undefined); ret.addPropertyResult('capacityProvider', 'CapacityProvider', properties.CapacityProvider != null ? cfn_parse.FromCloudFormation.getString(properties.CapacityProvider) : undefined); ret.addPropertyResult('weight', 'Weight', properties.Weight != null ? cfn_parse.FromCloudFormation.getNumber(properties.Weight) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ClusterConfigurationProperty` * * @param properties - the TypeScript properties of a `ClusterConfigurationProperty` * * @returns the result of the validation. */ function CfnCluster_ClusterConfigurationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('executeCommandConfiguration', CfnCluster_ExecuteCommandConfigurationPropertyValidator)(properties.executeCommandConfiguration)); return errors.wrap('supplied properties not correct for "ClusterConfigurationProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::Cluster.ClusterConfiguration` resource * * @param properties - the TypeScript properties of a `ClusterConfigurationProperty` * * @returns the AWS CloudFormation properties of an `AWS::ECS::Cluster.ClusterConfiguration` resource. */ // @ts-ignore TS6133 function cfnClusterClusterConfigurationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCluster_ClusterConfigurationPropertyValidator(properties).assertSuccess(); return { ExecuteCommandConfiguration: cfnClusterExecuteCommandConfigurationPropertyToCloudFormation(properties.executeCommandConfiguration), }; } // @ts-ignore TS6133 function CfnClusterClusterConfigurationPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('executeCommandConfiguration', 'ExecuteCommandConfiguration', properties.ExecuteCommandConfiguration != null ? CfnClusterExecuteCommandConfigurationPropertyFromCloudFormation(properties.ExecuteCommandConfiguration) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ClusterSettingsProperty` * * @param properties - the TypeScript properties of a `ClusterSettingsProperty` * * @returns the result of the validation. */ function CfnCluster_ClusterSettingsPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('name', cdk.validateString)(properties.name)); errors.collect(cdk.propertyValidator('value', cdk.validateString)(properties.value)); return errors.wrap('supplied properties not correct for "ClusterSettingsProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::Cluster.ClusterSettings` resource * * @param properties - the TypeScript properties of a `ClusterSettingsProperty` * * @returns the AWS CloudFormation properties of an `AWS::ECS::Cluster.ClusterSettings` resource. */ // @ts-ignore TS6133 function cfnClusterClusterSettingsPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCluster_ClusterSettingsPropertyValidator(properties).assertSuccess(); return { Name: cdk.stringToCloudFormation(properties.name), Value: cdk.stringToCloudFormation(properties.value), }; } // @ts-ignore TS6133 function CfnClusterClusterSettingsPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('name', 'Name', properties.Name != null ? cfn_parse.FromCloudFormation.getString(properties.Name) : undefined); ret.addPropertyResult('value', 'Value', properties.Value != null ? cfn_parse.FromCloudFormation.getString(properties.Value) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ExecuteCommandConfigurationProperty` * * @param properties - the TypeScript properties of a `ExecuteCommandConfigurationProperty` * * @returns the result of the validation. */ function CfnCluster_ExecuteCommandConfigurationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('kmsKeyId', cdk.validateString)(properties.kmsKeyId)); errors.collect(cdk.propertyValidator('logConfiguration', CfnCluster_ExecuteCommandLogConfigurationPropertyValidator)(properties.logConfiguration)); errors.collect(cdk.propertyValidator('logging', cdk.validateString)(properties.logging)); return errors.wrap('supplied properties not correct for "ExecuteCommandConfigurationProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::Cluster.ExecuteCommandConfiguration` resource * * @param properties - the TypeScript properties of a `ExecuteCommandConfigurationProperty` * * @returns the AWS CloudFormation properties of an `AWS::ECS::Cluster.ExecuteCommandConfiguration` resource. */ // @ts-ignore TS6133 function cfnClusterExecuteCommandConfigurationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCluster_ExecuteCommandConfigurationPropertyValidator(properties).assertSuccess(); return { KmsKeyId: cdk.stringToCloudFormation(properties.kmsKeyId), LogConfiguration: cfnClusterExecuteCommandLogConfigurationPropertyToCloudFormation(properties.logConfiguration), Logging: cdk.stringToCloudFormation(properties.logging), }; } // @ts-ignore TS6133 function CfnClusterExecuteCommandConfigurationPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('kmsKeyId', 'KmsKeyId', properties.KmsKeyId != null ? cfn_parse.FromCloudFormation.getString(properties.KmsKeyId) : undefined); ret.addPropertyResult('logConfiguration', 'LogConfiguration', properties.LogConfiguration != null ? CfnClusterExecuteCommandLogConfigurationPropertyFromCloudFormation(properties.LogConfiguration) : undefined); ret.addPropertyResult('logging', 'Logging', properties.Logging != null ? cfn_parse.FromCloudFormation.getString(properties.Logging) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ExecuteCommandLogConfigurationProperty` * * @param properties - the TypeScript properties of a `ExecuteCommandLogConfigurationProperty` * * @returns the result of the validation. */ function CfnCluster_ExecuteCommandLogConfigurationPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('cloudWatchEncryptionEnabled', cdk.validateBoolean)(properties.cloudWatchEncryptionEnabled)); errors.collect(cdk.propertyValidator('cloudWatchLogGroupName', cdk.validateString)(properties.cloudWatchLogGroupName)); errors.collect(cdk.propertyValidator('s3BucketName', cdk.validateString)(properties.s3BucketName)); errors.collect(cdk.propertyValidator('s3EncryptionEnabled', cdk.validateBoolean)(properties.s3EncryptionEnabled)); errors.collect(cdk.propertyValidator('s3KeyPrefix', cdk.validateString)(properties.s3KeyPrefix)); return errors.wrap('supplied properties not correct for "ExecuteCommandLogConfigurationProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::Cluster.ExecuteCommandLogConfiguration` resource * * @param properties - the TypeScript properties of a `ExecuteCommandLogConfigurationProperty` * * @returns the AWS CloudFormation properties of an `AWS::ECS::Cluster.ExecuteCommandLogConfiguration` resource. */ // @ts-ignore TS6133 function cfnClusterExecuteCommandLogConfigurationPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCluster_ExecuteCommandLogConfigurationPropertyValidator(properties).assertSuccess(); return { CloudWatchEncryptionEnabled: cdk.booleanToCloudFormation(properties.cloudWatchEncryptionEnabled), CloudWatchLogGroupName: cdk.stringToCloudFormation(properties.cloudWatchLogGroupName), S3BucketName: cdk.stringToCloudFormation(properties.s3BucketName), S3EncryptionEnabled: cdk.booleanToCloudFormation(properties.s3EncryptionEnabled), S3KeyPrefix: cdk.stringToCloudFormation(properties.s3KeyPrefix), }; } // @ts-ignore TS6133 function CfnClusterExecuteCommandLogConfigurationPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('cloudWatchEncryptionEnabled', 'CloudWatchEncryptionEnabled', properties.CloudWatchEncryptionEnabled != null ? cfn_parse.FromCloudFormation.getBoolean(properties.CloudWatchEncryptionEnabled) : undefined); ret.addPropertyResult('cloudWatchLogGroupName', 'CloudWatchLogGroupName', properties.CloudWatchLogGroupName != null ? cfn_parse.FromCloudFormation.getString(properties.CloudWatchLogGroupName) : undefined); ret.addPropertyResult('s3BucketName', 'S3BucketName', properties.S3BucketName != null ? cfn_parse.FromCloudFormation.getString(properties.S3BucketName) : undefined); ret.addPropertyResult('s3EncryptionEnabled', 'S3EncryptionEnabled', properties.S3EncryptionEnabled != null ? cfn_parse.FromCloudFormation.getBoolean(properties.S3EncryptionEnabled) : undefined); ret.addPropertyResult('s3KeyPrefix', 'S3KeyPrefix', properties.S3KeyPrefix != null ? cfn_parse.FromCloudFormation.getString(properties.S3KeyPrefix) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `ServiceConnectDefaultsProperty` * * @param properties - the TypeScript properties of a `ServiceConnectDefaultsProperty` * * @returns the result of the validation. */ function CfnCluster_ServiceConnectDefaultsPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('namespace', cdk.validateString)(properties.namespace)); return errors.wrap('supplied properties not correct for "ServiceConnectDefaultsProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::Cluster.ServiceConnectDefaults` resource * * @param properties - the TypeScript properties of a `ServiceConnectDefaultsProperty` * * @returns the AWS CloudFormation properties of an `AWS::ECS::Cluster.ServiceConnectDefaults` resource. */ // @ts-ignore TS6133 function cfnClusterServiceConnectDefaultsPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnCluster_ServiceConnectDefaultsPropertyValidator(properties).assertSuccess(); return { Namespace: cdk.stringToCloudFormation(properties.namespace), }; } // @ts-ignore TS6133 function CfnClusterServiceConnectDefaultsPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('namespace', 'Namespace', properties.Namespace != null ? cfn_parse.FromCloudFormation.getString(properties.Namespace) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `CfnClusterCapacityProviderAssociationsProps` * * @param properties - the TypeScript properties of a `CfnClusterCapacityProviderAssociationsProps` * * @returns the result of the validation. */ function CfnClusterCapacityProviderAssociationsPropsValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('capacityProviders', cdk.requiredValidator)(properties.capacityProviders)); errors.collect(cdk.propertyValidator('capacityProviders', cdk.listValidator(cdk.validateString))(properties.capacityProviders)); errors.collect(cdk.propertyValidator('cluster', cdk.requiredValidator)(properties.cluster)); errors.collect(cdk.propertyValidator('cluster', cdk.validateString)(properties.cluster)); errors.collect(cdk.propertyValidator('defaultCapacityProviderStrategy', cdk.requiredValidator)(properties.defaultCapacityProviderStrategy)); errors.collect(cdk.propertyValidator('defaultCapacityProviderStrategy', cdk.listValidator(CfnClusterCapacityProviderAssociations_CapacityProviderStrategyPropertyValidator))(properties.defaultCapacityProviderStrategy)); return errors.wrap('supplied properties not correct for "CfnClusterCapacityProviderAssociationsProps"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::ClusterCapacityProviderAssociations` resource * * @param properties - the TypeScript properties of a `CfnClusterCapacityProviderAssociationsProps` * * @returns the AWS CloudFormation properties of an `AWS::ECS::ClusterCapacityProviderAssociations` resource. */ // @ts-ignore TS6133 function cfnClusterCapacityProviderAssociationsPropsToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnClusterCapacityProviderAssociationsPropsValidator(properties).assertSuccess(); return { CapacityProviders: cdk.listMapper(cdk.stringToCloudFormation)(properties.capacityProviders), Cluster: cdk.stringToCloudFormation(properties.cluster), DefaultCapacityProviderStrategy: cdk.listMapper(cfnClusterCapacityProviderAssociationsCapacityProviderStrategyPropertyToCloudFormation)(properties.defaultCapacityProviderStrategy), }; } // @ts-ignore TS6133 function CfnClusterCapacityProviderAssociationsPropsFromCloudFormation(properties) { properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('capacityProviders', 'CapacityProviders', cfn_parse.FromCloudFormation.getStringArray(properties.CapacityProviders)); ret.addPropertyResult('cluster', 'Cluster', cfn_parse.FromCloudFormation.getString(properties.Cluster)); ret.addPropertyResult('defaultCapacityProviderStrategy', 'DefaultCapacityProviderStrategy', cfn_parse.FromCloudFormation.getArray(CfnClusterCapacityProviderAssociationsCapacityProviderStrategyPropertyFromCloudFormation)(properties.DefaultCapacityProviderStrategy)); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * A CloudFormation `AWS::ECS::ClusterCapacityProviderAssociations` * * The `AWS::ECS::ClusterCapacityProviderAssociations` resource associates one or more capacity providers and a default capacity provider strategy with a cluster. * * @cloudformationResource AWS::ECS::ClusterCapacityProviderAssociations * @stability external * * @link http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ecs-clustercapacityproviderassociations.html */ class CfnClusterCapacityProviderAssociations extends cdk.CfnResource { /** * Create a new `AWS::ECS::ClusterCapacityProviderAssociations`. * * @param scope - scope in which this resource is defined * @param id - scoped id of the resource * @param props - resource properties */ constructor(scope, id, props) { super(scope, id, { type: CfnClusterCapacityProviderAssociations.CFN_RESOURCE_TYPE_NAME, properties: props }); try { jsiiDeprecationWarnings._aws_cdk_aws_ecs_CfnClusterCapacityProviderAssociationsProps(props); } catch (error) { if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") { Error.captureStackTrace(error, CfnClusterCapacityProviderAssociations); } throw error; } cdk.requireProperty(props, 'capacityProviders', this); cdk.requireProperty(props, 'cluster', this); cdk.requireProperty(props, 'defaultCapacityProviderStrategy', this); this.capacityProviders = props.capacityProviders; this.cluster = props.cluster; this.defaultCapacityProviderStrategy = props.defaultCapacityProviderStrategy; } /** * A factory method that creates a new instance of this class from an object * containing the CloudFormation properties of this resource. * Used in the @aws-cdk/cloudformation-include module. * * @internal */ static _fromCloudFormation(scope, id, resourceAttributes, options) { resourceAttributes = resourceAttributes || {}; const resourceProperties = options.parser.parseValue(resourceAttributes.Properties); const propsResult = CfnClusterCapacityProviderAssociationsPropsFromCloudFormation(resourceProperties); const ret = new CfnClusterCapacityProviderAssociations(scope, id, propsResult.value); for (const [propKey, propVal] of Object.entries(propsResult.extraProperties)) { ret.addPropertyOverride(propKey, propVal); } options.parser.handleAttributes(ret, resourceAttributes, id); return ret; } /** * Examines the CloudFormation resource and discloses attributes. * * @param inspector - tree inspector to collect and process attributes * */ inspect(inspector) { inspector.addAttribute("aws:cdk:cloudformation:type", CfnClusterCapacityProviderAssociations.CFN_RESOURCE_TYPE_NAME); inspector.addAttribute("aws:cdk:cloudformation:props", this.cfnProperties); } get cfnProperties() { return { capacityProviders: this.capacityProviders, cluster: this.cluster, defaultCapacityProviderStrategy: this.defaultCapacityProviderStrategy, }; } renderProperties(props) { return cfnClusterCapacityProviderAssociationsPropsToCloudFormation(props); } } exports.CfnClusterCapacityProviderAssociations = CfnClusterCapacityProviderAssociations; _c = JSII_RTTI_SYMBOL_1; CfnClusterCapacityProviderAssociations[_c] = { fqn: "@aws-cdk/aws-ecs.CfnClusterCapacityProviderAssociations", version: "1.204.0" }; /** * The CloudFormation resource type name for this resource class. */ CfnClusterCapacityProviderAssociations.CFN_RESOURCE_TYPE_NAME = "AWS::ECS::ClusterCapacityProviderAssociations"; /** * Determine whether the given properties match those of a `CapacityProviderStrategyProperty` * * @param properties - the TypeScript properties of a `CapacityProviderStrategyProperty` * * @returns the result of the validation. */ function CfnClusterCapacityProviderAssociations_CapacityProviderStrategyPropertyValidator(properties) { if (!cdk.canInspect(properties)) { return cdk.VALIDATION_SUCCESS; } const errors = new cdk.ValidationResults(); if (typeof properties !== 'object') { errors.collect(new cdk.ValidationResult('Expected an object, but received: ' + JSON.stringify(properties))); } errors.collect(cdk.propertyValidator('base', cdk.validateNumber)(properties.base)); errors.collect(cdk.propertyValidator('capacityProvider', cdk.requiredValidator)(properties.capacityProvider)); errors.collect(cdk.propertyValidator('capacityProvider', cdk.validateString)(properties.capacityProvider)); errors.collect(cdk.propertyValidator('weight', cdk.validateNumber)(properties.weight)); return errors.wrap('supplied properties not correct for "CapacityProviderStrategyProperty"'); } /** * Renders the AWS CloudFormation properties of an `AWS::ECS::ClusterCapacityProviderAssociations.CapacityProviderStrategy` resource * * @param properties - the TypeScript properties of a `CapacityProviderStrategyProperty` * * @returns the AWS CloudFormation properties of an `AWS::ECS::ClusterCapacityProviderAssociations.CapacityProviderStrategy` resource. */ // @ts-ignore TS6133 function cfnClusterCapacityProviderAssociationsCapacityProviderStrategyPropertyToCloudFormation(properties) { if (!cdk.canInspect(properties)) { return properties; } CfnClusterCapacityProviderAssociations_CapacityProviderStrategyPropertyValidator(properties).assertSuccess(); return { Base: cdk.numberToCloudFormation(properties.base), CapacityProvider: cdk.stringToCloudFormation(properties.capacityProvider), Weight: cdk.numberToCloudFormation(properties.weight), }; } // @ts-ignore TS6133 function CfnClusterCapacityProviderAssociationsCapacityProviderStrategyPropertyFromCloudFormation(properties) { if (cdk.isResolvableObject(properties)) { return new cfn_parse.FromCloudFormationResult(properties); } properties = properties == null ? {} : properties; if (typeof properties !== 'object') { return new cfn_parse.FromCloudFormationResult(properties); } const ret = new cfn_parse.FromCloudFormationPropertyObject(); ret.addPropertyResult('base', 'Base', properties.Base != null ? cfn_parse.FromCloudFormation.getNumber(properties.Base) : undefined); ret.addPropertyResult('capacityProvider', 'CapacityProvider', cfn_parse.FromCloudFormation.getString(properties.CapacityProvider)); ret.addPropertyResult('weight', 'Weight', properties.Weight != null ? cfn_parse.FromCloudFormation.getNumber(properties.Weight) : undefined); ret.addUnrecognizedPropertiesAsExtra(properties); return ret; } /** * Determine whether the given properties match those of a `CfnPrimaryTaskSetProps` * * @param properties - the TypeScript properties of a `CfnPrima