This repository has been archived by the owner on Jul 6, 2023. It is now read-only.
/
vpc.go
345 lines (285 loc) · 10.3 KB
/
vpc.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
// *** 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 vpc
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a VPC resource.
//
// > **Note** The network segment can only be created or deleted, can not perform both of them at the same time.
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-ucloud/sdk/go/ucloud/vpc"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := vpc.NewVPC(ctx, "example", &vpc.VPCArgs{
// CidrBlocks: pulumi.StringArray{
// pulumi.String("192.168.0.0/16"),
// },
// Tag: pulumi.String("tf-example"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// VPC can be imported using the `id`, e.g.
//
// ```sh
// $ pulumi import ucloud:vpc/vPC:VPC example uvnet-abc123456
// ```
type VPC struct {
pulumi.CustomResourceState
// The CIDR blocks of VPC.
CidrBlocks pulumi.StringArrayOutput `pulumi:"cidrBlocks"`
// The time of creation for VPC, formatted in RFC3339 time string.
CreateTime pulumi.StringOutput `pulumi:"createTime"`
Name pulumi.StringOutput `pulumi:"name"`
// It is a nested type which documented below.
NetworkInfos VPCNetworkInfoArrayOutput `pulumi:"networkInfos"`
// The remarks of the VPC. (Default: `""`).
Remark pulumi.StringOutput `pulumi:"remark"`
// A tag assigned to VPC, which contains at most 63 characters and only support Chinese, English, numbers, '-', '_', and '.'. If it is not filled in or a empty string is filled in, then default tag will be assigned. (Default: `Default`).
Tag pulumi.StringPtrOutput `pulumi:"tag"`
// The time whenever there is a change made to VPC, formatted in RFC3339 time string.
UpdateTime pulumi.StringOutput `pulumi:"updateTime"`
}
// NewVPC registers a new resource with the given unique name, arguments, and options.
func NewVPC(ctx *pulumi.Context,
name string, args *VPCArgs, opts ...pulumi.ResourceOption) (*VPC, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CidrBlocks == nil {
return nil, errors.New("invalid value for required argument 'CidrBlocks'")
}
var resource VPC
err := ctx.RegisterResource("ucloud:vpc/vPC:VPC", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetVPC gets an existing VPC 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 GetVPC(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *VPCState, opts ...pulumi.ResourceOption) (*VPC, error) {
var resource VPC
err := ctx.ReadResource("ucloud:vpc/vPC:VPC", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering VPC resources.
type vpcState struct {
// The CIDR blocks of VPC.
CidrBlocks []string `pulumi:"cidrBlocks"`
// The time of creation for VPC, formatted in RFC3339 time string.
CreateTime *string `pulumi:"createTime"`
Name *string `pulumi:"name"`
// It is a nested type which documented below.
NetworkInfos []VPCNetworkInfo `pulumi:"networkInfos"`
// The remarks of the VPC. (Default: `""`).
Remark *string `pulumi:"remark"`
// A tag assigned to VPC, which contains at most 63 characters and only support Chinese, English, numbers, '-', '_', and '.'. If it is not filled in or a empty string is filled in, then default tag will be assigned. (Default: `Default`).
Tag *string `pulumi:"tag"`
// The time whenever there is a change made to VPC, formatted in RFC3339 time string.
UpdateTime *string `pulumi:"updateTime"`
}
type VPCState struct {
// The CIDR blocks of VPC.
CidrBlocks pulumi.StringArrayInput
// The time of creation for VPC, formatted in RFC3339 time string.
CreateTime pulumi.StringPtrInput
Name pulumi.StringPtrInput
// It is a nested type which documented below.
NetworkInfos VPCNetworkInfoArrayInput
// The remarks of the VPC. (Default: `""`).
Remark pulumi.StringPtrInput
// A tag assigned to VPC, which contains at most 63 characters and only support Chinese, English, numbers, '-', '_', and '.'. If it is not filled in or a empty string is filled in, then default tag will be assigned. (Default: `Default`).
Tag pulumi.StringPtrInput
// The time whenever there is a change made to VPC, formatted in RFC3339 time string.
UpdateTime pulumi.StringPtrInput
}
func (VPCState) ElementType() reflect.Type {
return reflect.TypeOf((*vpcState)(nil)).Elem()
}
type vpcArgs struct {
// The CIDR blocks of VPC.
CidrBlocks []string `pulumi:"cidrBlocks"`
Name *string `pulumi:"name"`
// The remarks of the VPC. (Default: `""`).
Remark *string `pulumi:"remark"`
// A tag assigned to VPC, which contains at most 63 characters and only support Chinese, English, numbers, '-', '_', and '.'. If it is not filled in or a empty string is filled in, then default tag will be assigned. (Default: `Default`).
Tag *string `pulumi:"tag"`
}
// The set of arguments for constructing a VPC resource.
type VPCArgs struct {
// The CIDR blocks of VPC.
CidrBlocks pulumi.StringArrayInput
Name pulumi.StringPtrInput
// The remarks of the VPC. (Default: `""`).
Remark pulumi.StringPtrInput
// A tag assigned to VPC, which contains at most 63 characters and only support Chinese, English, numbers, '-', '_', and '.'. If it is not filled in or a empty string is filled in, then default tag will be assigned. (Default: `Default`).
Tag pulumi.StringPtrInput
}
func (VPCArgs) ElementType() reflect.Type {
return reflect.TypeOf((*vpcArgs)(nil)).Elem()
}
type VPCInput interface {
pulumi.Input
ToVPCOutput() VPCOutput
ToVPCOutputWithContext(ctx context.Context) VPCOutput
}
func (*VPC) ElementType() reflect.Type {
return reflect.TypeOf((*VPC)(nil))
}
func (i *VPC) ToVPCOutput() VPCOutput {
return i.ToVPCOutputWithContext(context.Background())
}
func (i *VPC) ToVPCOutputWithContext(ctx context.Context) VPCOutput {
return pulumi.ToOutputWithContext(ctx, i).(VPCOutput)
}
func (i *VPC) ToVPCPtrOutput() VPCPtrOutput {
return i.ToVPCPtrOutputWithContext(context.Background())
}
func (i *VPC) ToVPCPtrOutputWithContext(ctx context.Context) VPCPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(VPCPtrOutput)
}
type VPCPtrInput interface {
pulumi.Input
ToVPCPtrOutput() VPCPtrOutput
ToVPCPtrOutputWithContext(ctx context.Context) VPCPtrOutput
}
type vpcPtrType VPCArgs
func (*vpcPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**VPC)(nil))
}
func (i *vpcPtrType) ToVPCPtrOutput() VPCPtrOutput {
return i.ToVPCPtrOutputWithContext(context.Background())
}
func (i *vpcPtrType) ToVPCPtrOutputWithContext(ctx context.Context) VPCPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(VPCPtrOutput)
}
// VPCArrayInput is an input type that accepts VPCArray and VPCArrayOutput values.
// You can construct a concrete instance of `VPCArrayInput` via:
//
// VPCArray{ VPCArgs{...} }
type VPCArrayInput interface {
pulumi.Input
ToVPCArrayOutput() VPCArrayOutput
ToVPCArrayOutputWithContext(context.Context) VPCArrayOutput
}
type VPCArray []VPCInput
func (VPCArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*VPC)(nil))
}
func (i VPCArray) ToVPCArrayOutput() VPCArrayOutput {
return i.ToVPCArrayOutputWithContext(context.Background())
}
func (i VPCArray) ToVPCArrayOutputWithContext(ctx context.Context) VPCArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(VPCArrayOutput)
}
// VPCMapInput is an input type that accepts VPCMap and VPCMapOutput values.
// You can construct a concrete instance of `VPCMapInput` via:
//
// VPCMap{ "key": VPCArgs{...} }
type VPCMapInput interface {
pulumi.Input
ToVPCMapOutput() VPCMapOutput
ToVPCMapOutputWithContext(context.Context) VPCMapOutput
}
type VPCMap map[string]VPCInput
func (VPCMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*VPC)(nil))
}
func (i VPCMap) ToVPCMapOutput() VPCMapOutput {
return i.ToVPCMapOutputWithContext(context.Background())
}
func (i VPCMap) ToVPCMapOutputWithContext(ctx context.Context) VPCMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(VPCMapOutput)
}
type VPCOutput struct {
*pulumi.OutputState
}
func (VPCOutput) ElementType() reflect.Type {
return reflect.TypeOf((*VPC)(nil))
}
func (o VPCOutput) ToVPCOutput() VPCOutput {
return o
}
func (o VPCOutput) ToVPCOutputWithContext(ctx context.Context) VPCOutput {
return o
}
func (o VPCOutput) ToVPCPtrOutput() VPCPtrOutput {
return o.ToVPCPtrOutputWithContext(context.Background())
}
func (o VPCOutput) ToVPCPtrOutputWithContext(ctx context.Context) VPCPtrOutput {
return o.ApplyT(func(v VPC) *VPC {
return &v
}).(VPCPtrOutput)
}
type VPCPtrOutput struct {
*pulumi.OutputState
}
func (VPCPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**VPC)(nil))
}
func (o VPCPtrOutput) ToVPCPtrOutput() VPCPtrOutput {
return o
}
func (o VPCPtrOutput) ToVPCPtrOutputWithContext(ctx context.Context) VPCPtrOutput {
return o
}
type VPCArrayOutput struct{ *pulumi.OutputState }
func (VPCArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]VPC)(nil))
}
func (o VPCArrayOutput) ToVPCArrayOutput() VPCArrayOutput {
return o
}
func (o VPCArrayOutput) ToVPCArrayOutputWithContext(ctx context.Context) VPCArrayOutput {
return o
}
func (o VPCArrayOutput) Index(i pulumi.IntInput) VPCOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) VPC {
return vs[0].([]VPC)[vs[1].(int)]
}).(VPCOutput)
}
type VPCMapOutput struct{ *pulumi.OutputState }
func (VPCMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]VPC)(nil))
}
func (o VPCMapOutput) ToVPCMapOutput() VPCMapOutput {
return o
}
func (o VPCMapOutput) ToVPCMapOutputWithContext(ctx context.Context) VPCMapOutput {
return o
}
func (o VPCMapOutput) MapIndex(k pulumi.StringInput) VPCOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) VPC {
return vs[0].(map[string]VPC)[vs[1].(string)]
}).(VPCOutput)
}
func init() {
pulumi.RegisterOutputType(VPCOutput{})
pulumi.RegisterOutputType(VPCPtrOutput{})
pulumi.RegisterOutputType(VPCArrayOutput{})
pulumi.RegisterOutputType(VPCMapOutput{})
}