UNPKG

aws-cdk-lib

Version:

Version 2 of the AWS Cloud Development Kit library

2 lines (1 loc) 2.81 kB
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.QueueBase=void 0;const jsiiDeprecationWarnings=require("../../.warnings.jsii.js"),JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti"),iam=require("../../aws-iam"),core_1=require("../../core"),policy_1=require("./policy");class QueueBase extends core_1.Resource{constructor(scope,id,props={}){super(scope,id,props);try{jsiiDeprecationWarnings.aws_cdk_lib_ResourceProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,QueueBase),error}this.node.addValidation({validate:()=>this.policy?.document.validateForResourcePolicy()??[]})}addToResourcePolicy(statement){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_iam_PolicyStatement(statement)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.addToResourcePolicy),error}return!this.policy&&this.autoCreatePolicy&&(this.policy=new policy_1.QueuePolicy(this,"Policy",{queues:[this]})),this.policy?(this.policy.document.addStatements(statement),{statementAdded:!0,policyDependable:this.policy}):{statementAdded:!1}}grantConsumeMessages(grantee){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grantConsumeMessages),error}const ret=this.grant(grantee,"sqs:ReceiveMessage","sqs:ChangeMessageVisibility","sqs:GetQueueUrl","sqs:DeleteMessage","sqs:GetQueueAttributes");return this.encryptionMasterKey&&this.encryptionMasterKey.grantDecrypt(grantee),ret}grantSendMessages(grantee){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grantSendMessages),error}const ret=this.grant(grantee,"sqs:SendMessage","sqs:GetQueueAttributes","sqs:GetQueueUrl");return this.encryptionMasterKey&&this.encryptionMasterKey.grantEncryptDecrypt(grantee),ret}grantPurge(grantee){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grantPurge),error}return this.grant(grantee,"sqs:PurgeQueue","sqs:GetQueueAttributes","sqs:GetQueueUrl")}grant(grantee,...actions){try{jsiiDeprecationWarnings.aws_cdk_lib_aws_iam_IGrantable(grantee)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.grant),error}return iam.Grant.addToPrincipalOrResource({grantee,actions,resourceArns:[this.queueArn],resource:this})}}exports.QueueBase=QueueBase,_a=JSII_RTTI_SYMBOL_1,QueueBase[_a]={fqn:"aws-cdk-lib.aws_sqs.QueueBase",version:"2.70.0"};