generated from pulumi/pulumi-tf-provider-boilerplate
/
node.go
291 lines (243 loc) · 8.29 KB
/
node.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
// 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 sdm
import (
"context"
"reflect"
"github.com/pierskarsenbarg/pulumi-sdm/sdk/go/sdm/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Nodes make up the strongDM network, and allow your users to connect securely to your resources.
//
// There are two types of nodes:
// 1. **Relay:** creates connectivity to your datasources, while maintaining the egress-only nature of your firewall
// 2. **Gateways:** a relay that also listens for connections from strongDM clients
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pierskarsenbarg/pulumi-sdm/sdk/go/sdm"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := sdm.NewNode(ctx, "gateway", &sdm.NodeArgs{
// Gateway: &sdm.NodeGatewayArgs{
// BindAddress: pulumi.String("0.0.0.0:21222"),
// ListenAddress: pulumi.String("165.23.40.1:21222"),
// Name: pulumi.String("test-gateway"),
// Tags: pulumi.StringMap{
// "env": pulumi.String("dev"),
// "region": pulumi.String("us-west"),
// },
// },
// })
// if err != nil {
// return err
// }
// _, err = sdm.NewNode(ctx, "relay", &sdm.NodeArgs{
// Relay: &sdm.NodeRelayArgs{
// Name: pulumi.String("test-relay"),
// Tags: pulumi.StringMap{
// "env": pulumi.String("dev"),
// "region": pulumi.String("us-west"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// This resource can be imported using the import command.
//
// ## Import
//
// A Node can be imported using the id, e.g.,
//
// ```sh
//
// $ pulumi import sdm:index/node:Node example n-12345678
//
// ```
type Node struct {
pulumi.CustomResourceState
// Gateway represents a StrongDM CLI installation running in gateway mode.
Gateway NodeGatewayPtrOutput `pulumi:"gateway"`
// Relay represents a StrongDM CLI installation running in relay mode.
Relay NodeRelayPtrOutput `pulumi:"relay"`
}
// NewNode registers a new resource with the given unique name, arguments, and options.
func NewNode(ctx *pulumi.Context,
name string, args *NodeArgs, opts ...pulumi.ResourceOption) (*Node, error) {
if args == nil {
args = &NodeArgs{}
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Node
err := ctx.RegisterResource("sdm:index/node:Node", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetNode gets an existing Node 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 GetNode(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *NodeState, opts ...pulumi.ResourceOption) (*Node, error) {
var resource Node
err := ctx.ReadResource("sdm:index/node:Node", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Node resources.
type nodeState struct {
// Gateway represents a StrongDM CLI installation running in gateway mode.
Gateway *NodeGateway `pulumi:"gateway"`
// Relay represents a StrongDM CLI installation running in relay mode.
Relay *NodeRelay `pulumi:"relay"`
}
type NodeState struct {
// Gateway represents a StrongDM CLI installation running in gateway mode.
Gateway NodeGatewayPtrInput
// Relay represents a StrongDM CLI installation running in relay mode.
Relay NodeRelayPtrInput
}
func (NodeState) ElementType() reflect.Type {
return reflect.TypeOf((*nodeState)(nil)).Elem()
}
type nodeArgs struct {
// Gateway represents a StrongDM CLI installation running in gateway mode.
Gateway *NodeGateway `pulumi:"gateway"`
// Relay represents a StrongDM CLI installation running in relay mode.
Relay *NodeRelay `pulumi:"relay"`
}
// The set of arguments for constructing a Node resource.
type NodeArgs struct {
// Gateway represents a StrongDM CLI installation running in gateway mode.
Gateway NodeGatewayPtrInput
// Relay represents a StrongDM CLI installation running in relay mode.
Relay NodeRelayPtrInput
}
func (NodeArgs) ElementType() reflect.Type {
return reflect.TypeOf((*nodeArgs)(nil)).Elem()
}
type NodeInput interface {
pulumi.Input
ToNodeOutput() NodeOutput
ToNodeOutputWithContext(ctx context.Context) NodeOutput
}
func (*Node) ElementType() reflect.Type {
return reflect.TypeOf((**Node)(nil)).Elem()
}
func (i *Node) ToNodeOutput() NodeOutput {
return i.ToNodeOutputWithContext(context.Background())
}
func (i *Node) ToNodeOutputWithContext(ctx context.Context) NodeOutput {
return pulumi.ToOutputWithContext(ctx, i).(NodeOutput)
}
// NodeArrayInput is an input type that accepts NodeArray and NodeArrayOutput values.
// You can construct a concrete instance of `NodeArrayInput` via:
//
// NodeArray{ NodeArgs{...} }
type NodeArrayInput interface {
pulumi.Input
ToNodeArrayOutput() NodeArrayOutput
ToNodeArrayOutputWithContext(context.Context) NodeArrayOutput
}
type NodeArray []NodeInput
func (NodeArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Node)(nil)).Elem()
}
func (i NodeArray) ToNodeArrayOutput() NodeArrayOutput {
return i.ToNodeArrayOutputWithContext(context.Background())
}
func (i NodeArray) ToNodeArrayOutputWithContext(ctx context.Context) NodeArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(NodeArrayOutput)
}
// NodeMapInput is an input type that accepts NodeMap and NodeMapOutput values.
// You can construct a concrete instance of `NodeMapInput` via:
//
// NodeMap{ "key": NodeArgs{...} }
type NodeMapInput interface {
pulumi.Input
ToNodeMapOutput() NodeMapOutput
ToNodeMapOutputWithContext(context.Context) NodeMapOutput
}
type NodeMap map[string]NodeInput
func (NodeMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Node)(nil)).Elem()
}
func (i NodeMap) ToNodeMapOutput() NodeMapOutput {
return i.ToNodeMapOutputWithContext(context.Background())
}
func (i NodeMap) ToNodeMapOutputWithContext(ctx context.Context) NodeMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(NodeMapOutput)
}
type NodeOutput struct{ *pulumi.OutputState }
func (NodeOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Node)(nil)).Elem()
}
func (o NodeOutput) ToNodeOutput() NodeOutput {
return o
}
func (o NodeOutput) ToNodeOutputWithContext(ctx context.Context) NodeOutput {
return o
}
// Gateway represents a StrongDM CLI installation running in gateway mode.
func (o NodeOutput) Gateway() NodeGatewayPtrOutput {
return o.ApplyT(func(v *Node) NodeGatewayPtrOutput { return v.Gateway }).(NodeGatewayPtrOutput)
}
// Relay represents a StrongDM CLI installation running in relay mode.
func (o NodeOutput) Relay() NodeRelayPtrOutput {
return o.ApplyT(func(v *Node) NodeRelayPtrOutput { return v.Relay }).(NodeRelayPtrOutput)
}
type NodeArrayOutput struct{ *pulumi.OutputState }
func (NodeArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Node)(nil)).Elem()
}
func (o NodeArrayOutput) ToNodeArrayOutput() NodeArrayOutput {
return o
}
func (o NodeArrayOutput) ToNodeArrayOutputWithContext(ctx context.Context) NodeArrayOutput {
return o
}
func (o NodeArrayOutput) Index(i pulumi.IntInput) NodeOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Node {
return vs[0].([]*Node)[vs[1].(int)]
}).(NodeOutput)
}
type NodeMapOutput struct{ *pulumi.OutputState }
func (NodeMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Node)(nil)).Elem()
}
func (o NodeMapOutput) ToNodeMapOutput() NodeMapOutput {
return o
}
func (o NodeMapOutput) ToNodeMapOutputWithContext(ctx context.Context) NodeMapOutput {
return o
}
func (o NodeMapOutput) MapIndex(k pulumi.StringInput) NodeOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Node {
return vs[0].(map[string]*Node)[vs[1].(string)]
}).(NodeOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*NodeInput)(nil)).Elem(), &Node{})
pulumi.RegisterInputType(reflect.TypeOf((*NodeArrayInput)(nil)).Elem(), NodeArray{})
pulumi.RegisterInputType(reflect.TypeOf((*NodeMapInput)(nil)).Elem(), NodeMap{})
pulumi.RegisterOutputType(NodeOutput{})
pulumi.RegisterOutputType(NodeArrayOutput{})
pulumi.RegisterOutputType(NodeMapOutput{})
}