UNPKG

2.1 kBTypeScriptView Raw
1import * as events from '@aws-cdk/aws-events';
2import * as iam from '@aws-cdk/aws-iam';
3/**
4 * AWS SDK service metadata.
5 */
6export declare type AwsSdkMetadata = {
7 [key: string]: any;
8};
9/**
10 * Rule target input for an AwsApi target.
11 */
12export interface AwsApiInput {
13 /**
14 * The service to call
15 *
16 * @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html
17 */
18 readonly service: string;
19 /**
20 * The service action to call
21 *
22 * @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html
23 */
24 readonly action: string;
25 /**
26 * The parameters for the service action
27 *
28 * @see https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html
29 *
30 * @default - no parameters
31 */
32 readonly parameters?: any;
33 /**
34 * The regex pattern to use to catch API errors. The `code` property of the
35 * `Error` object will be tested against this pattern. If there is a match an
36 * error will not be thrown.
37 *
38 * @default - do not catch errors
39 */
40 readonly catchErrorPattern?: string;
41 /**
42 * API version to use for the service
43 *
44 * @see https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/locking-api-versions.html
45 * @default - use latest available API version
46 */
47 readonly apiVersion?: string;
48}
49/**
50 * Properties for an AwsApi target.
51 */
52export interface AwsApiProps extends AwsApiInput {
53 /**
54 * The IAM policy statement to allow the API call. Use only if
55 * resource restriction is needed.
56 *
57 * @default - extract the permission from the API call
58 */
59 readonly policyStatement?: iam.PolicyStatement;
60}
61/**
62 * Use an AWS Lambda function that makes API calls as an event rule target.
63 */
64export declare class AwsApi implements events.IRuleTarget {
65 private readonly props;
66 constructor(props: AwsApiProps);
67 /**
68 * Returns a RuleTarget that can be used to trigger this AwsApi as a
69 * result from an EventBridge event.
70 */
71 bind(rule: events.IRule, id?: string): events.RuleTargetConfig;
72}