/
apiMapping.go
311 lines (261 loc) · 12 KB
/
apiMapping.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
// 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 apigatewayv2
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an Amazon API Gateway Version 2 API mapping.
// More information can be found in the [Amazon API Gateway Developer Guide](https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html).
//
// ## Example Usage
//
// ### Basic
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{
// ApiId: pulumi.Any(exampleAwsApigatewayv2Api.Id),
// DomainName: pulumi.Any(exampleAwsApigatewayv2DomainName.Id),
// Stage: pulumi.Any(exampleAwsApigatewayv2Stage.Id),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example:
//
// ```sh
// $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com
// ```
type ApiMapping struct {
pulumi.CustomResourceState
// API identifier.
ApiId pulumi.StringOutput `pulumi:"apiId"`
// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html).
ApiMappingKey pulumi.StringPtrOutput `pulumi:"apiMappingKey"`
// Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name.
DomainName pulumi.StringOutput `pulumi:"domainName"`
// API stage. Use the `apigatewayv2.Stage` resource to configure an API stage.
Stage pulumi.StringOutput `pulumi:"stage"`
}
// NewApiMapping registers a new resource with the given unique name, arguments, and options.
func NewApiMapping(ctx *pulumi.Context,
name string, args *ApiMappingArgs, opts ...pulumi.ResourceOption) (*ApiMapping, 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'")
}
if args.DomainName == nil {
return nil, errors.New("invalid value for required argument 'DomainName'")
}
if args.Stage == nil {
return nil, errors.New("invalid value for required argument 'Stage'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource ApiMapping
err := ctx.RegisterResource("aws:apigatewayv2/apiMapping:ApiMapping", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetApiMapping gets an existing ApiMapping 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 GetApiMapping(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ApiMappingState, opts ...pulumi.ResourceOption) (*ApiMapping, error) {
var resource ApiMapping
err := ctx.ReadResource("aws:apigatewayv2/apiMapping:ApiMapping", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ApiMapping resources.
type apiMappingState struct {
// API identifier.
ApiId *string `pulumi:"apiId"`
// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html).
ApiMappingKey *string `pulumi:"apiMappingKey"`
// Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name.
DomainName *string `pulumi:"domainName"`
// API stage. Use the `apigatewayv2.Stage` resource to configure an API stage.
Stage *string `pulumi:"stage"`
}
type ApiMappingState struct {
// API identifier.
ApiId pulumi.StringPtrInput
// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html).
ApiMappingKey pulumi.StringPtrInput
// Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name.
DomainName pulumi.StringPtrInput
// API stage. Use the `apigatewayv2.Stage` resource to configure an API stage.
Stage pulumi.StringPtrInput
}
func (ApiMappingState) ElementType() reflect.Type {
return reflect.TypeOf((*apiMappingState)(nil)).Elem()
}
type apiMappingArgs struct {
// API identifier.
ApiId string `pulumi:"apiId"`
// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html).
ApiMappingKey *string `pulumi:"apiMappingKey"`
// Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name.
DomainName string `pulumi:"domainName"`
// API stage. Use the `apigatewayv2.Stage` resource to configure an API stage.
Stage string `pulumi:"stage"`
}
// The set of arguments for constructing a ApiMapping resource.
type ApiMappingArgs struct {
// API identifier.
ApiId pulumi.StringInput
// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html).
ApiMappingKey pulumi.StringPtrInput
// Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name.
DomainName pulumi.StringInput
// API stage. Use the `apigatewayv2.Stage` resource to configure an API stage.
Stage pulumi.StringInput
}
func (ApiMappingArgs) ElementType() reflect.Type {
return reflect.TypeOf((*apiMappingArgs)(nil)).Elem()
}
type ApiMappingInput interface {
pulumi.Input
ToApiMappingOutput() ApiMappingOutput
ToApiMappingOutputWithContext(ctx context.Context) ApiMappingOutput
}
func (*ApiMapping) ElementType() reflect.Type {
return reflect.TypeOf((**ApiMapping)(nil)).Elem()
}
func (i *ApiMapping) ToApiMappingOutput() ApiMappingOutput {
return i.ToApiMappingOutputWithContext(context.Background())
}
func (i *ApiMapping) ToApiMappingOutputWithContext(ctx context.Context) ApiMappingOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiMappingOutput)
}
// ApiMappingArrayInput is an input type that accepts ApiMappingArray and ApiMappingArrayOutput values.
// You can construct a concrete instance of `ApiMappingArrayInput` via:
//
// ApiMappingArray{ ApiMappingArgs{...} }
type ApiMappingArrayInput interface {
pulumi.Input
ToApiMappingArrayOutput() ApiMappingArrayOutput
ToApiMappingArrayOutputWithContext(context.Context) ApiMappingArrayOutput
}
type ApiMappingArray []ApiMappingInput
func (ApiMappingArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ApiMapping)(nil)).Elem()
}
func (i ApiMappingArray) ToApiMappingArrayOutput() ApiMappingArrayOutput {
return i.ToApiMappingArrayOutputWithContext(context.Background())
}
func (i ApiMappingArray) ToApiMappingArrayOutputWithContext(ctx context.Context) ApiMappingArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiMappingArrayOutput)
}
// ApiMappingMapInput is an input type that accepts ApiMappingMap and ApiMappingMapOutput values.
// You can construct a concrete instance of `ApiMappingMapInput` via:
//
// ApiMappingMap{ "key": ApiMappingArgs{...} }
type ApiMappingMapInput interface {
pulumi.Input
ToApiMappingMapOutput() ApiMappingMapOutput
ToApiMappingMapOutputWithContext(context.Context) ApiMappingMapOutput
}
type ApiMappingMap map[string]ApiMappingInput
func (ApiMappingMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ApiMapping)(nil)).Elem()
}
func (i ApiMappingMap) ToApiMappingMapOutput() ApiMappingMapOutput {
return i.ToApiMappingMapOutputWithContext(context.Background())
}
func (i ApiMappingMap) ToApiMappingMapOutputWithContext(ctx context.Context) ApiMappingMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApiMappingMapOutput)
}
type ApiMappingOutput struct{ *pulumi.OutputState }
func (ApiMappingOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ApiMapping)(nil)).Elem()
}
func (o ApiMappingOutput) ToApiMappingOutput() ApiMappingOutput {
return o
}
func (o ApiMappingOutput) ToApiMappingOutputWithContext(ctx context.Context) ApiMappingOutput {
return o
}
// API identifier.
func (o ApiMappingOutput) ApiId() pulumi.StringOutput {
return o.ApplyT(func(v *ApiMapping) pulumi.StringOutput { return v.ApiId }).(pulumi.StringOutput)
}
// The API mapping key. Refer to [REST API](https://docs.aws.amazon.com/apigateway/latest/developerguide/rest-api-mappings.html), [HTTP API](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-mappings.html) or [WebSocket API](https://docs.aws.amazon.com/apigateway/latest/developerguide/websocket-api-mappings.html).
func (o ApiMappingOutput) ApiMappingKey() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ApiMapping) pulumi.StringPtrOutput { return v.ApiMappingKey }).(pulumi.StringPtrOutput)
}
// Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name.
func (o ApiMappingOutput) DomainName() pulumi.StringOutput {
return o.ApplyT(func(v *ApiMapping) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput)
}
// API stage. Use the `apigatewayv2.Stage` resource to configure an API stage.
func (o ApiMappingOutput) Stage() pulumi.StringOutput {
return o.ApplyT(func(v *ApiMapping) pulumi.StringOutput { return v.Stage }).(pulumi.StringOutput)
}
type ApiMappingArrayOutput struct{ *pulumi.OutputState }
func (ApiMappingArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ApiMapping)(nil)).Elem()
}
func (o ApiMappingArrayOutput) ToApiMappingArrayOutput() ApiMappingArrayOutput {
return o
}
func (o ApiMappingArrayOutput) ToApiMappingArrayOutputWithContext(ctx context.Context) ApiMappingArrayOutput {
return o
}
func (o ApiMappingArrayOutput) Index(i pulumi.IntInput) ApiMappingOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ApiMapping {
return vs[0].([]*ApiMapping)[vs[1].(int)]
}).(ApiMappingOutput)
}
type ApiMappingMapOutput struct{ *pulumi.OutputState }
func (ApiMappingMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ApiMapping)(nil)).Elem()
}
func (o ApiMappingMapOutput) ToApiMappingMapOutput() ApiMappingMapOutput {
return o
}
func (o ApiMappingMapOutput) ToApiMappingMapOutputWithContext(ctx context.Context) ApiMappingMapOutput {
return o
}
func (o ApiMappingMapOutput) MapIndex(k pulumi.StringInput) ApiMappingOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ApiMapping {
return vs[0].(map[string]*ApiMapping)[vs[1].(string)]
}).(ApiMappingOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ApiMappingInput)(nil)).Elem(), &ApiMapping{})
pulumi.RegisterInputType(reflect.TypeOf((*ApiMappingArrayInput)(nil)).Elem(), ApiMappingArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ApiMappingMapInput)(nil)).Elem(), ApiMappingMap{})
pulumi.RegisterOutputType(ApiMappingOutput{})
pulumi.RegisterOutputType(ApiMappingArrayOutput{})
pulumi.RegisterOutputType(ApiMappingMapOutput{})
}