UNPKG

6.77 kBTypeScriptView Raw
1import * as iam from '@aws-cdk/aws-iam';
2import { IResource, Resource } from '@aws-cdk/core';
3import { Construct } from 'constructs';
4import { Archive, BaseArchiveProps } from './archive';
5/**
6 * Interface which all EventBus based classes MUST implement
7 */
8export interface IEventBus extends IResource {
9 /**
10 * The physical ID of this event bus resource
11 *
12 * @attribute
13 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#cfn-events-eventbus-name
14 */
15 readonly eventBusName: string;
16 /**
17 * The ARN of this event bus resource
18 *
19 * @attribute
20 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#Arn-fn::getatt
21 */
22 readonly eventBusArn: string;
23 /**
24 * The JSON policy of this event bus resource
25 *
26 * @attribute
27 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#Policy-fn::getatt
28 */
29 readonly eventBusPolicy: string;
30 /**
31 * The partner event source to associate with this event bus resource
32 *
33 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#cfn-events-eventbus-eventsourcename
34 */
35 readonly eventSourceName?: string;
36 /**
37 * Create an EventBridge archive to send events to.
38 * When you create an archive, incoming events might not immediately start being sent to the archive.
39 * Allow a short period of time for changes to take effect.
40 *
41 * @param props Properties of the archive
42 */
43 archive(id: string, props: BaseArchiveProps): Archive;
44 /**
45 * Grants an IAM Principal to send custom events to the eventBus
46 * so that they can be matched to rules.
47 *
48 * @param grantee The principal (no-op if undefined)
49 */
50 grantPutEventsTo(grantee: iam.IGrantable): iam.Grant;
51}
52/**
53 * Properties to define an event bus
54 */
55export interface EventBusProps {
56 /**
57 * The name of the event bus you are creating
58 * Note: If 'eventSourceName' is passed in, you cannot set this
59 *
60 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#cfn-events-eventbus-name
61 * @default - automatically generated name
62 */
63 readonly eventBusName?: string;
64 /**
65 * The partner event source to associate with this event bus resource
66 * Note: If 'eventBusName' is passed in, you cannot set this
67 *
68 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#cfn-events-eventbus-eventsourcename
69 * @default - no partner event source
70 */
71 readonly eventSourceName?: string;
72}
73/**
74 * Interface with properties necessary to import a reusable EventBus
75 */
76export interface EventBusAttributes {
77 /**
78 * The physical ID of this event bus resource
79 *
80 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#cfn-events-eventbus-name
81 */
82 readonly eventBusName: string;
83 /**
84 * The ARN of this event bus resource
85 *
86 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#Arn-fn::getatt
87 */
88 readonly eventBusArn: string;
89 /**
90 * The JSON policy of this event bus resource
91 *
92 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#Policy-fn::getatt
93 */
94 readonly eventBusPolicy: string;
95 /**
96 * The partner event source to associate with this event bus resource
97 *
98 * @link https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-eventbus.html#cfn-events-eventbus-eventsourcename
99 * @default - no partner event source
100 */
101 readonly eventSourceName?: string;
102}
103declare abstract class EventBusBase extends Resource implements IEventBus {
104 /**
105 * The physical ID of this event bus resource
106 */
107 abstract readonly eventBusName: string;
108 /**
109 * The ARN of the event bus, such as:
110 * arn:aws:events:us-east-2:123456789012:event-bus/aws.partner/PartnerName/acct1/repo1.
111 */
112 abstract readonly eventBusArn: string;
113 /**
114 * The policy for the event bus in JSON form.
115 */
116 abstract readonly eventBusPolicy: string;
117 /**
118 * The name of the partner event source
119 */
120 abstract readonly eventSourceName?: string;
121 archive(id: string, props: BaseArchiveProps): Archive;
122 grantPutEventsTo(grantee: iam.IGrantable): iam.Grant;
123}
124/**
125 * Define an EventBridge EventBus
126 *
127 * @resource AWS::Events::EventBus
128 */
129export declare class EventBus extends EventBusBase {
130 /**
131 * Import an existing event bus resource
132 * @param scope Parent construct
133 * @param id Construct ID
134 * @param eventBusArn ARN of imported event bus
135 */
136 static fromEventBusArn(scope: Construct, id: string, eventBusArn: string): IEventBus;
137 /**
138 * Import an existing event bus resource
139 * @param scope Parent construct
140 * @param id Construct ID
141 * @param eventBusName Name of imported event bus
142 */
143 static fromEventBusName(scope: Construct, id: string, eventBusName: string): IEventBus;
144 /**
145 * Import an existing event bus resource
146 * @param scope Parent construct
147 * @param id Construct ID
148 * @param attrs Imported event bus properties
149 */
150 static fromEventBusAttributes(scope: Construct, id: string, attrs: EventBusAttributes): IEventBus;
151 /**
152 * Permits an IAM Principal to send custom events to EventBridge
153 * so that they can be matched to rules.
154 *
155 * @param grantee The principal (no-op if undefined)
156 * @deprecated use grantAllPutEvents instead
157 */
158 static grantPutEvents(grantee: iam.IGrantable): iam.Grant;
159 /**
160 * Permits an IAM Principal to send custom events to EventBridge
161 * so that they can be matched to rules.
162 *
163 * @param grantee The principal (no-op if undefined)
164 */
165 static grantAllPutEvents(grantee: iam.IGrantable): iam.Grant;
166 private static eventBusProps;
167 /**
168 * The physical ID of this event bus resource
169 */
170 readonly eventBusName: string;
171 /**
172 * The ARN of the event bus, such as:
173 * arn:aws:events:us-east-2:123456789012:event-bus/aws.partner/PartnerName/acct1/repo1.
174 */
175 readonly eventBusArn: string;
176 /**
177 * The policy for the event bus in JSON form.
178 */
179 readonly eventBusPolicy: string;
180 /**
181 * The name of the partner event source
182 */
183 readonly eventSourceName?: string;
184 constructor(scope: Construct, id: string, props?: EventBusProps);
185}
186export {};