1 | import { IResource, Resource, SecretValue } from '@aws-cdk/core';
|
2 | import { Construct } from 'constructs';
|
3 | /**
|
4 | * An API Destination Connection
|
5 | *
|
6 | * A connection defines the authorization type and credentials to use for authorization with an API destination HTTP endpoint.
|
7 | */
|
8 | export interface ConnectionProps {
|
9 | /**
|
10 | * The name of the connection.
|
11 | *
|
12 | * @default - A name is automatically generated
|
13 | */
|
14 | readonly connectionName?: string;
|
15 | /**
|
16 | * The name of the connection.
|
17 | *
|
18 | * @default - none
|
19 | */
|
20 | readonly description?: string;
|
21 | /**
|
22 | * The authorization type for the connection.
|
23 | */
|
24 | readonly authorization: Authorization;
|
25 | /**
|
26 | * Additional string parameters to add to the invocation bodies
|
27 | *
|
28 | * @default - No additional parameters
|
29 | */
|
30 | readonly bodyParameters?: Record<string, HttpParameter>;
|
31 | /**
|
32 | * Additional string parameters to add to the invocation headers
|
33 | *
|
34 | * @default - No additional parameters
|
35 | */
|
36 | readonly headerParameters?: Record<string, HttpParameter>;
|
37 | /**
|
38 | * Additional string parameters to add to the invocation query strings
|
39 | *
|
40 | * @default - No additional parameters
|
41 | */
|
42 | readonly queryStringParameters?: Record<string, HttpParameter>;
|
43 | }
|
44 | /**
|
45 | * Authorization type for an API Destination Connection
|
46 | */
|
47 | export declare abstract class Authorization {
|
48 | /**
|
49 | * Use API key authorization
|
50 | *
|
51 | * API key authorization has two components: an API key name and an API key value.
|
52 | * What these are depends on the target of your connection.
|
53 | */
|
54 | static apiKey(apiKeyName: string, apiKeyValue: SecretValue): Authorization;
|
55 | /**
|
56 | * Use username and password authorization
|
57 | */
|
58 | static basic(username: string, password: SecretValue): Authorization;
|
59 | /**
|
60 | * Use OAuth authorization
|
61 | */
|
62 | static oauth(props: OAuthAuthorizationProps): Authorization;
|
63 | /**
|
64 | * Bind the authorization to the construct and return the authorization properties
|
65 | *
|
66 | * @internal
|
67 | */
|
68 | abstract _bind(): AuthorizationBindResult;
|
69 | }
|
70 | /**
|
71 | * Properties for `Authorization.oauth()`
|
72 | */
|
73 | export interface OAuthAuthorizationProps {
|
74 | /**
|
75 | * The URL to the authorization endpoint
|
76 | */
|
77 | readonly authorizationEndpoint: string;
|
78 | /**
|
79 | * The method to use for the authorization request.
|
80 | *
|
81 | * (Can only choose POST, GET or PUT).
|
82 | */
|
83 | readonly httpMethod: HttpMethod;
|
84 | /**
|
85 | * The client ID to use for OAuth authorization for the connection.
|
86 | */
|
87 | readonly clientId: string;
|
88 | /**
|
89 | * The client secret associated with the client ID to use for OAuth authorization for the connection.
|
90 | */
|
91 | readonly clientSecret: SecretValue;
|
92 | /**
|
93 | * Additional string parameters to add to the OAuth request body
|
94 | *
|
95 | * @default - No additional parameters
|
96 | */
|
97 | readonly bodyParameters?: Record<string, HttpParameter>;
|
98 | /**
|
99 | * Additional string parameters to add to the OAuth request header
|
100 | *
|
101 | * @default - No additional parameters
|
102 | */
|
103 | readonly headerParameters?: Record<string, HttpParameter>;
|
104 | /**
|
105 | * Additional string parameters to add to the OAuth request query string
|
106 | *
|
107 | * @default - No additional parameters
|
108 | */
|
109 | readonly queryStringParameters?: Record<string, HttpParameter>;
|
110 | }
|
111 | /**
|
112 | * An additional HTTP parameter to send along with the OAuth request
|
113 | */
|
114 | export declare abstract class HttpParameter {
|
115 | /**
|
116 | * Make an OAuthParameter from a string value
|
117 | *
|
118 | * The value is not treated as a secret.
|
119 | */
|
120 | static fromString(value: string): HttpParameter;
|
121 | /**
|
122 | * Make an OAuthParameter from a secret
|
123 | */
|
124 | static fromSecret(value: SecretValue): HttpParameter;
|
125 | /**
|
126 | * Render the paramter value
|
127 | *
|
128 | * @internal
|
129 | */
|
130 | abstract _render(name: string): any;
|
131 | }
|
132 | /**
|
133 | * Result of the 'bind' operation of the 'Authorization' class
|
134 | *
|
135 | * @internal
|
136 | */
|
137 | export interface AuthorizationBindResult {
|
138 | /**
|
139 | * The authorization type
|
140 | */
|
141 | readonly authorizationType: AuthorizationType;
|
142 | /**
|
143 | * The authorization parameters (depends on the type)
|
144 | */
|
145 | readonly authParameters: any;
|
146 | }
|
147 | /**
|
148 | * Interface for EventBus Connections
|
149 | */
|
150 | export interface IConnection extends IResource {
|
151 | /**
|
152 | * The Name for the connection.
|
153 | * @attribute
|
154 | */
|
155 | readonly connectionName: string;
|
156 | /**
|
157 | * The ARN of the connection created.
|
158 | * @attribute
|
159 | */
|
160 | readonly connectionArn: string;
|
161 | /**
|
162 | * The ARN for the secret created for the connection.
|
163 | * @attribute
|
164 | */
|
165 | readonly connectionSecretArn: string;
|
166 | }
|
167 | /**
|
168 | * Interface with properties necessary to import a reusable Connection
|
169 | */
|
170 | export interface ConnectionAttributes {
|
171 | /**
|
172 | * The Name for the connection.
|
173 | */
|
174 | readonly connectionName: string;
|
175 | /**
|
176 | * The ARN of the connection created.
|
177 | */
|
178 | readonly connectionArn: string;
|
179 | /**
|
180 | * The ARN for the secret created for the connection.
|
181 | */
|
182 | readonly connectionSecretArn: string;
|
183 | }
|
184 | /**
|
185 | * Define an EventBridge Connection
|
186 | *
|
187 | * @resource AWS::Events::Connection
|
188 | */
|
189 | export declare class Connection extends Resource implements IConnection {
|
190 | /**
|
191 | * Import an existing connection resource
|
192 | * @param scope Parent construct
|
193 | * @param id Construct ID
|
194 | * @param connectionArn ARN of imported connection
|
195 | */
|
196 | static fromEventBusArn(scope: Construct, id: string, connectionArn: string, connectionSecretArn: string): IConnection;
|
197 | /**
|
198 | * Import an existing connection resource
|
199 | * @param scope Parent construct
|
200 | * @param id Construct ID
|
201 | * @param attrs Imported connection properties
|
202 | */
|
203 | static fromConnectionAttributes(scope: Construct, id: string, attrs: ConnectionAttributes): IConnection;
|
204 | /**
|
205 | * The Name for the connection.
|
206 | * @attribute
|
207 | */
|
208 | readonly connectionName: string;
|
209 | /**
|
210 | * The ARN of the connection created.
|
211 | * @attribute
|
212 | */
|
213 | readonly connectionArn: string;
|
214 | /**
|
215 | * The ARN for the secret created for the connection.
|
216 | * @attribute
|
217 | */
|
218 | readonly connectionSecretArn: string;
|
219 | constructor(scope: Construct, id: string, props: ConnectionProps);
|
220 | }
|
221 | /**
|
222 | * Supported HTTP operations.
|
223 | */
|
224 | export declare enum HttpMethod {
|
225 | /** POST */
|
226 | POST = "POST",
|
227 | /** GET */
|
228 | GET = "GET",
|
229 | /** HEAD */
|
230 | HEAD = "HEAD",
|
231 | /** OPTIONS */
|
232 | OPTIONS = "OPTIONS",
|
233 | /** PUT */
|
234 | PUT = "PUT",
|
235 | /** PATCH */
|
236 | PATCH = "PATCH",
|
237 | /** DELETE */
|
238 | DELETE = "DELETE"
|
239 | }
|
240 | /**
|
241 | * Supported Authorization Types.
|
242 | */
|
243 | declare enum AuthorizationType {
|
244 | /** API_KEY */
|
245 | API_KEY = "API_KEY",
|
246 | /** BASIC */
|
247 | BASIC = "BASIC",
|
248 | /** OAUTH_CLIENT_CREDENTIALS */
|
249 | OAUTH_CLIENT_CREDENTIALS = "OAUTH_CLIENT_CREDENTIALS"
|
250 | }
|
251 | export {};
|