github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apigateway/basePathMapping.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 apigateway 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 // Connects a custom domain name registered via `apigateway.DomainName` 16 // with a deployed API so that its methods can be called via the 17 // custom domain name. 18 // 19 // ## Import 20 // 21 // For a non-root `base_path`: 22 // 23 // Using `pulumi import`, import `aws_api_gateway_base_path_mapping` using the domain name and base path. For example: 24 // 25 // For an empty `base_path` or, in other words, a root path (`/`): 26 // 27 // ```sh 28 // $ pulumi import aws:apigateway/basePathMapping:BasePathMapping example example.com/ 29 // ``` 30 // For a non-root `base_path`: 31 // 32 // ```sh 33 // $ pulumi import aws:apigateway/basePathMapping:BasePathMapping example example.com/base-path 34 // ``` 35 type BasePathMapping struct { 36 pulumi.CustomResourceState 37 38 // Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain. 39 BasePath pulumi.StringPtrOutput `pulumi:"basePath"` 40 // Already-registered domain name to connect the API to. 41 DomainName pulumi.StringOutput `pulumi:"domainName"` 42 // ID of the API to connect. 43 RestApi pulumi.StringOutput `pulumi:"restApi"` 44 // Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path. 45 StageName pulumi.StringPtrOutput `pulumi:"stageName"` 46 } 47 48 // NewBasePathMapping registers a new resource with the given unique name, arguments, and options. 49 func NewBasePathMapping(ctx *pulumi.Context, 50 name string, args *BasePathMappingArgs, opts ...pulumi.ResourceOption) (*BasePathMapping, error) { 51 if args == nil { 52 return nil, errors.New("missing one or more required arguments") 53 } 54 55 if args.DomainName == nil { 56 return nil, errors.New("invalid value for required argument 'DomainName'") 57 } 58 if args.RestApi == nil { 59 return nil, errors.New("invalid value for required argument 'RestApi'") 60 } 61 opts = internal.PkgResourceDefaultOpts(opts) 62 var resource BasePathMapping 63 err := ctx.RegisterResource("aws:apigateway/basePathMapping:BasePathMapping", name, args, &resource, opts...) 64 if err != nil { 65 return nil, err 66 } 67 return &resource, nil 68 } 69 70 // GetBasePathMapping gets an existing BasePathMapping resource's state with the given name, ID, and optional 71 // state properties that are used to uniquely qualify the lookup (nil if not required). 72 func GetBasePathMapping(ctx *pulumi.Context, 73 name string, id pulumi.IDInput, state *BasePathMappingState, opts ...pulumi.ResourceOption) (*BasePathMapping, error) { 74 var resource BasePathMapping 75 err := ctx.ReadResource("aws:apigateway/basePathMapping:BasePathMapping", name, id, state, &resource, opts...) 76 if err != nil { 77 return nil, err 78 } 79 return &resource, nil 80 } 81 82 // Input properties used for looking up and filtering BasePathMapping resources. 83 type basePathMappingState struct { 84 // Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain. 85 BasePath *string `pulumi:"basePath"` 86 // Already-registered domain name to connect the API to. 87 DomainName *string `pulumi:"domainName"` 88 // ID of the API to connect. 89 RestApi interface{} `pulumi:"restApi"` 90 // Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path. 91 StageName *string `pulumi:"stageName"` 92 } 93 94 type BasePathMappingState struct { 95 // Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain. 96 BasePath pulumi.StringPtrInput 97 // Already-registered domain name to connect the API to. 98 DomainName pulumi.StringPtrInput 99 // ID of the API to connect. 100 RestApi pulumi.Input 101 // Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path. 102 StageName pulumi.StringPtrInput 103 } 104 105 func (BasePathMappingState) ElementType() reflect.Type { 106 return reflect.TypeOf((*basePathMappingState)(nil)).Elem() 107 } 108 109 type basePathMappingArgs struct { 110 // Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain. 111 BasePath *string `pulumi:"basePath"` 112 // Already-registered domain name to connect the API to. 113 DomainName string `pulumi:"domainName"` 114 // ID of the API to connect. 115 RestApi interface{} `pulumi:"restApi"` 116 // Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path. 117 StageName *string `pulumi:"stageName"` 118 } 119 120 // The set of arguments for constructing a BasePathMapping resource. 121 type BasePathMappingArgs struct { 122 // Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain. 123 BasePath pulumi.StringPtrInput 124 // Already-registered domain name to connect the API to. 125 DomainName pulumi.StringInput 126 // ID of the API to connect. 127 RestApi pulumi.Input 128 // Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path. 129 StageName pulumi.StringPtrInput 130 } 131 132 func (BasePathMappingArgs) ElementType() reflect.Type { 133 return reflect.TypeOf((*basePathMappingArgs)(nil)).Elem() 134 } 135 136 type BasePathMappingInput interface { 137 pulumi.Input 138 139 ToBasePathMappingOutput() BasePathMappingOutput 140 ToBasePathMappingOutputWithContext(ctx context.Context) BasePathMappingOutput 141 } 142 143 func (*BasePathMapping) ElementType() reflect.Type { 144 return reflect.TypeOf((**BasePathMapping)(nil)).Elem() 145 } 146 147 func (i *BasePathMapping) ToBasePathMappingOutput() BasePathMappingOutput { 148 return i.ToBasePathMappingOutputWithContext(context.Background()) 149 } 150 151 func (i *BasePathMapping) ToBasePathMappingOutputWithContext(ctx context.Context) BasePathMappingOutput { 152 return pulumi.ToOutputWithContext(ctx, i).(BasePathMappingOutput) 153 } 154 155 // BasePathMappingArrayInput is an input type that accepts BasePathMappingArray and BasePathMappingArrayOutput values. 156 // You can construct a concrete instance of `BasePathMappingArrayInput` via: 157 // 158 // BasePathMappingArray{ BasePathMappingArgs{...} } 159 type BasePathMappingArrayInput interface { 160 pulumi.Input 161 162 ToBasePathMappingArrayOutput() BasePathMappingArrayOutput 163 ToBasePathMappingArrayOutputWithContext(context.Context) BasePathMappingArrayOutput 164 } 165 166 type BasePathMappingArray []BasePathMappingInput 167 168 func (BasePathMappingArray) ElementType() reflect.Type { 169 return reflect.TypeOf((*[]*BasePathMapping)(nil)).Elem() 170 } 171 172 func (i BasePathMappingArray) ToBasePathMappingArrayOutput() BasePathMappingArrayOutput { 173 return i.ToBasePathMappingArrayOutputWithContext(context.Background()) 174 } 175 176 func (i BasePathMappingArray) ToBasePathMappingArrayOutputWithContext(ctx context.Context) BasePathMappingArrayOutput { 177 return pulumi.ToOutputWithContext(ctx, i).(BasePathMappingArrayOutput) 178 } 179 180 // BasePathMappingMapInput is an input type that accepts BasePathMappingMap and BasePathMappingMapOutput values. 181 // You can construct a concrete instance of `BasePathMappingMapInput` via: 182 // 183 // BasePathMappingMap{ "key": BasePathMappingArgs{...} } 184 type BasePathMappingMapInput interface { 185 pulumi.Input 186 187 ToBasePathMappingMapOutput() BasePathMappingMapOutput 188 ToBasePathMappingMapOutputWithContext(context.Context) BasePathMappingMapOutput 189 } 190 191 type BasePathMappingMap map[string]BasePathMappingInput 192 193 func (BasePathMappingMap) ElementType() reflect.Type { 194 return reflect.TypeOf((*map[string]*BasePathMapping)(nil)).Elem() 195 } 196 197 func (i BasePathMappingMap) ToBasePathMappingMapOutput() BasePathMappingMapOutput { 198 return i.ToBasePathMappingMapOutputWithContext(context.Background()) 199 } 200 201 func (i BasePathMappingMap) ToBasePathMappingMapOutputWithContext(ctx context.Context) BasePathMappingMapOutput { 202 return pulumi.ToOutputWithContext(ctx, i).(BasePathMappingMapOutput) 203 } 204 205 type BasePathMappingOutput struct{ *pulumi.OutputState } 206 207 func (BasePathMappingOutput) ElementType() reflect.Type { 208 return reflect.TypeOf((**BasePathMapping)(nil)).Elem() 209 } 210 211 func (o BasePathMappingOutput) ToBasePathMappingOutput() BasePathMappingOutput { 212 return o 213 } 214 215 func (o BasePathMappingOutput) ToBasePathMappingOutputWithContext(ctx context.Context) BasePathMappingOutput { 216 return o 217 } 218 219 // Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain. 220 func (o BasePathMappingOutput) BasePath() pulumi.StringPtrOutput { 221 return o.ApplyT(func(v *BasePathMapping) pulumi.StringPtrOutput { return v.BasePath }).(pulumi.StringPtrOutput) 222 } 223 224 // Already-registered domain name to connect the API to. 225 func (o BasePathMappingOutput) DomainName() pulumi.StringOutput { 226 return o.ApplyT(func(v *BasePathMapping) pulumi.StringOutput { return v.DomainName }).(pulumi.StringOutput) 227 } 228 229 // ID of the API to connect. 230 func (o BasePathMappingOutput) RestApi() pulumi.StringOutput { 231 return o.ApplyT(func(v *BasePathMapping) pulumi.StringOutput { return v.RestApi }).(pulumi.StringOutput) 232 } 233 234 // Name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path. 235 func (o BasePathMappingOutput) StageName() pulumi.StringPtrOutput { 236 return o.ApplyT(func(v *BasePathMapping) pulumi.StringPtrOutput { return v.StageName }).(pulumi.StringPtrOutput) 237 } 238 239 type BasePathMappingArrayOutput struct{ *pulumi.OutputState } 240 241 func (BasePathMappingArrayOutput) ElementType() reflect.Type { 242 return reflect.TypeOf((*[]*BasePathMapping)(nil)).Elem() 243 } 244 245 func (o BasePathMappingArrayOutput) ToBasePathMappingArrayOutput() BasePathMappingArrayOutput { 246 return o 247 } 248 249 func (o BasePathMappingArrayOutput) ToBasePathMappingArrayOutputWithContext(ctx context.Context) BasePathMappingArrayOutput { 250 return o 251 } 252 253 func (o BasePathMappingArrayOutput) Index(i pulumi.IntInput) BasePathMappingOutput { 254 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BasePathMapping { 255 return vs[0].([]*BasePathMapping)[vs[1].(int)] 256 }).(BasePathMappingOutput) 257 } 258 259 type BasePathMappingMapOutput struct{ *pulumi.OutputState } 260 261 func (BasePathMappingMapOutput) ElementType() reflect.Type { 262 return reflect.TypeOf((*map[string]*BasePathMapping)(nil)).Elem() 263 } 264 265 func (o BasePathMappingMapOutput) ToBasePathMappingMapOutput() BasePathMappingMapOutput { 266 return o 267 } 268 269 func (o BasePathMappingMapOutput) ToBasePathMappingMapOutputWithContext(ctx context.Context) BasePathMappingMapOutput { 270 return o 271 } 272 273 func (o BasePathMappingMapOutput) MapIndex(k pulumi.StringInput) BasePathMappingOutput { 274 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BasePathMapping { 275 return vs[0].(map[string]*BasePathMapping)[vs[1].(string)] 276 }).(BasePathMappingOutput) 277 } 278 279 func init() { 280 pulumi.RegisterInputType(reflect.TypeOf((*BasePathMappingInput)(nil)).Elem(), &BasePathMapping{}) 281 pulumi.RegisterInputType(reflect.TypeOf((*BasePathMappingArrayInput)(nil)).Elem(), BasePathMappingArray{}) 282 pulumi.RegisterInputType(reflect.TypeOf((*BasePathMappingMapInput)(nil)).Elem(), BasePathMappingMap{}) 283 pulumi.RegisterOutputType(BasePathMappingOutput{}) 284 pulumi.RegisterOutputType(BasePathMappingArrayOutput{}) 285 pulumi.RegisterOutputType(BasePathMappingMapOutput{}) 286 }