generated from pulumi/pulumi-provider-boilerplate
/
ipvs.go
191 lines (150 loc) · 5.95 KB
/
ipvs.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
// Code generated by pulumigen DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package linux
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// IPVS is used to set up, maintain or inspect the virtual server table in the Linux kernel. The Linux Virtual Server can be used to build scalable network services based on a cluster of two or more nodes. The active node of the cluster redirects service requests to a collection of server hosts that will actually perform the services. Supported features include two protocols (TCP and UDP), three packet-forwarding methods (NAT, tunneling, and direct routing), and eight load balancing algorithms (round robin, weighted round robin, least-connection, weighted least-connection, locality-based least-connection, locality-based least-connection with replication, destination-hashing, and source-hashing).
// The connection is established via ssh.
type Ipvs struct {
pulumi.ResourceState
}
// NewIpvs registers a new resource with the given unique name, arguments, and options.
func NewIpvs(ctx *pulumi.Context,
name string, args *IpvsArgs, opts ...pulumi.ResourceOption) (*Ipvs, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.SshConnection == nil {
return nil, errors.New("invalid value for required argument 'SshConnection'")
}
if isZero(args.Provision) {
args.Provision = pulumi.Bool(true)
}
args.SshConnection = args.SshConnection.ToSshConnectionOutput().ApplyT(func(v SshConnection) SshConnection { return *v.Defaults() }).(SshConnectionOutput)
var resource Ipvs
err := ctx.RegisterRemoteComponentResource("linux:index:Ipvs", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
type ipvsArgs struct {
// Install ipvsadm and modules on target instance
Provision bool `pulumi:"provision"`
// The parameters with which to connect to the remote host
SshConnection SshConnection `pulumi:"sshConnection"`
}
// The set of arguments for constructing a Ipvs resource.
type IpvsArgs struct {
// Install ipvsadm and modules on target instance
Provision pulumi.BoolInput
// The parameters with which to connect to the remote host
SshConnection SshConnectionInput
}
func (IpvsArgs) ElementType() reflect.Type {
return reflect.TypeOf((*ipvsArgs)(nil)).Elem()
}
type IpvsInput interface {
pulumi.Input
ToIpvsOutput() IpvsOutput
ToIpvsOutputWithContext(ctx context.Context) IpvsOutput
}
func (*Ipvs) ElementType() reflect.Type {
return reflect.TypeOf((**Ipvs)(nil)).Elem()
}
func (i *Ipvs) ToIpvsOutput() IpvsOutput {
return i.ToIpvsOutputWithContext(context.Background())
}
func (i *Ipvs) ToIpvsOutputWithContext(ctx context.Context) IpvsOutput {
return pulumi.ToOutputWithContext(ctx, i).(IpvsOutput)
}
// IpvsArrayInput is an input type that accepts IpvsArray and IpvsArrayOutput values.
// You can construct a concrete instance of `IpvsArrayInput` via:
//
// IpvsArray{ IpvsArgs{...} }
type IpvsArrayInput interface {
pulumi.Input
ToIpvsArrayOutput() IpvsArrayOutput
ToIpvsArrayOutputWithContext(context.Context) IpvsArrayOutput
}
type IpvsArray []IpvsInput
func (IpvsArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Ipvs)(nil)).Elem()
}
func (i IpvsArray) ToIpvsArrayOutput() IpvsArrayOutput {
return i.ToIpvsArrayOutputWithContext(context.Background())
}
func (i IpvsArray) ToIpvsArrayOutputWithContext(ctx context.Context) IpvsArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(IpvsArrayOutput)
}
// IpvsMapInput is an input type that accepts IpvsMap and IpvsMapOutput values.
// You can construct a concrete instance of `IpvsMapInput` via:
//
// IpvsMap{ "key": IpvsArgs{...} }
type IpvsMapInput interface {
pulumi.Input
ToIpvsMapOutput() IpvsMapOutput
ToIpvsMapOutputWithContext(context.Context) IpvsMapOutput
}
type IpvsMap map[string]IpvsInput
func (IpvsMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Ipvs)(nil)).Elem()
}
func (i IpvsMap) ToIpvsMapOutput() IpvsMapOutput {
return i.ToIpvsMapOutputWithContext(context.Background())
}
func (i IpvsMap) ToIpvsMapOutputWithContext(ctx context.Context) IpvsMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(IpvsMapOutput)
}
type IpvsOutput struct{ *pulumi.OutputState }
func (IpvsOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Ipvs)(nil)).Elem()
}
func (o IpvsOutput) ToIpvsOutput() IpvsOutput {
return o
}
func (o IpvsOutput) ToIpvsOutputWithContext(ctx context.Context) IpvsOutput {
return o
}
type IpvsArrayOutput struct{ *pulumi.OutputState }
func (IpvsArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Ipvs)(nil)).Elem()
}
func (o IpvsArrayOutput) ToIpvsArrayOutput() IpvsArrayOutput {
return o
}
func (o IpvsArrayOutput) ToIpvsArrayOutputWithContext(ctx context.Context) IpvsArrayOutput {
return o
}
func (o IpvsArrayOutput) Index(i pulumi.IntInput) IpvsOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Ipvs {
return vs[0].([]*Ipvs)[vs[1].(int)]
}).(IpvsOutput)
}
type IpvsMapOutput struct{ *pulumi.OutputState }
func (IpvsMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Ipvs)(nil)).Elem()
}
func (o IpvsMapOutput) ToIpvsMapOutput() IpvsMapOutput {
return o
}
func (o IpvsMapOutput) ToIpvsMapOutputWithContext(ctx context.Context) IpvsMapOutput {
return o
}
func (o IpvsMapOutput) MapIndex(k pulumi.StringInput) IpvsOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Ipvs {
return vs[0].(map[string]*Ipvs)[vs[1].(string)]
}).(IpvsOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*IpvsInput)(nil)).Elem(), &Ipvs{})
pulumi.RegisterInputType(reflect.TypeOf((*IpvsArrayInput)(nil)).Elem(), IpvsArray{})
pulumi.RegisterInputType(reflect.TypeOf((*IpvsMapInput)(nil)).Elem(), IpvsMap{})
pulumi.RegisterOutputType(IpvsOutput{})
pulumi.RegisterOutputType(IpvsArrayOutput{})
pulumi.RegisterOutputType(IpvsMapOutput{})
}