generated from pulumi/pulumi-tf-provider-boilerplate
/
vpcSubnet.go
453 lines (397 loc) · 17.8 KB
/
vpcSubnet.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
// 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 iec
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a VPC subnet resource within HuaweiCloud IEC.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/huaweicloud/pulumi-huaweicloud/sdk/go/huaweicloud/Iec"
// "github.com/pulumi/pulumi-huaweicloud/sdk/go/huaweicloud/Iec"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// sitesTest, err := Iec.GetSites(ctx, nil, nil)
// if err != nil {
// return err
// }
// vpcTest, err := Iec.NewVpc(ctx, "vpcTest", &Iec.VpcArgs{
// Cidr: pulumi.String("192.168.0.0/16"),
// Mode: pulumi.String("CUSTOMER"),
// })
// if err != nil {
// return err
// }
// _, err = Iec.NewVpcSubnet(ctx, "subnetTest", &Iec.VpcSubnetArgs{
// Cidr: pulumi.String("192.168.128.0/18"),
// VpcId: vpcTest.ID(),
// SiteId: pulumi.String(sitesTest.Sites[0].Id),
// GatewayIp: pulumi.String("192.168.128.1"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// IEC vpc subnet can be imported using the `id`, e.g.
//
// ```sh
//
// $ pulumi import huaweicloud:Iec/vpcSubnet:VpcSubnet subnet_demo 51be9f2b-5a3b-406a-9271-36f0c929fbcc
//
// ```
type VpcSubnet struct {
pulumi.CustomResourceState
// Specifies the network segment on which the subnet resides. The value must be in
// CIDR format and within the CIDR block of the iec vpc. Changing this parameter creates a new subnet resource.
Cidr pulumi.StringOutput `pulumi:"cidr"`
// Specifies the status of subnet DHCP is enabled or not.
// Valid values are **true** and **false**, defaults to **true**.
DhcpEnable pulumi.BoolPtrOutput `pulumi:"dhcpEnable"`
// Specifies the DNS server address list of a subnet. These DNS server address must be
// valid IP addresses.
DnsLists pulumi.StringArrayOutput `pulumi:"dnsLists"`
// Specifies the gateway of the subnet. The value must be a valid IP address
// and in the subnet segment. Changing this parameter creates a new subnet resource.
GatewayIp pulumi.StringOutput `pulumi:"gatewayIp"`
// Specifies the name of the iec vpc subnet. The value is a string of 1 to 64 characters that
// can contain letters, digits, underscores(_), and hyphens(-).
Name pulumi.StringOutput `pulumi:"name"`
// The region in which to create the iec vpc subnet resource. If omitted, the
// provider-level region will be used. Changing this creates a new resource.
Region pulumi.StringPtrOutput `pulumi:"region"`
// Specifies the ID of the iec site. Changing this parameter creates a new
// subnet resource.
SiteId pulumi.StringOutput `pulumi:"siteId"`
// The located information of the iec site. It contains area, province and city.
SiteInfo pulumi.StringOutput `pulumi:"siteInfo"`
// The status of the subnet.
Status pulumi.StringOutput `pulumi:"status"`
// Specifies the ID of the iec **CUSTOMER**
// vpc to which the subnet belongs. Changing this parameter creates a new subnet resource.
VpcId pulumi.StringOutput `pulumi:"vpcId"`
}
// NewVpcSubnet registers a new resource with the given unique name, arguments, and options.
func NewVpcSubnet(ctx *pulumi.Context,
name string, args *VpcSubnetArgs, opts ...pulumi.ResourceOption) (*VpcSubnet, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Cidr == nil {
return nil, errors.New("invalid value for required argument 'Cidr'")
}
if args.GatewayIp == nil {
return nil, errors.New("invalid value for required argument 'GatewayIp'")
}
if args.SiteId == nil {
return nil, errors.New("invalid value for required argument 'SiteId'")
}
if args.VpcId == nil {
return nil, errors.New("invalid value for required argument 'VpcId'")
}
opts = pkgResourceDefaultOpts(opts)
var resource VpcSubnet
err := ctx.RegisterResource("huaweicloud:Iec/vpcSubnet:VpcSubnet", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetVpcSubnet gets an existing VpcSubnet 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 GetVpcSubnet(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *VpcSubnetState, opts ...pulumi.ResourceOption) (*VpcSubnet, error) {
var resource VpcSubnet
err := ctx.ReadResource("huaweicloud:Iec/vpcSubnet:VpcSubnet", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering VpcSubnet resources.
type vpcSubnetState struct {
// Specifies the network segment on which the subnet resides. The value must be in
// CIDR format and within the CIDR block of the iec vpc. Changing this parameter creates a new subnet resource.
Cidr *string `pulumi:"cidr"`
// Specifies the status of subnet DHCP is enabled or not.
// Valid values are **true** and **false**, defaults to **true**.
DhcpEnable *bool `pulumi:"dhcpEnable"`
// Specifies the DNS server address list of a subnet. These DNS server address must be
// valid IP addresses.
DnsLists []string `pulumi:"dnsLists"`
// Specifies the gateway of the subnet. The value must be a valid IP address
// and in the subnet segment. Changing this parameter creates a new subnet resource.
GatewayIp *string `pulumi:"gatewayIp"`
// Specifies the name of the iec vpc subnet. The value is a string of 1 to 64 characters that
// can contain letters, digits, underscores(_), and hyphens(-).
Name *string `pulumi:"name"`
// The region in which to create the iec vpc subnet resource. If omitted, the
// provider-level region will be used. Changing this creates a new resource.
Region *string `pulumi:"region"`
// Specifies the ID of the iec site. Changing this parameter creates a new
// subnet resource.
SiteId *string `pulumi:"siteId"`
// The located information of the iec site. It contains area, province and city.
SiteInfo *string `pulumi:"siteInfo"`
// The status of the subnet.
Status *string `pulumi:"status"`
// Specifies the ID of the iec **CUSTOMER**
// vpc to which the subnet belongs. Changing this parameter creates a new subnet resource.
VpcId *string `pulumi:"vpcId"`
}
type VpcSubnetState struct {
// Specifies the network segment on which the subnet resides. The value must be in
// CIDR format and within the CIDR block of the iec vpc. Changing this parameter creates a new subnet resource.
Cidr pulumi.StringPtrInput
// Specifies the status of subnet DHCP is enabled or not.
// Valid values are **true** and **false**, defaults to **true**.
DhcpEnable pulumi.BoolPtrInput
// Specifies the DNS server address list of a subnet. These DNS server address must be
// valid IP addresses.
DnsLists pulumi.StringArrayInput
// Specifies the gateway of the subnet. The value must be a valid IP address
// and in the subnet segment. Changing this parameter creates a new subnet resource.
GatewayIp pulumi.StringPtrInput
// Specifies the name of the iec vpc subnet. The value is a string of 1 to 64 characters that
// can contain letters, digits, underscores(_), and hyphens(-).
Name pulumi.StringPtrInput
// The region in which to create the iec vpc subnet resource. If omitted, the
// provider-level region will be used. Changing this creates a new resource.
Region pulumi.StringPtrInput
// Specifies the ID of the iec site. Changing this parameter creates a new
// subnet resource.
SiteId pulumi.StringPtrInput
// The located information of the iec site. It contains area, province and city.
SiteInfo pulumi.StringPtrInput
// The status of the subnet.
Status pulumi.StringPtrInput
// Specifies the ID of the iec **CUSTOMER**
// vpc to which the subnet belongs. Changing this parameter creates a new subnet resource.
VpcId pulumi.StringPtrInput
}
func (VpcSubnetState) ElementType() reflect.Type {
return reflect.TypeOf((*vpcSubnetState)(nil)).Elem()
}
type vpcSubnetArgs struct {
// Specifies the network segment on which the subnet resides. The value must be in
// CIDR format and within the CIDR block of the iec vpc. Changing this parameter creates a new subnet resource.
Cidr string `pulumi:"cidr"`
// Specifies the status of subnet DHCP is enabled or not.
// Valid values are **true** and **false**, defaults to **true**.
DhcpEnable *bool `pulumi:"dhcpEnable"`
// Specifies the DNS server address list of a subnet. These DNS server address must be
// valid IP addresses.
DnsLists []string `pulumi:"dnsLists"`
// Specifies the gateway of the subnet. The value must be a valid IP address
// and in the subnet segment. Changing this parameter creates a new subnet resource.
GatewayIp string `pulumi:"gatewayIp"`
// Specifies the name of the iec vpc subnet. The value is a string of 1 to 64 characters that
// can contain letters, digits, underscores(_), and hyphens(-).
Name *string `pulumi:"name"`
// The region in which to create the iec vpc subnet resource. If omitted, the
// provider-level region will be used. Changing this creates a new resource.
Region *string `pulumi:"region"`
// Specifies the ID of the iec site. Changing this parameter creates a new
// subnet resource.
SiteId string `pulumi:"siteId"`
// Specifies the ID of the iec **CUSTOMER**
// vpc to which the subnet belongs. Changing this parameter creates a new subnet resource.
VpcId string `pulumi:"vpcId"`
}
// The set of arguments for constructing a VpcSubnet resource.
type VpcSubnetArgs struct {
// Specifies the network segment on which the subnet resides. The value must be in
// CIDR format and within the CIDR block of the iec vpc. Changing this parameter creates a new subnet resource.
Cidr pulumi.StringInput
// Specifies the status of subnet DHCP is enabled or not.
// Valid values are **true** and **false**, defaults to **true**.
DhcpEnable pulumi.BoolPtrInput
// Specifies the DNS server address list of a subnet. These DNS server address must be
// valid IP addresses.
DnsLists pulumi.StringArrayInput
// Specifies the gateway of the subnet. The value must be a valid IP address
// and in the subnet segment. Changing this parameter creates a new subnet resource.
GatewayIp pulumi.StringInput
// Specifies the name of the iec vpc subnet. The value is a string of 1 to 64 characters that
// can contain letters, digits, underscores(_), and hyphens(-).
Name pulumi.StringPtrInput
// The region in which to create the iec vpc subnet resource. If omitted, the
// provider-level region will be used. Changing this creates a new resource.
Region pulumi.StringPtrInput
// Specifies the ID of the iec site. Changing this parameter creates a new
// subnet resource.
SiteId pulumi.StringInput
// Specifies the ID of the iec **CUSTOMER**
// vpc to which the subnet belongs. Changing this parameter creates a new subnet resource.
VpcId pulumi.StringInput
}
func (VpcSubnetArgs) ElementType() reflect.Type {
return reflect.TypeOf((*vpcSubnetArgs)(nil)).Elem()
}
type VpcSubnetInput interface {
pulumi.Input
ToVpcSubnetOutput() VpcSubnetOutput
ToVpcSubnetOutputWithContext(ctx context.Context) VpcSubnetOutput
}
func (*VpcSubnet) ElementType() reflect.Type {
return reflect.TypeOf((**VpcSubnet)(nil)).Elem()
}
func (i *VpcSubnet) ToVpcSubnetOutput() VpcSubnetOutput {
return i.ToVpcSubnetOutputWithContext(context.Background())
}
func (i *VpcSubnet) ToVpcSubnetOutputWithContext(ctx context.Context) VpcSubnetOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpcSubnetOutput)
}
// VpcSubnetArrayInput is an input type that accepts VpcSubnetArray and VpcSubnetArrayOutput values.
// You can construct a concrete instance of `VpcSubnetArrayInput` via:
//
// VpcSubnetArray{ VpcSubnetArgs{...} }
type VpcSubnetArrayInput interface {
pulumi.Input
ToVpcSubnetArrayOutput() VpcSubnetArrayOutput
ToVpcSubnetArrayOutputWithContext(context.Context) VpcSubnetArrayOutput
}
type VpcSubnetArray []VpcSubnetInput
func (VpcSubnetArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*VpcSubnet)(nil)).Elem()
}
func (i VpcSubnetArray) ToVpcSubnetArrayOutput() VpcSubnetArrayOutput {
return i.ToVpcSubnetArrayOutputWithContext(context.Background())
}
func (i VpcSubnetArray) ToVpcSubnetArrayOutputWithContext(ctx context.Context) VpcSubnetArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpcSubnetArrayOutput)
}
// VpcSubnetMapInput is an input type that accepts VpcSubnetMap and VpcSubnetMapOutput values.
// You can construct a concrete instance of `VpcSubnetMapInput` via:
//
// VpcSubnetMap{ "key": VpcSubnetArgs{...} }
type VpcSubnetMapInput interface {
pulumi.Input
ToVpcSubnetMapOutput() VpcSubnetMapOutput
ToVpcSubnetMapOutputWithContext(context.Context) VpcSubnetMapOutput
}
type VpcSubnetMap map[string]VpcSubnetInput
func (VpcSubnetMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*VpcSubnet)(nil)).Elem()
}
func (i VpcSubnetMap) ToVpcSubnetMapOutput() VpcSubnetMapOutput {
return i.ToVpcSubnetMapOutputWithContext(context.Background())
}
func (i VpcSubnetMap) ToVpcSubnetMapOutputWithContext(ctx context.Context) VpcSubnetMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(VpcSubnetMapOutput)
}
type VpcSubnetOutput struct{ *pulumi.OutputState }
func (VpcSubnetOutput) ElementType() reflect.Type {
return reflect.TypeOf((**VpcSubnet)(nil)).Elem()
}
func (o VpcSubnetOutput) ToVpcSubnetOutput() VpcSubnetOutput {
return o
}
func (o VpcSubnetOutput) ToVpcSubnetOutputWithContext(ctx context.Context) VpcSubnetOutput {
return o
}
// Specifies the network segment on which the subnet resides. The value must be in
// CIDR format and within the CIDR block of the iec vpc. Changing this parameter creates a new subnet resource.
func (o VpcSubnetOutput) Cidr() pulumi.StringOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.StringOutput { return v.Cidr }).(pulumi.StringOutput)
}
// Specifies the status of subnet DHCP is enabled or not.
// Valid values are **true** and **false**, defaults to **true**.
func (o VpcSubnetOutput) DhcpEnable() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.BoolPtrOutput { return v.DhcpEnable }).(pulumi.BoolPtrOutput)
}
// Specifies the DNS server address list of a subnet. These DNS server address must be
// valid IP addresses.
func (o VpcSubnetOutput) DnsLists() pulumi.StringArrayOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.StringArrayOutput { return v.DnsLists }).(pulumi.StringArrayOutput)
}
// Specifies the gateway of the subnet. The value must be a valid IP address
// and in the subnet segment. Changing this parameter creates a new subnet resource.
func (o VpcSubnetOutput) GatewayIp() pulumi.StringOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.StringOutput { return v.GatewayIp }).(pulumi.StringOutput)
}
// Specifies the name of the iec vpc subnet. The value is a string of 1 to 64 characters that
// can contain letters, digits, underscores(_), and hyphens(-).
func (o VpcSubnetOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The region in which to create the iec vpc subnet resource. If omitted, the
// provider-level region will be used. Changing this creates a new resource.
func (o VpcSubnetOutput) Region() pulumi.StringPtrOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.StringPtrOutput { return v.Region }).(pulumi.StringPtrOutput)
}
// Specifies the ID of the iec site. Changing this parameter creates a new
// subnet resource.
func (o VpcSubnetOutput) SiteId() pulumi.StringOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.StringOutput { return v.SiteId }).(pulumi.StringOutput)
}
// The located information of the iec site. It contains area, province and city.
func (o VpcSubnetOutput) SiteInfo() pulumi.StringOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.StringOutput { return v.SiteInfo }).(pulumi.StringOutput)
}
// The status of the subnet.
func (o VpcSubnetOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// Specifies the ID of the iec **CUSTOMER**
// vpc to which the subnet belongs. Changing this parameter creates a new subnet resource.
func (o VpcSubnetOutput) VpcId() pulumi.StringOutput {
return o.ApplyT(func(v *VpcSubnet) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
}
type VpcSubnetArrayOutput struct{ *pulumi.OutputState }
func (VpcSubnetArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*VpcSubnet)(nil)).Elem()
}
func (o VpcSubnetArrayOutput) ToVpcSubnetArrayOutput() VpcSubnetArrayOutput {
return o
}
func (o VpcSubnetArrayOutput) ToVpcSubnetArrayOutputWithContext(ctx context.Context) VpcSubnetArrayOutput {
return o
}
func (o VpcSubnetArrayOutput) Index(i pulumi.IntInput) VpcSubnetOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcSubnet {
return vs[0].([]*VpcSubnet)[vs[1].(int)]
}).(VpcSubnetOutput)
}
type VpcSubnetMapOutput struct{ *pulumi.OutputState }
func (VpcSubnetMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*VpcSubnet)(nil)).Elem()
}
func (o VpcSubnetMapOutput) ToVpcSubnetMapOutput() VpcSubnetMapOutput {
return o
}
func (o VpcSubnetMapOutput) ToVpcSubnetMapOutputWithContext(ctx context.Context) VpcSubnetMapOutput {
return o
}
func (o VpcSubnetMapOutput) MapIndex(k pulumi.StringInput) VpcSubnetOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcSubnet {
return vs[0].(map[string]*VpcSubnet)[vs[1].(string)]
}).(VpcSubnetOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*VpcSubnetInput)(nil)).Elem(), &VpcSubnet{})
pulumi.RegisterInputType(reflect.TypeOf((*VpcSubnetArrayInput)(nil)).Elem(), VpcSubnetArray{})
pulumi.RegisterInputType(reflect.TypeOf((*VpcSubnetMapInput)(nil)).Elem(), VpcSubnetMap{})
pulumi.RegisterOutputType(VpcSubnetOutput{})
pulumi.RegisterOutputType(VpcSubnetArrayOutput{})
pulumi.RegisterOutputType(VpcSubnetMapOutput{})
}