UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 5.42 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnResourceShare=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 CfnResourceSharePropsValidator(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("allowExternalPrincipals",cdk.validateBoolean)(properties.allowExternalPrincipals)),errors.collect(cdk.propertyValidator("name",cdk.requiredValidator)(properties.name)),errors.collect(cdk.propertyValidator("name",cdk.validateString)(properties.name)),errors.collect(cdk.propertyValidator("permissionArns",cdk.listValidator(cdk.validateString))(properties.permissionArns)),errors.collect(cdk.propertyValidator("principals",cdk.listValidator(cdk.validateString))(properties.principals)),errors.collect(cdk.propertyValidator("resourceArns",cdk.listValidator(cdk.validateString))(properties.resourceArns)),errors.collect(cdk.propertyValidator("tags",cdk.listValidator(cdk.validateCfnTag))(properties.tags)),errors.wrap('supplied properties not correct for "CfnResourceShareProps"')}function cfnResourceSharePropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnResourceSharePropsValidator(properties).assertSuccess(),{Name:cdk.stringToCloudFormation(properties.name),AllowExternalPrincipals:cdk.booleanToCloudFormation(properties.allowExternalPrincipals),PermissionArns:cdk.listMapper(cdk.stringToCloudFormation)(properties.permissionArns),Principals:cdk.listMapper(cdk.stringToCloudFormation)(properties.principals),ResourceArns:cdk.listMapper(cdk.stringToCloudFormation)(properties.resourceArns),Tags:cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags)}):properties}function CfnResourceSharePropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("name","Name",cfn_parse.FromCloudFormation.getString(properties.Name)),ret.addPropertyResult("allowExternalPrincipals","AllowExternalPrincipals",properties.AllowExternalPrincipals!=null?cfn_parse.FromCloudFormation.getBoolean(properties.AllowExternalPrincipals):void 0),ret.addPropertyResult("permissionArns","PermissionArns",properties.PermissionArns!=null?cfn_parse.FromCloudFormation.getStringArray(properties.PermissionArns):void 0),ret.addPropertyResult("principals","Principals",properties.Principals!=null?cfn_parse.FromCloudFormation.getStringArray(properties.Principals):void 0),ret.addPropertyResult("resourceArns","ResourceArns",properties.ResourceArns!=null?cfn_parse.FromCloudFormation.getStringArray(properties.ResourceArns):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 CfnResourceShare extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnResourceShare.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_ram_CfnResourceShareProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnResourceShare),error}cdk.requireProperty(props,"name",this),this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.name=props.name,this.allowExternalPrincipals=props.allowExternalPrincipals,this.permissionArns=props.permissionArns,this.principals=props.principals,this.resourceArns=props.resourceArns,this.tags=new cdk.TagManager(cdk.TagType.STANDARD,"AWS::RAM::ResourceShare",props.tags,{tagPropertyName:"tags"})}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnResourceSharePropsFromCloudFormation(resourceProperties),ret=new CfnResourceShare(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",CfnResourceShare.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{name:this.name,allowExternalPrincipals:this.allowExternalPrincipals,permissionArns:this.permissionArns,principals:this.principals,resourceArns:this.resourceArns,tags:this.tags.renderTags()}}renderProperties(props){return cfnResourceSharePropsToCloudFormation(props)}}exports.CfnResourceShare=CfnResourceShare,_a=JSII_RTTI_SYMBOL_1,CfnResourceShare[_a]={fqn:"aws-cdk-lib.aws_ram.CfnResourceShare",version:"2.70.0"},CfnResourceShare.CFN_RESOURCE_TYPE_NAME="AWS::RAM::ResourceShare";