generated from pulumi/pulumi-tf-provider-boilerplate
/
procedure.go
372 lines (326 loc) · 13.5 KB
/
procedure.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
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
// *** 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 snowflake
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Example Usage
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-snowflake/sdk/go/snowflake"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := snowflake.NewSchema(ctx, "db", &snowflake.SchemaArgs{
// DataRetentionDays: pulumi.Int(1),
// })
// if err != nil {
// return err
// }
// schema, err := snowflake.NewSchema(ctx, "schema", &snowflake.SchemaArgs{
// Database: pulumi.Any(snowflake_database.Db.Name),
// DataRetentionDays: pulumi.Int(1),
// })
// if err != nil {
// return err
// }
// _, err = snowflake.NewProcedure(ctx, "proc", &snowflake.ProcedureArgs{
// Database: pulumi.Any(snowflake_database.Db.Name),
// Schema: schema.Name,
// Arguments: ProcedureArgumentArray{
// &ProcedureArgumentArgs{
// Name: pulumi.String("arg1"),
// Type: pulumi.String("varchar"),
// },
// &ProcedureArgumentArgs{
// Name: pulumi.String("arg2"),
// Type: pulumi.String("DATE"),
// },
// },
// Comment: pulumi.String("Procedure with 2 arguments"),
// ReturnType: pulumi.String("VARCHAR"),
// ExecuteAs: pulumi.String("CALLER"),
// ReturnBehavior: pulumi.String("IMMUTABLE"),
// NullInputBehavior: pulumi.String("RETURNS NULL ON NULL INPUT"),
// Statement: pulumi.String(fmt.Sprintf("%v%v", "var X=1\n", "return X\n")),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// # format is database name | schema name | stored procedure name | <list of arg types, separated with '-'>
//
// ```sh
// $ pulumi import snowflake:index/procedure:Procedure example 'dbName|schemaName|procedureName|varchar-varchar-varchar'
// ```
type Procedure struct {
pulumi.CustomResourceState
// List of the arguments for the procedure
Arguments ProcedureArgumentArrayOutput `pulumi:"arguments"`
// Specifies a comment for the procedure.
Comment pulumi.StringPtrOutput `pulumi:"comment"`
// The database in which to create the procedure. Don't use the | character.
Database pulumi.StringOutput `pulumi:"database"`
// Sets execute context - see caller's rights and owner's rights
ExecuteAs pulumi.StringPtrOutput `pulumi:"executeAs"`
// Specifies the identifier for the procedure; does not have to be unique for the schema in which the procedure is created. Don't use the | character.
Name pulumi.StringOutput `pulumi:"name"`
// Specifies the behavior of the procedure when called with null inputs.
NullInputBehavior pulumi.StringPtrOutput `pulumi:"nullInputBehavior"`
// Specifies the behavior of the function when returning results
ReturnBehavior pulumi.StringPtrOutput `pulumi:"returnBehavior"`
// The return type of the procedure
ReturnType pulumi.StringOutput `pulumi:"returnType"`
// The schema in which to create the procedure. Don't use the | character.
Schema pulumi.StringOutput `pulumi:"schema"`
// Specifies the javascript code used to create the procedure.
Statement pulumi.StringOutput `pulumi:"statement"`
}
// NewProcedure registers a new resource with the given unique name, arguments, and options.
func NewProcedure(ctx *pulumi.Context,
name string, args *ProcedureArgs, opts ...pulumi.ResourceOption) (*Procedure, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Database == nil {
return nil, errors.New("invalid value for required argument 'Database'")
}
if args.ReturnType == nil {
return nil, errors.New("invalid value for required argument 'ReturnType'")
}
if args.Schema == nil {
return nil, errors.New("invalid value for required argument 'Schema'")
}
if args.Statement == nil {
return nil, errors.New("invalid value for required argument 'Statement'")
}
var resource Procedure
err := ctx.RegisterResource("snowflake:index/procedure:Procedure", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetProcedure gets an existing Procedure 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 GetProcedure(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ProcedureState, opts ...pulumi.ResourceOption) (*Procedure, error) {
var resource Procedure
err := ctx.ReadResource("snowflake:index/procedure:Procedure", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Procedure resources.
type procedureState struct {
// List of the arguments for the procedure
Arguments []ProcedureArgument `pulumi:"arguments"`
// Specifies a comment for the procedure.
Comment *string `pulumi:"comment"`
// The database in which to create the procedure. Don't use the | character.
Database *string `pulumi:"database"`
// Sets execute context - see caller's rights and owner's rights
ExecuteAs *string `pulumi:"executeAs"`
// Specifies the identifier for the procedure; does not have to be unique for the schema in which the procedure is created. Don't use the | character.
Name *string `pulumi:"name"`
// Specifies the behavior of the procedure when called with null inputs.
NullInputBehavior *string `pulumi:"nullInputBehavior"`
// Specifies the behavior of the function when returning results
ReturnBehavior *string `pulumi:"returnBehavior"`
// The return type of the procedure
ReturnType *string `pulumi:"returnType"`
// The schema in which to create the procedure. Don't use the | character.
Schema *string `pulumi:"schema"`
// Specifies the javascript code used to create the procedure.
Statement *string `pulumi:"statement"`
}
type ProcedureState struct {
// List of the arguments for the procedure
Arguments ProcedureArgumentArrayInput
// Specifies a comment for the procedure.
Comment pulumi.StringPtrInput
// The database in which to create the procedure. Don't use the | character.
Database pulumi.StringPtrInput
// Sets execute context - see caller's rights and owner's rights
ExecuteAs pulumi.StringPtrInput
// Specifies the identifier for the procedure; does not have to be unique for the schema in which the procedure is created. Don't use the | character.
Name pulumi.StringPtrInput
// Specifies the behavior of the procedure when called with null inputs.
NullInputBehavior pulumi.StringPtrInput
// Specifies the behavior of the function when returning results
ReturnBehavior pulumi.StringPtrInput
// The return type of the procedure
ReturnType pulumi.StringPtrInput
// The schema in which to create the procedure. Don't use the | character.
Schema pulumi.StringPtrInput
// Specifies the javascript code used to create the procedure.
Statement pulumi.StringPtrInput
}
func (ProcedureState) ElementType() reflect.Type {
return reflect.TypeOf((*procedureState)(nil)).Elem()
}
type procedureArgs struct {
// List of the arguments for the procedure
Arguments []ProcedureArgument `pulumi:"arguments"`
// Specifies a comment for the procedure.
Comment *string `pulumi:"comment"`
// The database in which to create the procedure. Don't use the | character.
Database string `pulumi:"database"`
// Sets execute context - see caller's rights and owner's rights
ExecuteAs *string `pulumi:"executeAs"`
// Specifies the identifier for the procedure; does not have to be unique for the schema in which the procedure is created. Don't use the | character.
Name *string `pulumi:"name"`
// Specifies the behavior of the procedure when called with null inputs.
NullInputBehavior *string `pulumi:"nullInputBehavior"`
// Specifies the behavior of the function when returning results
ReturnBehavior *string `pulumi:"returnBehavior"`
// The return type of the procedure
ReturnType string `pulumi:"returnType"`
// The schema in which to create the procedure. Don't use the | character.
Schema string `pulumi:"schema"`
// Specifies the javascript code used to create the procedure.
Statement string `pulumi:"statement"`
}
// The set of arguments for constructing a Procedure resource.
type ProcedureArgs struct {
// List of the arguments for the procedure
Arguments ProcedureArgumentArrayInput
// Specifies a comment for the procedure.
Comment pulumi.StringPtrInput
// The database in which to create the procedure. Don't use the | character.
Database pulumi.StringInput
// Sets execute context - see caller's rights and owner's rights
ExecuteAs pulumi.StringPtrInput
// Specifies the identifier for the procedure; does not have to be unique for the schema in which the procedure is created. Don't use the | character.
Name pulumi.StringPtrInput
// Specifies the behavior of the procedure when called with null inputs.
NullInputBehavior pulumi.StringPtrInput
// Specifies the behavior of the function when returning results
ReturnBehavior pulumi.StringPtrInput
// The return type of the procedure
ReturnType pulumi.StringInput
// The schema in which to create the procedure. Don't use the | character.
Schema pulumi.StringInput
// Specifies the javascript code used to create the procedure.
Statement pulumi.StringInput
}
func (ProcedureArgs) ElementType() reflect.Type {
return reflect.TypeOf((*procedureArgs)(nil)).Elem()
}
type ProcedureInput interface {
pulumi.Input
ToProcedureOutput() ProcedureOutput
ToProcedureOutputWithContext(ctx context.Context) ProcedureOutput
}
func (*Procedure) ElementType() reflect.Type {
return reflect.TypeOf((**Procedure)(nil)).Elem()
}
func (i *Procedure) ToProcedureOutput() ProcedureOutput {
return i.ToProcedureOutputWithContext(context.Background())
}
func (i *Procedure) ToProcedureOutputWithContext(ctx context.Context) ProcedureOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProcedureOutput)
}
// ProcedureArrayInput is an input type that accepts ProcedureArray and ProcedureArrayOutput values.
// You can construct a concrete instance of `ProcedureArrayInput` via:
//
// ProcedureArray{ ProcedureArgs{...} }
type ProcedureArrayInput interface {
pulumi.Input
ToProcedureArrayOutput() ProcedureArrayOutput
ToProcedureArrayOutputWithContext(context.Context) ProcedureArrayOutput
}
type ProcedureArray []ProcedureInput
func (ProcedureArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Procedure)(nil)).Elem()
}
func (i ProcedureArray) ToProcedureArrayOutput() ProcedureArrayOutput {
return i.ToProcedureArrayOutputWithContext(context.Background())
}
func (i ProcedureArray) ToProcedureArrayOutputWithContext(ctx context.Context) ProcedureArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProcedureArrayOutput)
}
// ProcedureMapInput is an input type that accepts ProcedureMap and ProcedureMapOutput values.
// You can construct a concrete instance of `ProcedureMapInput` via:
//
// ProcedureMap{ "key": ProcedureArgs{...} }
type ProcedureMapInput interface {
pulumi.Input
ToProcedureMapOutput() ProcedureMapOutput
ToProcedureMapOutputWithContext(context.Context) ProcedureMapOutput
}
type ProcedureMap map[string]ProcedureInput
func (ProcedureMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Procedure)(nil)).Elem()
}
func (i ProcedureMap) ToProcedureMapOutput() ProcedureMapOutput {
return i.ToProcedureMapOutputWithContext(context.Background())
}
func (i ProcedureMap) ToProcedureMapOutputWithContext(ctx context.Context) ProcedureMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ProcedureMapOutput)
}
type ProcedureOutput struct{ *pulumi.OutputState }
func (ProcedureOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Procedure)(nil)).Elem()
}
func (o ProcedureOutput) ToProcedureOutput() ProcedureOutput {
return o
}
func (o ProcedureOutput) ToProcedureOutputWithContext(ctx context.Context) ProcedureOutput {
return o
}
type ProcedureArrayOutput struct{ *pulumi.OutputState }
func (ProcedureArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Procedure)(nil)).Elem()
}
func (o ProcedureArrayOutput) ToProcedureArrayOutput() ProcedureArrayOutput {
return o
}
func (o ProcedureArrayOutput) ToProcedureArrayOutputWithContext(ctx context.Context) ProcedureArrayOutput {
return o
}
func (o ProcedureArrayOutput) Index(i pulumi.IntInput) ProcedureOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Procedure {
return vs[0].([]*Procedure)[vs[1].(int)]
}).(ProcedureOutput)
}
type ProcedureMapOutput struct{ *pulumi.OutputState }
func (ProcedureMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Procedure)(nil)).Elem()
}
func (o ProcedureMapOutput) ToProcedureMapOutput() ProcedureMapOutput {
return o
}
func (o ProcedureMapOutput) ToProcedureMapOutputWithContext(ctx context.Context) ProcedureMapOutput {
return o
}
func (o ProcedureMapOutput) MapIndex(k pulumi.StringInput) ProcedureOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Procedure {
return vs[0].(map[string]*Procedure)[vs[1].(string)]
}).(ProcedureOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ProcedureInput)(nil)).Elem(), &Procedure{})
pulumi.RegisterInputType(reflect.TypeOf((*ProcedureArrayInput)(nil)).Elem(), ProcedureArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ProcedureMapInput)(nil)).Elem(), ProcedureMap{})
pulumi.RegisterOutputType(ProcedureOutput{})
pulumi.RegisterOutputType(ProcedureArrayOutput{})
pulumi.RegisterOutputType(ProcedureMapOutput{})
}