UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 14.6 kB
"use strict";var _a,_b,_c;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnReplicaKey=exports.CfnKey=exports.CfnAlias=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),cdk=require("../../core"),cfn_parse=require("../../core/lib/helpers-internal");function CfnAliasPropsValidator(properties){if(!cdk.canInspect(properties))return cdk.VALIDATION_SUCCESS;const errors=new cdk.ValidationResults;return typeof properties!="object"&&errors.collect(new cdk.ValidationResult("Expected an object, but received: "+JSON.stringify(properties))),errors.collect(cdk.propertyValidator("aliasName",cdk.requiredValidator)(properties.aliasName)),errors.collect(cdk.propertyValidator("aliasName",cdk.validateString)(properties.aliasName)),errors.collect(cdk.propertyValidator("targetKeyId",cdk.requiredValidator)(properties.targetKeyId)),errors.collect(cdk.propertyValidator("targetKeyId",cdk.validateString)(properties.targetKeyId)),errors.wrap('supplied properties not correct for "CfnAliasProps"')}function cfnAliasPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnAliasPropsValidator(properties).assertSuccess(),{AliasName:cdk.stringToCloudFormation(properties.aliasName),TargetKeyId:cdk.stringToCloudFormation(properties.targetKeyId)}):properties}function CfnAliasPropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("aliasName","AliasName",cfn_parse.FromCloudFormation.getString(properties.AliasName)),ret.addPropertyResult("targetKeyId","TargetKeyId",cfn_parse.FromCloudFormation.getString(properties.TargetKeyId)),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnAlias extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnAlias.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_kms_CfnAliasProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnAlias),error}cdk.requireProperty(props,"aliasName",this),cdk.requireProperty(props,"targetKeyId",this),this.aliasName=props.aliasName,this.targetKeyId=props.targetKeyId}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnAliasPropsFromCloudFormation(resourceProperties),ret=new CfnAlias(scope,id,propsResult.value);for(const[propKey,propVal]of Object.entries(propsResult.extraProperties))ret.addPropertyOverride(propKey,propVal);return options.parser.handleAttributes(ret,resourceAttributes,id),ret}inspect(inspector){try{jsiiDeprecationWarnings.aws_cdk_lib_TreeInspector(inspector)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.inspect),error}inspector.addAttribute("aws:cdk:cloudformation:type",CfnAlias.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{aliasName:this.aliasName,targetKeyId:this.targetKeyId}}renderProperties(props){return cfnAliasPropsToCloudFormation(props)}}exports.CfnAlias=CfnAlias,_a=JSII_RTTI_SYMBOL_1,CfnAlias[_a]={fqn:"aws-cdk-lib.aws_kms.CfnAlias",version:"2.70.0"},CfnAlias.CFN_RESOURCE_TYPE_NAME="AWS::KMS::Alias";function CfnKeyPropsValidator(properties){if(!cdk.canInspect(properties))return cdk.VALIDATION_SUCCESS;const errors=new cdk.ValidationResults;return typeof properties!="object"&&errors.collect(new cdk.ValidationResult("Expected an object, but received: "+JSON.stringify(properties))),errors.collect(cdk.propertyValidator("description",cdk.validateString)(properties.description)),errors.collect(cdk.propertyValidator("enableKeyRotation",cdk.validateBoolean)(properties.enableKeyRotation)),errors.collect(cdk.propertyValidator("enabled",cdk.validateBoolean)(properties.enabled)),errors.collect(cdk.propertyValidator("keyPolicy",cdk.requiredValidator)(properties.keyPolicy)),errors.collect(cdk.propertyValidator("keyPolicy",cdk.validateObject)(properties.keyPolicy)),errors.collect(cdk.propertyValidator("keySpec",cdk.validateString)(properties.keySpec)),errors.collect(cdk.propertyValidator("keyUsage",cdk.validateString)(properties.keyUsage)),errors.collect(cdk.propertyValidator("multiRegion",cdk.validateBoolean)(properties.multiRegion)),errors.collect(cdk.propertyValidator("pendingWindowInDays",cdk.validateNumber)(properties.pendingWindowInDays)),errors.collect(cdk.propertyValidator("tags",cdk.listValidator(cdk.validateCfnTag))(properties.tags)),errors.wrap('supplied properties not correct for "CfnKeyProps"')}function cfnKeyPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnKeyPropsValidator(properties).assertSuccess(),{KeyPolicy:cdk.objectToCloudFormation(properties.keyPolicy),Description:cdk.stringToCloudFormation(properties.description),Enabled:cdk.booleanToCloudFormation(properties.enabled),EnableKeyRotation:cdk.booleanToCloudFormation(properties.enableKeyRotation),KeySpec:cdk.stringToCloudFormation(properties.keySpec),KeyUsage:cdk.stringToCloudFormation(properties.keyUsage),MultiRegion:cdk.booleanToCloudFormation(properties.multiRegion),PendingWindowInDays:cdk.numberToCloudFormation(properties.pendingWindowInDays),Tags:cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags)}):properties}function CfnKeyPropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("keyPolicy","KeyPolicy",cfn_parse.FromCloudFormation.getAny(properties.KeyPolicy)),ret.addPropertyResult("description","Description",properties.Description!=null?cfn_parse.FromCloudFormation.getString(properties.Description):void 0),ret.addPropertyResult("enabled","Enabled",properties.Enabled!=null?cfn_parse.FromCloudFormation.getBoolean(properties.Enabled):void 0),ret.addPropertyResult("enableKeyRotation","EnableKeyRotation",properties.EnableKeyRotation!=null?cfn_parse.FromCloudFormation.getBoolean(properties.EnableKeyRotation):void 0),ret.addPropertyResult("keySpec","KeySpec",properties.KeySpec!=null?cfn_parse.FromCloudFormation.getString(properties.KeySpec):void 0),ret.addPropertyResult("keyUsage","KeyUsage",properties.KeyUsage!=null?cfn_parse.FromCloudFormation.getString(properties.KeyUsage):void 0),ret.addPropertyResult("multiRegion","MultiRegion",properties.MultiRegion!=null?cfn_parse.FromCloudFormation.getBoolean(properties.MultiRegion):void 0),ret.addPropertyResult("pendingWindowInDays","PendingWindowInDays",properties.PendingWindowInDays!=null?cfn_parse.FromCloudFormation.getNumber(properties.PendingWindowInDays):void 0),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnKey extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnKey.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_kms_CfnKeyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnKey),error}cdk.requireProperty(props,"keyPolicy",this),this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.attrKeyId=cdk.Token.asString(this.getAtt("KeyId",cdk.ResolutionTypeHint.STRING)),this.keyPolicy=props.keyPolicy,this.description=props.description,this.enabled=props.enabled,this.enableKeyRotation=props.enableKeyRotation,this.keySpec=props.keySpec,this.keyUsage=props.keyUsage,this.multiRegion=props.multiRegion,this.pendingWindowInDays=props.pendingWindowInDays,this.tags=new cdk.TagManager(cdk.TagType.STANDARD,"AWS::KMS::Key",props.tags,{tagPropertyName:"tags"})}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnKeyPropsFromCloudFormation(resourceProperties),ret=new CfnKey(scope,id,propsResult.value);for(const[propKey,propVal]of Object.entries(propsResult.extraProperties))ret.addPropertyOverride(propKey,propVal);return options.parser.handleAttributes(ret,resourceAttributes,id),ret}inspect(inspector){try{jsiiDeprecationWarnings.aws_cdk_lib_TreeInspector(inspector)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.inspect),error}inspector.addAttribute("aws:cdk:cloudformation:type",CfnKey.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{keyPolicy:this.keyPolicy,description:this.description,enabled:this.enabled,enableKeyRotation:this.enableKeyRotation,keySpec:this.keySpec,keyUsage:this.keyUsage,multiRegion:this.multiRegion,pendingWindowInDays:this.pendingWindowInDays,tags:this.tags.renderTags()}}renderProperties(props){return cfnKeyPropsToCloudFormation(props)}}exports.CfnKey=CfnKey,_b=JSII_RTTI_SYMBOL_1,CfnKey[_b]={fqn:"aws-cdk-lib.aws_kms.CfnKey",version:"2.70.0"},CfnKey.CFN_RESOURCE_TYPE_NAME="AWS::KMS::Key";function CfnReplicaKeyPropsValidator(properties){if(!cdk.canInspect(properties))return cdk.VALIDATION_SUCCESS;const errors=new cdk.ValidationResults;return typeof properties!="object"&&errors.collect(new cdk.ValidationResult("Expected an object, but received: "+JSON.stringify(properties))),errors.collect(cdk.propertyValidator("description",cdk.validateString)(properties.description)),errors.collect(cdk.propertyValidator("enabled",cdk.validateBoolean)(properties.enabled)),errors.collect(cdk.propertyValidator("keyPolicy",cdk.requiredValidator)(properties.keyPolicy)),errors.collect(cdk.propertyValidator("keyPolicy",cdk.validateObject)(properties.keyPolicy)),errors.collect(cdk.propertyValidator("pendingWindowInDays",cdk.validateNumber)(properties.pendingWindowInDays)),errors.collect(cdk.propertyValidator("primaryKeyArn",cdk.requiredValidator)(properties.primaryKeyArn)),errors.collect(cdk.propertyValidator("primaryKeyArn",cdk.validateString)(properties.primaryKeyArn)),errors.collect(cdk.propertyValidator("tags",cdk.listValidator(cdk.validateCfnTag))(properties.tags)),errors.wrap('supplied properties not correct for "CfnReplicaKeyProps"')}function cfnReplicaKeyPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnReplicaKeyPropsValidator(properties).assertSuccess(),{KeyPolicy:cdk.objectToCloudFormation(properties.keyPolicy),PrimaryKeyArn:cdk.stringToCloudFormation(properties.primaryKeyArn),Description:cdk.stringToCloudFormation(properties.description),Enabled:cdk.booleanToCloudFormation(properties.enabled),PendingWindowInDays:cdk.numberToCloudFormation(properties.pendingWindowInDays),Tags:cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags)}):properties}function CfnReplicaKeyPropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("keyPolicy","KeyPolicy",cfn_parse.FromCloudFormation.getAny(properties.KeyPolicy)),ret.addPropertyResult("primaryKeyArn","PrimaryKeyArn",cfn_parse.FromCloudFormation.getString(properties.PrimaryKeyArn)),ret.addPropertyResult("description","Description",properties.Description!=null?cfn_parse.FromCloudFormation.getString(properties.Description):void 0),ret.addPropertyResult("enabled","Enabled",properties.Enabled!=null?cfn_parse.FromCloudFormation.getBoolean(properties.Enabled):void 0),ret.addPropertyResult("pendingWindowInDays","PendingWindowInDays",properties.PendingWindowInDays!=null?cfn_parse.FromCloudFormation.getNumber(properties.PendingWindowInDays):void 0),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnReplicaKey extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnReplicaKey.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_kms_CfnReplicaKeyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnReplicaKey),error}cdk.requireProperty(props,"keyPolicy",this),cdk.requireProperty(props,"primaryKeyArn",this),this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.attrKeyId=cdk.Token.asString(this.getAtt("KeyId",cdk.ResolutionTypeHint.STRING)),this.keyPolicy=props.keyPolicy,this.primaryKeyArn=props.primaryKeyArn,this.description=props.description,this.enabled=props.enabled,this.pendingWindowInDays=props.pendingWindowInDays,this.tags=new cdk.TagManager(cdk.TagType.STANDARD,"AWS::KMS::ReplicaKey",props.tags,{tagPropertyName:"tags"})}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnReplicaKeyPropsFromCloudFormation(resourceProperties),ret=new CfnReplicaKey(scope,id,propsResult.value);for(const[propKey,propVal]of Object.entries(propsResult.extraProperties))ret.addPropertyOverride(propKey,propVal);return options.parser.handleAttributes(ret,resourceAttributes,id),ret}inspect(inspector){try{jsiiDeprecationWarnings.aws_cdk_lib_TreeInspector(inspector)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.inspect),error}inspector.addAttribute("aws:cdk:cloudformation:type",CfnReplicaKey.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{keyPolicy:this.keyPolicy,primaryKeyArn:this.primaryKeyArn,description:this.description,enabled:this.enabled,pendingWindowInDays:this.pendingWindowInDays,tags:this.tags.renderTags()}}renderProperties(props){return cfnReplicaKeyPropsToCloudFormation(props)}}exports.CfnReplicaKey=CfnReplicaKey,_c=JSII_RTTI_SYMBOL_1,CfnReplicaKey[_c]={fqn:"aws-cdk-lib.aws_kms.CfnReplicaKey",version:"2.70.0"},CfnReplicaKey.CFN_RESOURCE_TYPE_NAME="AWS::KMS::ReplicaKey";