github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigatewayv2/apiMapping.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package apigatewayv2 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Manages an Amazon API Gateway Version 2 API mapping. 16 // 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). 17 // 18 // ## Example Usage 19 // 20 // ### Basic 21 // 22 // <!--Start PulumiCodeChooser --> 23 // ```go 24 // package main 25 // 26 // import ( 27 // 28 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigatewayv2" 29 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 30 // 31 // ) 32 // 33 // func main() { 34 // pulumi.Run(func(ctx *pulumi.Context) error { 35 // _, err := apigatewayv2.NewApiMapping(ctx, "example", &apigatewayv2.ApiMappingArgs{ 36 // ApiId: pulumi.Any(exampleAwsApigatewayv2Api.Id), 37 // DomainName: pulumi.Any(exampleAwsApigatewayv2DomainName.Id), 38 // Stage: pulumi.Any(exampleAwsApigatewayv2Stage.Id), 39 // }) 40 // if err != nil { 41 // return err 42 // } 43 // return nil 44 // }) 45 // } 46 // 47 // ``` 48 // <!--End PulumiCodeChooser --> 49 // 50 // ## Import 51 // 52 // Using `pulumi import`, import `aws_apigatewayv2_api_mapping` using the API mapping identifier and domain name. For example: 53 // 54 // ```sh 55 // $ pulumi import aws:apigatewayv2/apiMapping:ApiMapping example 1122334/ws-api.example.com 56 // ``` 57 type ApiMapping struct { 58 pulumi.CustomResourceState 59 60 // API identifier. 61 ApiId pulumi.StringOutput `pulumi:"apiId"` 62 // 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). 63 ApiMappingKey pulumi.StringPtrOutput `pulumi:"apiMappingKey"` 64 // Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name. 65 DomainName pulumi.StringOutput `pulumi:"domainName"` 66 // API stage. Use the `apigatewayv2.Stage` resource to configure an API stage. 67 Stage pulumi.StringOutput `pulumi:"stage"` 68 } 69 70 // NewApiMapping registers a new resource with the given unique name, arguments, and options. 71 func NewApiMapping(ctx *pulumi.Context, 72 name string, args *ApiMappingArgs, opts ...pulumi.ResourceOption) (*ApiMapping, error) { 73 if args == nil { 74 return nil, errors.New("missing one or more required arguments") 75 } 76 77 if args.ApiId == nil { 78 return nil, errors.New("invalid value for required argument 'ApiId'") 79 } 80 if args.DomainName == nil { 81 return nil, errors.New("invalid value for required argument 'DomainName'") 82 } 83 if args.Stage == nil { 84 return nil, errors.New("invalid value for required argument 'Stage'") 85 } 86 opts = internal.PkgResourceDefaultOpts(opts) 87 var resource ApiMapping 88 err := ctx.RegisterResource("aws:apigatewayv2/apiMapping:ApiMapping", name, args, &resource, opts...) 89 if err != nil { 90 return nil, err 91 } 92 return &resource, nil 93 } 94 95 // GetApiMapping gets an existing ApiMapping resource's state with the given name, ID, and optional 96 // state properties that are used to uniquely qualify the lookup (nil if not required). 97 func GetApiMapping(ctx *pulumi.Context, 98 name string, id pulumi.IDInput, state *ApiMappingState, opts ...pulumi.ResourceOption) (*ApiMapping, error) { 99 var resource ApiMapping 100 err := ctx.ReadResource("aws:apigatewayv2/apiMapping:ApiMapping", name, id, state, &resource, opts...) 101 if err != nil { 102 return nil, err 103 } 104 return &resource, nil 105 } 106 107 // Input properties used for looking up and filtering ApiMapping resources. 108 type apiMappingState struct { 109 // API identifier. 110 ApiId *string `pulumi:"apiId"` 111 // 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). 112 ApiMappingKey *string `pulumi:"apiMappingKey"` 113 // Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name. 114 DomainName *string `pulumi:"domainName"` 115 // API stage. Use the `apigatewayv2.Stage` resource to configure an API stage. 116 Stage *string `pulumi:"stage"` 117 } 118 119 type ApiMappingState struct { 120 // API identifier. 121 ApiId pulumi.StringPtrInput 122 // 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). 123 ApiMappingKey pulumi.StringPtrInput 124 // Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name. 125 DomainName pulumi.StringPtrInput 126 // API stage. Use the `apigatewayv2.Stage` resource to configure an API stage. 127 Stage pulumi.StringPtrInput 128 } 129 130 func (ApiMappingState) ElementType() reflect.Type { 131 return reflect.TypeOf((*apiMappingState)(nil)).Elem() 132 } 133 134 type apiMappingArgs struct { 135 // API identifier. 136 ApiId string `pulumi:"apiId"` 137 // 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). 138 ApiMappingKey *string `pulumi:"apiMappingKey"` 139 // Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name. 140 DomainName string `pulumi:"domainName"` 141 // API stage. Use the `apigatewayv2.Stage` resource to configure an API stage. 142 Stage string `pulumi:"stage"` 143 } 144 145 // The set of arguments for constructing a ApiMapping resource. 146 type ApiMappingArgs struct { 147 // API identifier. 148 ApiId pulumi.StringInput 149 // 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). 150 ApiMappingKey pulumi.StringPtrInput 151 // Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name. 152 DomainName pulumi.StringInput 153 // API stage. Use the `apigatewayv2.Stage` resource to configure an API stage. 154 Stage pulumi.StringInput 155 } 156 157 func (ApiMappingArgs) ElementType() reflect.Type { 158 return reflect.TypeOf((*apiMappingArgs)(nil)).Elem() 159 } 160 161 type ApiMappingInput interface { 162 pulumi.Input 163 164 ToApiMappingOutput() ApiMappingOutput 165 ToApiMappingOutputWithContext(ctx context.Context) ApiMappingOutput 166 } 167 168 func (*ApiMapping) ElementType() reflect.Type { 169 return reflect.TypeOf((**ApiMapping)(nil)).Elem() 170 } 171 172 func (i *ApiMapping) ToApiMappingOutput() ApiMappingOutput { 173 return i.ToApiMappingOutputWithContext(context.Background()) 174 } 175 176 func (i *ApiMapping) ToApiMappingOutputWithContext(ctx context.Context) ApiMappingOutput { 177 return pulumi.ToOutputWithContext(ctx, i).(ApiMappingOutput) 178 } 179 180 // ApiMappingArrayInput is an input type that accepts ApiMappingArray and ApiMappingArrayOutput values. 181 // You can construct a concrete instance of `ApiMappingArrayInput` via: 182 // 183 // ApiMappingArray{ ApiMappingArgs{...} } 184 type ApiMappingArrayInput interface { 185 pulumi.Input 186 187 ToApiMappingArrayOutput() ApiMappingArrayOutput 188 ToApiMappingArrayOutputWithContext(context.Context) ApiMappingArrayOutput 189 } 190 191 type ApiMappingArray []ApiMappingInput 192 193 func (ApiMappingArray) ElementType() reflect.Type { 194 return reflect.TypeOf((*[]*ApiMapping)(nil)).Elem() 195 } 196 197 func (i ApiMappingArray) ToApiMappingArrayOutput() ApiMappingArrayOutput { 198 return i.ToApiMappingArrayOutputWithContext(context.Background()) 199 } 200 201 func (i ApiMappingArray) ToApiMappingArrayOutputWithContext(ctx context.Context) ApiMappingArrayOutput { 202 return pulumi.ToOutputWithContext(ctx, i).(ApiMappingArrayOutput) 203 } 204 205 // ApiMappingMapInput is an input type that accepts ApiMappingMap and ApiMappingMapOutput values. 206 // You can construct a concrete instance of `ApiMappingMapInput` via: 207 // 208 // ApiMappingMap{ "key": ApiMappingArgs{...} } 209 type ApiMappingMapInput interface { 210 pulumi.Input 211 212 ToApiMappingMapOutput() ApiMappingMapOutput 213 ToApiMappingMapOutputWithContext(context.Context) ApiMappingMapOutput 214 } 215 216 type ApiMappingMap map[string]ApiMappingInput 217 218 func (ApiMappingMap) ElementType() reflect.Type { 219 return reflect.TypeOf((*map[string]*ApiMapping)(nil)).Elem() 220 } 221 222 func (i ApiMappingMap) ToApiMappingMapOutput() ApiMappingMapOutput { 223 return i.ToApiMappingMapOutputWithContext(context.Background()) 224 } 225 226 func (i ApiMappingMap) ToApiMappingMapOutputWithContext(ctx context.Context) ApiMappingMapOutput { 227 return pulumi.ToOutputWithContext(ctx, i).(ApiMappingMapOutput) 228 } 229 230 type ApiMappingOutput struct{ *pulumi.OutputState } 231 232 func (ApiMappingOutput) ElementType() reflect.Type { 233 return reflect.TypeOf((**ApiMapping)(nil)).Elem() 234 } 235 236 func (o ApiMappingOutput) ToApiMappingOutput() ApiMappingOutput { 237 return o 238 } 239 240 func (o ApiMappingOutput) ToApiMappingOutputWithContext(ctx context.Context) ApiMappingOutput { 241 return o 242 } 243 244 // API identifier. 245 func (o ApiMappingOutput) ApiId() pulumi.StringOutput { 246 return o.ApplyT(func(v *ApiMapping) pulumi.StringOutput { return v.ApiId }).(pulumi.StringOutput) 247 } 248 249 // 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). 250 func (o ApiMappingOutput) ApiMappingKey() pulumi.StringPtrOutput { 251 return o.ApplyT(func(v *ApiMapping) pulumi.StringPtrOutput { return v.ApiMappingKey }).(pulumi.StringPtrOutput) 252 } 253 254 // Domain name. Use the `apigatewayv2.DomainName` resource to configure a domain name. 255 func (o ApiMappingOutput) DomainName() pulumi.StringOutput { 256 return o.ApplyT(func(v *ApiMapping) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput) 257 } 258 259 // API stage. Use the `apigatewayv2.Stage` resource to configure an API stage. 260 func (o ApiMappingOutput) Stage() pulumi.StringOutput { 261 return o.ApplyT(func(v *ApiMapping) pulumi.StringOutput { return v.Stage }).(pulumi.StringOutput) 262 } 263 264 type ApiMappingArrayOutput struct{ *pulumi.OutputState } 265 266 func (ApiMappingArrayOutput) ElementType() reflect.Type { 267 return reflect.TypeOf((*[]*ApiMapping)(nil)).Elem() 268 } 269 270 func (o ApiMappingArrayOutput) ToApiMappingArrayOutput() ApiMappingArrayOutput { 271 return o 272 } 273 274 func (o ApiMappingArrayOutput) ToApiMappingArrayOutputWithContext(ctx context.Context) ApiMappingArrayOutput { 275 return o 276 } 277 278 func (o ApiMappingArrayOutput) Index(i pulumi.IntInput) ApiMappingOutput { 279 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ApiMapping { 280 return vs[0].([]*ApiMapping)[vs[1].(int)] 281 }).(ApiMappingOutput) 282 } 283 284 type ApiMappingMapOutput struct{ *pulumi.OutputState } 285 286 func (ApiMappingMapOutput) ElementType() reflect.Type { 287 return reflect.TypeOf((*map[string]*ApiMapping)(nil)).Elem() 288 } 289 290 func (o ApiMappingMapOutput) ToApiMappingMapOutput() ApiMappingMapOutput { 291 return o 292 } 293 294 func (o ApiMappingMapOutput) ToApiMappingMapOutputWithContext(ctx context.Context) ApiMappingMapOutput { 295 return o 296 } 297 298 func (o ApiMappingMapOutput) MapIndex(k pulumi.StringInput) ApiMappingOutput { 299 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ApiMapping { 300 return vs[0].(map[string]*ApiMapping)[vs[1].(string)] 301 }).(ApiMappingOutput) 302 } 303 304 func init() { 305 pulumi.RegisterInputType(reflect.TypeOf((*ApiMappingInput)(nil)).Elem(), &ApiMapping{}) 306 pulumi.RegisterInputType(reflect.TypeOf((*ApiMappingArrayInput)(nil)).Elem(), ApiMappingArray{}) 307 pulumi.RegisterInputType(reflect.TypeOf((*ApiMappingMapInput)(nil)).Elem(), ApiMappingMap{}) 308 pulumi.RegisterOutputType(ApiMappingOutput{}) 309 pulumi.RegisterOutputType(ApiMappingArrayOutput{}) 310 pulumi.RegisterOutputType(ApiMappingMapOutput{}) 311 }