@pulumi/aws-serverless
Version:
Pulumi Amazon Web Services (AWS) Serverless Components.
51 lines (50 loc) • 1.7 kB
TypeScript
import { lambda, sns } from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";
import { Handler } from "./function";
import { EventSubscription } from "./subscription";
export interface TopicEvent {
Records: TopicRecord[];
}
export interface TopicRecord {
EventVersion: string;
EventSubscriptionArn: string;
EventSource: string;
Sns: SNSItem;
}
export interface SNSItem {
SignatureVersion: string;
Timestamp: string;
Signature: string;
SigningCertUrl: string;
MessageId: string;
Message: string;
MessageAttributes: {
[key: string]: SNSMessageAttribute;
};
Type: string;
UnsubscribeUrl: string;
TopicArn: string;
Subject: string;
}
export interface SNSMessageAttribute {
Type: string;
Value: string;
}
export declare type TopicEventHandler = Handler<TopicEvent, void>;
/**
* Arguments to control the topic subscription. Currently empty, but still defined in case of
* future need.
*/
export declare type TopicSubscriptionArgs = {};
/**
* Creates a new subscription to the given topic using the lambda provided, along with optional
* options to control the behavior of the subscription.
*/
export declare function subscribe(name: string, topic: sns.Topic, handler: TopicEventHandler, args?: TopicSubscriptionArgs, opts?: pulumi.ResourceOptions): TopicEventSubscription;
export declare class TopicEventSubscription extends EventSubscription {
/**
* The underlying sns object created for the subscription.
*/
readonly subscription: sns.TopicSubscription;
constructor(name: string, topic: sns.Topic, func: lambda.Function, args: TopicSubscriptionArgs, opts?: pulumi.ResourceOptions);
}