/
floatingIp.go
339 lines (288 loc) · 11.9 KB
/
floatingIp.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
// 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 compute
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a V2 floating IP resource within OpenStack Nova (compute)
// that can be used for compute instances.
//
// Please note that managing floating IPs through the OpenStack Compute API has
// been deprecated. Unless you are using an older OpenStack environment, it is
// recommended to use the `networking.FloatingIp`
// resource instead, which uses the OpenStack Networking API.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/compute"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := compute.NewFloatingIp(ctx, "floatip1", &compute.FloatingIpArgs{
// Pool: pulumi.String("public"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Floating IPs can be imported using the `id`, e.g.
//
// ```sh
// $ pulumi import openstack:compute/floatingIp:FloatingIp floatip_1 89c60255-9bd6-460c-822a-e2b959ede9d2
// ```
type FloatingIp struct {
pulumi.CustomResourceState
// The actual floating IP address itself.
Address pulumi.StringOutput `pulumi:"address"`
// The fixed IP address corresponding to the floating IP.
FixedIp pulumi.StringOutput `pulumi:"fixedIp"`
// UUID of the compute instance associated with the floating IP.
InstanceId pulumi.StringOutput `pulumi:"instanceId"`
// The name of the pool from which to obtain the floating
// IP. Changing this creates a new floating IP.
Pool pulumi.StringOutput `pulumi:"pool"`
// The region in which to obtain the V2 Compute client.
// A Compute client is needed to create a floating IP that can be used with
// a compute instance. If omitted, the `region` argument of the provider
// is used. Changing this creates a new floating IP (which may or may not
// have a different address).
Region pulumi.StringOutput `pulumi:"region"`
}
// NewFloatingIp registers a new resource with the given unique name, arguments, and options.
func NewFloatingIp(ctx *pulumi.Context,
name string, args *FloatingIpArgs, opts ...pulumi.ResourceOption) (*FloatingIp, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Pool == nil {
return nil, errors.New("invalid value for required argument 'Pool'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource FloatingIp
err := ctx.RegisterResource("openstack:compute/floatingIp:FloatingIp", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetFloatingIp gets an existing FloatingIp 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 GetFloatingIp(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *FloatingIpState, opts ...pulumi.ResourceOption) (*FloatingIp, error) {
var resource FloatingIp
err := ctx.ReadResource("openstack:compute/floatingIp:FloatingIp", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering FloatingIp resources.
type floatingIpState struct {
// The actual floating IP address itself.
Address *string `pulumi:"address"`
// The fixed IP address corresponding to the floating IP.
FixedIp *string `pulumi:"fixedIp"`
// UUID of the compute instance associated with the floating IP.
InstanceId *string `pulumi:"instanceId"`
// The name of the pool from which to obtain the floating
// IP. Changing this creates a new floating IP.
Pool *string `pulumi:"pool"`
// The region in which to obtain the V2 Compute client.
// A Compute client is needed to create a floating IP that can be used with
// a compute instance. If omitted, the `region` argument of the provider
// is used. Changing this creates a new floating IP (which may or may not
// have a different address).
Region *string `pulumi:"region"`
}
type FloatingIpState struct {
// The actual floating IP address itself.
Address pulumi.StringPtrInput
// The fixed IP address corresponding to the floating IP.
FixedIp pulumi.StringPtrInput
// UUID of the compute instance associated with the floating IP.
InstanceId pulumi.StringPtrInput
// The name of the pool from which to obtain the floating
// IP. Changing this creates a new floating IP.
Pool pulumi.StringPtrInput
// The region in which to obtain the V2 Compute client.
// A Compute client is needed to create a floating IP that can be used with
// a compute instance. If omitted, the `region` argument of the provider
// is used. Changing this creates a new floating IP (which may or may not
// have a different address).
Region pulumi.StringPtrInput
}
func (FloatingIpState) ElementType() reflect.Type {
return reflect.TypeOf((*floatingIpState)(nil)).Elem()
}
type floatingIpArgs struct {
// The name of the pool from which to obtain the floating
// IP. Changing this creates a new floating IP.
Pool string `pulumi:"pool"`
// The region in which to obtain the V2 Compute client.
// A Compute client is needed to create a floating IP that can be used with
// a compute instance. If omitted, the `region` argument of the provider
// is used. Changing this creates a new floating IP (which may or may not
// have a different address).
Region *string `pulumi:"region"`
}
// The set of arguments for constructing a FloatingIp resource.
type FloatingIpArgs struct {
// The name of the pool from which to obtain the floating
// IP. Changing this creates a new floating IP.
Pool pulumi.StringInput
// The region in which to obtain the V2 Compute client.
// A Compute client is needed to create a floating IP that can be used with
// a compute instance. If omitted, the `region` argument of the provider
// is used. Changing this creates a new floating IP (which may or may not
// have a different address).
Region pulumi.StringPtrInput
}
func (FloatingIpArgs) ElementType() reflect.Type {
return reflect.TypeOf((*floatingIpArgs)(nil)).Elem()
}
type FloatingIpInput interface {
pulumi.Input
ToFloatingIpOutput() FloatingIpOutput
ToFloatingIpOutputWithContext(ctx context.Context) FloatingIpOutput
}
func (*FloatingIp) ElementType() reflect.Type {
return reflect.TypeOf((**FloatingIp)(nil)).Elem()
}
func (i *FloatingIp) ToFloatingIpOutput() FloatingIpOutput {
return i.ToFloatingIpOutputWithContext(context.Background())
}
func (i *FloatingIp) ToFloatingIpOutputWithContext(ctx context.Context) FloatingIpOutput {
return pulumi.ToOutputWithContext(ctx, i).(FloatingIpOutput)
}
// FloatingIpArrayInput is an input type that accepts FloatingIpArray and FloatingIpArrayOutput values.
// You can construct a concrete instance of `FloatingIpArrayInput` via:
//
// FloatingIpArray{ FloatingIpArgs{...} }
type FloatingIpArrayInput interface {
pulumi.Input
ToFloatingIpArrayOutput() FloatingIpArrayOutput
ToFloatingIpArrayOutputWithContext(context.Context) FloatingIpArrayOutput
}
type FloatingIpArray []FloatingIpInput
func (FloatingIpArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*FloatingIp)(nil)).Elem()
}
func (i FloatingIpArray) ToFloatingIpArrayOutput() FloatingIpArrayOutput {
return i.ToFloatingIpArrayOutputWithContext(context.Background())
}
func (i FloatingIpArray) ToFloatingIpArrayOutputWithContext(ctx context.Context) FloatingIpArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(FloatingIpArrayOutput)
}
// FloatingIpMapInput is an input type that accepts FloatingIpMap and FloatingIpMapOutput values.
// You can construct a concrete instance of `FloatingIpMapInput` via:
//
// FloatingIpMap{ "key": FloatingIpArgs{...} }
type FloatingIpMapInput interface {
pulumi.Input
ToFloatingIpMapOutput() FloatingIpMapOutput
ToFloatingIpMapOutputWithContext(context.Context) FloatingIpMapOutput
}
type FloatingIpMap map[string]FloatingIpInput
func (FloatingIpMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*FloatingIp)(nil)).Elem()
}
func (i FloatingIpMap) ToFloatingIpMapOutput() FloatingIpMapOutput {
return i.ToFloatingIpMapOutputWithContext(context.Background())
}
func (i FloatingIpMap) ToFloatingIpMapOutputWithContext(ctx context.Context) FloatingIpMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(FloatingIpMapOutput)
}
type FloatingIpOutput struct{ *pulumi.OutputState }
func (FloatingIpOutput) ElementType() reflect.Type {
return reflect.TypeOf((**FloatingIp)(nil)).Elem()
}
func (o FloatingIpOutput) ToFloatingIpOutput() FloatingIpOutput {
return o
}
func (o FloatingIpOutput) ToFloatingIpOutputWithContext(ctx context.Context) FloatingIpOutput {
return o
}
// The actual floating IP address itself.
func (o FloatingIpOutput) Address() pulumi.StringOutput {
return o.ApplyT(func(v *FloatingIp) pulumi.StringOutput { return v.Address }).(pulumi.StringOutput)
}
// The fixed IP address corresponding to the floating IP.
func (o FloatingIpOutput) FixedIp() pulumi.StringOutput {
return o.ApplyT(func(v *FloatingIp) pulumi.StringOutput { return v.FixedIp }).(pulumi.StringOutput)
}
// UUID of the compute instance associated with the floating IP.
func (o FloatingIpOutput) InstanceId() pulumi.StringOutput {
return o.ApplyT(func(v *FloatingIp) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)
}
// The name of the pool from which to obtain the floating
// IP. Changing this creates a new floating IP.
func (o FloatingIpOutput) Pool() pulumi.StringOutput {
return o.ApplyT(func(v *FloatingIp) pulumi.StringOutput { return v.Pool }).(pulumi.StringOutput)
}
// The region in which to obtain the V2 Compute client.
// A Compute client is needed to create a floating IP that can be used with
// a compute instance. If omitted, the `region` argument of the provider
// is used. Changing this creates a new floating IP (which may or may not
// have a different address).
func (o FloatingIpOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v *FloatingIp) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)
}
type FloatingIpArrayOutput struct{ *pulumi.OutputState }
func (FloatingIpArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*FloatingIp)(nil)).Elem()
}
func (o FloatingIpArrayOutput) ToFloatingIpArrayOutput() FloatingIpArrayOutput {
return o
}
func (o FloatingIpArrayOutput) ToFloatingIpArrayOutputWithContext(ctx context.Context) FloatingIpArrayOutput {
return o
}
func (o FloatingIpArrayOutput) Index(i pulumi.IntInput) FloatingIpOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *FloatingIp {
return vs[0].([]*FloatingIp)[vs[1].(int)]
}).(FloatingIpOutput)
}
type FloatingIpMapOutput struct{ *pulumi.OutputState }
func (FloatingIpMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*FloatingIp)(nil)).Elem()
}
func (o FloatingIpMapOutput) ToFloatingIpMapOutput() FloatingIpMapOutput {
return o
}
func (o FloatingIpMapOutput) ToFloatingIpMapOutputWithContext(ctx context.Context) FloatingIpMapOutput {
return o
}
func (o FloatingIpMapOutput) MapIndex(k pulumi.StringInput) FloatingIpOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *FloatingIp {
return vs[0].(map[string]*FloatingIp)[vs[1].(string)]
}).(FloatingIpOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*FloatingIpInput)(nil)).Elem(), &FloatingIp{})
pulumi.RegisterInputType(reflect.TypeOf((*FloatingIpArrayInput)(nil)).Elem(), FloatingIpArray{})
pulumi.RegisterInputType(reflect.TypeOf((*FloatingIpMapInput)(nil)).Elem(), FloatingIpMap{})
pulumi.RegisterOutputType(FloatingIpOutput{})
pulumi.RegisterOutputType(FloatingIpArrayOutput{})
pulumi.RegisterOutputType(FloatingIpMapOutput{})
}