/
stage.go
388 lines (342 loc) · 17.6 KB
/
stage.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
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package apigatewayv2
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an Amazon API Gateway Version 2 stage.
// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api.html).
//
// ## Example Usage
// ### Basic
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/apigatewayv2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := apigatewayv2.NewStage(ctx, "example", &apigatewayv2.StageArgs{
// ApiId: pulumi.Any(aws_apigatewayv2_api.Example.Id),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// `aws_apigatewayv2_stage` can be imported by using the API identifier and stage name, e.g.,
//
// ```sh
// $ pulumi import aws:apigatewayv2/stage:Stage example aabbccddee/example-stage
// ```
type Stage struct {
pulumi.CustomResourceState
// Settings for logging access in this stage.
// Use the `apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions).
AccessLogSettings StageAccessLogSettingsPtrOutput `pulumi:"accessLogSettings"`
// The API identifier.
ApiId pulumi.StringOutput `pulumi:"apiId"`
// The ARN of the stage.
Arn pulumi.StringOutput `pulumi:"arn"`
// Whether updates to an API automatically trigger a new deployment. Defaults to `false`.
AutoDeploy pulumi.BoolPtrOutput `pulumi:"autoDeploy"`
// The identifier of a client certificate for the stage. Use the `apigateway.ClientCertificate` resource to configure a client certificate.
// Supported only for WebSocket APIs.
ClientCertificateId pulumi.StringPtrOutput `pulumi:"clientCertificateId"`
// The default route settings for the stage.
DefaultRouteSettings StageDefaultRouteSettingsPtrOutput `pulumi:"defaultRouteSettings"`
// The deployment identifier of the stage. Use the `apigatewayv2.Deployment` resource to configure a deployment.
DeploymentId pulumi.StringOutput `pulumi:"deploymentId"`
// The description for the stage. Must be less than or equal to 1024 characters in length.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The ARN prefix to be used in an `lambda.Permission` `sourceArn` attribute.
// For WebSocket APIs this attribute can additionally be used in an `iam.Policy` to authorize access to the [`@connections` API](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html).
// See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-control-access-iam.html) for details.
ExecutionArn pulumi.StringOutput `pulumi:"executionArn"`
// The URL to invoke the API pointing to the stage,
// e.g., `wss://z4675bid1j.execute-api.eu-west-2.amazonaws.com/example-stage`, or `https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/`
InvokeUrl pulumi.StringOutput `pulumi:"invokeUrl"`
// The name of the stage. Must be between 1 and 128 characters in length.
Name pulumi.StringOutput `pulumi:"name"`
// Route settings for the stage.
RouteSettings StageRouteSettingArrayOutput `pulumi:"routeSettings"`
// A map that defines the stage variables for the stage.
StageVariables pulumi.StringMapOutput `pulumi:"stageVariables"`
// A map of tags to assign to the stage. .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"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
}
// NewStage registers a new resource with the given unique name, arguments, and options.
func NewStage(ctx *pulumi.Context,
name string, args *StageArgs, opts ...pulumi.ResourceOption) (*Stage, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApiId == nil {
return nil, errors.New("invalid value for required argument 'ApiId'")
}
var resource Stage
err := ctx.RegisterResource("aws:apigatewayv2/stage:Stage", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetStage gets an existing Stage 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 GetStage(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *StageState, opts ...pulumi.ResourceOption) (*Stage, error) {
var resource Stage
err := ctx.ReadResource("aws:apigatewayv2/stage:Stage", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Stage resources.
type stageState struct {
// Settings for logging access in this stage.
// Use the `apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions).
AccessLogSettings *StageAccessLogSettings `pulumi:"accessLogSettings"`
// The API identifier.
ApiId *string `pulumi:"apiId"`
// The ARN of the stage.
Arn *string `pulumi:"arn"`
// Whether updates to an API automatically trigger a new deployment. Defaults to `false`.
AutoDeploy *bool `pulumi:"autoDeploy"`
// The identifier of a client certificate for the stage. Use the `apigateway.ClientCertificate` resource to configure a client certificate.
// Supported only for WebSocket APIs.
ClientCertificateId *string `pulumi:"clientCertificateId"`
// The default route settings for the stage.
DefaultRouteSettings *StageDefaultRouteSettings `pulumi:"defaultRouteSettings"`
// The deployment identifier of the stage. Use the `apigatewayv2.Deployment` resource to configure a deployment.
DeploymentId *string `pulumi:"deploymentId"`
// The description for the stage. Must be less than or equal to 1024 characters in length.
Description *string `pulumi:"description"`
// The ARN prefix to be used in an `lambda.Permission` `sourceArn` attribute.
// For WebSocket APIs this attribute can additionally be used in an `iam.Policy` to authorize access to the [`@connections` API](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html).
// See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-control-access-iam.html) for details.
ExecutionArn *string `pulumi:"executionArn"`
// The URL to invoke the API pointing to the stage,
// e.g., `wss://z4675bid1j.execute-api.eu-west-2.amazonaws.com/example-stage`, or `https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/`
InvokeUrl *string `pulumi:"invokeUrl"`
// The name of the stage. Must be between 1 and 128 characters in length.
Name *string `pulumi:"name"`
// Route settings for the stage.
RouteSettings []StageRouteSetting `pulumi:"routeSettings"`
// A map that defines the stage variables for the stage.
StageVariables map[string]string `pulumi:"stageVariables"`
// A map of tags to assign to the stage. .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"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll map[string]string `pulumi:"tagsAll"`
}
type StageState struct {
// Settings for logging access in this stage.
// Use the `apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions).
AccessLogSettings StageAccessLogSettingsPtrInput
// The API identifier.
ApiId pulumi.StringPtrInput
// The ARN of the stage.
Arn pulumi.StringPtrInput
// Whether updates to an API automatically trigger a new deployment. Defaults to `false`.
AutoDeploy pulumi.BoolPtrInput
// The identifier of a client certificate for the stage. Use the `apigateway.ClientCertificate` resource to configure a client certificate.
// Supported only for WebSocket APIs.
ClientCertificateId pulumi.StringPtrInput
// The default route settings for the stage.
DefaultRouteSettings StageDefaultRouteSettingsPtrInput
// The deployment identifier of the stage. Use the `apigatewayv2.Deployment` resource to configure a deployment.
DeploymentId pulumi.StringPtrInput
// The description for the stage. Must be less than or equal to 1024 characters in length.
Description pulumi.StringPtrInput
// The ARN prefix to be used in an `lambda.Permission` `sourceArn` attribute.
// For WebSocket APIs this attribute can additionally be used in an `iam.Policy` to authorize access to the [`@connections` API](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html).
// See the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-control-access-iam.html) for details.
ExecutionArn pulumi.StringPtrInput
// The URL to invoke the API pointing to the stage,
// e.g., `wss://z4675bid1j.execute-api.eu-west-2.amazonaws.com/example-stage`, or `https://z4675bid1j.execute-api.eu-west-2.amazonaws.com/`
InvokeUrl pulumi.StringPtrInput
// The name of the stage. Must be between 1 and 128 characters in length.
Name pulumi.StringPtrInput
// Route settings for the stage.
RouteSettings StageRouteSettingArrayInput
// A map that defines the stage variables for the stage.
StageVariables pulumi.StringMapInput
// A map of tags to assign to the stage. .If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll pulumi.StringMapInput
}
func (StageState) ElementType() reflect.Type {
return reflect.TypeOf((*stageState)(nil)).Elem()
}
type stageArgs struct {
// Settings for logging access in this stage.
// Use the `apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions).
AccessLogSettings *StageAccessLogSettings `pulumi:"accessLogSettings"`
// The API identifier.
ApiId string `pulumi:"apiId"`
// Whether updates to an API automatically trigger a new deployment. Defaults to `false`.
AutoDeploy *bool `pulumi:"autoDeploy"`
// The identifier of a client certificate for the stage. Use the `apigateway.ClientCertificate` resource to configure a client certificate.
// Supported only for WebSocket APIs.
ClientCertificateId *string `pulumi:"clientCertificateId"`
// The default route settings for the stage.
DefaultRouteSettings *StageDefaultRouteSettings `pulumi:"defaultRouteSettings"`
// The deployment identifier of the stage. Use the `apigatewayv2.Deployment` resource to configure a deployment.
DeploymentId *string `pulumi:"deploymentId"`
// The description for the stage. Must be less than or equal to 1024 characters in length.
Description *string `pulumi:"description"`
// The name of the stage. Must be between 1 and 128 characters in length.
Name *string `pulumi:"name"`
// Route settings for the stage.
RouteSettings []StageRouteSetting `pulumi:"routeSettings"`
// A map that defines the stage variables for the stage.
StageVariables map[string]string `pulumi:"stageVariables"`
// A map of tags to assign to the stage. .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 Stage resource.
type StageArgs struct {
// Settings for logging access in this stage.
// Use the `apigateway.Account` resource to configure [permissions for CloudWatch Logging](https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-logging.html#set-up-access-logging-permissions).
AccessLogSettings StageAccessLogSettingsPtrInput
// The API identifier.
ApiId pulumi.StringInput
// Whether updates to an API automatically trigger a new deployment. Defaults to `false`.
AutoDeploy pulumi.BoolPtrInput
// The identifier of a client certificate for the stage. Use the `apigateway.ClientCertificate` resource to configure a client certificate.
// Supported only for WebSocket APIs.
ClientCertificateId pulumi.StringPtrInput
// The default route settings for the stage.
DefaultRouteSettings StageDefaultRouteSettingsPtrInput
// The deployment identifier of the stage. Use the `apigatewayv2.Deployment` resource to configure a deployment.
DeploymentId pulumi.StringPtrInput
// The description for the stage. Must be less than or equal to 1024 characters in length.
Description pulumi.StringPtrInput
// The name of the stage. Must be between 1 and 128 characters in length.
Name pulumi.StringPtrInput
// Route settings for the stage.
RouteSettings StageRouteSettingArrayInput
// A map that defines the stage variables for the stage.
StageVariables pulumi.StringMapInput
// A map of tags to assign to the stage. .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 (StageArgs) ElementType() reflect.Type {
return reflect.TypeOf((*stageArgs)(nil)).Elem()
}
type StageInput interface {
pulumi.Input
ToStageOutput() StageOutput
ToStageOutputWithContext(ctx context.Context) StageOutput
}
func (*Stage) ElementType() reflect.Type {
return reflect.TypeOf((**Stage)(nil)).Elem()
}
func (i *Stage) ToStageOutput() StageOutput {
return i.ToStageOutputWithContext(context.Background())
}
func (i *Stage) ToStageOutputWithContext(ctx context.Context) StageOutput {
return pulumi.ToOutputWithContext(ctx, i).(StageOutput)
}
// StageArrayInput is an input type that accepts StageArray and StageArrayOutput values.
// You can construct a concrete instance of `StageArrayInput` via:
//
// StageArray{ StageArgs{...} }
type StageArrayInput interface {
pulumi.Input
ToStageArrayOutput() StageArrayOutput
ToStageArrayOutputWithContext(context.Context) StageArrayOutput
}
type StageArray []StageInput
func (StageArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Stage)(nil)).Elem()
}
func (i StageArray) ToStageArrayOutput() StageArrayOutput {
return i.ToStageArrayOutputWithContext(context.Background())
}
func (i StageArray) ToStageArrayOutputWithContext(ctx context.Context) StageArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(StageArrayOutput)
}
// StageMapInput is an input type that accepts StageMap and StageMapOutput values.
// You can construct a concrete instance of `StageMapInput` via:
//
// StageMap{ "key": StageArgs{...} }
type StageMapInput interface {
pulumi.Input
ToStageMapOutput() StageMapOutput
ToStageMapOutputWithContext(context.Context) StageMapOutput
}
type StageMap map[string]StageInput
func (StageMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Stage)(nil)).Elem()
}
func (i StageMap) ToStageMapOutput() StageMapOutput {
return i.ToStageMapOutputWithContext(context.Background())
}
func (i StageMap) ToStageMapOutputWithContext(ctx context.Context) StageMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(StageMapOutput)
}
type StageOutput struct{ *pulumi.OutputState }
func (StageOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Stage)(nil)).Elem()
}
func (o StageOutput) ToStageOutput() StageOutput {
return o
}
func (o StageOutput) ToStageOutputWithContext(ctx context.Context) StageOutput {
return o
}
type StageArrayOutput struct{ *pulumi.OutputState }
func (StageArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Stage)(nil)).Elem()
}
func (o StageArrayOutput) ToStageArrayOutput() StageArrayOutput {
return o
}
func (o StageArrayOutput) ToStageArrayOutputWithContext(ctx context.Context) StageArrayOutput {
return o
}
func (o StageArrayOutput) Index(i pulumi.IntInput) StageOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Stage {
return vs[0].([]*Stage)[vs[1].(int)]
}).(StageOutput)
}
type StageMapOutput struct{ *pulumi.OutputState }
func (StageMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Stage)(nil)).Elem()
}
func (o StageMapOutput) ToStageMapOutput() StageMapOutput {
return o
}
func (o StageMapOutput) ToStageMapOutputWithContext(ctx context.Context) StageMapOutput {
return o
}
func (o StageMapOutput) MapIndex(k pulumi.StringInput) StageOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Stage {
return vs[0].(map[string]*Stage)[vs[1].(string)]
}).(StageOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*StageInput)(nil)).Elem(), &Stage{})
pulumi.RegisterInputType(reflect.TypeOf((*StageArrayInput)(nil)).Elem(), StageArray{})
pulumi.RegisterInputType(reflect.TypeOf((*StageMapInput)(nil)).Elem(), StageMap{})
pulumi.RegisterOutputType(StageOutput{})
pulumi.RegisterOutputType(StageArrayOutput{})
pulumi.RegisterOutputType(StageMapOutput{})
}