/
masterSlaveServerGroup.go
330 lines (270 loc) · 14.3 KB
/
masterSlaveServerGroup.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
// *** 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 slb
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// A master slave server group contains two ECS instances. The master slave server group can help you to define multiple listening dimension.
//
// > **NOTE:** One ECS instance can be added into multiple master slave server groups.
//
// > **NOTE:** One master slave server group can only add two ECS instances, which are master server and slave server.
//
// > **NOTE:** One master slave server group can be attached with tcp/udp listeners in one load balancer.
//
// > **NOTE:** One Classic and Internet load balancer, its master slave server group can add Classic and VPC ECS instances.
//
// > **NOTE:** One Classic and Intranet load balancer, its master slave server group can only add Classic ECS instances.
//
// > **NOTE:** One VPC load balancer, its master slave server group can only add the same VPC ECS instances.
//
// > **NOTE:** Available in 1.54.0+
//
// ## Block servers
//
// The servers mapping supports the following:
//
// * `serverIds` - (Required) A list backend server ID (ECS instance ID).
// * `port` - (Required) The port used by the backend server. Valid value range: [1-65535].
// * `weight` - (Optional) Weight of the backend server. Valid value range: [0-100]. Default to 100.
// * `type` - (Optional, Available in 1.51.0+) Type of the backend server. Valid value ecs, eni. Default to eni.
// * `serverType` - (Optional) The server type of the backend server. Valid value Master, Slave.
// * `isBackup` - (Removed from v1.63.0) Determine if the server is executing. Valid value 0, 1.
//
// ## Import
//
// Load balancer master slave server group can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:slb/masterSlaveServerGroup:MasterSlaveServerGroup example abc123456
// ```
type MasterSlaveServerGroup struct {
pulumi.CustomResourceState
// Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.
DeleteProtectionValidation pulumi.BoolPtrOutput `pulumi:"deleteProtectionValidation"`
// The Load Balancer ID which is used to launch a new master slave server group.
LoadBalancerId pulumi.StringOutput `pulumi:"loadBalancerId"`
// Name of the master slave server group.
Name pulumi.StringOutput `pulumi:"name"`
// A list of ECS instances to be added. Only two ECS instances can be supported in one resource. It contains six sub-fields as `Block server` follows.
Servers MasterSlaveServerGroupServerArrayOutput `pulumi:"servers"`
}
// NewMasterSlaveServerGroup registers a new resource with the given unique name, arguments, and options.
func NewMasterSlaveServerGroup(ctx *pulumi.Context,
name string, args *MasterSlaveServerGroupArgs, opts ...pulumi.ResourceOption) (*MasterSlaveServerGroup, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.LoadBalancerId == nil {
return nil, errors.New("invalid value for required argument 'LoadBalancerId'")
}
var resource MasterSlaveServerGroup
err := ctx.RegisterResource("alicloud:slb/masterSlaveServerGroup:MasterSlaveServerGroup", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetMasterSlaveServerGroup gets an existing MasterSlaveServerGroup 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 GetMasterSlaveServerGroup(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *MasterSlaveServerGroupState, opts ...pulumi.ResourceOption) (*MasterSlaveServerGroup, error) {
var resource MasterSlaveServerGroup
err := ctx.ReadResource("alicloud:slb/masterSlaveServerGroup:MasterSlaveServerGroup", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering MasterSlaveServerGroup resources.
type masterSlaveServerGroupState struct {
// Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.
DeleteProtectionValidation *bool `pulumi:"deleteProtectionValidation"`
// The Load Balancer ID which is used to launch a new master slave server group.
LoadBalancerId *string `pulumi:"loadBalancerId"`
// Name of the master slave server group.
Name *string `pulumi:"name"`
// A list of ECS instances to be added. Only two ECS instances can be supported in one resource. It contains six sub-fields as `Block server` follows.
Servers []MasterSlaveServerGroupServer `pulumi:"servers"`
}
type MasterSlaveServerGroupState struct {
// Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.
DeleteProtectionValidation pulumi.BoolPtrInput
// The Load Balancer ID which is used to launch a new master slave server group.
LoadBalancerId pulumi.StringPtrInput
// Name of the master slave server group.
Name pulumi.StringPtrInput
// A list of ECS instances to be added. Only two ECS instances can be supported in one resource. It contains six sub-fields as `Block server` follows.
Servers MasterSlaveServerGroupServerArrayInput
}
func (MasterSlaveServerGroupState) ElementType() reflect.Type {
return reflect.TypeOf((*masterSlaveServerGroupState)(nil)).Elem()
}
type masterSlaveServerGroupArgs struct {
// Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.
DeleteProtectionValidation *bool `pulumi:"deleteProtectionValidation"`
// The Load Balancer ID which is used to launch a new master slave server group.
LoadBalancerId string `pulumi:"loadBalancerId"`
// Name of the master slave server group.
Name *string `pulumi:"name"`
// A list of ECS instances to be added. Only two ECS instances can be supported in one resource. It contains six sub-fields as `Block server` follows.
Servers []MasterSlaveServerGroupServer `pulumi:"servers"`
}
// The set of arguments for constructing a MasterSlaveServerGroup resource.
type MasterSlaveServerGroupArgs struct {
// Checking DeleteProtection of SLB instance before deleting. If true, this resource will not be deleted when its SLB instance enabled DeleteProtection. Default to false.
DeleteProtectionValidation pulumi.BoolPtrInput
// The Load Balancer ID which is used to launch a new master slave server group.
LoadBalancerId pulumi.StringInput
// Name of the master slave server group.
Name pulumi.StringPtrInput
// A list of ECS instances to be added. Only two ECS instances can be supported in one resource. It contains six sub-fields as `Block server` follows.
Servers MasterSlaveServerGroupServerArrayInput
}
func (MasterSlaveServerGroupArgs) ElementType() reflect.Type {
return reflect.TypeOf((*masterSlaveServerGroupArgs)(nil)).Elem()
}
type MasterSlaveServerGroupInput interface {
pulumi.Input
ToMasterSlaveServerGroupOutput() MasterSlaveServerGroupOutput
ToMasterSlaveServerGroupOutputWithContext(ctx context.Context) MasterSlaveServerGroupOutput
}
func (*MasterSlaveServerGroup) ElementType() reflect.Type {
return reflect.TypeOf((*MasterSlaveServerGroup)(nil))
}
func (i *MasterSlaveServerGroup) ToMasterSlaveServerGroupOutput() MasterSlaveServerGroupOutput {
return i.ToMasterSlaveServerGroupOutputWithContext(context.Background())
}
func (i *MasterSlaveServerGroup) ToMasterSlaveServerGroupOutputWithContext(ctx context.Context) MasterSlaveServerGroupOutput {
return pulumi.ToOutputWithContext(ctx, i).(MasterSlaveServerGroupOutput)
}
func (i *MasterSlaveServerGroup) ToMasterSlaveServerGroupPtrOutput() MasterSlaveServerGroupPtrOutput {
return i.ToMasterSlaveServerGroupPtrOutputWithContext(context.Background())
}
func (i *MasterSlaveServerGroup) ToMasterSlaveServerGroupPtrOutputWithContext(ctx context.Context) MasterSlaveServerGroupPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(MasterSlaveServerGroupPtrOutput)
}
type MasterSlaveServerGroupPtrInput interface {
pulumi.Input
ToMasterSlaveServerGroupPtrOutput() MasterSlaveServerGroupPtrOutput
ToMasterSlaveServerGroupPtrOutputWithContext(ctx context.Context) MasterSlaveServerGroupPtrOutput
}
type masterSlaveServerGroupPtrType MasterSlaveServerGroupArgs
func (*masterSlaveServerGroupPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**MasterSlaveServerGroup)(nil))
}
func (i *masterSlaveServerGroupPtrType) ToMasterSlaveServerGroupPtrOutput() MasterSlaveServerGroupPtrOutput {
return i.ToMasterSlaveServerGroupPtrOutputWithContext(context.Background())
}
func (i *masterSlaveServerGroupPtrType) ToMasterSlaveServerGroupPtrOutputWithContext(ctx context.Context) MasterSlaveServerGroupPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(MasterSlaveServerGroupPtrOutput)
}
// MasterSlaveServerGroupArrayInput is an input type that accepts MasterSlaveServerGroupArray and MasterSlaveServerGroupArrayOutput values.
// You can construct a concrete instance of `MasterSlaveServerGroupArrayInput` via:
//
// MasterSlaveServerGroupArray{ MasterSlaveServerGroupArgs{...} }
type MasterSlaveServerGroupArrayInput interface {
pulumi.Input
ToMasterSlaveServerGroupArrayOutput() MasterSlaveServerGroupArrayOutput
ToMasterSlaveServerGroupArrayOutputWithContext(context.Context) MasterSlaveServerGroupArrayOutput
}
type MasterSlaveServerGroupArray []MasterSlaveServerGroupInput
func (MasterSlaveServerGroupArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*MasterSlaveServerGroup)(nil))
}
func (i MasterSlaveServerGroupArray) ToMasterSlaveServerGroupArrayOutput() MasterSlaveServerGroupArrayOutput {
return i.ToMasterSlaveServerGroupArrayOutputWithContext(context.Background())
}
func (i MasterSlaveServerGroupArray) ToMasterSlaveServerGroupArrayOutputWithContext(ctx context.Context) MasterSlaveServerGroupArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(MasterSlaveServerGroupArrayOutput)
}
// MasterSlaveServerGroupMapInput is an input type that accepts MasterSlaveServerGroupMap and MasterSlaveServerGroupMapOutput values.
// You can construct a concrete instance of `MasterSlaveServerGroupMapInput` via:
//
// MasterSlaveServerGroupMap{ "key": MasterSlaveServerGroupArgs{...} }
type MasterSlaveServerGroupMapInput interface {
pulumi.Input
ToMasterSlaveServerGroupMapOutput() MasterSlaveServerGroupMapOutput
ToMasterSlaveServerGroupMapOutputWithContext(context.Context) MasterSlaveServerGroupMapOutput
}
type MasterSlaveServerGroupMap map[string]MasterSlaveServerGroupInput
func (MasterSlaveServerGroupMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*MasterSlaveServerGroup)(nil))
}
func (i MasterSlaveServerGroupMap) ToMasterSlaveServerGroupMapOutput() MasterSlaveServerGroupMapOutput {
return i.ToMasterSlaveServerGroupMapOutputWithContext(context.Background())
}
func (i MasterSlaveServerGroupMap) ToMasterSlaveServerGroupMapOutputWithContext(ctx context.Context) MasterSlaveServerGroupMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(MasterSlaveServerGroupMapOutput)
}
type MasterSlaveServerGroupOutput struct {
*pulumi.OutputState
}
func (MasterSlaveServerGroupOutput) ElementType() reflect.Type {
return reflect.TypeOf((*MasterSlaveServerGroup)(nil))
}
func (o MasterSlaveServerGroupOutput) ToMasterSlaveServerGroupOutput() MasterSlaveServerGroupOutput {
return o
}
func (o MasterSlaveServerGroupOutput) ToMasterSlaveServerGroupOutputWithContext(ctx context.Context) MasterSlaveServerGroupOutput {
return o
}
func (o MasterSlaveServerGroupOutput) ToMasterSlaveServerGroupPtrOutput() MasterSlaveServerGroupPtrOutput {
return o.ToMasterSlaveServerGroupPtrOutputWithContext(context.Background())
}
func (o MasterSlaveServerGroupOutput) ToMasterSlaveServerGroupPtrOutputWithContext(ctx context.Context) MasterSlaveServerGroupPtrOutput {
return o.ApplyT(func(v MasterSlaveServerGroup) *MasterSlaveServerGroup {
return &v
}).(MasterSlaveServerGroupPtrOutput)
}
type MasterSlaveServerGroupPtrOutput struct {
*pulumi.OutputState
}
func (MasterSlaveServerGroupPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**MasterSlaveServerGroup)(nil))
}
func (o MasterSlaveServerGroupPtrOutput) ToMasterSlaveServerGroupPtrOutput() MasterSlaveServerGroupPtrOutput {
return o
}
func (o MasterSlaveServerGroupPtrOutput) ToMasterSlaveServerGroupPtrOutputWithContext(ctx context.Context) MasterSlaveServerGroupPtrOutput {
return o
}
type MasterSlaveServerGroupArrayOutput struct{ *pulumi.OutputState }
func (MasterSlaveServerGroupArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]MasterSlaveServerGroup)(nil))
}
func (o MasterSlaveServerGroupArrayOutput) ToMasterSlaveServerGroupArrayOutput() MasterSlaveServerGroupArrayOutput {
return o
}
func (o MasterSlaveServerGroupArrayOutput) ToMasterSlaveServerGroupArrayOutputWithContext(ctx context.Context) MasterSlaveServerGroupArrayOutput {
return o
}
func (o MasterSlaveServerGroupArrayOutput) Index(i pulumi.IntInput) MasterSlaveServerGroupOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) MasterSlaveServerGroup {
return vs[0].([]MasterSlaveServerGroup)[vs[1].(int)]
}).(MasterSlaveServerGroupOutput)
}
type MasterSlaveServerGroupMapOutput struct{ *pulumi.OutputState }
func (MasterSlaveServerGroupMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]MasterSlaveServerGroup)(nil))
}
func (o MasterSlaveServerGroupMapOutput) ToMasterSlaveServerGroupMapOutput() MasterSlaveServerGroupMapOutput {
return o
}
func (o MasterSlaveServerGroupMapOutput) ToMasterSlaveServerGroupMapOutputWithContext(ctx context.Context) MasterSlaveServerGroupMapOutput {
return o
}
func (o MasterSlaveServerGroupMapOutput) MapIndex(k pulumi.StringInput) MasterSlaveServerGroupOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) MasterSlaveServerGroup {
return vs[0].(map[string]MasterSlaveServerGroup)[vs[1].(string)]
}).(MasterSlaveServerGroupOutput)
}
func init() {
pulumi.RegisterOutputType(MasterSlaveServerGroupOutput{})
pulumi.RegisterOutputType(MasterSlaveServerGroupPtrOutput{})
pulumi.RegisterOutputType(MasterSlaveServerGroupArrayOutput{})
pulumi.RegisterOutputType(MasterSlaveServerGroupMapOutput{})
}