/
appCookieStickinessPolicy.go
176 lines (163 loc) · 6.09 KB
/
appCookieStickinessPolicy.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
// *** 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 elb
import (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Provides an application cookie stickiness policy, which allows an ELB to wed its sticky cookie's expiration to a cookie generated by your application.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/elb"
// "github.com/pulumi/pulumi/sdk/v2/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(8000),
// InstanceProtocol: pulumi.String("http"),
// LbPort: pulumi.Int(80),
// LbProtocol: pulumi.String("http"),
// },
// },
// })
// if err != nil {
// return err
// }
// _, err = elb.NewAppCookieStickinessPolicy(ctx, "foo", &elb.AppCookieStickinessPolicyArgs{
// CookieName: pulumi.String("MyAppCookie"),
// LbPort: pulumi.Int(80),
// LoadBalancer: lb.Name,
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type AppCookieStickinessPolicy struct {
pulumi.CustomResourceState
// The application cookie whose lifetime the ELB's cookie should follow.
CookieName pulumi.StringOutput `pulumi:"cookieName"`
// The load balancer port to which the policy
// should be applied. This must be an active listener on the load
// balancer.
LbPort pulumi.IntOutput `pulumi:"lbPort"`
// The name of load balancer to which the policy
// should be attached.
LoadBalancer pulumi.StringOutput `pulumi:"loadBalancer"`
// The name of the stickiness policy.
Name pulumi.StringOutput `pulumi:"name"`
}
// NewAppCookieStickinessPolicy registers a new resource with the given unique name, arguments, and options.
func NewAppCookieStickinessPolicy(ctx *pulumi.Context,
name string, args *AppCookieStickinessPolicyArgs, opts ...pulumi.ResourceOption) (*AppCookieStickinessPolicy, error) {
if args == nil || args.CookieName == nil {
return nil, errors.New("missing required argument 'CookieName'")
}
if args == nil || args.LbPort == nil {
return nil, errors.New("missing required argument 'LbPort'")
}
if args == nil || args.LoadBalancer == nil {
return nil, errors.New("missing required argument 'LoadBalancer'")
}
if args == nil {
args = &AppCookieStickinessPolicyArgs{}
}
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("aws:elasticloadbalancing/appCookieStickinessPolicy:AppCookieStickinessPolicy"),
},
})
opts = append(opts, aliases)
var resource AppCookieStickinessPolicy
err := ctx.RegisterResource("aws:elb/appCookieStickinessPolicy:AppCookieStickinessPolicy", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAppCookieStickinessPolicy gets an existing AppCookieStickinessPolicy 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 GetAppCookieStickinessPolicy(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AppCookieStickinessPolicyState, opts ...pulumi.ResourceOption) (*AppCookieStickinessPolicy, error) {
var resource AppCookieStickinessPolicy
err := ctx.ReadResource("aws:elb/appCookieStickinessPolicy:AppCookieStickinessPolicy", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering AppCookieStickinessPolicy resources.
type appCookieStickinessPolicyState struct {
// The application cookie whose lifetime the ELB's cookie should follow.
CookieName *string `pulumi:"cookieName"`
// The load balancer port to which the policy
// should be applied. This must be an active listener on the load
// balancer.
LbPort *int `pulumi:"lbPort"`
// The name of load balancer to which the policy
// should be attached.
LoadBalancer *string `pulumi:"loadBalancer"`
// The name of the stickiness policy.
Name *string `pulumi:"name"`
}
type AppCookieStickinessPolicyState struct {
// The application cookie whose lifetime the ELB's cookie should follow.
CookieName pulumi.StringPtrInput
// The load balancer port to which the policy
// should be applied. This must be an active listener on the load
// balancer.
LbPort pulumi.IntPtrInput
// The name of load balancer to which the policy
// should be attached.
LoadBalancer pulumi.StringPtrInput
// The name of the stickiness policy.
Name pulumi.StringPtrInput
}
func (AppCookieStickinessPolicyState) ElementType() reflect.Type {
return reflect.TypeOf((*appCookieStickinessPolicyState)(nil)).Elem()
}
type appCookieStickinessPolicyArgs struct {
// The application cookie whose lifetime the ELB's cookie should follow.
CookieName string `pulumi:"cookieName"`
// The load balancer port to which the policy
// should be applied. This must be an active listener on the load
// balancer.
LbPort int `pulumi:"lbPort"`
// The name of load balancer to which the policy
// should be attached.
LoadBalancer string `pulumi:"loadBalancer"`
// The name of the stickiness policy.
Name *string `pulumi:"name"`
}
// The set of arguments for constructing a AppCookieStickinessPolicy resource.
type AppCookieStickinessPolicyArgs struct {
// The application cookie whose lifetime the ELB's cookie should follow.
CookieName pulumi.StringInput
// The load balancer port to which the policy
// should be applied. This must be an active listener on the load
// balancer.
LbPort pulumi.IntInput
// The name of load balancer to which the policy
// should be attached.
LoadBalancer pulumi.StringInput
// The name of the stickiness policy.
Name pulumi.StringPtrInput
}
func (AppCookieStickinessPolicyArgs) ElementType() reflect.Type {
return reflect.TypeOf((*appCookieStickinessPolicyArgs)(nil)).Elem()
}