aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 13.8 kB
JavaScript
"use strict";var _a,_b;Object.defineProperty(exports,"__esModule",{value:!0}),exports.CfnQueuePolicy=exports.CfnQueue=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 CfnQueuePropsValidator(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("contentBasedDeduplication",cdk.validateBoolean)(properties.contentBasedDeduplication)),errors.collect(cdk.propertyValidator("deduplicationScope",cdk.validateString)(properties.deduplicationScope)),errors.collect(cdk.propertyValidator("delaySeconds",cdk.validateNumber)(properties.delaySeconds)),errors.collect(cdk.propertyValidator("fifoQueue",cdk.validateBoolean)(properties.fifoQueue)),errors.collect(cdk.propertyValidator("fifoThroughputLimit",cdk.validateString)(properties.fifoThroughputLimit)),errors.collect(cdk.propertyValidator("kmsDataKeyReusePeriodSeconds",cdk.validateNumber)(properties.kmsDataKeyReusePeriodSeconds)),errors.collect(cdk.propertyValidator("kmsMasterKeyId",cdk.validateString)(properties.kmsMasterKeyId)),errors.collect(cdk.propertyValidator("maximumMessageSize",cdk.validateNumber)(properties.maximumMessageSize)),errors.collect(cdk.propertyValidator("messageRetentionPeriod",cdk.validateNumber)(properties.messageRetentionPeriod)),errors.collect(cdk.propertyValidator("queueName",cdk.validateString)(properties.queueName)),errors.collect(cdk.propertyValidator("receiveMessageWaitTimeSeconds",cdk.validateNumber)(properties.receiveMessageWaitTimeSeconds)),errors.collect(cdk.propertyValidator("redriveAllowPolicy",cdk.validateObject)(properties.redriveAllowPolicy)),errors.collect(cdk.propertyValidator("redrivePolicy",cdk.validateObject)(properties.redrivePolicy)),errors.collect(cdk.propertyValidator("sqsManagedSseEnabled",cdk.validateBoolean)(properties.sqsManagedSseEnabled)),errors.collect(cdk.propertyValidator("tags",cdk.listValidator(cdk.validateCfnTag))(properties.tags)),errors.collect(cdk.propertyValidator("visibilityTimeout",cdk.validateNumber)(properties.visibilityTimeout)),errors.wrap('supplied properties not correct for "CfnQueueProps"')}function cfnQueuePropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnQueuePropsValidator(properties).assertSuccess(),{ContentBasedDeduplication:cdk.booleanToCloudFormation(properties.contentBasedDeduplication),DeduplicationScope:cdk.stringToCloudFormation(properties.deduplicationScope),DelaySeconds:cdk.numberToCloudFormation(properties.delaySeconds),FifoQueue:cdk.booleanToCloudFormation(properties.fifoQueue),FifoThroughputLimit:cdk.stringToCloudFormation(properties.fifoThroughputLimit),KmsDataKeyReusePeriodSeconds:cdk.numberToCloudFormation(properties.kmsDataKeyReusePeriodSeconds),KmsMasterKeyId:cdk.stringToCloudFormation(properties.kmsMasterKeyId),MaximumMessageSize:cdk.numberToCloudFormation(properties.maximumMessageSize),MessageRetentionPeriod:cdk.numberToCloudFormation(properties.messageRetentionPeriod),QueueName:cdk.stringToCloudFormation(properties.queueName),ReceiveMessageWaitTimeSeconds:cdk.numberToCloudFormation(properties.receiveMessageWaitTimeSeconds),RedriveAllowPolicy:cdk.objectToCloudFormation(properties.redriveAllowPolicy),RedrivePolicy:cdk.objectToCloudFormation(properties.redrivePolicy),SqsManagedSseEnabled:cdk.booleanToCloudFormation(properties.sqsManagedSseEnabled),Tags:cdk.listMapper(cdk.cfnTagToCloudFormation)(properties.tags),VisibilityTimeout:cdk.numberToCloudFormation(properties.visibilityTimeout)}):properties}function CfnQueuePropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("contentBasedDeduplication","ContentBasedDeduplication",properties.ContentBasedDeduplication!=null?cfn_parse.FromCloudFormation.getBoolean(properties.ContentBasedDeduplication):void 0),ret.addPropertyResult("deduplicationScope","DeduplicationScope",properties.DeduplicationScope!=null?cfn_parse.FromCloudFormation.getString(properties.DeduplicationScope):void 0),ret.addPropertyResult("delaySeconds","DelaySeconds",properties.DelaySeconds!=null?cfn_parse.FromCloudFormation.getNumber(properties.DelaySeconds):void 0),ret.addPropertyResult("fifoQueue","FifoQueue",properties.FifoQueue!=null?cfn_parse.FromCloudFormation.getBoolean(properties.FifoQueue):void 0),ret.addPropertyResult("fifoThroughputLimit","FifoThroughputLimit",properties.FifoThroughputLimit!=null?cfn_parse.FromCloudFormation.getString(properties.FifoThroughputLimit):void 0),ret.addPropertyResult("kmsDataKeyReusePeriodSeconds","KmsDataKeyReusePeriodSeconds",properties.KmsDataKeyReusePeriodSeconds!=null?cfn_parse.FromCloudFormation.getNumber(properties.KmsDataKeyReusePeriodSeconds):void 0),ret.addPropertyResult("kmsMasterKeyId","KmsMasterKeyId",properties.KmsMasterKeyId!=null?cfn_parse.FromCloudFormation.getString(properties.KmsMasterKeyId):void 0),ret.addPropertyResult("maximumMessageSize","MaximumMessageSize",properties.MaximumMessageSize!=null?cfn_parse.FromCloudFormation.getNumber(properties.MaximumMessageSize):void 0),ret.addPropertyResult("messageRetentionPeriod","MessageRetentionPeriod",properties.MessageRetentionPeriod!=null?cfn_parse.FromCloudFormation.getNumber(properties.MessageRetentionPeriod):void 0),ret.addPropertyResult("queueName","QueueName",properties.QueueName!=null?cfn_parse.FromCloudFormation.getString(properties.QueueName):void 0),ret.addPropertyResult("receiveMessageWaitTimeSeconds","ReceiveMessageWaitTimeSeconds",properties.ReceiveMessageWaitTimeSeconds!=null?cfn_parse.FromCloudFormation.getNumber(properties.ReceiveMessageWaitTimeSeconds):void 0),ret.addPropertyResult("redriveAllowPolicy","RedriveAllowPolicy",properties.RedriveAllowPolicy!=null?cfn_parse.FromCloudFormation.getAny(properties.RedriveAllowPolicy):void 0),ret.addPropertyResult("redrivePolicy","RedrivePolicy",properties.RedrivePolicy!=null?cfn_parse.FromCloudFormation.getAny(properties.RedrivePolicy):void 0),ret.addPropertyResult("sqsManagedSseEnabled","SqsManagedSseEnabled",properties.SqsManagedSseEnabled!=null?cfn_parse.FromCloudFormation.getBoolean(properties.SqsManagedSseEnabled):void 0),ret.addPropertyResult("tags","Tags",properties.Tags!=null?cfn_parse.FromCloudFormation.getArray(cfn_parse.FromCloudFormation.getCfnTag)(properties.Tags):void 0),ret.addPropertyResult("visibilityTimeout","VisibilityTimeout",properties.VisibilityTimeout!=null?cfn_parse.FromCloudFormation.getNumber(properties.VisibilityTimeout):void 0),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnQueue extends cdk.CfnResource{constructor(scope,id,props={}){super(scope,id,{type:CfnQueue.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_sqs_CfnQueueProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnQueue),error}this.attrArn=cdk.Token.asString(this.getAtt("Arn",cdk.ResolutionTypeHint.STRING)),this.attrQueueName=cdk.Token.asString(this.getAtt("QueueName",cdk.ResolutionTypeHint.STRING)),this.attrQueueUrl=cdk.Token.asString(this.getAtt("QueueUrl",cdk.ResolutionTypeHint.STRING)),this.contentBasedDeduplication=props.contentBasedDeduplication,this.deduplicationScope=props.deduplicationScope,this.delaySeconds=props.delaySeconds,this.fifoQueue=props.fifoQueue,this.fifoThroughputLimit=props.fifoThroughputLimit,this.kmsDataKeyReusePeriodSeconds=props.kmsDataKeyReusePeriodSeconds,this.kmsMasterKeyId=props.kmsMasterKeyId,this.maximumMessageSize=props.maximumMessageSize,this.messageRetentionPeriod=props.messageRetentionPeriod,this.queueName=props.queueName,this.receiveMessageWaitTimeSeconds=props.receiveMessageWaitTimeSeconds,this.redriveAllowPolicy=props.redriveAllowPolicy,this.redrivePolicy=props.redrivePolicy,this.sqsManagedSseEnabled=props.sqsManagedSseEnabled,this.tags=new cdk.TagManager(cdk.TagType.STANDARD,"AWS::SQS::Queue",props.tags,{tagPropertyName:"tags"}),this.visibilityTimeout=props.visibilityTimeout,this.node.scope&&cdk.Resource.isResource(this.node.scope)&&this.node.addValidation({validate:()=>this.cfnOptions.deletionPolicy===void 0?["'AWS::SQS::Queue' 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=CfnQueuePropsFromCloudFormation(resourceProperties),ret=new CfnQueue(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",CfnQueue.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{contentBasedDeduplication:this.contentBasedDeduplication,deduplicationScope:this.deduplicationScope,delaySeconds:this.delaySeconds,fifoQueue:this.fifoQueue,fifoThroughputLimit:this.fifoThroughputLimit,kmsDataKeyReusePeriodSeconds:this.kmsDataKeyReusePeriodSeconds,kmsMasterKeyId:this.kmsMasterKeyId,maximumMessageSize:this.maximumMessageSize,messageRetentionPeriod:this.messageRetentionPeriod,queueName:this.queueName,receiveMessageWaitTimeSeconds:this.receiveMessageWaitTimeSeconds,redriveAllowPolicy:this.redriveAllowPolicy,redrivePolicy:this.redrivePolicy,sqsManagedSseEnabled:this.sqsManagedSseEnabled,tags:this.tags.renderTags(),visibilityTimeout:this.visibilityTimeout}}renderProperties(props){return cfnQueuePropsToCloudFormation(props)}}exports.CfnQueue=CfnQueue,_a=JSII_RTTI_SYMBOL_1,CfnQueue[_a]={fqn:"aws-cdk-lib.aws_sqs.CfnQueue",version:"2.70.0"},CfnQueue.CFN_RESOURCE_TYPE_NAME="AWS::SQS::Queue";function CfnQueuePolicyPropsValidator(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("policyDocument",cdk.requiredValidator)(properties.policyDocument)),errors.collect(cdk.propertyValidator("policyDocument",cdk.validateObject)(properties.policyDocument)),errors.collect(cdk.propertyValidator("queues",cdk.requiredValidator)(properties.queues)),errors.collect(cdk.propertyValidator("queues",cdk.listValidator(cdk.validateString))(properties.queues)),errors.wrap('supplied properties not correct for "CfnQueuePolicyProps"')}function cfnQueuePolicyPropsToCloudFormation(properties){return cdk.canInspect(properties)?(CfnQueuePolicyPropsValidator(properties).assertSuccess(),{PolicyDocument:cdk.objectToCloudFormation(properties.policyDocument),Queues:cdk.listMapper(cdk.stringToCloudFormation)(properties.queues)}):properties}function CfnQueuePolicyPropsFromCloudFormation(properties){if(properties=properties??{},typeof properties!="object")return new cfn_parse.FromCloudFormationResult(properties);const ret=new cfn_parse.FromCloudFormationPropertyObject;return ret.addPropertyResult("policyDocument","PolicyDocument",cfn_parse.FromCloudFormation.getAny(properties.PolicyDocument)),ret.addPropertyResult("queues","Queues",cfn_parse.FromCloudFormation.getStringArray(properties.Queues)),ret.addUnrecognizedPropertiesAsExtra(properties),ret}class CfnQueuePolicy extends cdk.CfnResource{constructor(scope,id,props){super(scope,id,{type:CfnQueuePolicy.CFN_RESOURCE_TYPE_NAME,properties:props});try{jsiiDeprecationWarnings.aws_cdk_lib_aws_sqs_CfnQueuePolicyProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,CfnQueuePolicy),error}cdk.requireProperty(props,"policyDocument",this),cdk.requireProperty(props,"queues",this),this.policyDocument=props.policyDocument,this.queues=props.queues}static _fromCloudFormation(scope,id,resourceAttributes,options){resourceAttributes=resourceAttributes||{};const resourceProperties=options.parser.parseValue(resourceAttributes.Properties),propsResult=CfnQueuePolicyPropsFromCloudFormation(resourceProperties),ret=new CfnQueuePolicy(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",CfnQueuePolicy.CFN_RESOURCE_TYPE_NAME),inspector.addAttribute("aws:cdk:cloudformation:props",this.cfnProperties)}get cfnProperties(){return{policyDocument:this.policyDocument,queues:this.queues}}renderProperties(props){return cfnQueuePolicyPropsToCloudFormation(props)}}exports.CfnQueuePolicy=CfnQueuePolicy,_b=JSII_RTTI_SYMBOL_1,CfnQueuePolicy[_b]={fqn:"aws-cdk-lib.aws_sqs.CfnQueuePolicy",version:"2.70.0"},CfnQueuePolicy.CFN_RESOURCE_TYPE_NAME="AWS::SQS::QueuePolicy";