/
endpointGroup.go
496 lines (436 loc) · 20 KB
/
endpointGroup.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
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
// *** 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 ga
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Provides a Global Accelerator (GA) Endpoint Group resource.
//
// For information about Global Accelerator (GA) Endpoint Group and how to use it, see [What is Endpoint Group](https://www.alibabacloud.com/help/en/doc-detail/153259.htm).
//
// > **NOTE:** Available in v1.113.0+.
//
// ## Example Usage
//
// Basic Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud/ecs"
// "github.com/pulumi/pulumi-alicloud/sdk/v2/go/alicloud/ga"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleAccelerator, err := ga.NewAccelerator(ctx, "exampleAccelerator", &ga.AcceleratorArgs{
// Duration: pulumi.Int(1),
// AutoUseCoupon: pulumi.Bool(true),
// Spec: pulumi.String("1"),
// })
// if err != nil {
// return err
// }
// exampleListener, err := ga.NewListener(ctx, "exampleListener", &ga.ListenerArgs{
// AcceleratorId: exampleAccelerator.ID(),
// PortRanges: ga.ListenerPortRangeArray{
// &ga.ListenerPortRangeArgs{
// FromPort: pulumi.Int(60),
// ToPort: pulumi.Int(70),
// },
// },
// })
// if err != nil {
// return err
// }
// exampleEip, err := ecs.NewEip(ctx, "exampleEip", &ecs.EipArgs{
// Bandwidth: pulumi.Int(10),
// InternetChargeType: pulumi.String("PayByBandwidth"),
// })
// if err != nil {
// return err
// }
// _, err = ga.NewEndpointGroup(ctx, "exampleEndpointGroup", &ga.EndpointGroupArgs{
// AcceleratorId: pulumi.Any(alicloud_ga_accelerators.Example.Id),
// EndpointConfigurations: ga.EndpointGroupEndpointConfigurationArray{
// &ga.EndpointGroupEndpointConfigurationArgs{
// Endpoint: exampleEip.IpAddress,
// Type: pulumi.String("PublicIp"),
// Weight: pulumi.Int(20),
// },
// },
// EndpointGroupRegion: pulumi.String("cn-hangzhou"),
// ListenerId: exampleListener.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Ga Endpoint Group can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:ga/endpointGroup:EndpointGroup example <id>
// ```
type EndpointGroup struct {
pulumi.CustomResourceState
// The ID of the Global Accelerator instance to which the endpoint group will be added.
AcceleratorId pulumi.StringOutput `pulumi:"acceleratorId"`
// The description of the endpoint group.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The endpointConfigurations of the endpoint group.
EndpointConfigurations EndpointGroupEndpointConfigurationArrayOutput `pulumi:"endpointConfigurations"`
// The ID of the region where the endpoint group is deployed.
EndpointGroupRegion pulumi.StringOutput `pulumi:"endpointGroupRegion"`
// The endpoint group type. Valid values: `default`, `virtual`. Default value is `default`.
EndpointGroupType pulumi.StringPtrOutput `pulumi:"endpointGroupType"`
// The endpoint request protocol.
EndpointRequestProtocol pulumi.StringPtrOutput `pulumi:"endpointRequestProtocol"`
// The interval between two consecutive health checks. Unit: seconds.
HealthCheckIntervalSeconds pulumi.IntPtrOutput `pulumi:"healthCheckIntervalSeconds"`
// The path specified as the destination of the targets for health checks.
HealthCheckPath pulumi.StringPtrOutput `pulumi:"healthCheckPath"`
// The port that is used for health checks.
HealthCheckPort pulumi.IntPtrOutput `pulumi:"healthCheckPort"`
// The protocol that is used to connect to the targets for health checks. Valid values: `http`, `https`, `tcp`.
HealthCheckProtocol pulumi.StringPtrOutput `pulumi:"healthCheckProtocol"`
// The ID of the listener that is associated with the endpoint group.
ListenerId pulumi.StringOutput `pulumi:"listenerId"`
// The name of the endpoint group.
Name pulumi.StringOutput `pulumi:"name"`
// Mapping between listening port and forwarding port of boarding point.
PortOverrides EndpointGroupPortOverridesPtrOutput `pulumi:"portOverrides"`
// The status of the endpoint group.
Status pulumi.StringOutput `pulumi:"status"`
// The number of consecutive failed heath checks that must occur before the endpoint is deemed unhealthy. Default value is `3`.
ThresholdCount pulumi.IntPtrOutput `pulumi:"thresholdCount"`
// The weight of the endpoint group when the corresponding listener is associated with multiple endpoint groups.
TrafficPercentage pulumi.IntPtrOutput `pulumi:"trafficPercentage"`
}
// NewEndpointGroup registers a new resource with the given unique name, arguments, and options.
func NewEndpointGroup(ctx *pulumi.Context,
name string, args *EndpointGroupArgs, opts ...pulumi.ResourceOption) (*EndpointGroup, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AcceleratorId == nil {
return nil, errors.New("invalid value for required argument 'AcceleratorId'")
}
if args.EndpointConfigurations == nil {
return nil, errors.New("invalid value for required argument 'EndpointConfigurations'")
}
if args.EndpointGroupRegion == nil {
return nil, errors.New("invalid value for required argument 'EndpointGroupRegion'")
}
if args.ListenerId == nil {
return nil, errors.New("invalid value for required argument 'ListenerId'")
}
var resource EndpointGroup
err := ctx.RegisterResource("alicloud:ga/endpointGroup:EndpointGroup", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEndpointGroup gets an existing EndpointGroup 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 GetEndpointGroup(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EndpointGroupState, opts ...pulumi.ResourceOption) (*EndpointGroup, error) {
var resource EndpointGroup
err := ctx.ReadResource("alicloud:ga/endpointGroup:EndpointGroup", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering EndpointGroup resources.
type endpointGroupState struct {
// The ID of the Global Accelerator instance to which the endpoint group will be added.
AcceleratorId *string `pulumi:"acceleratorId"`
// The description of the endpoint group.
Description *string `pulumi:"description"`
// The endpointConfigurations of the endpoint group.
EndpointConfigurations []EndpointGroupEndpointConfiguration `pulumi:"endpointConfigurations"`
// The ID of the region where the endpoint group is deployed.
EndpointGroupRegion *string `pulumi:"endpointGroupRegion"`
// The endpoint group type. Valid values: `default`, `virtual`. Default value is `default`.
EndpointGroupType *string `pulumi:"endpointGroupType"`
// The endpoint request protocol.
EndpointRequestProtocol *string `pulumi:"endpointRequestProtocol"`
// The interval between two consecutive health checks. Unit: seconds.
HealthCheckIntervalSeconds *int `pulumi:"healthCheckIntervalSeconds"`
// The path specified as the destination of the targets for health checks.
HealthCheckPath *string `pulumi:"healthCheckPath"`
// The port that is used for health checks.
HealthCheckPort *int `pulumi:"healthCheckPort"`
// The protocol that is used to connect to the targets for health checks. Valid values: `http`, `https`, `tcp`.
HealthCheckProtocol *string `pulumi:"healthCheckProtocol"`
// The ID of the listener that is associated with the endpoint group.
ListenerId *string `pulumi:"listenerId"`
// The name of the endpoint group.
Name *string `pulumi:"name"`
// Mapping between listening port and forwarding port of boarding point.
PortOverrides *EndpointGroupPortOverrides `pulumi:"portOverrides"`
// The status of the endpoint group.
Status *string `pulumi:"status"`
// The number of consecutive failed heath checks that must occur before the endpoint is deemed unhealthy. Default value is `3`.
ThresholdCount *int `pulumi:"thresholdCount"`
// The weight of the endpoint group when the corresponding listener is associated with multiple endpoint groups.
TrafficPercentage *int `pulumi:"trafficPercentage"`
}
type EndpointGroupState struct {
// The ID of the Global Accelerator instance to which the endpoint group will be added.
AcceleratorId pulumi.StringPtrInput
// The description of the endpoint group.
Description pulumi.StringPtrInput
// The endpointConfigurations of the endpoint group.
EndpointConfigurations EndpointGroupEndpointConfigurationArrayInput
// The ID of the region where the endpoint group is deployed.
EndpointGroupRegion pulumi.StringPtrInput
// The endpoint group type. Valid values: `default`, `virtual`. Default value is `default`.
EndpointGroupType pulumi.StringPtrInput
// The endpoint request protocol.
EndpointRequestProtocol pulumi.StringPtrInput
// The interval between two consecutive health checks. Unit: seconds.
HealthCheckIntervalSeconds pulumi.IntPtrInput
// The path specified as the destination of the targets for health checks.
HealthCheckPath pulumi.StringPtrInput
// The port that is used for health checks.
HealthCheckPort pulumi.IntPtrInput
// The protocol that is used to connect to the targets for health checks. Valid values: `http`, `https`, `tcp`.
HealthCheckProtocol pulumi.StringPtrInput
// The ID of the listener that is associated with the endpoint group.
ListenerId pulumi.StringPtrInput
// The name of the endpoint group.
Name pulumi.StringPtrInput
// Mapping between listening port and forwarding port of boarding point.
PortOverrides EndpointGroupPortOverridesPtrInput
// The status of the endpoint group.
Status pulumi.StringPtrInput
// The number of consecutive failed heath checks that must occur before the endpoint is deemed unhealthy. Default value is `3`.
ThresholdCount pulumi.IntPtrInput
// The weight of the endpoint group when the corresponding listener is associated with multiple endpoint groups.
TrafficPercentage pulumi.IntPtrInput
}
func (EndpointGroupState) ElementType() reflect.Type {
return reflect.TypeOf((*endpointGroupState)(nil)).Elem()
}
type endpointGroupArgs struct {
// The ID of the Global Accelerator instance to which the endpoint group will be added.
AcceleratorId string `pulumi:"acceleratorId"`
// The description of the endpoint group.
Description *string `pulumi:"description"`
// The endpointConfigurations of the endpoint group.
EndpointConfigurations []EndpointGroupEndpointConfiguration `pulumi:"endpointConfigurations"`
// The ID of the region where the endpoint group is deployed.
EndpointGroupRegion string `pulumi:"endpointGroupRegion"`
// The endpoint group type. Valid values: `default`, `virtual`. Default value is `default`.
EndpointGroupType *string `pulumi:"endpointGroupType"`
// The endpoint request protocol.
EndpointRequestProtocol *string `pulumi:"endpointRequestProtocol"`
// The interval between two consecutive health checks. Unit: seconds.
HealthCheckIntervalSeconds *int `pulumi:"healthCheckIntervalSeconds"`
// The path specified as the destination of the targets for health checks.
HealthCheckPath *string `pulumi:"healthCheckPath"`
// The port that is used for health checks.
HealthCheckPort *int `pulumi:"healthCheckPort"`
// The protocol that is used to connect to the targets for health checks. Valid values: `http`, `https`, `tcp`.
HealthCheckProtocol *string `pulumi:"healthCheckProtocol"`
// The ID of the listener that is associated with the endpoint group.
ListenerId string `pulumi:"listenerId"`
// The name of the endpoint group.
Name *string `pulumi:"name"`
// Mapping between listening port and forwarding port of boarding point.
PortOverrides *EndpointGroupPortOverrides `pulumi:"portOverrides"`
// The number of consecutive failed heath checks that must occur before the endpoint is deemed unhealthy. Default value is `3`.
ThresholdCount *int `pulumi:"thresholdCount"`
// The weight of the endpoint group when the corresponding listener is associated with multiple endpoint groups.
TrafficPercentage *int `pulumi:"trafficPercentage"`
}
// The set of arguments for constructing a EndpointGroup resource.
type EndpointGroupArgs struct {
// The ID of the Global Accelerator instance to which the endpoint group will be added.
AcceleratorId pulumi.StringInput
// The description of the endpoint group.
Description pulumi.StringPtrInput
// The endpointConfigurations of the endpoint group.
EndpointConfigurations EndpointGroupEndpointConfigurationArrayInput
// The ID of the region where the endpoint group is deployed.
EndpointGroupRegion pulumi.StringInput
// The endpoint group type. Valid values: `default`, `virtual`. Default value is `default`.
EndpointGroupType pulumi.StringPtrInput
// The endpoint request protocol.
EndpointRequestProtocol pulumi.StringPtrInput
// The interval between two consecutive health checks. Unit: seconds.
HealthCheckIntervalSeconds pulumi.IntPtrInput
// The path specified as the destination of the targets for health checks.
HealthCheckPath pulumi.StringPtrInput
// The port that is used for health checks.
HealthCheckPort pulumi.IntPtrInput
// The protocol that is used to connect to the targets for health checks. Valid values: `http`, `https`, `tcp`.
HealthCheckProtocol pulumi.StringPtrInput
// The ID of the listener that is associated with the endpoint group.
ListenerId pulumi.StringInput
// The name of the endpoint group.
Name pulumi.StringPtrInput
// Mapping between listening port and forwarding port of boarding point.
PortOverrides EndpointGroupPortOverridesPtrInput
// The number of consecutive failed heath checks that must occur before the endpoint is deemed unhealthy. Default value is `3`.
ThresholdCount pulumi.IntPtrInput
// The weight of the endpoint group when the corresponding listener is associated with multiple endpoint groups.
TrafficPercentage pulumi.IntPtrInput
}
func (EndpointGroupArgs) ElementType() reflect.Type {
return reflect.TypeOf((*endpointGroupArgs)(nil)).Elem()
}
type EndpointGroupInput interface {
pulumi.Input
ToEndpointGroupOutput() EndpointGroupOutput
ToEndpointGroupOutputWithContext(ctx context.Context) EndpointGroupOutput
}
func (*EndpointGroup) ElementType() reflect.Type {
return reflect.TypeOf((*EndpointGroup)(nil))
}
func (i *EndpointGroup) ToEndpointGroupOutput() EndpointGroupOutput {
return i.ToEndpointGroupOutputWithContext(context.Background())
}
func (i *EndpointGroup) ToEndpointGroupOutputWithContext(ctx context.Context) EndpointGroupOutput {
return pulumi.ToOutputWithContext(ctx, i).(EndpointGroupOutput)
}
func (i *EndpointGroup) ToEndpointGroupPtrOutput() EndpointGroupPtrOutput {
return i.ToEndpointGroupPtrOutputWithContext(context.Background())
}
func (i *EndpointGroup) ToEndpointGroupPtrOutputWithContext(ctx context.Context) EndpointGroupPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(EndpointGroupPtrOutput)
}
type EndpointGroupPtrInput interface {
pulumi.Input
ToEndpointGroupPtrOutput() EndpointGroupPtrOutput
ToEndpointGroupPtrOutputWithContext(ctx context.Context) EndpointGroupPtrOutput
}
type endpointGroupPtrType EndpointGroupArgs
func (*endpointGroupPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**EndpointGroup)(nil))
}
func (i *endpointGroupPtrType) ToEndpointGroupPtrOutput() EndpointGroupPtrOutput {
return i.ToEndpointGroupPtrOutputWithContext(context.Background())
}
func (i *endpointGroupPtrType) ToEndpointGroupPtrOutputWithContext(ctx context.Context) EndpointGroupPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(EndpointGroupPtrOutput)
}
// EndpointGroupArrayInput is an input type that accepts EndpointGroupArray and EndpointGroupArrayOutput values.
// You can construct a concrete instance of `EndpointGroupArrayInput` via:
//
// EndpointGroupArray{ EndpointGroupArgs{...} }
type EndpointGroupArrayInput interface {
pulumi.Input
ToEndpointGroupArrayOutput() EndpointGroupArrayOutput
ToEndpointGroupArrayOutputWithContext(context.Context) EndpointGroupArrayOutput
}
type EndpointGroupArray []EndpointGroupInput
func (EndpointGroupArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*EndpointGroup)(nil))
}
func (i EndpointGroupArray) ToEndpointGroupArrayOutput() EndpointGroupArrayOutput {
return i.ToEndpointGroupArrayOutputWithContext(context.Background())
}
func (i EndpointGroupArray) ToEndpointGroupArrayOutputWithContext(ctx context.Context) EndpointGroupArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(EndpointGroupArrayOutput)
}
// EndpointGroupMapInput is an input type that accepts EndpointGroupMap and EndpointGroupMapOutput values.
// You can construct a concrete instance of `EndpointGroupMapInput` via:
//
// EndpointGroupMap{ "key": EndpointGroupArgs{...} }
type EndpointGroupMapInput interface {
pulumi.Input
ToEndpointGroupMapOutput() EndpointGroupMapOutput
ToEndpointGroupMapOutputWithContext(context.Context) EndpointGroupMapOutput
}
type EndpointGroupMap map[string]EndpointGroupInput
func (EndpointGroupMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*EndpointGroup)(nil))
}
func (i EndpointGroupMap) ToEndpointGroupMapOutput() EndpointGroupMapOutput {
return i.ToEndpointGroupMapOutputWithContext(context.Background())
}
func (i EndpointGroupMap) ToEndpointGroupMapOutputWithContext(ctx context.Context) EndpointGroupMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(EndpointGroupMapOutput)
}
type EndpointGroupOutput struct {
*pulumi.OutputState
}
func (EndpointGroupOutput) ElementType() reflect.Type {
return reflect.TypeOf((*EndpointGroup)(nil))
}
func (o EndpointGroupOutput) ToEndpointGroupOutput() EndpointGroupOutput {
return o
}
func (o EndpointGroupOutput) ToEndpointGroupOutputWithContext(ctx context.Context) EndpointGroupOutput {
return o
}
func (o EndpointGroupOutput) ToEndpointGroupPtrOutput() EndpointGroupPtrOutput {
return o.ToEndpointGroupPtrOutputWithContext(context.Background())
}
func (o EndpointGroupOutput) ToEndpointGroupPtrOutputWithContext(ctx context.Context) EndpointGroupPtrOutput {
return o.ApplyT(func(v EndpointGroup) *EndpointGroup {
return &v
}).(EndpointGroupPtrOutput)
}
type EndpointGroupPtrOutput struct {
*pulumi.OutputState
}
func (EndpointGroupPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**EndpointGroup)(nil))
}
func (o EndpointGroupPtrOutput) ToEndpointGroupPtrOutput() EndpointGroupPtrOutput {
return o
}
func (o EndpointGroupPtrOutput) ToEndpointGroupPtrOutputWithContext(ctx context.Context) EndpointGroupPtrOutput {
return o
}
type EndpointGroupArrayOutput struct{ *pulumi.OutputState }
func (EndpointGroupArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]EndpointGroup)(nil))
}
func (o EndpointGroupArrayOutput) ToEndpointGroupArrayOutput() EndpointGroupArrayOutput {
return o
}
func (o EndpointGroupArrayOutput) ToEndpointGroupArrayOutputWithContext(ctx context.Context) EndpointGroupArrayOutput {
return o
}
func (o EndpointGroupArrayOutput) Index(i pulumi.IntInput) EndpointGroupOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) EndpointGroup {
return vs[0].([]EndpointGroup)[vs[1].(int)]
}).(EndpointGroupOutput)
}
type EndpointGroupMapOutput struct{ *pulumi.OutputState }
func (EndpointGroupMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]EndpointGroup)(nil))
}
func (o EndpointGroupMapOutput) ToEndpointGroupMapOutput() EndpointGroupMapOutput {
return o
}
func (o EndpointGroupMapOutput) ToEndpointGroupMapOutputWithContext(ctx context.Context) EndpointGroupMapOutput {
return o
}
func (o EndpointGroupMapOutput) MapIndex(k pulumi.StringInput) EndpointGroupOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) EndpointGroup {
return vs[0].(map[string]EndpointGroup)[vs[1].(string)]
}).(EndpointGroupOutput)
}
func init() {
pulumi.RegisterOutputType(EndpointGroupOutput{})
pulumi.RegisterOutputType(EndpointGroupPtrOutput{})
pulumi.RegisterOutputType(EndpointGroupArrayOutput{})
pulumi.RegisterOutputType(EndpointGroupMapOutput{})
}