generated from pulumi/pulumi-tf-provider-boilerplate
/
member.go
411 lines (358 loc) · 15.9 KB
/
member.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
// 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 dedicatedelb
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages an ELB member resource within HuaweiCloud.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/huaweicloud/pulumi-huaweicloud/sdk/go/huaweicloud/DedicatedElb"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// cfg := config.New(ctx, "")
// elbPoolId := cfg.RequireObject("elbPoolId")
// ipv4SubnetId := cfg.RequireObject("ipv4SubnetId")
// _, err := DedicatedElb.NewMember(ctx, "member1", &DedicatedElb.MemberArgs{
// Address: pulumi.String("192.168.199.23"),
// ProtocolPort: pulumi.Int(8080),
// PoolId: pulumi.Any(elbPoolId),
// SubnetId: pulumi.Any(ipv4SubnetId),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// ELB member can be imported using the pool ID and member ID separated by a slash, e.g.
//
// ```sh
//
// $ pulumi import huaweicloud:DedicatedElb/member:Member member_1 e0bd694a-abbe-450e-b329-0931fd1cc5eb/4086b0c9-b18c-4d1c-b6b8-4c56c3ad2a9e
//
// ```
type Member struct {
pulumi.CustomResourceState
// The IP address of the member to receive traffic from the load balancer.
// Changing this creates a new member.
Address pulumi.StringOutput `pulumi:"address"`
// Human-readable name for the member.
Name pulumi.StringOutput `pulumi:"name"`
// The id of the pool that this member will be assigned to.
PoolId pulumi.StringOutput `pulumi:"poolId"`
// The port on which to listen for client traffic. Changing this creates a
// new member.
ProtocolPort pulumi.IntOutput `pulumi:"protocolPort"`
// The region in which to create the ELB member resource. If omitted, the the
// provider-level region will be used. Changing this creates a new member.
Region pulumi.StringOutput `pulumi:"region"`
// The **IPv4 or IPv6 subnet ID** of the subnet in which to access the member.
// + The IPv4 or IPv6 subnet must be in the same VPC as the subnet of the load balancer.
// + If this parameter is not specified, **cross-VPC backend** has been enabled for the load balancer.
// In this case, cross-VPC backend servers must use private IPv4 addresses,
// and the protocol of the backend server group must be TCP, HTTP, or HTTPS.
SubnetId pulumi.StringPtrOutput `pulumi:"subnetId"`
// A positive integer value that indicates the relative portion of traffic that this member
// should receive from the pool. For example, a member with a weight of 10 receives five times as much traffic as a
// member with a weight of 2.
Weight pulumi.IntOutput `pulumi:"weight"`
}
// NewMember registers a new resource with the given unique name, arguments, and options.
func NewMember(ctx *pulumi.Context,
name string, args *MemberArgs, opts ...pulumi.ResourceOption) (*Member, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Address == nil {
return nil, errors.New("invalid value for required argument 'Address'")
}
if args.PoolId == nil {
return nil, errors.New("invalid value for required argument 'PoolId'")
}
if args.ProtocolPort == nil {
return nil, errors.New("invalid value for required argument 'ProtocolPort'")
}
opts = pkgResourceDefaultOpts(opts)
var resource Member
err := ctx.RegisterResource("huaweicloud:DedicatedElb/member:Member", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetMember gets an existing Member 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 GetMember(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *MemberState, opts ...pulumi.ResourceOption) (*Member, error) {
var resource Member
err := ctx.ReadResource("huaweicloud:DedicatedElb/member:Member", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Member resources.
type memberState struct {
// The IP address of the member to receive traffic from the load balancer.
// Changing this creates a new member.
Address *string `pulumi:"address"`
// Human-readable name for the member.
Name *string `pulumi:"name"`
// The id of the pool that this member will be assigned to.
PoolId *string `pulumi:"poolId"`
// The port on which to listen for client traffic. Changing this creates a
// new member.
ProtocolPort *int `pulumi:"protocolPort"`
// The region in which to create the ELB member resource. If omitted, the the
// provider-level region will be used. Changing this creates a new member.
Region *string `pulumi:"region"`
// The **IPv4 or IPv6 subnet ID** of the subnet in which to access the member.
// + The IPv4 or IPv6 subnet must be in the same VPC as the subnet of the load balancer.
// + If this parameter is not specified, **cross-VPC backend** has been enabled for the load balancer.
// In this case, cross-VPC backend servers must use private IPv4 addresses,
// and the protocol of the backend server group must be TCP, HTTP, or HTTPS.
SubnetId *string `pulumi:"subnetId"`
// A positive integer value that indicates the relative portion of traffic that this member
// should receive from the pool. For example, a member with a weight of 10 receives five times as much traffic as a
// member with a weight of 2.
Weight *int `pulumi:"weight"`
}
type MemberState struct {
// The IP address of the member to receive traffic from the load balancer.
// Changing this creates a new member.
Address pulumi.StringPtrInput
// Human-readable name for the member.
Name pulumi.StringPtrInput
// The id of the pool that this member will be assigned to.
PoolId pulumi.StringPtrInput
// The port on which to listen for client traffic. Changing this creates a
// new member.
ProtocolPort pulumi.IntPtrInput
// The region in which to create the ELB member resource. If omitted, the the
// provider-level region will be used. Changing this creates a new member.
Region pulumi.StringPtrInput
// The **IPv4 or IPv6 subnet ID** of the subnet in which to access the member.
// + The IPv4 or IPv6 subnet must be in the same VPC as the subnet of the load balancer.
// + If this parameter is not specified, **cross-VPC backend** has been enabled for the load balancer.
// In this case, cross-VPC backend servers must use private IPv4 addresses,
// and the protocol of the backend server group must be TCP, HTTP, or HTTPS.
SubnetId pulumi.StringPtrInput
// A positive integer value that indicates the relative portion of traffic that this member
// should receive from the pool. For example, a member with a weight of 10 receives five times as much traffic as a
// member with a weight of 2.
Weight pulumi.IntPtrInput
}
func (MemberState) ElementType() reflect.Type {
return reflect.TypeOf((*memberState)(nil)).Elem()
}
type memberArgs struct {
// The IP address of the member to receive traffic from the load balancer.
// Changing this creates a new member.
Address string `pulumi:"address"`
// Human-readable name for the member.
Name *string `pulumi:"name"`
// The id of the pool that this member will be assigned to.
PoolId string `pulumi:"poolId"`
// The port on which to listen for client traffic. Changing this creates a
// new member.
ProtocolPort int `pulumi:"protocolPort"`
// The region in which to create the ELB member resource. If omitted, the the
// provider-level region will be used. Changing this creates a new member.
Region *string `pulumi:"region"`
// The **IPv4 or IPv6 subnet ID** of the subnet in which to access the member.
// + The IPv4 or IPv6 subnet must be in the same VPC as the subnet of the load balancer.
// + If this parameter is not specified, **cross-VPC backend** has been enabled for the load balancer.
// In this case, cross-VPC backend servers must use private IPv4 addresses,
// and the protocol of the backend server group must be TCP, HTTP, or HTTPS.
SubnetId *string `pulumi:"subnetId"`
// A positive integer value that indicates the relative portion of traffic that this member
// should receive from the pool. For example, a member with a weight of 10 receives five times as much traffic as a
// member with a weight of 2.
Weight *int `pulumi:"weight"`
}
// The set of arguments for constructing a Member resource.
type MemberArgs struct {
// The IP address of the member to receive traffic from the load balancer.
// Changing this creates a new member.
Address pulumi.StringInput
// Human-readable name for the member.
Name pulumi.StringPtrInput
// The id of the pool that this member will be assigned to.
PoolId pulumi.StringInput
// The port on which to listen for client traffic. Changing this creates a
// new member.
ProtocolPort pulumi.IntInput
// The region in which to create the ELB member resource. If omitted, the the
// provider-level region will be used. Changing this creates a new member.
Region pulumi.StringPtrInput
// The **IPv4 or IPv6 subnet ID** of the subnet in which to access the member.
// + The IPv4 or IPv6 subnet must be in the same VPC as the subnet of the load balancer.
// + If this parameter is not specified, **cross-VPC backend** has been enabled for the load balancer.
// In this case, cross-VPC backend servers must use private IPv4 addresses,
// and the protocol of the backend server group must be TCP, HTTP, or HTTPS.
SubnetId pulumi.StringPtrInput
// A positive integer value that indicates the relative portion of traffic that this member
// should receive from the pool. For example, a member with a weight of 10 receives five times as much traffic as a
// member with a weight of 2.
Weight pulumi.IntPtrInput
}
func (MemberArgs) ElementType() reflect.Type {
return reflect.TypeOf((*memberArgs)(nil)).Elem()
}
type MemberInput interface {
pulumi.Input
ToMemberOutput() MemberOutput
ToMemberOutputWithContext(ctx context.Context) MemberOutput
}
func (*Member) ElementType() reflect.Type {
return reflect.TypeOf((**Member)(nil)).Elem()
}
func (i *Member) ToMemberOutput() MemberOutput {
return i.ToMemberOutputWithContext(context.Background())
}
func (i *Member) ToMemberOutputWithContext(ctx context.Context) MemberOutput {
return pulumi.ToOutputWithContext(ctx, i).(MemberOutput)
}
// MemberArrayInput is an input type that accepts MemberArray and MemberArrayOutput values.
// You can construct a concrete instance of `MemberArrayInput` via:
//
// MemberArray{ MemberArgs{...} }
type MemberArrayInput interface {
pulumi.Input
ToMemberArrayOutput() MemberArrayOutput
ToMemberArrayOutputWithContext(context.Context) MemberArrayOutput
}
type MemberArray []MemberInput
func (MemberArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Member)(nil)).Elem()
}
func (i MemberArray) ToMemberArrayOutput() MemberArrayOutput {
return i.ToMemberArrayOutputWithContext(context.Background())
}
func (i MemberArray) ToMemberArrayOutputWithContext(ctx context.Context) MemberArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(MemberArrayOutput)
}
// MemberMapInput is an input type that accepts MemberMap and MemberMapOutput values.
// You can construct a concrete instance of `MemberMapInput` via:
//
// MemberMap{ "key": MemberArgs{...} }
type MemberMapInput interface {
pulumi.Input
ToMemberMapOutput() MemberMapOutput
ToMemberMapOutputWithContext(context.Context) MemberMapOutput
}
type MemberMap map[string]MemberInput
func (MemberMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Member)(nil)).Elem()
}
func (i MemberMap) ToMemberMapOutput() MemberMapOutput {
return i.ToMemberMapOutputWithContext(context.Background())
}
func (i MemberMap) ToMemberMapOutputWithContext(ctx context.Context) MemberMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(MemberMapOutput)
}
type MemberOutput struct{ *pulumi.OutputState }
func (MemberOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Member)(nil)).Elem()
}
func (o MemberOutput) ToMemberOutput() MemberOutput {
return o
}
func (o MemberOutput) ToMemberOutputWithContext(ctx context.Context) MemberOutput {
return o
}
// The IP address of the member to receive traffic from the load balancer.
// Changing this creates a new member.
func (o MemberOutput) Address() pulumi.StringOutput {
return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.Address }).(pulumi.StringOutput)
}
// Human-readable name for the member.
func (o MemberOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The id of the pool that this member will be assigned to.
func (o MemberOutput) PoolId() pulumi.StringOutput {
return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.PoolId }).(pulumi.StringOutput)
}
// The port on which to listen for client traffic. Changing this creates a
// new member.
func (o MemberOutput) ProtocolPort() pulumi.IntOutput {
return o.ApplyT(func(v *Member) pulumi.IntOutput { return v.ProtocolPort }).(pulumi.IntOutput)
}
// The region in which to create the ELB member resource. If omitted, the the
// provider-level region will be used. Changing this creates a new member.
func (o MemberOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v *Member) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)
}
// The **IPv4 or IPv6 subnet ID** of the subnet in which to access the member.
// - The IPv4 or IPv6 subnet must be in the same VPC as the subnet of the load balancer.
// - If this parameter is not specified, **cross-VPC backend** has been enabled for the load balancer.
// In this case, cross-VPC backend servers must use private IPv4 addresses,
// and the protocol of the backend server group must be TCP, HTTP, or HTTPS.
func (o MemberOutput) SubnetId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Member) pulumi.StringPtrOutput { return v.SubnetId }).(pulumi.StringPtrOutput)
}
// A positive integer value that indicates the relative portion of traffic that this member
// should receive from the pool. For example, a member with a weight of 10 receives five times as much traffic as a
// member with a weight of 2.
func (o MemberOutput) Weight() pulumi.IntOutput {
return o.ApplyT(func(v *Member) pulumi.IntOutput { return v.Weight }).(pulumi.IntOutput)
}
type MemberArrayOutput struct{ *pulumi.OutputState }
func (MemberArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Member)(nil)).Elem()
}
func (o MemberArrayOutput) ToMemberArrayOutput() MemberArrayOutput {
return o
}
func (o MemberArrayOutput) ToMemberArrayOutputWithContext(ctx context.Context) MemberArrayOutput {
return o
}
func (o MemberArrayOutput) Index(i pulumi.IntInput) MemberOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Member {
return vs[0].([]*Member)[vs[1].(int)]
}).(MemberOutput)
}
type MemberMapOutput struct{ *pulumi.OutputState }
func (MemberMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Member)(nil)).Elem()
}
func (o MemberMapOutput) ToMemberMapOutput() MemberMapOutput {
return o
}
func (o MemberMapOutput) ToMemberMapOutputWithContext(ctx context.Context) MemberMapOutput {
return o
}
func (o MemberMapOutput) MapIndex(k pulumi.StringInput) MemberOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Member {
return vs[0].(map[string]*Member)[vs[1].(string)]
}).(MemberOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*MemberInput)(nil)).Elem(), &Member{})
pulumi.RegisterInputType(reflect.TypeOf((*MemberArrayInput)(nil)).Elem(), MemberArray{})
pulumi.RegisterInputType(reflect.TypeOf((*MemberMapInput)(nil)).Elem(), MemberMap{})
pulumi.RegisterOutputType(MemberOutput{})
pulumi.RegisterOutputType(MemberArrayOutput{})
pulumi.RegisterOutputType(MemberMapOutput{})
}