/
refresh.go
297 lines (249 loc) · 9.2 KB
/
refresh.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
// 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 iploadbalancing
import (
"context"
"reflect"
"errors"
"github.com/ovh/pulumi-ovh/sdk/go/ovh/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Applies changes from other `ovh_iploadbalancing_*` resources to the production configuration of loadbalancers.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/ovh/pulumi-ovh/sdk/go/ovh/IpLoadBalancing"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// lb, err := IpLoadBalancing.GetIpLoadBalancing(ctx, &iploadbalancing.GetIpLoadBalancingArgs{
// ServiceName: pulumi.StringRef("ip-1.2.3.4"),
// State: pulumi.StringRef("ok"),
// }, nil);
// if err != nil {
// return err
// }
// farmname, err := IpLoadBalancing.NewTcpFarm(ctx, "farmname", &IpLoadBalancing.TcpFarmArgs{
// Port: pulumi.Int(8080),
// ServiceName: pulumi.String(lb.ServiceName),
// Zone: pulumi.String("all"),
// })
// if err != nil {
// return err
// }
// backend, err := IpLoadBalancing.NewTcpFarmServer(ctx, "backend", &IpLoadBalancing.TcpFarmServerArgs{
// Address: pulumi.String("4.5.6.7"),
// Backup: pulumi.Bool(true),
// DisplayName: pulumi.String("mybackend"),
// FarmId: farmname.ID(),
// Port: pulumi.Int(80),
// Probe: pulumi.Bool(true),
// ProxyProtocolVersion: pulumi.String("v2"),
// ServiceName: pulumi.String(lb.ServiceName),
// Ssl: pulumi.Bool(false),
// Status: pulumi.String("active"),
// Weight: pulumi.Int(2),
// })
// if err != nil {
// return err
// }
// _, err = IpLoadBalancing.NewRefresh(ctx, "mylb", &IpLoadBalancing.RefreshArgs{
// Keepers: pulumi.StringArray{
// %!v(PANIC=Format method: fatal: A failure has occurred: unlowered splat expression @ #-resources-ovh:IpLoadBalancing-refresh:Refresh.pp:23,16-35),
// },
// ServiceName: pulumi.String(lb.ServiceName),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// <!--End PulumiCodeChooser -->
type Refresh struct {
pulumi.CustomResourceState
// List of values tracked to trigger refresh, used also to form implicit dependencies
Keepers pulumi.StringArrayOutput `pulumi:"keepers"`
// The internal name of your IP load balancing
ServiceName pulumi.StringOutput `pulumi:"serviceName"`
}
// NewRefresh registers a new resource with the given unique name, arguments, and options.
func NewRefresh(ctx *pulumi.Context,
name string, args *RefreshArgs, opts ...pulumi.ResourceOption) (*Refresh, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Keepers == nil {
return nil, errors.New("invalid value for required argument 'Keepers'")
}
if args.ServiceName == nil {
return nil, errors.New("invalid value for required argument 'ServiceName'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Refresh
err := ctx.RegisterResource("ovh:IpLoadBalancing/refresh:Refresh", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetRefresh gets an existing Refresh 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 GetRefresh(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *RefreshState, opts ...pulumi.ResourceOption) (*Refresh, error) {
var resource Refresh
err := ctx.ReadResource("ovh:IpLoadBalancing/refresh:Refresh", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Refresh resources.
type refreshState struct {
// List of values tracked to trigger refresh, used also to form implicit dependencies
Keepers []string `pulumi:"keepers"`
// The internal name of your IP load balancing
ServiceName *string `pulumi:"serviceName"`
}
type RefreshState struct {
// List of values tracked to trigger refresh, used also to form implicit dependencies
Keepers pulumi.StringArrayInput
// The internal name of your IP load balancing
ServiceName pulumi.StringPtrInput
}
func (RefreshState) ElementType() reflect.Type {
return reflect.TypeOf((*refreshState)(nil)).Elem()
}
type refreshArgs struct {
// List of values tracked to trigger refresh, used also to form implicit dependencies
Keepers []string `pulumi:"keepers"`
// The internal name of your IP load balancing
ServiceName string `pulumi:"serviceName"`
}
// The set of arguments for constructing a Refresh resource.
type RefreshArgs struct {
// List of values tracked to trigger refresh, used also to form implicit dependencies
Keepers pulumi.StringArrayInput
// The internal name of your IP load balancing
ServiceName pulumi.StringInput
}
func (RefreshArgs) ElementType() reflect.Type {
return reflect.TypeOf((*refreshArgs)(nil)).Elem()
}
type RefreshInput interface {
pulumi.Input
ToRefreshOutput() RefreshOutput
ToRefreshOutputWithContext(ctx context.Context) RefreshOutput
}
func (*Refresh) ElementType() reflect.Type {
return reflect.TypeOf((**Refresh)(nil)).Elem()
}
func (i *Refresh) ToRefreshOutput() RefreshOutput {
return i.ToRefreshOutputWithContext(context.Background())
}
func (i *Refresh) ToRefreshOutputWithContext(ctx context.Context) RefreshOutput {
return pulumi.ToOutputWithContext(ctx, i).(RefreshOutput)
}
// RefreshArrayInput is an input type that accepts RefreshArray and RefreshArrayOutput values.
// You can construct a concrete instance of `RefreshArrayInput` via:
//
// RefreshArray{ RefreshArgs{...} }
type RefreshArrayInput interface {
pulumi.Input
ToRefreshArrayOutput() RefreshArrayOutput
ToRefreshArrayOutputWithContext(context.Context) RefreshArrayOutput
}
type RefreshArray []RefreshInput
func (RefreshArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Refresh)(nil)).Elem()
}
func (i RefreshArray) ToRefreshArrayOutput() RefreshArrayOutput {
return i.ToRefreshArrayOutputWithContext(context.Background())
}
func (i RefreshArray) ToRefreshArrayOutputWithContext(ctx context.Context) RefreshArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(RefreshArrayOutput)
}
// RefreshMapInput is an input type that accepts RefreshMap and RefreshMapOutput values.
// You can construct a concrete instance of `RefreshMapInput` via:
//
// RefreshMap{ "key": RefreshArgs{...} }
type RefreshMapInput interface {
pulumi.Input
ToRefreshMapOutput() RefreshMapOutput
ToRefreshMapOutputWithContext(context.Context) RefreshMapOutput
}
type RefreshMap map[string]RefreshInput
func (RefreshMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Refresh)(nil)).Elem()
}
func (i RefreshMap) ToRefreshMapOutput() RefreshMapOutput {
return i.ToRefreshMapOutputWithContext(context.Background())
}
func (i RefreshMap) ToRefreshMapOutputWithContext(ctx context.Context) RefreshMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(RefreshMapOutput)
}
type RefreshOutput struct{ *pulumi.OutputState }
func (RefreshOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Refresh)(nil)).Elem()
}
func (o RefreshOutput) ToRefreshOutput() RefreshOutput {
return o
}
func (o RefreshOutput) ToRefreshOutputWithContext(ctx context.Context) RefreshOutput {
return o
}
// List of values tracked to trigger refresh, used also to form implicit dependencies
func (o RefreshOutput) Keepers() pulumi.StringArrayOutput {
return o.ApplyT(func(v *Refresh) pulumi.StringArrayOutput { return v.Keepers }).(pulumi.StringArrayOutput)
}
// The internal name of your IP load balancing
func (o RefreshOutput) ServiceName() pulumi.StringOutput {
return o.ApplyT(func(v *Refresh) pulumi.StringOutput { return v.ServiceName }).(pulumi.StringOutput)
}
type RefreshArrayOutput struct{ *pulumi.OutputState }
func (RefreshArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Refresh)(nil)).Elem()
}
func (o RefreshArrayOutput) ToRefreshArrayOutput() RefreshArrayOutput {
return o
}
func (o RefreshArrayOutput) ToRefreshArrayOutputWithContext(ctx context.Context) RefreshArrayOutput {
return o
}
func (o RefreshArrayOutput) Index(i pulumi.IntInput) RefreshOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Refresh {
return vs[0].([]*Refresh)[vs[1].(int)]
}).(RefreshOutput)
}
type RefreshMapOutput struct{ *pulumi.OutputState }
func (RefreshMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Refresh)(nil)).Elem()
}
func (o RefreshMapOutput) ToRefreshMapOutput() RefreshMapOutput {
return o
}
func (o RefreshMapOutput) ToRefreshMapOutputWithContext(ctx context.Context) RefreshMapOutput {
return o
}
func (o RefreshMapOutput) MapIndex(k pulumi.StringInput) RefreshOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Refresh {
return vs[0].(map[string]*Refresh)[vs[1].(string)]
}).(RefreshOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*RefreshInput)(nil)).Elem(), &Refresh{})
pulumi.RegisterInputType(reflect.TypeOf((*RefreshArrayInput)(nil)).Elem(), RefreshArray{})
pulumi.RegisterInputType(reflect.TypeOf((*RefreshMapInput)(nil)).Elem(), RefreshMap{})
pulumi.RegisterOutputType(RefreshOutput{})
pulumi.RegisterOutputType(RefreshArrayOutput{})
pulumi.RegisterOutputType(RefreshMapOutput{})
}