/
eip.go
366 lines (306 loc) · 15.1 KB
/
eip.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
// *** 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 ecs
import (
"context"
"reflect"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// ## Import
//
// Elastic IP address can be imported using the id, e.g.
//
// ```sh
// $ pulumi import alicloud:ecs/eip:Eip example eip-abc12345678
// ```
type Eip struct {
pulumi.CustomResourceState
// Maximum bandwidth to the elastic public network, measured in Mbps (Mega bit per second). If this value is not specified, then automatically sets it to 5 Mbps.
Bandwidth pulumi.IntPtrOutput `pulumi:"bandwidth"`
// Description of the EIP instance, This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description pulumi.StringPtrOutput `pulumi:"description"`
// Elastic IP instance charge type. Valid values are "PrePaid" and "PostPaid". Default to "PostPaid".
InstanceChargeType pulumi.StringPtrOutput `pulumi:"instanceChargeType"`
// Internet charge type of the EIP, Valid values are `PayByBandwidth`, `PayByTraffic`. Default to `PayByBandwidth`. From version `1.7.1`, default to `PayByTraffic`. It is only PayByBandwidth when `instanceChargeType` is PrePaid.
InternetChargeType pulumi.StringPtrOutput `pulumi:"internetChargeType"`
// The elastic ip address
IpAddress pulumi.StringOutput `pulumi:"ipAddress"`
// The line type of the Elastic IP instance. Default to `BGP`. Other type of the isp need to open a whitelist.
Isp pulumi.StringOutput `pulumi:"isp"`
// The name of the EIP instance. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin or end with a hyphen, and must not begin with http:// or https://.
Name pulumi.StringOutput `pulumi:"name"`
// The duration that you will buy the resource, in month. It is valid when `instanceChargeType` is `PrePaid`.
// Default to 1. Valid values: [1-9, 12, 24, 36]. At present, the provider does not support modify "period" and you can do that via web console.
Period pulumi.IntPtrOutput `pulumi:"period"`
// The Id of resource group which the eip belongs.
ResourceGroupId pulumi.StringOutput `pulumi:"resourceGroupId"`
// The EIP current status.
Status pulumi.StringOutput `pulumi:"status"`
// A mapping of tags to assign to the resource.
Tags pulumi.MapOutput `pulumi:"tags"`
}
// NewEip registers a new resource with the given unique name, arguments, and options.
func NewEip(ctx *pulumi.Context,
name string, args *EipArgs, opts ...pulumi.ResourceOption) (*Eip, error) {
if args == nil {
args = &EipArgs{}
}
var resource Eip
err := ctx.RegisterResource("alicloud:ecs/eip:Eip", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetEip gets an existing Eip 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 GetEip(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *EipState, opts ...pulumi.ResourceOption) (*Eip, error) {
var resource Eip
err := ctx.ReadResource("alicloud:ecs/eip:Eip", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Eip resources.
type eipState struct {
// Maximum bandwidth to the elastic public network, measured in Mbps (Mega bit per second). If this value is not specified, then automatically sets it to 5 Mbps.
Bandwidth *int `pulumi:"bandwidth"`
// Description of the EIP instance, This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description *string `pulumi:"description"`
// Elastic IP instance charge type. Valid values are "PrePaid" and "PostPaid". Default to "PostPaid".
InstanceChargeType *string `pulumi:"instanceChargeType"`
// Internet charge type of the EIP, Valid values are `PayByBandwidth`, `PayByTraffic`. Default to `PayByBandwidth`. From version `1.7.1`, default to `PayByTraffic`. It is only PayByBandwidth when `instanceChargeType` is PrePaid.
InternetChargeType *string `pulumi:"internetChargeType"`
// The elastic ip address
IpAddress *string `pulumi:"ipAddress"`
// The line type of the Elastic IP instance. Default to `BGP`. Other type of the isp need to open a whitelist.
Isp *string `pulumi:"isp"`
// The name of the EIP instance. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin or end with a hyphen, and must not begin with http:// or https://.
Name *string `pulumi:"name"`
// The duration that you will buy the resource, in month. It is valid when `instanceChargeType` is `PrePaid`.
// Default to 1. Valid values: [1-9, 12, 24, 36]. At present, the provider does not support modify "period" and you can do that via web console.
Period *int `pulumi:"period"`
// The Id of resource group which the eip belongs.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// The EIP current status.
Status *string `pulumi:"status"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
}
type EipState struct {
// Maximum bandwidth to the elastic public network, measured in Mbps (Mega bit per second). If this value is not specified, then automatically sets it to 5 Mbps.
Bandwidth pulumi.IntPtrInput
// Description of the EIP instance, This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description pulumi.StringPtrInput
// Elastic IP instance charge type. Valid values are "PrePaid" and "PostPaid". Default to "PostPaid".
InstanceChargeType pulumi.StringPtrInput
// Internet charge type of the EIP, Valid values are `PayByBandwidth`, `PayByTraffic`. Default to `PayByBandwidth`. From version `1.7.1`, default to `PayByTraffic`. It is only PayByBandwidth when `instanceChargeType` is PrePaid.
InternetChargeType pulumi.StringPtrInput
// The elastic ip address
IpAddress pulumi.StringPtrInput
// The line type of the Elastic IP instance. Default to `BGP`. Other type of the isp need to open a whitelist.
Isp pulumi.StringPtrInput
// The name of the EIP instance. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin or end with a hyphen, and must not begin with http:// or https://.
Name pulumi.StringPtrInput
// The duration that you will buy the resource, in month. It is valid when `instanceChargeType` is `PrePaid`.
// Default to 1. Valid values: [1-9, 12, 24, 36]. At present, the provider does not support modify "period" and you can do that via web console.
Period pulumi.IntPtrInput
// The Id of resource group which the eip belongs.
ResourceGroupId pulumi.StringPtrInput
// The EIP current status.
Status pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
}
func (EipState) ElementType() reflect.Type {
return reflect.TypeOf((*eipState)(nil)).Elem()
}
type eipArgs struct {
// Maximum bandwidth to the elastic public network, measured in Mbps (Mega bit per second). If this value is not specified, then automatically sets it to 5 Mbps.
Bandwidth *int `pulumi:"bandwidth"`
// Description of the EIP instance, This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description *string `pulumi:"description"`
// Elastic IP instance charge type. Valid values are "PrePaid" and "PostPaid". Default to "PostPaid".
InstanceChargeType *string `pulumi:"instanceChargeType"`
// Internet charge type of the EIP, Valid values are `PayByBandwidth`, `PayByTraffic`. Default to `PayByBandwidth`. From version `1.7.1`, default to `PayByTraffic`. It is only PayByBandwidth when `instanceChargeType` is PrePaid.
InternetChargeType *string `pulumi:"internetChargeType"`
// The line type of the Elastic IP instance. Default to `BGP`. Other type of the isp need to open a whitelist.
Isp *string `pulumi:"isp"`
// The name of the EIP instance. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin or end with a hyphen, and must not begin with http:// or https://.
Name *string `pulumi:"name"`
// The duration that you will buy the resource, in month. It is valid when `instanceChargeType` is `PrePaid`.
// Default to 1. Valid values: [1-9, 12, 24, 36]. At present, the provider does not support modify "period" and you can do that via web console.
Period *int `pulumi:"period"`
// The Id of resource group which the eip belongs.
ResourceGroupId *string `pulumi:"resourceGroupId"`
// A mapping of tags to assign to the resource.
Tags map[string]interface{} `pulumi:"tags"`
}
// The set of arguments for constructing a Eip resource.
type EipArgs struct {
// Maximum bandwidth to the elastic public network, measured in Mbps (Mega bit per second). If this value is not specified, then automatically sets it to 5 Mbps.
Bandwidth pulumi.IntPtrInput
// Description of the EIP instance, This description can have a string of 2 to 256 characters, It cannot begin with http:// or https://. Default value is null.
Description pulumi.StringPtrInput
// Elastic IP instance charge type. Valid values are "PrePaid" and "PostPaid". Default to "PostPaid".
InstanceChargeType pulumi.StringPtrInput
// Internet charge type of the EIP, Valid values are `PayByBandwidth`, `PayByTraffic`. Default to `PayByBandwidth`. From version `1.7.1`, default to `PayByTraffic`. It is only PayByBandwidth when `instanceChargeType` is PrePaid.
InternetChargeType pulumi.StringPtrInput
// The line type of the Elastic IP instance. Default to `BGP`. Other type of the isp need to open a whitelist.
Isp pulumi.StringPtrInput
// The name of the EIP instance. This name can have a string of 2 to 128 characters, must contain only alphanumeric characters or hyphens, such as "-",".","_", and must not begin or end with a hyphen, and must not begin with http:// or https://.
Name pulumi.StringPtrInput
// The duration that you will buy the resource, in month. It is valid when `instanceChargeType` is `PrePaid`.
// Default to 1. Valid values: [1-9, 12, 24, 36]. At present, the provider does not support modify "period" and you can do that via web console.
Period pulumi.IntPtrInput
// The Id of resource group which the eip belongs.
ResourceGroupId pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.MapInput
}
func (EipArgs) ElementType() reflect.Type {
return reflect.TypeOf((*eipArgs)(nil)).Elem()
}
type EipInput interface {
pulumi.Input
ToEipOutput() EipOutput
ToEipOutputWithContext(ctx context.Context) EipOutput
}
func (*Eip) ElementType() reflect.Type {
return reflect.TypeOf((*Eip)(nil))
}
func (i *Eip) ToEipOutput() EipOutput {
return i.ToEipOutputWithContext(context.Background())
}
func (i *Eip) ToEipOutputWithContext(ctx context.Context) EipOutput {
return pulumi.ToOutputWithContext(ctx, i).(EipOutput)
}
func (i *Eip) ToEipPtrOutput() EipPtrOutput {
return i.ToEipPtrOutputWithContext(context.Background())
}
func (i *Eip) ToEipPtrOutputWithContext(ctx context.Context) EipPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(EipPtrOutput)
}
type EipPtrInput interface {
pulumi.Input
ToEipPtrOutput() EipPtrOutput
ToEipPtrOutputWithContext(ctx context.Context) EipPtrOutput
}
type eipPtrType EipArgs
func (*eipPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Eip)(nil))
}
func (i *eipPtrType) ToEipPtrOutput() EipPtrOutput {
return i.ToEipPtrOutputWithContext(context.Background())
}
func (i *eipPtrType) ToEipPtrOutputWithContext(ctx context.Context) EipPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(EipPtrOutput)
}
// EipArrayInput is an input type that accepts EipArray and EipArrayOutput values.
// You can construct a concrete instance of `EipArrayInput` via:
//
// EipArray{ EipArgs{...} }
type EipArrayInput interface {
pulumi.Input
ToEipArrayOutput() EipArrayOutput
ToEipArrayOutputWithContext(context.Context) EipArrayOutput
}
type EipArray []EipInput
func (EipArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*Eip)(nil))
}
func (i EipArray) ToEipArrayOutput() EipArrayOutput {
return i.ToEipArrayOutputWithContext(context.Background())
}
func (i EipArray) ToEipArrayOutputWithContext(ctx context.Context) EipArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(EipArrayOutput)
}
// EipMapInput is an input type that accepts EipMap and EipMapOutput values.
// You can construct a concrete instance of `EipMapInput` via:
//
// EipMap{ "key": EipArgs{...} }
type EipMapInput interface {
pulumi.Input
ToEipMapOutput() EipMapOutput
ToEipMapOutputWithContext(context.Context) EipMapOutput
}
type EipMap map[string]EipInput
func (EipMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*Eip)(nil))
}
func (i EipMap) ToEipMapOutput() EipMapOutput {
return i.ToEipMapOutputWithContext(context.Background())
}
func (i EipMap) ToEipMapOutputWithContext(ctx context.Context) EipMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(EipMapOutput)
}
type EipOutput struct {
*pulumi.OutputState
}
func (EipOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Eip)(nil))
}
func (o EipOutput) ToEipOutput() EipOutput {
return o
}
func (o EipOutput) ToEipOutputWithContext(ctx context.Context) EipOutput {
return o
}
func (o EipOutput) ToEipPtrOutput() EipPtrOutput {
return o.ToEipPtrOutputWithContext(context.Background())
}
func (o EipOutput) ToEipPtrOutputWithContext(ctx context.Context) EipPtrOutput {
return o.ApplyT(func(v Eip) *Eip {
return &v
}).(EipPtrOutput)
}
type EipPtrOutput struct {
*pulumi.OutputState
}
func (EipPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Eip)(nil))
}
func (o EipPtrOutput) ToEipPtrOutput() EipPtrOutput {
return o
}
func (o EipPtrOutput) ToEipPtrOutputWithContext(ctx context.Context) EipPtrOutput {
return o
}
type EipArrayOutput struct{ *pulumi.OutputState }
func (EipArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Eip)(nil))
}
func (o EipArrayOutput) ToEipArrayOutput() EipArrayOutput {
return o
}
func (o EipArrayOutput) ToEipArrayOutputWithContext(ctx context.Context) EipArrayOutput {
return o
}
func (o EipArrayOutput) Index(i pulumi.IntInput) EipOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Eip {
return vs[0].([]Eip)[vs[1].(int)]
}).(EipOutput)
}
type EipMapOutput struct{ *pulumi.OutputState }
func (EipMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Eip)(nil))
}
func (o EipMapOutput) ToEipMapOutput() EipMapOutput {
return o
}
func (o EipMapOutput) ToEipMapOutputWithContext(ctx context.Context) EipMapOutput {
return o
}
func (o EipMapOutput) MapIndex(k pulumi.StringInput) EipOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Eip {
return vs[0].(map[string]Eip)[vs[1].(string)]
}).(EipOutput)
}
func init() {
pulumi.RegisterOutputType(EipOutput{})
pulumi.RegisterOutputType(EipPtrOutput{})
pulumi.RegisterOutputType(EipArrayOutput{})
pulumi.RegisterOutputType(EipMapOutput{})
}