aws-cdk-lib
Version:
Version 2 of the AWS Cloud Development Kit library
2 lines (1 loc) • 3.3 kB
JavaScript
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.QueueEncryption=exports.QueueBase=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var policy_1=()=>{var tmp=require("./policy");return policy_1=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp};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.202.0"};var QueueEncryption;(function(QueueEncryption2){QueueEncryption2.UNENCRYPTED="NONE",QueueEncryption2.KMS_MANAGED="KMS_MANAGED",QueueEncryption2.KMS="KMS",QueueEncryption2.SQS_MANAGED="SQS_MANAGED"})(QueueEncryption||(exports.QueueEncryption=QueueEncryption={}));