generated from pulumi/pulumi-tf-provider-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
variable.go
341 lines (288 loc) · 10.9 KB
/
variable.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
// 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 prefect
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/ru5j4r0/pulumi-prefect/sdk/go/prefect/internal"
)
// The resource `variable` represents a Prefect Cloud Variable. Variables enable you to store and reuse non-sensitive information in your flows.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// "github.com/ru5j4r0/pulumi-prefect/sdk/go/prefect"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := prefect.NewVariable(ctx, "example", &prefect.VariableArgs{
// Value: pulumi.String("variable value goes here"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Prefect Variables can be imported via name in the form `name/name_of_variable`
//
// ```sh
// $ pulumi import prefect:index/variable:Variable example name/name_of_variable
// ```
//
// # Prefect Variables can also be imported via UUID
//
// ```sh
// $ pulumi import prefect:index/variable:Variable example 00000000-0000-0000-0000-000000000000
// ```
type Variable struct {
pulumi.CustomResourceState
// Account ID (UUID), defaults to the account set in the provider
AccountId pulumi.StringPtrOutput `pulumi:"accountId"`
// Timestamp of when the resource was created (RFC3339)
Created pulumi.StringOutput `pulumi:"created"`
// Name of the variable
Name pulumi.StringOutput `pulumi:"name"`
// Tags associated with the variable
Tags pulumi.StringArrayOutput `pulumi:"tags"`
// Timestamp of when the resource was updated (RFC3339)
Updated pulumi.StringOutput `pulumi:"updated"`
// Value of the variable
Value pulumi.StringOutput `pulumi:"value"`
// Workspace ID (UUID), defaults to the workspace set in the provider
WorkspaceId pulumi.StringPtrOutput `pulumi:"workspaceId"`
}
// NewVariable registers a new resource with the given unique name, arguments, and options.
func NewVariable(ctx *pulumi.Context,
name string, args *VariableArgs, opts ...pulumi.ResourceOption) (*Variable, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Value == nil {
return nil, errors.New("invalid value for required argument 'Value'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource Variable
err := ctx.RegisterResource("prefect:index/variable:Variable", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetVariable gets an existing Variable 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 GetVariable(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *VariableState, opts ...pulumi.ResourceOption) (*Variable, error) {
var resource Variable
err := ctx.ReadResource("prefect:index/variable:Variable", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Variable resources.
type variableState struct {
// Account ID (UUID), defaults to the account set in the provider
AccountId *string `pulumi:"accountId"`
// Timestamp of when the resource was created (RFC3339)
Created *string `pulumi:"created"`
// Name of the variable
Name *string `pulumi:"name"`
// Tags associated with the variable
Tags []string `pulumi:"tags"`
// Timestamp of when the resource was updated (RFC3339)
Updated *string `pulumi:"updated"`
// Value of the variable
Value *string `pulumi:"value"`
// Workspace ID (UUID), defaults to the workspace set in the provider
WorkspaceId *string `pulumi:"workspaceId"`
}
type VariableState struct {
// Account ID (UUID), defaults to the account set in the provider
AccountId pulumi.StringPtrInput
// Timestamp of when the resource was created (RFC3339)
Created pulumi.StringPtrInput
// Name of the variable
Name pulumi.StringPtrInput
// Tags associated with the variable
Tags pulumi.StringArrayInput
// Timestamp of when the resource was updated (RFC3339)
Updated pulumi.StringPtrInput
// Value of the variable
Value pulumi.StringPtrInput
// Workspace ID (UUID), defaults to the workspace set in the provider
WorkspaceId pulumi.StringPtrInput
}
func (VariableState) ElementType() reflect.Type {
return reflect.TypeOf((*variableState)(nil)).Elem()
}
type variableArgs struct {
// Account ID (UUID), defaults to the account set in the provider
AccountId *string `pulumi:"accountId"`
// Name of the variable
Name *string `pulumi:"name"`
// Tags associated with the variable
Tags []string `pulumi:"tags"`
// Value of the variable
Value string `pulumi:"value"`
// Workspace ID (UUID), defaults to the workspace set in the provider
WorkspaceId *string `pulumi:"workspaceId"`
}
// The set of arguments for constructing a Variable resource.
type VariableArgs struct {
// Account ID (UUID), defaults to the account set in the provider
AccountId pulumi.StringPtrInput
// Name of the variable
Name pulumi.StringPtrInput
// Tags associated with the variable
Tags pulumi.StringArrayInput
// Value of the variable
Value pulumi.StringInput
// Workspace ID (UUID), defaults to the workspace set in the provider
WorkspaceId pulumi.StringPtrInput
}
func (VariableArgs) ElementType() reflect.Type {
return reflect.TypeOf((*variableArgs)(nil)).Elem()
}
type VariableInput interface {
pulumi.Input
ToVariableOutput() VariableOutput
ToVariableOutputWithContext(ctx context.Context) VariableOutput
}
func (*Variable) ElementType() reflect.Type {
return reflect.TypeOf((**Variable)(nil)).Elem()
}
func (i *Variable) ToVariableOutput() VariableOutput {
return i.ToVariableOutputWithContext(context.Background())
}
func (i *Variable) ToVariableOutputWithContext(ctx context.Context) VariableOutput {
return pulumi.ToOutputWithContext(ctx, i).(VariableOutput)
}
// VariableArrayInput is an input type that accepts VariableArray and VariableArrayOutput values.
// You can construct a concrete instance of `VariableArrayInput` via:
//
// VariableArray{ VariableArgs{...} }
type VariableArrayInput interface {
pulumi.Input
ToVariableArrayOutput() VariableArrayOutput
ToVariableArrayOutputWithContext(context.Context) VariableArrayOutput
}
type VariableArray []VariableInput
func (VariableArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Variable)(nil)).Elem()
}
func (i VariableArray) ToVariableArrayOutput() VariableArrayOutput {
return i.ToVariableArrayOutputWithContext(context.Background())
}
func (i VariableArray) ToVariableArrayOutputWithContext(ctx context.Context) VariableArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(VariableArrayOutput)
}
// VariableMapInput is an input type that accepts VariableMap and VariableMapOutput values.
// You can construct a concrete instance of `VariableMapInput` via:
//
// VariableMap{ "key": VariableArgs{...} }
type VariableMapInput interface {
pulumi.Input
ToVariableMapOutput() VariableMapOutput
ToVariableMapOutputWithContext(context.Context) VariableMapOutput
}
type VariableMap map[string]VariableInput
func (VariableMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Variable)(nil)).Elem()
}
func (i VariableMap) ToVariableMapOutput() VariableMapOutput {
return i.ToVariableMapOutputWithContext(context.Background())
}
func (i VariableMap) ToVariableMapOutputWithContext(ctx context.Context) VariableMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(VariableMapOutput)
}
type VariableOutput struct{ *pulumi.OutputState }
func (VariableOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Variable)(nil)).Elem()
}
func (o VariableOutput) ToVariableOutput() VariableOutput {
return o
}
func (o VariableOutput) ToVariableOutputWithContext(ctx context.Context) VariableOutput {
return o
}
// Account ID (UUID), defaults to the account set in the provider
func (o VariableOutput) AccountId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Variable) pulumi.StringPtrOutput { return v.AccountId }).(pulumi.StringPtrOutput)
}
// Timestamp of when the resource was created (RFC3339)
func (o VariableOutput) Created() pulumi.StringOutput {
return o.ApplyT(func(v *Variable) pulumi.StringOutput { return v.Created }).(pulumi.StringOutput)
}
// Name of the variable
func (o VariableOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Variable) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Tags associated with the variable
func (o VariableOutput) Tags() pulumi.StringArrayOutput {
return o.ApplyT(func(v *Variable) pulumi.StringArrayOutput { return v.Tags }).(pulumi.StringArrayOutput)
}
// Timestamp of when the resource was updated (RFC3339)
func (o VariableOutput) Updated() pulumi.StringOutput {
return o.ApplyT(func(v *Variable) pulumi.StringOutput { return v.Updated }).(pulumi.StringOutput)
}
// Value of the variable
func (o VariableOutput) Value() pulumi.StringOutput {
return o.ApplyT(func(v *Variable) pulumi.StringOutput { return v.Value }).(pulumi.StringOutput)
}
// Workspace ID (UUID), defaults to the workspace set in the provider
func (o VariableOutput) WorkspaceId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Variable) pulumi.StringPtrOutput { return v.WorkspaceId }).(pulumi.StringPtrOutput)
}
type VariableArrayOutput struct{ *pulumi.OutputState }
func (VariableArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Variable)(nil)).Elem()
}
func (o VariableArrayOutput) ToVariableArrayOutput() VariableArrayOutput {
return o
}
func (o VariableArrayOutput) ToVariableArrayOutputWithContext(ctx context.Context) VariableArrayOutput {
return o
}
func (o VariableArrayOutput) Index(i pulumi.IntInput) VariableOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Variable {
return vs[0].([]*Variable)[vs[1].(int)]
}).(VariableOutput)
}
type VariableMapOutput struct{ *pulumi.OutputState }
func (VariableMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Variable)(nil)).Elem()
}
func (o VariableMapOutput) ToVariableMapOutput() VariableMapOutput {
return o
}
func (o VariableMapOutput) ToVariableMapOutputWithContext(ctx context.Context) VariableMapOutput {
return o
}
func (o VariableMapOutput) MapIndex(k pulumi.StringInput) VariableOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Variable {
return vs[0].(map[string]*Variable)[vs[1].(string)]
}).(VariableOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*VariableInput)(nil)).Elem(), &Variable{})
pulumi.RegisterInputType(reflect.TypeOf((*VariableArrayInput)(nil)).Elem(), VariableArray{})
pulumi.RegisterInputType(reflect.TypeOf((*VariableMapInput)(nil)).Elem(), VariableMap{})
pulumi.RegisterOutputType(VariableOutput{})
pulumi.RegisterOutputType(VariableArrayOutput{})
pulumi.RegisterOutputType(VariableMapOutput{})
}