agent-claw: automated task changes

This commit is contained in:
daniel
2026-05-06 18:55:16 -05:00
parent 38905bb1e9
commit 732b00fb66
8494 changed files with 2018127 additions and 4 deletions

View File

@@ -0,0 +1,13 @@
{
"targets": {
"java": {
"package": "software.amazon.awscdk.services.sns.subscriptions"
},
"dotnet": {
"namespace": "Amazon.CDK.AWS.SNS.Subscriptions"
},
"python": {
"module": "aws_cdk.aws_sns_subscriptions"
}
}
}

View File

@@ -0,0 +1,176 @@
# CDK Construct Library for Amazon Simple Notification Service Subscriptions
This library provides constructs for adding subscriptions to an Amazon SNS topic.
Subscriptions can be added by calling the `.addSubscription(...)` method on the topic.
## Subscriptions
Subscriptions can be added to the following endpoints:
* HTTPS
* Amazon SQS
* AWS Lambda
* Email
* SMS
* Amazon Data Firehose
Subscriptions to Amazon SQS, AWS Lambda and Amazon Data Firehose can be added on topics across regions.
Create an Amazon SNS Topic to add subscriptions.
```ts
const myTopic = new sns.Topic(this, 'MyTopic');
```
### HTTPS
Add an HTTP or HTTPS Subscription to your topic:
```ts
const myTopic = new sns.Topic(this, 'MyTopic');
myTopic.addSubscription(new subscriptions.UrlSubscription('https://foobar.com/'));
```
The URL being subscribed can also be [tokens](https://docs.aws.amazon.com/cdk/latest/guide/tokens.html), that resolve
to a URL during deployment. A typical use case is when the URL is passed in as a [CloudFormation
parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html). The
following code defines a CloudFormation parameter and uses it in a URL subscription.
```ts
const myTopic = new sns.Topic(this, 'MyTopic');
const url = new CfnParameter(this, 'url-param');
myTopic.addSubscription(new subscriptions.UrlSubscription(url.valueAsString));
```
The [delivery policy](https://docs.aws.amazon.com/sns/latest/dg/sns-message-delivery-retries.html) can also be set like so:
```ts
const myTopic = new sns.Topic(this, 'MyTopic');
myTopic.addSubscription(
new subscriptions.UrlSubscription(
'https://foobar.com/',
{
deliveryPolicy: {
healthyRetryPolicy: {
minDelayTarget: Duration.seconds(5),
maxDelayTarget: Duration.seconds(10),
numRetries: 6,
backoffFunction: sns.BackoffFunction.EXPONENTIAL,
},
throttlePolicy: {
maxReceivesPerSecond: 10,
},
requestPolicy: {
headerContentType: 'application/json',
},
},
},
),
);
```
### Amazon SQS
Subscribe a queue to your topic:
```ts
const myQueue = new sqs.Queue(this, 'MyQueue');
const myTopic = new sns.Topic(this, 'MyTopic');
myTopic.addSubscription(new subscriptions.SqsSubscription(myQueue));
```
KMS key permissions will automatically be granted to SNS when a subscription is made to
an encrypted queue.
Note that subscriptions of queues in different accounts need to be manually confirmed by
reading the initial message from the queue and visiting the link found in it.
### AWS Lambda
Subscribe an AWS Lambda function to your topic:
```ts
import * as lambda from 'aws-cdk-lib/aws-lambda';
const myTopic = new sns.Topic(this, 'myTopic');
declare const myFunction: lambda.Function;
myTopic.addSubscription(new subscriptions.LambdaSubscription(myFunction));
```
### Email
Subscribe an email address to your topic:
```ts
const myTopic = new sns.Topic(this, 'MyTopic');
myTopic.addSubscription(new subscriptions.EmailSubscription('foo@bar.com'));
```
The email being subscribed can also be [tokens](https://docs.aws.amazon.com/cdk/latest/guide/tokens.html), that resolve
to an email address during deployment. A typical use case is when the email address is passed in as a [CloudFormation
parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html). The
following code defines a CloudFormation parameter and uses it in an email subscription.
```ts
const myTopic = new sns.Topic(this, 'Topic');
const emailAddress = new CfnParameter(this, 'email-param');
myTopic.addSubscription(new subscriptions.EmailSubscription(emailAddress.valueAsString));
```
Note that email subscriptions require confirmation by visiting the link sent to the
email address.
### SMS
Subscribe an sms number to your topic:
```ts
const myTopic = new sns.Topic(this, 'Topic');
myTopic.addSubscription(new subscriptions.SmsSubscription('+15551231234'));
```
The number being subscribed can also be [tokens](https://docs.aws.amazon.com/cdk/latest/guide/tokens.html), that resolve
to a number during deployment. A typical use case is when the number is passed in as a [CloudFormation
parameter](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html). The
following code defines a CloudFormation parameter and uses it in an sms subscription.
```ts
const myTopic = new sns.Topic(this, 'Topic');
const smsNumber = new CfnParameter(this, 'sms-param');
myTopic.addSubscription(new subscriptions.SmsSubscription(smsNumber.valueAsString));
```
### Amazon Data Firehose
Subscribe an Amazon Data Firehose delivery stream to your topic:
```ts
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';
const myTopic = new sns.Topic(this, 'Topic');
declare const stream: firehose.DeliveryStream;
myTopic.addSubscription(new subscriptions.FirehoseSubscription(stream));
```
To remove any Amazon SNS metadata from published messages, specify `rawMessageDelivery` to true.
```ts
import * as firehose from 'aws-cdk-lib/aws-kinesisfirehose';
const myTopic = new sns.Topic(this, 'Topic');
declare const stream: firehose.DeliveryStream;
myTopic.addSubscription(new subscriptions.FirehoseSubscription(stream, {
rawMessageDelivery: true,
}));
```

View File

@@ -0,0 +1 @@
export * from './lib';

View File

@@ -0,0 +1 @@
"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.__exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});var _noFold;exports.EmailSubscription=void 0,Object.defineProperty(exports,_noFold="EmailSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./lib").EmailSubscription;return Object.defineProperty(exports,_noFold="EmailSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.LambdaSubscription=void 0,Object.defineProperty(exports,_noFold="LambdaSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./lib").LambdaSubscription;return Object.defineProperty(exports,_noFold="LambdaSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.SqsSubscription=void 0,Object.defineProperty(exports,_noFold="SqsSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./lib").SqsSubscription;return Object.defineProperty(exports,_noFold="SqsSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.UrlSubscription=void 0,Object.defineProperty(exports,_noFold="UrlSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./lib").UrlSubscription;return Object.defineProperty(exports,_noFold="UrlSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.SmsSubscription=void 0,Object.defineProperty(exports,_noFold="SmsSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./lib").SmsSubscription;return Object.defineProperty(exports,_noFold="SmsSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.FirehoseSubscription=void 0,Object.defineProperty(exports,_noFold="FirehoseSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./lib").FirehoseSubscription;return Object.defineProperty(exports,_noFold="FirehoseSubscription",{enumerable:!0,configurable:!0,value}),value}});

View File

@@ -0,0 +1,28 @@
import type { SubscriptionProps } from './subscription';
import * as sns from '../../aws-sns';
/**
* Options for email subscriptions.
*/
export interface EmailSubscriptionProps extends SubscriptionProps {
/**
* Indicates if the full notification JSON should be sent to the email
* address or just the message text.
*
* @default false (Message text)
*/
readonly json?: boolean;
}
/**
* Use an email address as a subscription target
*
* Email subscriptions require confirmation.
*/
export declare class EmailSubscription implements sns.ITopicSubscription {
private readonly emailAddress;
private readonly props;
constructor(emailAddress: string, props?: EmailSubscriptionProps);
/**
* Returns a configuration for an email address to subscribe to an SNS topic
*/
bind(_topic: sns.ITopic): sns.TopicSubscriptionConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EmailSubscription=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var sns=()=>{var tmp=require("../../aws-sns");return sns=()=>tmp,tmp};class EmailSubscription{emailAddress;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_sns_subscriptions.EmailSubscription",version:"2.252.0"};constructor(emailAddress,props={}){this.emailAddress=emailAddress,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_subscriptions_EmailSubscriptionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,EmailSubscription),error}}bind(_topic){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_ITopic(_topic)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}return{subscriberId:this.emailAddress,endpoint:this.emailAddress,protocol:this.props.json?sns().SubscriptionProtocol.EMAIL_JSON:sns().SubscriptionProtocol.EMAIL,filterPolicy:this.props.filterPolicy,filterPolicyWithMessageBody:this.props.filterPolicyWithMessageBody,deadLetterQueue:this.props.deadLetterQueue}}}exports.EmailSubscription=EmailSubscription;

View File

@@ -0,0 +1,36 @@
import type { SubscriptionProps } from './subscription';
import * as iam from '../../aws-iam';
import type * as firehose from '../../aws-kinesisfirehose';
import * as sns from '../../aws-sns';
/**
* Properties for an Amazon Data Firehose subscription
*/
export interface FirehoseSubscriptionProps extends SubscriptionProps {
/**
* Whether to remove any Amazon SNS metadata from published messages.
*
* @see https://docs.aws.amazon.com/sns/latest/dg/sns-large-payload-raw-message-delivery.html
* @default false
*/
readonly rawMessageDelivery?: boolean;
/**
* The role to assume to write messages to the Amazon Data Firehose delivery stream.
*
* @default - A new Role is created
*/
readonly role?: iam.IRole;
}
/**
* Use an Amazon Data Firehose delivery stream as a subscription target.
*
* @see https://docs.aws.amazon.com/sns/latest/dg/sns-firehose-as-subscriber.html
*/
export declare class FirehoseSubscription implements sns.ITopicSubscription {
private readonly deliveryStream;
private readonly props;
constructor(deliveryStream: firehose.IDeliveryStream, props?: FirehoseSubscriptionProps);
/**
* Returns a configuration for a Lambda function to subscribe to an SNS topic
*/
bind(topic: sns.ITopic): sns.TopicSubscriptionConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FirehoseSubscription=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var constructs_1=()=>{var tmp=require("constructs");return constructs_1=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},sns=()=>{var tmp=require("../../aws-sns");return sns=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},util_1=()=>{var tmp=require("./private/util");return util_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class FirehoseSubscription{deliveryStream;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_sns_subscriptions.FirehoseSubscription",version:"2.252.0"};constructor(deliveryStream,props={}){this.deliveryStream=deliveryStream,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_kinesisfirehose_IDeliveryStream(deliveryStream),jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_subscriptions_FirehoseSubscriptionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,FirehoseSubscription),error}}bind(topic){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_ITopic(topic)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}if(!constructs_1().Construct.isConstruct(this.deliveryStream))throw new(core_1()).ValidationError((0,literal_string_1().lit)`SuppliedDeliveryStreamObjectInstance`,"The supplied delivery stream object must be an instance of Construct",topic);const role=this.props.role??this.deliveryStream.node.tryFindChild("TopicSubscriptionRole")??new(iam()).Role(this.deliveryStream,"TopicSubscriptionRole",{assumedBy:new(iam()).ServicePrincipal("sns.amazonaws.com")});return this.deliveryStream.grant(role,"firehose:DescribeDeliveryStream","firehose:ListDeliveryStreams","firehose:ListTagsForDeliveryStream","firehose:PutRecord","firehose:PutRecordBatch"),topic instanceof sns().Topic&&topic.stack!==this.deliveryStream.stack&&this.deliveryStream.stack.addDependency(topic.stack),{subscriberScope:this.deliveryStream,subscriberId:core_1().Names.nodeUniqueId(topic.node),endpoint:this.deliveryStream.deliveryStreamArn,protocol:sns().SubscriptionProtocol.FIREHOSE,filterPolicy:this.props.filterPolicy,filterPolicyWithMessageBody:this.props.filterPolicyWithMessageBody,rawMessageDelivery:this.props.rawMessageDelivery,region:(0,util_1().regionFromArn)(topic,this.deliveryStream),deadLetterQueue:this.props.deadLetterQueue,subscriptionRoleArn:role.roleArn}}}exports.FirehoseSubscription=FirehoseSubscription;

View File

@@ -0,0 +1,7 @@
export * from './subscription';
export * from './email';
export * from './lambda';
export * from './sqs';
export * from './url';
export * from './sms';
export * from './firehose';

View File

@@ -0,0 +1 @@
"use strict";var __createBinding=exports&&exports.__createBinding||(Object.create?(function(o,m,k,k2){k2===void 0&&(k2=k);var desc=Object.getOwnPropertyDescriptor(m,k);(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable))&&(desc={enumerable:!0,get:function(){return m[k]}}),Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]})),__exportStar=exports&&exports.__exportStar||function(m,exports2){for(var p in m)p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p)&&__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:!0});var _noFold;exports.EmailSubscription=void 0,Object.defineProperty(exports,_noFold="EmailSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./email").EmailSubscription;return Object.defineProperty(exports,_noFold="EmailSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.LambdaSubscription=void 0,Object.defineProperty(exports,_noFold="LambdaSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./lambda").LambdaSubscription;return Object.defineProperty(exports,_noFold="LambdaSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.SqsSubscription=void 0,Object.defineProperty(exports,_noFold="SqsSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./sqs").SqsSubscription;return Object.defineProperty(exports,_noFold="SqsSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.UrlSubscription=void 0,Object.defineProperty(exports,_noFold="UrlSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./url").UrlSubscription;return Object.defineProperty(exports,_noFold="UrlSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.SmsSubscription=void 0,Object.defineProperty(exports,_noFold="SmsSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./sms").SmsSubscription;return Object.defineProperty(exports,_noFold="SmsSubscription",{enumerable:!0,configurable:!0,value}),value}}),exports.FirehoseSubscription=void 0,Object.defineProperty(exports,_noFold="FirehoseSubscription",{enumerable:!0,configurable:!0,get:()=>{var value=require("./firehose").FirehoseSubscription;return Object.defineProperty(exports,_noFold="FirehoseSubscription",{enumerable:!0,configurable:!0,value}),value}});

View File

@@ -0,0 +1,20 @@
import type { SubscriptionProps } from './subscription';
import type * as lambda from '../../aws-lambda';
import * as sns from '../../aws-sns';
/**
* Properties for a Lambda subscription
*/
export interface LambdaSubscriptionProps extends SubscriptionProps {
}
/**
* Use a Lambda function as a subscription target
*/
export declare class LambdaSubscription implements sns.ITopicSubscription {
private readonly fn;
private readonly props;
constructor(fn: lambda.IFunction, props?: LambdaSubscriptionProps);
/**
* Returns a configuration for a Lambda function to subscribe to an SNS topic
*/
bind(topic: sns.ITopic): sns.TopicSubscriptionConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LambdaSubscription=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var constructs_1=()=>{var tmp=require("constructs");return constructs_1=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},sns=()=>{var tmp=require("../../aws-sns");return sns=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},util_1=()=>{var tmp=require("./private/util");return util_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class LambdaSubscription{fn;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_sns_subscriptions.LambdaSubscription",version:"2.252.0"};constructor(fn,props={}){this.fn=fn,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_lambda_IFunction(fn),jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_subscriptions_LambdaSubscriptionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,LambdaSubscription),error}}bind(topic){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_ITopic(topic)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}if(!constructs_1().Construct.isConstruct(this.fn))throw new(core_1()).ValidationError((0,literal_string_1().lit)`SuppliedLambdaFunctionObjectInstance`,"The supplied lambda Function object must be an instance of Construct",topic);return this.fn.addPermission(`AllowInvoke:${core_1().Names.nodeUniqueId(topic.node)}`,{sourceArn:topic.topicArn,principal:new(iam()).ServicePrincipal("sns.amazonaws.com")}),topic instanceof sns().Topic&&topic.stack!==this.fn.stack&&this.fn.stack.addDependency(topic.stack),{subscriberScope:this.fn,subscriberId:topic.node.id,endpoint:this.fn.functionArn,protocol:sns().SubscriptionProtocol.LAMBDA,filterPolicy:this.props.filterPolicy,filterPolicyWithMessageBody:this.props.filterPolicyWithMessageBody,region:(0,util_1().regionFromArn)(topic,this.fn),deadLetterQueue:this.props.deadLetterQueue}}}exports.LambdaSubscription=LambdaSubscription;

View File

@@ -0,0 +1,3 @@
import * as sns from '../../../aws-sns';
import type { IResource } from '../../../core';
export declare function regionFromArn(topic: sns.ITopic, resource: IResource): string | undefined;

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.regionFromArn=regionFromArn;var sns=()=>{var tmp=require("../../../aws-sns");return sns=()=>tmp,tmp},core_1=()=>{var tmp=require("../../../core");return core_1=()=>tmp,tmp};function regionFromArn(topic,resource){return topic instanceof sns().Topic?topic.stack!==resource.stack&&!core_1().Token.isUnresolved(topic.env.region)&&topic.env.region!==resource.env.region?topic.env.region:void 0:core_1().Stack.of(topic).splitArn(topic.topicArn,core_1().ArnFormat.SLASH_RESOURCE_NAME).region}

View File

@@ -0,0 +1,16 @@
import type { SubscriptionProps } from './subscription';
import * as sns from '../../aws-sns';
/**
* Options for SMS subscriptions.
*/
export interface SmsSubscriptionProps extends SubscriptionProps {
}
/**
* Use an sms address as a subscription target
*/
export declare class SmsSubscription implements sns.ITopicSubscription {
private readonly phoneNumber;
private readonly props;
constructor(phoneNumber: string, props?: SmsSubscriptionProps);
bind(_topic: sns.ITopic): sns.TopicSubscriptionConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SmsSubscription=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var sns=()=>{var tmp=require("../../aws-sns");return sns=()=>tmp,tmp};class SmsSubscription{phoneNumber;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_sns_subscriptions.SmsSubscription",version:"2.252.0"};constructor(phoneNumber,props={}){this.phoneNumber=phoneNumber,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_subscriptions_SmsSubscriptionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,SmsSubscription),error}}bind(_topic){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_ITopic(_topic)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}return{subscriberId:this.phoneNumber,endpoint:this.phoneNumber,protocol:sns().SubscriptionProtocol.SMS,filterPolicy:this.props.filterPolicy,filterPolicyWithMessageBody:this.props.filterPolicyWithMessageBody}}}exports.SmsSubscription=SmsSubscription;

View File

@@ -0,0 +1,28 @@
import type { SubscriptionProps } from './subscription';
import * as sns from '../../aws-sns';
import * as sqs from '../../aws-sqs';
/**
* Properties for an SQS subscription
*/
export interface SqsSubscriptionProps extends SubscriptionProps {
/**
* The message to the queue is the same as it was sent to the topic
*
* If false, the message will be wrapped in an SNS envelope.
*
* @default false
*/
readonly rawMessageDelivery?: boolean;
}
/**
* Use an SQS queue as a subscription target
*/
export declare class SqsSubscription implements sns.ITopicSubscription {
private readonly queue;
private readonly props;
constructor(queue: sqs.IQueue, props?: SqsSubscriptionProps);
/**
* Returns a configuration for an SQS queue to subscribe to an SNS topic
*/
bind(topic: sns.ITopic): sns.TopicSubscriptionConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SqsSubscription=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var constructs_1=()=>{var tmp=require("constructs");return constructs_1=()=>tmp,tmp},iam=()=>{var tmp=require("../../aws-iam");return iam=()=>tmp,tmp},sns=()=>{var tmp=require("../../aws-sns");return sns=()=>tmp,tmp},sqs=()=>{var tmp=require("../../aws-sqs");return sqs=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},cxapi=()=>{var tmp=require("../../cx-api");return cxapi=()=>tmp,tmp},util_1=()=>{var tmp=require("./private/util");return util_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class SqsSubscription{queue;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_sns_subscriptions.SqsSubscription",version:"2.252.0"};constructor(queue,props={}){this.queue=queue,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sqs_IQueue(queue),jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_subscriptions_SqsSubscriptionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,SqsSubscription),error}}bind(topic){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_ITopic(topic)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}if(!constructs_1().Construct.isConstruct(this.queue))throw new(core_1()).ValidationError((0,literal_string_1().lit)`SuppliedQueueObjectInstanceConstruct`,"The supplied Queue object must be an instance of Construct",topic);const snsServicePrincipal=new(iam()).ServicePrincipal("sns.amazonaws.com");if(this.queue.encryptionType===sqs().QueueEncryption.KMS_MANAGED)throw new(core_1()).ValidationError((0,literal_string_1().lit)`QueueEncryptedManagedKeyCannot`,"SQS queue encrypted by AWS managed KMS key cannot be used as SNS subscription",topic);if(this.props.deadLetterQueue&&this.props.deadLetterQueue.encryptionType===sqs().QueueEncryption.KMS_MANAGED)throw new(core_1()).ValidationError((0,literal_string_1().lit)`QueueEncryptedManagedKeyCannot`,"SQS queue encrypted by AWS managed KMS key cannot be used as dead-letter queue",topic);const queuePolicyDependable=this.queue.addToResourcePolicy(new(iam()).PolicyStatement({resources:[this.queue.queueArn],actions:["sqs:SendMessage"],principals:[snsServicePrincipal],conditions:{ArnEquals:{"aws:SourceArn":topic.topicArn}}})).policyDependable;return this.queue.encryptionMasterKey&&this.queue.encryptionMasterKey.addToResourcePolicy(new(iam()).PolicyStatement({resources:["*"],actions:["kms:Decrypt","kms:GenerateDataKey"],principals:[snsServicePrincipal],conditions:core_1().FeatureFlags.of(topic).isEnabled(cxapi().SNS_SUBSCRIPTIONS_SQS_DECRYPTION_POLICY)?{ArnEquals:{"aws:SourceArn":topic.topicArn}}:void 0})),topic instanceof sns().Topic&&topic.stack!==this.queue.stack&&this.queue.stack.addDependency(topic.stack),{subscriberScope:this.queue,subscriberId:core_1().Names.nodeUniqueId(topic.node),endpoint:this.queue.queueArn,protocol:sns().SubscriptionProtocol.SQS,rawMessageDelivery:this.props.rawMessageDelivery,filterPolicy:this.props.filterPolicy,filterPolicyWithMessageBody:this.props.filterPolicyWithMessageBody,region:(0,util_1().regionFromArn)(topic,this.queue),deadLetterQueue:this.props.deadLetterQueue,subscriptionDependency:queuePolicyDependable}}}exports.SqsSubscription=SqsSubscription;

View File

@@ -0,0 +1,31 @@
import type * as sns from '../../aws-sns';
import type { IQueue } from '../../aws-sqs';
/**
* Options to subscribing to an SNS topic
*/
export interface SubscriptionProps {
/**
* The filter policy.
*
* @default - all messages are delivered
*/
readonly filterPolicy?: {
[attribute: string]: sns.SubscriptionFilter;
};
/**
* The filter policy that is applied on the message body.
* To apply a filter policy to the message attributes, use `filterPolicy`. A maximum of one of `filterPolicyWithMessageBody` and `filterPolicy` may be used.
*
* @default - all messages are delivered
*/
readonly filterPolicyWithMessageBody?: {
[attribute: string]: sns.FilterOrPolicy;
};
/**
* Queue to be used as dead letter queue.
* If not passed no dead letter queue is enabled.
*
* @default - No dead letter queue enabled.
*/
readonly deadLetterQueue?: IQueue;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});

View File

@@ -0,0 +1,49 @@
import type { SubscriptionProps } from './subscription';
import * as sns from '../../aws-sns';
/**
* Options for URL subscriptions.
*/
export interface UrlSubscriptionProps extends SubscriptionProps {
/**
* The message to the queue is the same as it was sent to the topic
*
* If false, the message will be wrapped in an SNS envelope.
*
* @default false
*/
readonly rawMessageDelivery?: boolean;
/**
* The subscription's protocol.
*
* @default - Protocol is derived from url
*/
readonly protocol?: sns.SubscriptionProtocol;
/**
* The delivery policy.
*
* @default - if the initial delivery of the message fails, three retries with a delay between failed attempts set at 20 seconds
*/
readonly deliveryPolicy?: sns.DeliveryPolicy;
}
/**
* Use a URL as a subscription target
*
* The message will be POSTed to the given URL.
*
* @see https://docs.aws.amazon.com/sns/latest/dg/sns-http-https-endpoint-as-subscriber.html
*/
export declare class UrlSubscription implements sns.ITopicSubscription {
private readonly url;
private readonly props;
/**
* Uniquely identifies this class.
*/
static readonly PROPERTY_INJECTION_ID: string;
private readonly protocol;
private readonly unresolvedUrl;
constructor(url: string, props?: UrlSubscriptionProps);
/**
* Returns a configuration for a URL to subscribe to an SNS topic
*/
bind(_topic: sns.ITopic): sns.TopicSubscriptionConfig;
}

View File

@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.UrlSubscription=void 0;var jsiiDeprecationWarnings=()=>{var tmp=require("../../.warnings.jsii.js");return jsiiDeprecationWarnings=()=>tmp,tmp};const JSII_RTTI_SYMBOL_1=Symbol.for("jsii.rtti");var sns=()=>{var tmp=require("../../aws-sns");return sns=()=>tmp,tmp},core_1=()=>{var tmp=require("../../core");return core_1=()=>tmp,tmp},literal_string_1=()=>{var tmp=require("../../core/lib/private/literal-string");return literal_string_1=()=>tmp,tmp};class UrlSubscription{url;props;static[JSII_RTTI_SYMBOL_1]={fqn:"aws-cdk-lib.aws_sns_subscriptions.UrlSubscription",version:"2.252.0"};static PROPERTY_INJECTION_ID="aws-cdk-lib.aws-sns-subscriptions.UrlSubscription";protocol;unresolvedUrl;constructor(url,props={}){this.url=url,this.props=props;try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_subscriptions_UrlSubscriptionProps(props)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,UrlSubscription),error}if(this.unresolvedUrl=core_1().Token.isUnresolved(url),!this.unresolvedUrl&&!url.startsWith("http://")&&!url.startsWith("https://"))throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`StartEitherHttpHttps`,"URL must start with either http:// or https://");if(this.unresolvedUrl&&props.protocol===void 0)throw new(core_1()).UnscopedValidationError((0,literal_string_1().lit)`ProvideProtocolUnresolved`,"Must provide protocol if url is unresolved");this.unresolvedUrl?this.protocol=props.protocol:this.protocol=this.url.startsWith("https:")?sns().SubscriptionProtocol.HTTPS:sns().SubscriptionProtocol.HTTP}bind(_topic){try{jsiiDeprecationWarnings().aws_cdk_lib_aws_sns_ITopic(_topic)}catch(error){throw process.env.JSII_DEBUG!=="1"&&error.name==="DeprecationError"&&Error.captureStackTrace(error,this.bind),error}return{subscriberId:this.url,endpoint:this.url,protocol:this.protocol,rawMessageDelivery:this.props.rawMessageDelivery,filterPolicy:this.props.filterPolicy,filterPolicyWithMessageBody:this.props.filterPolicyWithMessageBody,deadLetterQueue:this.props.deadLetterQueue,deliveryPolicy:this.props.deliveryPolicy}}}exports.UrlSubscription=UrlSubscription;