/
restApi.go
481 lines (417 loc) · 48.7 KB
/
restApi.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package apigateway
import (
"context"
"reflect"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an API Gateway REST API. The REST API can be configured via [importing an OpenAPI specification](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html) in the `body` argument (with other arguments serving as overrides) or via other provider resources to manage the resources (`apigateway.Resource` resource), methods (`apigateway.Method` resource), integrations (`apigateway.Integration` resource), etc. of the REST API. Once the REST API is configured, the `apigateway.Deployment` resource can be used along with the `apigateway.Stage` resource to publish the REST API.
//
// > **Note:** Amazon API Gateway Version 1 resources are used for creating and deploying REST APIs. To create and deploy WebSocket and HTTP APIs, use Amazon API Gateway Version 2 resources.
//
// !> **WARN:** When importing Open API Specifications with the `body` argument, by default the API Gateway REST API will be replaced with the Open API Specification thus removing any existing methods, resources, integrations, or endpoints. Endpoint mutations are asynchronous operations, and race conditions with DNS are possible. To overcome this limitation, use the `putRestApiMode` attribute and set it to `merge`.
//
// ## Example Usage
//
// ## Import
//
// Using `pulumi import`, import `aws_api_gateway_rest_api` using the REST API ID. For example:
//
// ```sh
// $ pulumi import aws:apigateway/restApi:RestApi example 12345abcde
// ```
// ~> __NOTE:__ Resource import does not currently support the `body` attribute.
type RestApi struct {
pulumi.CustomResourceState
// Source of the API key for requests. Valid values are `HEADER` (default) and `AUTHORIZER`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-api-key-source` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-api-key-source.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
ApiKeySource pulumi.StringOutput `pulumi:"apiKeySource"`
// ARN
Arn pulumi.StringOutput `pulumi:"arn"`
// List of binary media types supported by the REST API. By default, the REST API supports only UTF-8-encoded text payloads. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-binary-media-types` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-binary-media-types.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
BinaryMediaTypes pulumi.StringArrayOutput `pulumi:"binaryMediaTypes"`
// OpenAPI specification that defines the set of routes and integrations to create as part of the REST API. This configuration, and any updates to it, will replace all REST API configuration except values overridden in this resource configuration and other resource updates applied after this resource but before any `apigateway.Deployment` creation. More information about REST API OpenAPI support can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Body pulumi.StringPtrOutput `pulumi:"body"`
// Creation date of the REST API
CreatedDate pulumi.StringOutput `pulumi:"createdDate"`
// Description of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.description` field. If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Description pulumi.StringOutput `pulumi:"description"`
// Whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint. Defaults to `false`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-endpoint-configuration` extension `disableExecuteApiEndpoint` property](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-endpoint-configuration.html). If the argument value is `true` and is different than the OpenAPI value, the argument value will override the OpenAPI value.
DisableExecuteApiEndpoint pulumi.BoolOutput `pulumi:"disableExecuteApiEndpoint"`
// Configuration block defining API endpoint configuration including endpoint type. Defined below.
EndpointConfiguration RestApiEndpointConfigurationOutput `pulumi:"endpointConfiguration"`
// Execution ARN part to be used in `lambdaPermission`'s `sourceArn`
// when allowing API Gateway to invoke a Lambda function,
// e.g., `arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j`, which can be concatenated with allowed stage, method and resource path.
ExecutionArn pulumi.StringOutput `pulumi:"executionArn"`
// Whether warnings while API Gateway is creating or updating the resource should return an error or not. Defaults to `false`
FailOnWarnings pulumi.BoolPtrOutput `pulumi:"failOnWarnings"`
// Minimum response size to compress for the REST API. String containing an integer value between `-1` and `10485760` (10MB). `-1` will disable an existing compression configuration, and all other values will enable compression with the configured size. New resources can simply omit this argument to disable compression, rather than setting the value to `-1`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-minimum-compression-size` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-openapi-minimum-compression-size.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
MinimumCompressionSize pulumi.StringOutput `pulumi:"minimumCompressionSize"`
// Name of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.title` field. If the argument value is different than the OpenAPI value, the argument value will override the OpenAPI value.
Name pulumi.StringOutput `pulumi:"name"`
// Map of customizations for importing the specification in the `body` argument. For example, to exclude DocumentationParts from an imported API, set `ignore` equal to `documentation`. Additional documentation, including other parameters such as `basepath`, can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Parameters pulumi.StringMapOutput `pulumi:"parameters"`
// JSON formatted policy document that controls access to the API Gateway. For more information about building AWS IAM policy documents with Pulumi, see the AWS IAM Policy Document Guide. The provider will only perform drift detection of its value when present in a configuration. We recommend using the `apigateway.RestApiPolicy` resource instead. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-policy` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/openapi-extensions-policy.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Policy pulumi.StringOutput `pulumi:"policy"`
// Mode of the PutRestApi operation when importing an OpenAPI specification via the `body` argument (create or update operation). Valid values are `merge` and `overwrite`. If unspecificed, defaults to `overwrite` (for backwards compatibility). This corresponds to the [`x-amazon-apigateway-put-integration-method` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-put-integration-method.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
PutRestApiMode pulumi.StringPtrOutput `pulumi:"putRestApiMode"`
// Resource ID of the REST API's root
RootResourceId pulumi.StringOutput `pulumi:"rootResourceId"`
// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
}
// NewRestApi registers a new resource with the given unique name, arguments, and options.
func NewRestApi(ctx *pulumi.Context,
name string, args *RestApiArgs, opts ...pulumi.ResourceOption) (*RestApi, error) {
if args == nil {
args = &RestApiArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource RestApi
err := ctx.RegisterResource("aws:apigateway/restApi:RestApi", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetRestApi gets an existing RestApi resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetRestApi(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RestApiState, opts ...pulumi.ResourceOption) (*RestApi, error) {
var resource RestApi
err := ctx.ReadResource("aws:apigateway/restApi:RestApi", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering RestApi resources.
type restApiState struct {
// Source of the API key for requests. Valid values are `HEADER` (default) and `AUTHORIZER`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-api-key-source` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-api-key-source.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
ApiKeySource *string `pulumi:"apiKeySource"`
// ARN
Arn *string `pulumi:"arn"`
// List of binary media types supported by the REST API. By default, the REST API supports only UTF-8-encoded text payloads. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-binary-media-types` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-binary-media-types.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
BinaryMediaTypes []string `pulumi:"binaryMediaTypes"`
// OpenAPI specification that defines the set of routes and integrations to create as part of the REST API. This configuration, and any updates to it, will replace all REST API configuration except values overridden in this resource configuration and other resource updates applied after this resource but before any `apigateway.Deployment` creation. More information about REST API OpenAPI support can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Body *string `pulumi:"body"`
// Creation date of the REST API
CreatedDate *string `pulumi:"createdDate"`
// Description of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.description` field. If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Description *string `pulumi:"description"`
// Whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint. Defaults to `false`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-endpoint-configuration` extension `disableExecuteApiEndpoint` property](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-endpoint-configuration.html). If the argument value is `true` and is different than the OpenAPI value, the argument value will override the OpenAPI value.
DisableExecuteApiEndpoint *bool `pulumi:"disableExecuteApiEndpoint"`
// Configuration block defining API endpoint configuration including endpoint type. Defined below.
EndpointConfiguration *RestApiEndpointConfiguration `pulumi:"endpointConfiguration"`
// Execution ARN part to be used in `lambdaPermission`'s `sourceArn`
// when allowing API Gateway to invoke a Lambda function,
// e.g., `arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j`, which can be concatenated with allowed stage, method and resource path.
ExecutionArn *string `pulumi:"executionArn"`
// Whether warnings while API Gateway is creating or updating the resource should return an error or not. Defaults to `false`
FailOnWarnings *bool `pulumi:"failOnWarnings"`
// Minimum response size to compress for the REST API. String containing an integer value between `-1` and `10485760` (10MB). `-1` will disable an existing compression configuration, and all other values will enable compression with the configured size. New resources can simply omit this argument to disable compression, rather than setting the value to `-1`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-minimum-compression-size` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-openapi-minimum-compression-size.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
MinimumCompressionSize *string `pulumi:"minimumCompressionSize"`
// Name of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.title` field. If the argument value is different than the OpenAPI value, the argument value will override the OpenAPI value.
Name *string `pulumi:"name"`
// Map of customizations for importing the specification in the `body` argument. For example, to exclude DocumentationParts from an imported API, set `ignore` equal to `documentation`. Additional documentation, including other parameters such as `basepath`, can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Parameters map[string]string `pulumi:"parameters"`
// JSON formatted policy document that controls access to the API Gateway. For more information about building AWS IAM policy documents with Pulumi, see the AWS IAM Policy Document Guide. The provider will only perform drift detection of its value when present in a configuration. We recommend using the `apigateway.RestApiPolicy` resource instead. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-policy` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/openapi-extensions-policy.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Policy *string `pulumi:"policy"`
// Mode of the PutRestApi operation when importing an OpenAPI specification via the `body` argument (create or update operation). Valid values are `merge` and `overwrite`. If unspecificed, defaults to `overwrite` (for backwards compatibility). This corresponds to the [`x-amazon-apigateway-put-integration-method` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-put-integration-method.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
PutRestApiMode *string `pulumi:"putRestApiMode"`
// Resource ID of the REST API's root
RootResourceId *string `pulumi:"rootResourceId"`
// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll map[string]string `pulumi:"tagsAll"`
}
type RestApiState struct {
// Source of the API key for requests. Valid values are `HEADER` (default) and `AUTHORIZER`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-api-key-source` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-api-key-source.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
ApiKeySource pulumi.StringPtrInput
// ARN
Arn pulumi.StringPtrInput
// List of binary media types supported by the REST API. By default, the REST API supports only UTF-8-encoded text payloads. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-binary-media-types` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-binary-media-types.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
BinaryMediaTypes pulumi.StringArrayInput
// OpenAPI specification that defines the set of routes and integrations to create as part of the REST API. This configuration, and any updates to it, will replace all REST API configuration except values overridden in this resource configuration and other resource updates applied after this resource but before any `apigateway.Deployment` creation. More information about REST API OpenAPI support can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Body pulumi.StringPtrInput
// Creation date of the REST API
CreatedDate pulumi.StringPtrInput
// Description of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.description` field. If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Description pulumi.StringPtrInput
// Whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint. Defaults to `false`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-endpoint-configuration` extension `disableExecuteApiEndpoint` property](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-endpoint-configuration.html). If the argument value is `true` and is different than the OpenAPI value, the argument value will override the OpenAPI value.
DisableExecuteApiEndpoint pulumi.BoolPtrInput
// Configuration block defining API endpoint configuration including endpoint type. Defined below.
EndpointConfiguration RestApiEndpointConfigurationPtrInput
// Execution ARN part to be used in `lambdaPermission`'s `sourceArn`
// when allowing API Gateway to invoke a Lambda function,
// e.g., `arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j`, which can be concatenated with allowed stage, method and resource path.
ExecutionArn pulumi.StringPtrInput
// Whether warnings while API Gateway is creating or updating the resource should return an error or not. Defaults to `false`
FailOnWarnings pulumi.BoolPtrInput
// Minimum response size to compress for the REST API. String containing an integer value between `-1` and `10485760` (10MB). `-1` will disable an existing compression configuration, and all other values will enable compression with the configured size. New resources can simply omit this argument to disable compression, rather than setting the value to `-1`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-minimum-compression-size` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-openapi-minimum-compression-size.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
MinimumCompressionSize pulumi.StringPtrInput
// Name of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.title` field. If the argument value is different than the OpenAPI value, the argument value will override the OpenAPI value.
Name pulumi.StringPtrInput
// Map of customizations for importing the specification in the `body` argument. For example, to exclude DocumentationParts from an imported API, set `ignore` equal to `documentation`. Additional documentation, including other parameters such as `basepath`, can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Parameters pulumi.StringMapInput
// JSON formatted policy document that controls access to the API Gateway. For more information about building AWS IAM policy documents with Pulumi, see the AWS IAM Policy Document Guide. The provider will only perform drift detection of its value when present in a configuration. We recommend using the `apigateway.RestApiPolicy` resource instead. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-policy` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/openapi-extensions-policy.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Policy pulumi.StringPtrInput
// Mode of the PutRestApi operation when importing an OpenAPI specification via the `body` argument (create or update operation). Valid values are `merge` and `overwrite`. If unspecificed, defaults to `overwrite` (for backwards compatibility). This corresponds to the [`x-amazon-apigateway-put-integration-method` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-put-integration-method.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
PutRestApiMode pulumi.StringPtrInput
// Resource ID of the REST API's root
RootResourceId pulumi.StringPtrInput
// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
TagsAll pulumi.StringMapInput
}
func (RestApiState) ElementType() reflect.Type {
return reflect.TypeOf((*restApiState)(nil)).Elem()
}
type restApiArgs struct {
// Source of the API key for requests. Valid values are `HEADER` (default) and `AUTHORIZER`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-api-key-source` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-api-key-source.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
ApiKeySource *string `pulumi:"apiKeySource"`
// List of binary media types supported by the REST API. By default, the REST API supports only UTF-8-encoded text payloads. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-binary-media-types` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-binary-media-types.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
BinaryMediaTypes []string `pulumi:"binaryMediaTypes"`
// OpenAPI specification that defines the set of routes and integrations to create as part of the REST API. This configuration, and any updates to it, will replace all REST API configuration except values overridden in this resource configuration and other resource updates applied after this resource but before any `apigateway.Deployment` creation. More information about REST API OpenAPI support can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Body *string `pulumi:"body"`
// Description of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.description` field. If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Description *string `pulumi:"description"`
// Whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint. Defaults to `false`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-endpoint-configuration` extension `disableExecuteApiEndpoint` property](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-endpoint-configuration.html). If the argument value is `true` and is different than the OpenAPI value, the argument value will override the OpenAPI value.
DisableExecuteApiEndpoint *bool `pulumi:"disableExecuteApiEndpoint"`
// Configuration block defining API endpoint configuration including endpoint type. Defined below.
EndpointConfiguration *RestApiEndpointConfiguration `pulumi:"endpointConfiguration"`
// Whether warnings while API Gateway is creating or updating the resource should return an error or not. Defaults to `false`
FailOnWarnings *bool `pulumi:"failOnWarnings"`
// Minimum response size to compress for the REST API. String containing an integer value between `-1` and `10485760` (10MB). `-1` will disable an existing compression configuration, and all other values will enable compression with the configured size. New resources can simply omit this argument to disable compression, rather than setting the value to `-1`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-minimum-compression-size` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-openapi-minimum-compression-size.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
MinimumCompressionSize *string `pulumi:"minimumCompressionSize"`
// Name of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.title` field. If the argument value is different than the OpenAPI value, the argument value will override the OpenAPI value.
Name *string `pulumi:"name"`
// Map of customizations for importing the specification in the `body` argument. For example, to exclude DocumentationParts from an imported API, set `ignore` equal to `documentation`. Additional documentation, including other parameters such as `basepath`, can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Parameters map[string]string `pulumi:"parameters"`
// JSON formatted policy document that controls access to the API Gateway. For more information about building AWS IAM policy documents with Pulumi, see the AWS IAM Policy Document Guide. The provider will only perform drift detection of its value when present in a configuration. We recommend using the `apigateway.RestApiPolicy` resource instead. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-policy` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/openapi-extensions-policy.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Policy *string `pulumi:"policy"`
// Mode of the PutRestApi operation when importing an OpenAPI specification via the `body` argument (create or update operation). Valid values are `merge` and `overwrite`. If unspecificed, defaults to `overwrite` (for backwards compatibility). This corresponds to the [`x-amazon-apigateway-put-integration-method` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-put-integration-method.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
PutRestApiMode *string `pulumi:"putRestApiMode"`
// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a RestApi resource.
type RestApiArgs struct {
// Source of the API key for requests. Valid values are `HEADER` (default) and `AUTHORIZER`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-api-key-source` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-api-key-source.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
ApiKeySource pulumi.StringPtrInput
// List of binary media types supported by the REST API. By default, the REST API supports only UTF-8-encoded text payloads. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-binary-media-types` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-binary-media-types.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
BinaryMediaTypes pulumi.StringArrayInput
// OpenAPI specification that defines the set of routes and integrations to create as part of the REST API. This configuration, and any updates to it, will replace all REST API configuration except values overridden in this resource configuration and other resource updates applied after this resource but before any `apigateway.Deployment` creation. More information about REST API OpenAPI support can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Body pulumi.StringPtrInput
// Description of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.description` field. If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Description pulumi.StringPtrInput
// Whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint. Defaults to `false`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-endpoint-configuration` extension `disableExecuteApiEndpoint` property](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-endpoint-configuration.html). If the argument value is `true` and is different than the OpenAPI value, the argument value will override the OpenAPI value.
DisableExecuteApiEndpoint pulumi.BoolPtrInput
// Configuration block defining API endpoint configuration including endpoint type. Defined below.
EndpointConfiguration RestApiEndpointConfigurationPtrInput
// Whether warnings while API Gateway is creating or updating the resource should return an error or not. Defaults to `false`
FailOnWarnings pulumi.BoolPtrInput
// Minimum response size to compress for the REST API. String containing an integer value between `-1` and `10485760` (10MB). `-1` will disable an existing compression configuration, and all other values will enable compression with the configured size. New resources can simply omit this argument to disable compression, rather than setting the value to `-1`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-minimum-compression-size` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-openapi-minimum-compression-size.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
MinimumCompressionSize pulumi.StringPtrInput
// Name of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.title` field. If the argument value is different than the OpenAPI value, the argument value will override the OpenAPI value.
Name pulumi.StringPtrInput
// Map of customizations for importing the specification in the `body` argument. For example, to exclude DocumentationParts from an imported API, set `ignore` equal to `documentation`. Additional documentation, including other parameters such as `basepath`, can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
Parameters pulumi.StringMapInput
// JSON formatted policy document that controls access to the API Gateway. For more information about building AWS IAM policy documents with Pulumi, see the AWS IAM Policy Document Guide. The provider will only perform drift detection of its value when present in a configuration. We recommend using the `apigateway.RestApiPolicy` resource instead. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-policy` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/openapi-extensions-policy.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
Policy pulumi.StringPtrInput
// Mode of the PutRestApi operation when importing an OpenAPI specification via the `body` argument (create or update operation). Valid values are `merge` and `overwrite`. If unspecificed, defaults to `overwrite` (for backwards compatibility). This corresponds to the [`x-amazon-apigateway-put-integration-method` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-put-integration-method.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
PutRestApiMode pulumi.StringPtrInput
// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
}
func (RestApiArgs) ElementType() reflect.Type {
return reflect.TypeOf((*restApiArgs)(nil)).Elem()
}
type RestApiInput interface {
pulumi.Input
ToRestApiOutput() RestApiOutput
ToRestApiOutputWithContext(ctx context.Context) RestApiOutput
}
func (*RestApi) ElementType() reflect.Type {
return reflect.TypeOf((**RestApi)(nil)).Elem()
}
func (i *RestApi) ToRestApiOutput() RestApiOutput {
return i.ToRestApiOutputWithContext(context.Background())
}
func (i *RestApi) ToRestApiOutputWithContext(ctx context.Context) RestApiOutput {
return pulumi.ToOutputWithContext(ctx, i).(RestApiOutput)
}
// RestApiArrayInput is an input type that accepts RestApiArray and RestApiArrayOutput values.
// You can construct a concrete instance of `RestApiArrayInput` via:
//
// RestApiArray{ RestApiArgs{...} }
type RestApiArrayInput interface {
pulumi.Input
ToRestApiArrayOutput() RestApiArrayOutput
ToRestApiArrayOutputWithContext(context.Context) RestApiArrayOutput
}
type RestApiArray []RestApiInput
func (RestApiArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*RestApi)(nil)).Elem()
}
func (i RestApiArray) ToRestApiArrayOutput() RestApiArrayOutput {
return i.ToRestApiArrayOutputWithContext(context.Background())
}
func (i RestApiArray) ToRestApiArrayOutputWithContext(ctx context.Context) RestApiArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(RestApiArrayOutput)
}
// RestApiMapInput is an input type that accepts RestApiMap and RestApiMapOutput values.
// You can construct a concrete instance of `RestApiMapInput` via:
//
// RestApiMap{ "key": RestApiArgs{...} }
type RestApiMapInput interface {
pulumi.Input
ToRestApiMapOutput() RestApiMapOutput
ToRestApiMapOutputWithContext(context.Context) RestApiMapOutput
}
type RestApiMap map[string]RestApiInput
func (RestApiMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*RestApi)(nil)).Elem()
}
func (i RestApiMap) ToRestApiMapOutput() RestApiMapOutput {
return i.ToRestApiMapOutputWithContext(context.Background())
}
func (i RestApiMap) ToRestApiMapOutputWithContext(ctx context.Context) RestApiMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(RestApiMapOutput)
}
type RestApiOutput struct{ *pulumi.OutputState }
func (RestApiOutput) ElementType() reflect.Type {
return reflect.TypeOf((**RestApi)(nil)).Elem()
}
func (o RestApiOutput) ToRestApiOutput() RestApiOutput {
return o
}
func (o RestApiOutput) ToRestApiOutputWithContext(ctx context.Context) RestApiOutput {
return o
}
// Source of the API key for requests. Valid values are `HEADER` (default) and `AUTHORIZER`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-api-key-source` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-api-key-source.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
func (o RestApiOutput) ApiKeySource() pulumi.StringOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringOutput { return v.ApiKeySource }).(pulumi.StringOutput)
}
// ARN
func (o RestApiOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// List of binary media types supported by the REST API. By default, the REST API supports only UTF-8-encoded text payloads. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-binary-media-types` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-binary-media-types.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
func (o RestApiOutput) BinaryMediaTypes() pulumi.StringArrayOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringArrayOutput { return v.BinaryMediaTypes }).(pulumi.StringArrayOutput)
}
// OpenAPI specification that defines the set of routes and integrations to create as part of the REST API. This configuration, and any updates to it, will replace all REST API configuration except values overridden in this resource configuration and other resource updates applied after this resource but before any `apigateway.Deployment` creation. More information about REST API OpenAPI support can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
func (o RestApiOutput) Body() pulumi.StringPtrOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringPtrOutput { return v.Body }).(pulumi.StringPtrOutput)
}
// Creation date of the REST API
func (o RestApiOutput) CreatedDate() pulumi.StringOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringOutput { return v.CreatedDate }).(pulumi.StringOutput)
}
// Description of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.description` field. If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
func (o RestApiOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// Whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https://{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint. Defaults to `false`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-endpoint-configuration` extension `disableExecuteApiEndpoint` property](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-endpoint-configuration.html). If the argument value is `true` and is different than the OpenAPI value, the argument value will override the OpenAPI value.
func (o RestApiOutput) DisableExecuteApiEndpoint() pulumi.BoolOutput {
return o.ApplyT(func(v *RestApi) pulumi.BoolOutput { return v.DisableExecuteApiEndpoint }).(pulumi.BoolOutput)
}
// Configuration block defining API endpoint configuration including endpoint type. Defined below.
func (o RestApiOutput) EndpointConfiguration() RestApiEndpointConfigurationOutput {
return o.ApplyT(func(v *RestApi) RestApiEndpointConfigurationOutput { return v.EndpointConfiguration }).(RestApiEndpointConfigurationOutput)
}
// Execution ARN part to be used in `lambdaPermission`'s `sourceArn`
// when allowing API Gateway to invoke a Lambda function,
// e.g., `arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j`, which can be concatenated with allowed stage, method and resource path.
func (o RestApiOutput) ExecutionArn() pulumi.StringOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringOutput { return v.ExecutionArn }).(pulumi.StringOutput)
}
// Whether warnings while API Gateway is creating or updating the resource should return an error or not. Defaults to `false`
func (o RestApiOutput) FailOnWarnings() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *RestApi) pulumi.BoolPtrOutput { return v.FailOnWarnings }).(pulumi.BoolPtrOutput)
}
// Minimum response size to compress for the REST API. String containing an integer value between `-1` and `10485760` (10MB). `-1` will disable an existing compression configuration, and all other values will enable compression with the configured size. New resources can simply omit this argument to disable compression, rather than setting the value to `-1`. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-minimum-compression-size` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-openapi-minimum-compression-size.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
func (o RestApiOutput) MinimumCompressionSize() pulumi.StringOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringOutput { return v.MinimumCompressionSize }).(pulumi.StringOutput)
}
// Name of the REST API. If importing an OpenAPI specification via the `body` argument, this corresponds to the `info.title` field. If the argument value is different than the OpenAPI value, the argument value will override the OpenAPI value.
func (o RestApiOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Map of customizations for importing the specification in the `body` argument. For example, to exclude DocumentationParts from an imported API, set `ignore` equal to `documentation`. Additional documentation, including other parameters such as `basepath`, can be found in the [API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html).
func (o RestApiOutput) Parameters() pulumi.StringMapOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringMapOutput { return v.Parameters }).(pulumi.StringMapOutput)
}
// JSON formatted policy document that controls access to the API Gateway. For more information about building AWS IAM policy documents with Pulumi, see the AWS IAM Policy Document Guide. The provider will only perform drift detection of its value when present in a configuration. We recommend using the `apigateway.RestApiPolicy` resource instead. If importing an OpenAPI specification via the `body` argument, this corresponds to the [`x-amazon-apigateway-policy` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/openapi-extensions-policy.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
func (o RestApiOutput) Policy() pulumi.StringOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringOutput { return v.Policy }).(pulumi.StringOutput)
}
// Mode of the PutRestApi operation when importing an OpenAPI specification via the `body` argument (create or update operation). Valid values are `merge` and `overwrite`. If unspecificed, defaults to `overwrite` (for backwards compatibility). This corresponds to the [`x-amazon-apigateway-put-integration-method` extension](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-put-integration-method.html). If the argument value is provided and is different than the OpenAPI value, the argument value will override the OpenAPI value.
func (o RestApiOutput) PutRestApiMode() pulumi.StringPtrOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringPtrOutput { return v.PutRestApiMode }).(pulumi.StringPtrOutput)
}
// Resource ID of the REST API's root
func (o RestApiOutput) RootResourceId() pulumi.StringOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringOutput { return v.RootResourceId }).(pulumi.StringOutput)
}
// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
func (o RestApiOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
//
// Deprecated: Please use `tags` instead.
func (o RestApiOutput) TagsAll() pulumi.StringMapOutput {
return o.ApplyT(func(v *RestApi) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
}
type RestApiArrayOutput struct{ *pulumi.OutputState }
func (RestApiArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*RestApi)(nil)).Elem()
}
func (o RestApiArrayOutput) ToRestApiArrayOutput() RestApiArrayOutput {
return o
}
func (o RestApiArrayOutput) ToRestApiArrayOutputWithContext(ctx context.Context) RestApiArrayOutput {
return o
}
func (o RestApiArrayOutput) Index(i pulumi.IntInput) RestApiOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *RestApi {
return vs[0].([]*RestApi)[vs[1].(int)]
}).(RestApiOutput)
}
type RestApiMapOutput struct{ *pulumi.OutputState }
func (RestApiMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*RestApi)(nil)).Elem()
}
func (o RestApiMapOutput) ToRestApiMapOutput() RestApiMapOutput {
return o
}
func (o RestApiMapOutput) ToRestApiMapOutputWithContext(ctx context.Context) RestApiMapOutput {
return o
}
func (o RestApiMapOutput) MapIndex(k pulumi.StringInput) RestApiOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *RestApi {
return vs[0].(map[string]*RestApi)[vs[1].(string)]
}).(RestApiOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*RestApiInput)(nil)).Elem(), &RestApi{})
pulumi.RegisterInputType(reflect.TypeOf((*RestApiArrayInput)(nil)).Elem(), RestApiArray{})
pulumi.RegisterInputType(reflect.TypeOf((*RestApiMapInput)(nil)).Elem(), RestApiMap{})
pulumi.RegisterOutputType(RestApiOutput{})
pulumi.RegisterOutputType(RestApiArrayOutput{})
pulumi.RegisterOutputType(RestApiMapOutput{})
}