UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 8.07 kB
"use strict";var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnSink=exports.CfnLink=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 CfnLinkPropsValidator(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("labelTemplate",cdk.validateString)(properties.labelTemplate)),errors.collect(cdk.propertyValidator("resourceTypes",cdk.requiredValidator)(properties.resourceTypes)),errors.collect(cdk.propertyValidator("resourceTypes",cdk.listValidator(cdk.validateString))(properties.resourceTypes)),errors.collect(cdk.propertyValidator("sinkIdentifier",cdk.requiredValidator)(properties.sinkIdentifier)),errors.collect(cdk.propertyValidator("sinkIdentifier",cdk.validateString)(properties.sinkIdentifier)),errors.collect(cdk.propertyValidator("tags",cdk.hashValidator(cdk.validateString))(properties.tags)),errors.wrap('supplied properties not correct for "CfnLinkProps"')}function cfnLinkPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnLinkPropsValidator(properties).assertSuccess(),{ResourceTypes:cdk.listMapper(cdk.stringToCloudFormation)(properties.resourceTypes),SinkIdentifier:cdk.stringToCloudFormation(properties.sinkIdentifier),LabelTemplate:cdk.stringToCloudFormation(properties.labelTemplate),Tags:cdk.hashMapper(cdk.stringToCloudFormation)(properties.tags)}):properties}function CfnLinkPropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("resourceTypes","ResourceTypes",cfn_parse.FromCloudFormation.getStringArray(properties.ResourceTypes)),ret.addPropertyResult("sinkIdentifier","SinkIdentifier",cfn_parse.FromCloudFormation.getString(properties.SinkIdentifier)),ret.addPropertyResult("labelTemplate","LabelTemplate",properties.LabelTemplate!=null?cfn_parse.FromCloudFormation.getString(properties.LabelTemplate):void 0),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse.FromCloudFormation.getMap(cfn_parse.FromCloudFormation.getString)(properties.Tags):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnLink extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnLink.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_oam_CfnLinkProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnLink),error}cdk.requireProperty(props,"resourceTypes",this),cdk.requireProperty(props,"sinkIdentifier",this),this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.attrLabel=cdk.Token.asString(this.getAtt("Label",cdk.ResolutionTypeHint.STRING)),this.resourceTypes=props.resourceTypes,this.sinkIdentifier=props.sinkIdentifier,this.labelTemplate=props.labelTemplate,this.tags=new cdk.TagManager(cdk.TagType.MAP,"AWS::Oam::Link",props.tags,{tagPropertyName:"tags"})}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnLinkPropsFromCloudFormation(resourceProperties),ret=new CfnLink(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",CfnLink.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{resourceTypes:this.resourceTypes,sinkIdentifier:this.sinkIdentifier,labelTemplate:this.labelTemplate,tags:this.tags.renderTags()}}renderProperties(props){return cfnLinkPropsToCloudFormation(props)}}exports.CfnLink=CfnLink,_a=JSII_RTTI_SYMBOL_1,CfnLink[_a]={fqn:"aws-cdk-lib.aws_oam.CfnLink",version:"2.70.0"},CfnLink.CFN_RESOURCE_TYPE_NAME="AWS::Oam::Link";function CfnSinkPropsValidator(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("policy",cdk.validateObject)(properties.policy)),errors.collect(cdk.propertyValidator("tags",cdk.hashValidator(cdk.validateString))(properties.tags)),errors.wrap('supplied properties not correct for "CfnSinkProps"')}function cfnSinkPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnSinkPropsValidator(properties).assertSuccess(),{Name:cdk.stringToCloudFormation(properties.name),Policy:cdk.objectToCloudFormation(properties.policy),Tags:cdk.hashMapper(cdk.stringToCloudFormation)(properties.tags)}):properties}function CfnSinkPropsFromCloudFormation(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("policy","Policy",properties.Policy!=null?cfn_parse.FromCloudFormation.getAny(properties.Policy):void 0),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse.FromCloudFormation.getMap(cfn_parse.FromCloudFormation.getString)(properties.Tags):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnSink extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnSink.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_oam_CfnSinkProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnSink),error}cdk.requireProperty(props,"name",this),this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.name=props.name,this.policy=props.policy,this.tags=new cdk.TagManager(cdk.TagType.MAP,"AWS::Oam::Sink",props.tags,{tagPropertyName:"tags"})}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnSinkPropsFromCloudFormation(resourceProperties),ret=new CfnSink(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",CfnSink.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{name:this.name,policy:this.policy,tags:this.tags.renderTags()}}renderProperties(props){return cfnSinkPropsToCloudFormation(props)}}exports.CfnSink=CfnSink,_b=JSII_RTTI_SYMBOL_1,CfnSink[_b]={fqn:"aws-cdk-lib.aws_oam.CfnSink",version:"2.70.0"},CfnSink.CFN_RESOURCE_TYPE_NAME="AWS::Oam::Sink";