-
Notifications
You must be signed in to change notification settings - Fork 151
/
proxyProtocolPolicy.go
350 lines (289 loc) · 12.6 KB
/
proxyProtocolPolicy.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
// *** 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 ec2
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a proxy protocol policy, which allows an ELB to carry a client connection information to a backend.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/elb"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// lb, err := elb.NewLoadBalancer(ctx, "lb", &elb.LoadBalancerArgs{
// AvailabilityZones: pulumi.StringArray{
// pulumi.String("us-east-1a"),
// },
// Listeners: elb.LoadBalancerListenerArray{
// &elb.LoadBalancerListenerArgs{
// InstancePort: pulumi.Int(25),
// InstanceProtocol: pulumi.String("tcp"),
// LbPort: pulumi.Int(25),
// LbProtocol: pulumi.String("tcp"),
// },
// &elb.LoadBalancerListenerArgs{
// InstancePort: pulumi.Int(587),
// InstanceProtocol: pulumi.String("tcp"),
// LbPort: pulumi.Int(587),
// LbProtocol: pulumi.String("tcp"),
// },
// },
// })
// if err != nil {
// return err
// }
// _, err = ec2.NewProxyProtocolPolicy(ctx, "smtp", &ec2.ProxyProtocolPolicyArgs{
// LoadBalancer: lb.Name,
// InstancePorts: pulumi.StringArray{
// pulumi.String("25"),
// pulumi.String("587"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type ProxyProtocolPolicy struct {
pulumi.CustomResourceState
// List of instance ports to which the policy
// should be applied. This can be specified if the protocol is SSL or TCP.
InstancePorts pulumi.StringArrayOutput `pulumi:"instancePorts"`
// The load balancer to which the policy
// should be attached.
LoadBalancer pulumi.StringOutput `pulumi:"loadBalancer"`
}
// NewProxyProtocolPolicy registers a new resource with the given unique name, arguments, and options.
func NewProxyProtocolPolicy(ctx *pulumi.Context,
name string, args *ProxyProtocolPolicyArgs, opts ...pulumi.ResourceOption) (*ProxyProtocolPolicy, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.InstancePorts == nil {
return nil, errors.New("invalid value for required argument 'InstancePorts'")
}
if args.LoadBalancer == nil {
return nil, errors.New("invalid value for required argument 'LoadBalancer'")
}
var resource ProxyProtocolPolicy
err := ctx.RegisterResource("aws:ec2/proxyProtocolPolicy:ProxyProtocolPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetProxyProtocolPolicy gets an existing ProxyProtocolPolicy 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 GetProxyProtocolPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ProxyProtocolPolicyState, opts ...pulumi.ResourceOption) (*ProxyProtocolPolicy, error) {
var resource ProxyProtocolPolicy
err := ctx.ReadResource("aws:ec2/proxyProtocolPolicy:ProxyProtocolPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ProxyProtocolPolicy resources.
type proxyProtocolPolicyState struct {
// List of instance ports to which the policy
// should be applied. This can be specified if the protocol is SSL or TCP.
InstancePorts []string `pulumi:"instancePorts"`
// The load balancer to which the policy
// should be attached.
LoadBalancer *string `pulumi:"loadBalancer"`
}
type ProxyProtocolPolicyState struct {
// List of instance ports to which the policy
// should be applied. This can be specified if the protocol is SSL or TCP.
InstancePorts pulumi.StringArrayInput
// The load balancer to which the policy
// should be attached.
LoadBalancer pulumi.StringPtrInput
}
func (ProxyProtocolPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*proxyProtocolPolicyState)(nil)).Elem()
}
type proxyProtocolPolicyArgs struct {
// List of instance ports to which the policy
// should be applied. This can be specified if the protocol is SSL or TCP.
InstancePorts []string `pulumi:"instancePorts"`
// The load balancer to which the policy
// should be attached.
LoadBalancer string `pulumi:"loadBalancer"`
}
// The set of arguments for constructing a ProxyProtocolPolicy resource.
type ProxyProtocolPolicyArgs struct {
// List of instance ports to which the policy
// should be applied. This can be specified if the protocol is SSL or TCP.
InstancePorts pulumi.StringArrayInput
// The load balancer to which the policy
// should be attached.
LoadBalancer pulumi.StringInput
}
func (ProxyProtocolPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*proxyProtocolPolicyArgs)(nil)).Elem()
}
type ProxyProtocolPolicyInput interface {
pulumi.Input
ToProxyProtocolPolicyOutput() ProxyProtocolPolicyOutput
ToProxyProtocolPolicyOutputWithContext(ctx context.Context) ProxyProtocolPolicyOutput
}
func (*ProxyProtocolPolicy) ElementType() reflect.Type {
return reflect.TypeOf((*ProxyProtocolPolicy)(nil))
}
func (i *ProxyProtocolPolicy) ToProxyProtocolPolicyOutput() ProxyProtocolPolicyOutput {
return i.ToProxyProtocolPolicyOutputWithContext(context.Background())
}
func (i *ProxyProtocolPolicy) ToProxyProtocolPolicyOutputWithContext(ctx context.Context) ProxyProtocolPolicyOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProxyProtocolPolicyOutput)
}
func (i *ProxyProtocolPolicy) ToProxyProtocolPolicyPtrOutput() ProxyProtocolPolicyPtrOutput {
return i.ToProxyProtocolPolicyPtrOutputWithContext(context.Background())
}
func (i *ProxyProtocolPolicy) ToProxyProtocolPolicyPtrOutputWithContext(ctx context.Context) ProxyProtocolPolicyPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProxyProtocolPolicyPtrOutput)
}
type ProxyProtocolPolicyPtrInput interface {
pulumi.Input
ToProxyProtocolPolicyPtrOutput() ProxyProtocolPolicyPtrOutput
ToProxyProtocolPolicyPtrOutputWithContext(ctx context.Context) ProxyProtocolPolicyPtrOutput
}
type proxyProtocolPolicyPtrType ProxyProtocolPolicyArgs
func (*proxyProtocolPolicyPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**ProxyProtocolPolicy)(nil))
}
func (i *proxyProtocolPolicyPtrType) ToProxyProtocolPolicyPtrOutput() ProxyProtocolPolicyPtrOutput {
return i.ToProxyProtocolPolicyPtrOutputWithContext(context.Background())
}
func (i *proxyProtocolPolicyPtrType) ToProxyProtocolPolicyPtrOutputWithContext(ctx context.Context) ProxyProtocolPolicyPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProxyProtocolPolicyPtrOutput)
}
// ProxyProtocolPolicyArrayInput is an input type that accepts ProxyProtocolPolicyArray and ProxyProtocolPolicyArrayOutput values.
// You can construct a concrete instance of `ProxyProtocolPolicyArrayInput` via:
//
// ProxyProtocolPolicyArray{ ProxyProtocolPolicyArgs{...} }
type ProxyProtocolPolicyArrayInput interface {
pulumi.Input
ToProxyProtocolPolicyArrayOutput() ProxyProtocolPolicyArrayOutput
ToProxyProtocolPolicyArrayOutputWithContext(context.Context) ProxyProtocolPolicyArrayOutput
}
type ProxyProtocolPolicyArray []ProxyProtocolPolicyInput
func (ProxyProtocolPolicyArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ProxyProtocolPolicy)(nil)).Elem()
}
func (i ProxyProtocolPolicyArray) ToProxyProtocolPolicyArrayOutput() ProxyProtocolPolicyArrayOutput {
return i.ToProxyProtocolPolicyArrayOutputWithContext(context.Background())
}
func (i ProxyProtocolPolicyArray) ToProxyProtocolPolicyArrayOutputWithContext(ctx context.Context) ProxyProtocolPolicyArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProxyProtocolPolicyArrayOutput)
}
// ProxyProtocolPolicyMapInput is an input type that accepts ProxyProtocolPolicyMap and ProxyProtocolPolicyMapOutput values.
// You can construct a concrete instance of `ProxyProtocolPolicyMapInput` via:
//
// ProxyProtocolPolicyMap{ "key": ProxyProtocolPolicyArgs{...} }
type ProxyProtocolPolicyMapInput interface {
pulumi.Input
ToProxyProtocolPolicyMapOutput() ProxyProtocolPolicyMapOutput
ToProxyProtocolPolicyMapOutputWithContext(context.Context) ProxyProtocolPolicyMapOutput
}
type ProxyProtocolPolicyMap map[string]ProxyProtocolPolicyInput
func (ProxyProtocolPolicyMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ProxyProtocolPolicy)(nil)).Elem()
}
func (i ProxyProtocolPolicyMap) ToProxyProtocolPolicyMapOutput() ProxyProtocolPolicyMapOutput {
return i.ToProxyProtocolPolicyMapOutputWithContext(context.Background())
}
func (i ProxyProtocolPolicyMap) ToProxyProtocolPolicyMapOutputWithContext(ctx context.Context) ProxyProtocolPolicyMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProxyProtocolPolicyMapOutput)
}
type ProxyProtocolPolicyOutput struct{ *pulumi.OutputState }
func (ProxyProtocolPolicyOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ProxyProtocolPolicy)(nil))
}
func (o ProxyProtocolPolicyOutput) ToProxyProtocolPolicyOutput() ProxyProtocolPolicyOutput {
return o
}
func (o ProxyProtocolPolicyOutput) ToProxyProtocolPolicyOutputWithContext(ctx context.Context) ProxyProtocolPolicyOutput {
return o
}
func (o ProxyProtocolPolicyOutput) ToProxyProtocolPolicyPtrOutput() ProxyProtocolPolicyPtrOutput {
return o.ToProxyProtocolPolicyPtrOutputWithContext(context.Background())
}
func (o ProxyProtocolPolicyOutput) ToProxyProtocolPolicyPtrOutputWithContext(ctx context.Context) ProxyProtocolPolicyPtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v ProxyProtocolPolicy) *ProxyProtocolPolicy {
return &v
}).(ProxyProtocolPolicyPtrOutput)
}
type ProxyProtocolPolicyPtrOutput struct{ *pulumi.OutputState }
func (ProxyProtocolPolicyPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ProxyProtocolPolicy)(nil))
}
func (o ProxyProtocolPolicyPtrOutput) ToProxyProtocolPolicyPtrOutput() ProxyProtocolPolicyPtrOutput {
return o
}
func (o ProxyProtocolPolicyPtrOutput) ToProxyProtocolPolicyPtrOutputWithContext(ctx context.Context) ProxyProtocolPolicyPtrOutput {
return o
}
func (o ProxyProtocolPolicyPtrOutput) Elem() ProxyProtocolPolicyOutput {
return o.ApplyT(func(v *ProxyProtocolPolicy) ProxyProtocolPolicy {
if v != nil {
return *v
}
var ret ProxyProtocolPolicy
return ret
}).(ProxyProtocolPolicyOutput)
}
type ProxyProtocolPolicyArrayOutput struct{ *pulumi.OutputState }
func (ProxyProtocolPolicyArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]ProxyProtocolPolicy)(nil))
}
func (o ProxyProtocolPolicyArrayOutput) ToProxyProtocolPolicyArrayOutput() ProxyProtocolPolicyArrayOutput {
return o
}
func (o ProxyProtocolPolicyArrayOutput) ToProxyProtocolPolicyArrayOutputWithContext(ctx context.Context) ProxyProtocolPolicyArrayOutput {
return o
}
func (o ProxyProtocolPolicyArrayOutput) Index(i pulumi.IntInput) ProxyProtocolPolicyOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) ProxyProtocolPolicy {
return vs[0].([]ProxyProtocolPolicy)[vs[1].(int)]
}).(ProxyProtocolPolicyOutput)
}
type ProxyProtocolPolicyMapOutput struct{ *pulumi.OutputState }
func (ProxyProtocolPolicyMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]ProxyProtocolPolicy)(nil))
}
func (o ProxyProtocolPolicyMapOutput) ToProxyProtocolPolicyMapOutput() ProxyProtocolPolicyMapOutput {
return o
}
func (o ProxyProtocolPolicyMapOutput) ToProxyProtocolPolicyMapOutputWithContext(ctx context.Context) ProxyProtocolPolicyMapOutput {
return o
}
func (o ProxyProtocolPolicyMapOutput) MapIndex(k pulumi.StringInput) ProxyProtocolPolicyOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) ProxyProtocolPolicy {
return vs[0].(map[string]ProxyProtocolPolicy)[vs[1].(string)]
}).(ProxyProtocolPolicyOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ProxyProtocolPolicyInput)(nil)).Elem(), &ProxyProtocolPolicy{})
pulumi.RegisterInputType(reflect.TypeOf((*ProxyProtocolPolicyPtrInput)(nil)).Elem(), &ProxyProtocolPolicy{})
pulumi.RegisterInputType(reflect.TypeOf((*ProxyProtocolPolicyArrayInput)(nil)).Elem(), ProxyProtocolPolicyArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ProxyProtocolPolicyMapInput)(nil)).Elem(), ProxyProtocolPolicyMap{})
pulumi.RegisterOutputType(ProxyProtocolPolicyOutput{})
pulumi.RegisterOutputType(ProxyProtocolPolicyPtrOutput{})
pulumi.RegisterOutputType(ProxyProtocolPolicyArrayOutput{})
pulumi.RegisterOutputType(ProxyProtocolPolicyMapOutput{})
}