UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 18 kB
"use strict";var _a,_b,_c,_d;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnResourcePolicy=exports.CfnPolicy=exports.CfnOrganizationalUnit=exports.CfnAccount=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 CfnAccountPropsValidator(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("accountName",cdk.requiredValidator)(properties.accountName)),errors.collect(cdk.propertyValidator("accountName",cdk.validateString)(properties.accountName)),errors.collect(cdk.propertyValidator("email",cdk.requiredValidator)(properties.email)),errors.collect(cdk.propertyValidator("email",cdk.validateString)(properties.email)),errors.collect(cdk.propertyValidator("parentIds",cdk.listValidator(cdk.validateString))(properties.parentIds)),errors.collect(cdk.propertyValidator("roleName",cdk.validateString)(properties.roleName)),errors.collect(cdk.propertyValidator("tags",cdk.listValidator(cdk.validateCfnTag))(properties.tags)),errors.wrap('supplied properties not correct for "CfnAccountProps"')}function cfnAccountPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnAccountPropsValidator(properties).assertSuccess(),{AccountName:cdk.stringToCloudFormation(properties.accountName),Email:cdk.stringToCloudFormation(properties.email),ParentIds:cdk.listMapper(cdk.stringToCloudFormation)(properties.parentIds),RoleName:cdk.stringToCloudFormation(properties.roleName),Tags:cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags)}):properties}function CfnAccountPropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("accountName","AccountName",cfn_parse.FromCloudFormation.getString(properties.AccountName)),ret.addPropertyResult("email","Email",cfn_parse.FromCloudFormation.getString(properties.Email)),ret.addPropertyResult("parentIds","ParentIds",properties.ParentIds!=null?cfn_parse.FromCloudFormation.getStringArray(properties.ParentIds):void 0),ret.addPropertyResult("roleName","RoleName",properties.RoleName!=null?cfn_parse.FromCloudFormation.getString(properties.RoleName):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 CfnAccount extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnAccount.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_organizations_CfnAccountProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnAccount),error}cdk.requireProperty(props,"accountName",this),cdk.requireProperty(props,"email",this),this.attrAccountId=cdk.Token.asString(this.getAtt("AccountId",cdk.ResolutionTypeHint.STRING)),this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.attrJoinedMethod=cdk.Token.asString(this.getAtt("JoinedMethod",cdk.ResolutionTypeHint.STRING)),this.attrJoinedTimestamp=cdk.Token.asString(this.getAtt("JoinedTimestamp",cdk.ResolutionTypeHint.STRING)),this.attrStatus=cdk.Token.asString(this.getAtt("Status",cdk.ResolutionTypeHint.STRING)),this.accountName=props.accountName,this.email=props.email,this.parentIds=props.parentIds,this.roleName=props.roleName,this.tags=new cdk.TagManager(cdk.TagType.STANDARD,"AWS::Organizations::Account",props.tags,{tagPropertyName:"tags"}),this.node.scope&&cdk.Resource.isResource(this.node.scope)&&this.node.addValidation({validate:()=>this.cfnOptions.deletionPolicy===void 0?["'AWS::Organizations::Account' is a stateful resource type, and you must specify a Removal Policy for it. Call 'resource.applyRemovalPolicy()'."]:[]})}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnAccountPropsFromCloudFormation(resourceProperties),ret=new CfnAccount(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",CfnAccount.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{accountName:this.accountName,email:this.email,parentIds:this.parentIds,roleName:this.roleName,tags:this.tags.renderTags()}}renderProperties(props){return cfnAccountPropsToCloudFormation(props)}}exports.CfnAccount=CfnAccount,_a=JSII_RTTI_SYMBOL_1,CfnAccount[_a]={fqn:"aws-cdk-lib.aws_organizations.CfnAccount",version:"2.70.0"},CfnAccount.CFN_RESOURCE_TYPE_NAME="AWS::Organizations::Account";function CfnOrganizationalUnitPropsValidator(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("name",cdk.requiredValidator)(properties.name)),errors.collect(cdk.propertyValidator("name",cdk.validateString)(properties.name)),errors.collect(cdk.propertyValidator("parentId",cdk.requiredValidator)(properties.parentId)),errors.collect(cdk.propertyValidator("parentId",cdk.validateString)(properties.parentId)),errors.collect(cdk.propertyValidator("tags",cdk.listValidator(cdk.validateCfnTag))(properties.tags)),errors.wrap('supplied properties not correct for "CfnOrganizationalUnitProps"')}function cfnOrganizationalUnitPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnOrganizationalUnitPropsValidator(properties).assertSuccess(),{Name:cdk.stringToCloudFormation(properties.name),ParentId:cdk.stringToCloudFormation(properties.parentId),Tags:cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags)}):properties}function CfnOrganizationalUnitPropsFromCloudFormation(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("parentId","ParentId",cfn_parse.FromCloudFormation.getString(properties.ParentId)),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnOrganizationalUnit extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnOrganizationalUnit.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_organizations_CfnOrganizationalUnitProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnOrganizationalUnit),error}cdk.requireProperty(props,"name",this),cdk.requireProperty(props,"parentId",this),this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.attrId=cdk.Token.asString(this.getAtt("Id",cdk.ResolutionTypeHint.STRING)),this.name=props.name,this.parentId=props.parentId,this.tags=new cdk.TagManager(cdk.TagType.STANDARD,"AWS::Organizations::OrganizationalUnit",props.tags,{tagPropertyName:"tags"})}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnOrganizationalUnitPropsFromCloudFormation(resourceProperties),ret=new CfnOrganizationalUnit(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",CfnOrganizationalUnit.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{name:this.name,parentId:this.parentId,tags:this.tags.renderTags()}}renderProperties(props){return cfnOrganizationalUnitPropsToCloudFormation(props)}}exports.CfnOrganizationalUnit=CfnOrganizationalUnit,_b=JSII_RTTI_SYMBOL_1,CfnOrganizationalUnit[_b]={fqn:"aws-cdk-lib.aws_organizations.CfnOrganizationalUnit",version:"2.70.0"},CfnOrganizationalUnit.CFN_RESOURCE_TYPE_NAME="AWS::Organizations::OrganizationalUnit";function CfnPolicyPropsValidator(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("content",cdk.requiredValidator)(properties.content)),errors.collect(cdk.propertyValidator("content",cdk.validateObject)(properties.content)),errors.collect(cdk.propertyValidator("description",cdk.validateString)(properties.description)),errors.collect(cdk.propertyValidator("name",cdk.requiredValidator)(properties.name)),errors.collect(cdk.propertyValidator("name",cdk.validateString)(properties.name)),errors.collect(cdk.propertyValidator("tags",cdk.listValidator(cdk.validateCfnTag))(properties.tags)),errors.collect(cdk.propertyValidator("targetIds",cdk.listValidator(cdk.validateString))(properties.targetIds)),errors.collect(cdk.propertyValidator("type",cdk.requiredValidator)(properties.type)),errors.collect(cdk.propertyValidator("type",cdk.validateString)(properties.type)),errors.wrap('supplied properties not correct for "CfnPolicyProps"')}function cfnPolicyPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnPolicyPropsValidator(properties).assertSuccess(),{Content:cdk.objectToCloudFormation(properties.content),Name:cdk.stringToCloudFormation(properties.name),Type:cdk.stringToCloudFormation(properties.type),Description:cdk.stringToCloudFormation(properties.description),Tags:cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags),TargetIds:cdk.listMapper(cdk.stringToCloudFormation)(properties.targetIds)}):properties}function CfnPolicyPropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("content","Content",cfn_parse.FromCloudFormation.getAny(properties.Content)),ret.addPropertyResult("name","Name",cfn_parse.FromCloudFormation.getString(properties.Name)),ret.addPropertyResult("type","Type",cfn_parse.FromCloudFormation.getString(properties.Type)),ret.addPropertyResult("description","Description",properties.Description!=null?cfn_parse.FromCloudFormation.getString(properties.Description):void 0),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags):void 0),ret.addPropertyResult("targetIds","TargetIds",properties.TargetIds!=null?cfn_parse.FromCloudFormation.getStringArray(properties.TargetIds):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnPolicy extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnPolicy.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_organizations_CfnPolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnPolicy),error}cdk.requireProperty(props,"content",this),cdk.requireProperty(props,"name",this),cdk.requireProperty(props,"type",this),this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.attrAwsManaged=this.getAtt("AwsManaged",cdk.ResolutionTypeHint.STRING),this.attrId=cdk.Token.asString(this.getAtt("Id",cdk.ResolutionTypeHint.STRING)),this.content=props.content,this.name=props.name,this.type=props.type,this.description=props.description,this.tags=new cdk.TagManager(cdk.TagType.STANDARD,"AWS::Organizations::Policy",props.tags,{tagPropertyName:"tags"}),this.targetIds=props.targetIds}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnPolicyPropsFromCloudFormation(resourceProperties),ret=new CfnPolicy(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",CfnPolicy.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{content:this.content,name:this.name,type:this.type,description:this.description,tags:this.tags.renderTags(),targetIds:this.targetIds}}renderProperties(props){return cfnPolicyPropsToCloudFormation(props)}}exports.CfnPolicy=CfnPolicy,_c=JSII_RTTI_SYMBOL_1,CfnPolicy[_c]={fqn:"aws-cdk-lib.aws_organizations.CfnPolicy",version:"2.70.0"},CfnPolicy.CFN_RESOURCE_TYPE_NAME="AWS::Organizations::Policy";function CfnResourcePolicyPropsValidator(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("content",cdk.requiredValidator)(properties.content)),errors.collect(cdk.propertyValidator("content",cdk.validateObject)(properties.content)),errors.collect(cdk.propertyValidator("tags",cdk.listValidator(cdk.validateCfnTag))(properties.tags)),errors.wrap('supplied properties not correct for "CfnResourcePolicyProps"')}function cfnResourcePolicyPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnResourcePolicyPropsValidator(properties).assertSuccess(),{Content:cdk.objectToCloudFormation(properties.content),Tags:cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags)}):properties}function CfnResourcePolicyPropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("content","Content",cfn_parse.FromCloudFormation.getAny(properties.Content)),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnResourcePolicy extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnResourcePolicy.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_organizations_CfnResourcePolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnResourcePolicy),error}cdk.requireProperty(props,"content",this),this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.attrId=cdk.Token.asString(this.getAtt("Id",cdk.ResolutionTypeHint.STRING)),this.content=props.content,this.tags=new cdk.TagManager(cdk.TagType.STANDARD,"AWS::Organizations::ResourcePolicy",props.tags,{tagPropertyName:"tags"})}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnResourcePolicyPropsFromCloudFormation(resourceProperties),ret=new CfnResourcePolicy(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",CfnResourcePolicy.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{content:this.content,tags:this.tags.renderTags()}}renderProperties(props){return cfnResourcePolicyPropsToCloudFormation(props)}}exports.CfnResourcePolicy=CfnResourcePolicy,_d=JSII_RTTI_SYMBOL_1,CfnResourcePolicy[_d]={fqn:"aws-cdk-lib.aws_organizations.CfnResourcePolicy",version:"2.70.0"},CfnResourcePolicy.CFN_RESOURCE_TYPE_NAME="AWS::Organizations::ResourcePolicy";