This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
generated from pulumi/pulumi-tf-provider-boilerplate
/
httpRoute.go
339 lines (286 loc) · 11.7 KB
/
httpRoute.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 iploadbalancing
import (
"context"
"reflect"
"errors"
"github.com/lbrlabs/pulumi-ovh/sdk/go/ovh/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manage HTTP route for a loadbalancer service
//
// ## Example Usage
//
// Route which redirect all url to https.
//
// ```go
// package main
//
// import (
//
// "github.com/lbrlabs/pulumi-ovh/sdk/go/ovh/IpLoadBalancing"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := IpLoadBalancing.NewHttpRoute(ctx, "httpsredirect", &IpLoadBalancing.HttpRouteArgs{
// Action: &iploadbalancing.HttpRouteActionArgs{
// Status: pulumi.Int(302),
// Target: pulumi.String("https://${host}${path}${arguments}"),
// Type: pulumi.String("redirect"),
// },
// DisplayName: pulumi.String("Redirect to HTTPS"),
// ServiceName: pulumi.String("loadbalancer-xxxxxxxxxxxxxxxxxx"),
// Weight: pulumi.Int(1),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
type HttpRoute struct {
pulumi.CustomResourceState
// Action triggered when all rules match
Action HttpRouteActionOutput `pulumi:"action"`
// Human readable name for your route, this field is for you
DisplayName pulumi.StringPtrOutput `pulumi:"displayName"`
// Route traffic for this frontend
FrontendId pulumi.IntOutput `pulumi:"frontendId"`
// List of rules to match to trigger action
Rules HttpRouteRuleTypeArrayOutput `pulumi:"rules"`
// The internal name of your IP load balancing
ServiceName pulumi.StringOutput `pulumi:"serviceName"`
// HTTP status code for "redirect" and "reject" actions
Status pulumi.StringOutput `pulumi:"status"`
// Route priority ([0..255]). 0 if null. Highest priority routes are evaluated first. Only the first matching route will trigger an action
Weight pulumi.IntOutput `pulumi:"weight"`
}
// NewHttpRoute registers a new resource with the given unique name, arguments, and options.
func NewHttpRoute(ctx *pulumi.Context,
name string, args *HttpRouteArgs, opts ...pulumi.ResourceOption) (*HttpRoute, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Action == nil {
return nil, errors.New("invalid value for required argument 'Action'")
}
if args.ServiceName == nil {
return nil, errors.New("invalid value for required argument 'ServiceName'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource HttpRoute
err := ctx.RegisterResource("ovh:IpLoadBalancing/httpRoute:HttpRoute", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetHttpRoute gets an existing HttpRoute 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 GetHttpRoute(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *HttpRouteState, opts ...pulumi.ResourceOption) (*HttpRoute, error) {
var resource HttpRoute
err := ctx.ReadResource("ovh:IpLoadBalancing/httpRoute:HttpRoute", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering HttpRoute resources.
type httpRouteState struct {
// Action triggered when all rules match
Action *HttpRouteAction `pulumi:"action"`
// Human readable name for your route, this field is for you
DisplayName *string `pulumi:"displayName"`
// Route traffic for this frontend
FrontendId *int `pulumi:"frontendId"`
// List of rules to match to trigger action
Rules []HttpRouteRuleType `pulumi:"rules"`
// The internal name of your IP load balancing
ServiceName *string `pulumi:"serviceName"`
// HTTP status code for "redirect" and "reject" actions
Status *string `pulumi:"status"`
// Route priority ([0..255]). 0 if null. Highest priority routes are evaluated first. Only the first matching route will trigger an action
Weight *int `pulumi:"weight"`
}
type HttpRouteState struct {
// Action triggered when all rules match
Action HttpRouteActionPtrInput
// Human readable name for your route, this field is for you
DisplayName pulumi.StringPtrInput
// Route traffic for this frontend
FrontendId pulumi.IntPtrInput
// List of rules to match to trigger action
Rules HttpRouteRuleTypeArrayInput
// The internal name of your IP load balancing
ServiceName pulumi.StringPtrInput
// HTTP status code for "redirect" and "reject" actions
Status pulumi.StringPtrInput
// Route priority ([0..255]). 0 if null. Highest priority routes are evaluated first. Only the first matching route will trigger an action
Weight pulumi.IntPtrInput
}
func (HttpRouteState) ElementType() reflect.Type {
return reflect.TypeOf((*httpRouteState)(nil)).Elem()
}
type httpRouteArgs struct {
// Action triggered when all rules match
Action HttpRouteAction `pulumi:"action"`
// Human readable name for your route, this field is for you
DisplayName *string `pulumi:"displayName"`
// Route traffic for this frontend
FrontendId *int `pulumi:"frontendId"`
// The internal name of your IP load balancing
ServiceName string `pulumi:"serviceName"`
// Route priority ([0..255]). 0 if null. Highest priority routes are evaluated first. Only the first matching route will trigger an action
Weight *int `pulumi:"weight"`
}
// The set of arguments for constructing a HttpRoute resource.
type HttpRouteArgs struct {
// Action triggered when all rules match
Action HttpRouteActionInput
// Human readable name for your route, this field is for you
DisplayName pulumi.StringPtrInput
// Route traffic for this frontend
FrontendId pulumi.IntPtrInput
// The internal name of your IP load balancing
ServiceName pulumi.StringInput
// Route priority ([0..255]). 0 if null. Highest priority routes are evaluated first. Only the first matching route will trigger an action
Weight pulumi.IntPtrInput
}
func (HttpRouteArgs) ElementType() reflect.Type {
return reflect.TypeOf((*httpRouteArgs)(nil)).Elem()
}
type HttpRouteInput interface {
pulumi.Input
ToHttpRouteOutput() HttpRouteOutput
ToHttpRouteOutputWithContext(ctx context.Context) HttpRouteOutput
}
func (*HttpRoute) ElementType() reflect.Type {
return reflect.TypeOf((**HttpRoute)(nil)).Elem()
}
func (i *HttpRoute) ToHttpRouteOutput() HttpRouteOutput {
return i.ToHttpRouteOutputWithContext(context.Background())
}
func (i *HttpRoute) ToHttpRouteOutputWithContext(ctx context.Context) HttpRouteOutput {
return pulumi.ToOutputWithContext(ctx, i).(HttpRouteOutput)
}
// HttpRouteArrayInput is an input type that accepts HttpRouteArray and HttpRouteArrayOutput values.
// You can construct a concrete instance of `HttpRouteArrayInput` via:
//
// HttpRouteArray{ HttpRouteArgs{...} }
type HttpRouteArrayInput interface {
pulumi.Input
ToHttpRouteArrayOutput() HttpRouteArrayOutput
ToHttpRouteArrayOutputWithContext(context.Context) HttpRouteArrayOutput
}
type HttpRouteArray []HttpRouteInput
func (HttpRouteArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*HttpRoute)(nil)).Elem()
}
func (i HttpRouteArray) ToHttpRouteArrayOutput() HttpRouteArrayOutput {
return i.ToHttpRouteArrayOutputWithContext(context.Background())
}
func (i HttpRouteArray) ToHttpRouteArrayOutputWithContext(ctx context.Context) HttpRouteArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(HttpRouteArrayOutput)
}
// HttpRouteMapInput is an input type that accepts HttpRouteMap and HttpRouteMapOutput values.
// You can construct a concrete instance of `HttpRouteMapInput` via:
//
// HttpRouteMap{ "key": HttpRouteArgs{...} }
type HttpRouteMapInput interface {
pulumi.Input
ToHttpRouteMapOutput() HttpRouteMapOutput
ToHttpRouteMapOutputWithContext(context.Context) HttpRouteMapOutput
}
type HttpRouteMap map[string]HttpRouteInput
func (HttpRouteMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*HttpRoute)(nil)).Elem()
}
func (i HttpRouteMap) ToHttpRouteMapOutput() HttpRouteMapOutput {
return i.ToHttpRouteMapOutputWithContext(context.Background())
}
func (i HttpRouteMap) ToHttpRouteMapOutputWithContext(ctx context.Context) HttpRouteMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(HttpRouteMapOutput)
}
type HttpRouteOutput struct{ *pulumi.OutputState }
func (HttpRouteOutput) ElementType() reflect.Type {
return reflect.TypeOf((**HttpRoute)(nil)).Elem()
}
func (o HttpRouteOutput) ToHttpRouteOutput() HttpRouteOutput {
return o
}
func (o HttpRouteOutput) ToHttpRouteOutputWithContext(ctx context.Context) HttpRouteOutput {
return o
}
// Action triggered when all rules match
func (o HttpRouteOutput) Action() HttpRouteActionOutput {
return o.ApplyT(func(v *HttpRoute) HttpRouteActionOutput { return v.Action }).(HttpRouteActionOutput)
}
// Human readable name for your route, this field is for you
func (o HttpRouteOutput) DisplayName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *HttpRoute) pulumi.StringPtrOutput { return v.DisplayName }).(pulumi.StringPtrOutput)
}
// Route traffic for this frontend
func (o HttpRouteOutput) FrontendId() pulumi.IntOutput {
return o.ApplyT(func(v *HttpRoute) pulumi.IntOutput { return v.FrontendId }).(pulumi.IntOutput)
}
// List of rules to match to trigger action
func (o HttpRouteOutput) Rules() HttpRouteRuleTypeArrayOutput {
return o.ApplyT(func(v *HttpRoute) HttpRouteRuleTypeArrayOutput { return v.Rules }).(HttpRouteRuleTypeArrayOutput)
}
// The internal name of your IP load balancing
func (o HttpRouteOutput) ServiceName() pulumi.StringOutput {
return o.ApplyT(func(v *HttpRoute) pulumi.StringOutput { return v.ServiceName }).(pulumi.StringOutput)
}
// HTTP status code for "redirect" and "reject" actions
func (o HttpRouteOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *HttpRoute) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
// Route priority ([0..255]). 0 if null. Highest priority routes are evaluated first. Only the first matching route will trigger an action
func (o HttpRouteOutput) Weight() pulumi.IntOutput {
return o.ApplyT(func(v *HttpRoute) pulumi.IntOutput { return v.Weight }).(pulumi.IntOutput)
}
type HttpRouteArrayOutput struct{ *pulumi.OutputState }
func (HttpRouteArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*HttpRoute)(nil)).Elem()
}
func (o HttpRouteArrayOutput) ToHttpRouteArrayOutput() HttpRouteArrayOutput {
return o
}
func (o HttpRouteArrayOutput) ToHttpRouteArrayOutputWithContext(ctx context.Context) HttpRouteArrayOutput {
return o
}
func (o HttpRouteArrayOutput) Index(i pulumi.IntInput) HttpRouteOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *HttpRoute {
return vs[0].([]*HttpRoute)[vs[1].(int)]
}).(HttpRouteOutput)
}
type HttpRouteMapOutput struct{ *pulumi.OutputState }
func (HttpRouteMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*HttpRoute)(nil)).Elem()
}
func (o HttpRouteMapOutput) ToHttpRouteMapOutput() HttpRouteMapOutput {
return o
}
func (o HttpRouteMapOutput) ToHttpRouteMapOutputWithContext(ctx context.Context) HttpRouteMapOutput {
return o
}
func (o HttpRouteMapOutput) MapIndex(k pulumi.StringInput) HttpRouteOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *HttpRoute {
return vs[0].(map[string]*HttpRoute)[vs[1].(string)]
}).(HttpRouteOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*HttpRouteInput)(nil)).Elem(), &HttpRoute{})
pulumi.RegisterInputType(reflect.TypeOf((*HttpRouteArrayInput)(nil)).Elem(), HttpRouteArray{})
pulumi.RegisterInputType(reflect.TypeOf((*HttpRouteMapInput)(nil)).Elem(), HttpRouteMap{})
pulumi.RegisterOutputType(HttpRouteOutput{})
pulumi.RegisterOutputType(HttpRouteArrayOutput{})
pulumi.RegisterOutputType(HttpRouteMapOutput{})
}