generated from pulumi/pulumi-tf-provider-boilerplate
/
pipeGrant.go
281 lines (235 loc) · 11.5 KB
/
pipeGrant.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
// *** 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"
)
// ## Import
//
// # format is database name | schema name | pipe name | privilege | true/false for with_grant_option
//
// ```sh
// $ pulumi import snowflake:index/pipeGrant:PipeGrant example 'dbName|schemaName|pipeName|OPERATE|false'
// ```
type PipeGrant struct {
pulumi.CustomResourceState
// The name of the database containing the current or future pipes on which to grant privileges.
DatabaseName pulumi.StringOutput `pulumi:"databaseName"`
// When this is set to true and a schema*name is provided, apply this grant on all future pipes in the given schema. When this is true and no schema*name is provided apply this grant on all future pipes in the given database. The pipe*name field must be unset in order to use on*future.
OnFuture pulumi.BoolPtrOutput `pulumi:"onFuture"`
// The name of the pipe on which to grant privileges immediately (only valid if onFuture is false).
PipeName pulumi.StringPtrOutput `pulumi:"pipeName"`
// The privilege to grant on the current or future pipe.
Privilege pulumi.StringPtrOutput `pulumi:"privilege"`
// Grants privilege to these roles.
Roles pulumi.StringArrayOutput `pulumi:"roles"`
// The name of the schema containing the current or future pipes on which to grant privileges.
SchemaName pulumi.StringOutput `pulumi:"schemaName"`
// When this is set to true, allows the recipient role to grant the privileges to other roles.
WithGrantOption pulumi.BoolPtrOutput `pulumi:"withGrantOption"`
}
// NewPipeGrant registers a new resource with the given unique name, arguments, and options.
func NewPipeGrant(ctx *pulumi.Context,
name string, args *PipeGrantArgs, opts ...pulumi.ResourceOption) (*PipeGrant, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DatabaseName == nil {
return nil, errors.New("invalid value for required argument 'DatabaseName'")
}
if args.SchemaName == nil {
return nil, errors.New("invalid value for required argument 'SchemaName'")
}
var resource PipeGrant
err := ctx.RegisterResource("snowflake:index/pipeGrant:PipeGrant", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetPipeGrant gets an existing PipeGrant 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 GetPipeGrant(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *PipeGrantState, opts ...pulumi.ResourceOption) (*PipeGrant, error) {
var resource PipeGrant
err := ctx.ReadResource("snowflake:index/pipeGrant:PipeGrant", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering PipeGrant resources.
type pipeGrantState struct {
// The name of the database containing the current or future pipes on which to grant privileges.
DatabaseName *string `pulumi:"databaseName"`
// When this is set to true and a schema*name is provided, apply this grant on all future pipes in the given schema. When this is true and no schema*name is provided apply this grant on all future pipes in the given database. The pipe*name field must be unset in order to use on*future.
OnFuture *bool `pulumi:"onFuture"`
// The name of the pipe on which to grant privileges immediately (only valid if onFuture is false).
PipeName *string `pulumi:"pipeName"`
// The privilege to grant on the current or future pipe.
Privilege *string `pulumi:"privilege"`
// Grants privilege to these roles.
Roles []string `pulumi:"roles"`
// The name of the schema containing the current or future pipes on which to grant privileges.
SchemaName *string `pulumi:"schemaName"`
// When this is set to true, allows the recipient role to grant the privileges to other roles.
WithGrantOption *bool `pulumi:"withGrantOption"`
}
type PipeGrantState struct {
// The name of the database containing the current or future pipes on which to grant privileges.
DatabaseName pulumi.StringPtrInput
// When this is set to true and a schema*name is provided, apply this grant on all future pipes in the given schema. When this is true and no schema*name is provided apply this grant on all future pipes in the given database. The pipe*name field must be unset in order to use on*future.
OnFuture pulumi.BoolPtrInput
// The name of the pipe on which to grant privileges immediately (only valid if onFuture is false).
PipeName pulumi.StringPtrInput
// The privilege to grant on the current or future pipe.
Privilege pulumi.StringPtrInput
// Grants privilege to these roles.
Roles pulumi.StringArrayInput
// The name of the schema containing the current or future pipes on which to grant privileges.
SchemaName pulumi.StringPtrInput
// When this is set to true, allows the recipient role to grant the privileges to other roles.
WithGrantOption pulumi.BoolPtrInput
}
func (PipeGrantState) ElementType() reflect.Type {
return reflect.TypeOf((*pipeGrantState)(nil)).Elem()
}
type pipeGrantArgs struct {
// The name of the database containing the current or future pipes on which to grant privileges.
DatabaseName string `pulumi:"databaseName"`
// When this is set to true and a schema*name is provided, apply this grant on all future pipes in the given schema. When this is true and no schema*name is provided apply this grant on all future pipes in the given database. The pipe*name field must be unset in order to use on*future.
OnFuture *bool `pulumi:"onFuture"`
// The name of the pipe on which to grant privileges immediately (only valid if onFuture is false).
PipeName *string `pulumi:"pipeName"`
// The privilege to grant on the current or future pipe.
Privilege *string `pulumi:"privilege"`
// Grants privilege to these roles.
Roles []string `pulumi:"roles"`
// The name of the schema containing the current or future pipes on which to grant privileges.
SchemaName string `pulumi:"schemaName"`
// When this is set to true, allows the recipient role to grant the privileges to other roles.
WithGrantOption *bool `pulumi:"withGrantOption"`
}
// The set of arguments for constructing a PipeGrant resource.
type PipeGrantArgs struct {
// The name of the database containing the current or future pipes on which to grant privileges.
DatabaseName pulumi.StringInput
// When this is set to true and a schema*name is provided, apply this grant on all future pipes in the given schema. When this is true and no schema*name is provided apply this grant on all future pipes in the given database. The pipe*name field must be unset in order to use on*future.
OnFuture pulumi.BoolPtrInput
// The name of the pipe on which to grant privileges immediately (only valid if onFuture is false).
PipeName pulumi.StringPtrInput
// The privilege to grant on the current or future pipe.
Privilege pulumi.StringPtrInput
// Grants privilege to these roles.
Roles pulumi.StringArrayInput
// The name of the schema containing the current or future pipes on which to grant privileges.
SchemaName pulumi.StringInput
// When this is set to true, allows the recipient role to grant the privileges to other roles.
WithGrantOption pulumi.BoolPtrInput
}
func (PipeGrantArgs) ElementType() reflect.Type {
return reflect.TypeOf((*pipeGrantArgs)(nil)).Elem()
}
type PipeGrantInput interface {
pulumi.Input
ToPipeGrantOutput() PipeGrantOutput
ToPipeGrantOutputWithContext(ctx context.Context) PipeGrantOutput
}
func (*PipeGrant) ElementType() reflect.Type {
return reflect.TypeOf((**PipeGrant)(nil)).Elem()
}
func (i *PipeGrant) ToPipeGrantOutput() PipeGrantOutput {
return i.ToPipeGrantOutputWithContext(context.Background())
}
func (i *PipeGrant) ToPipeGrantOutputWithContext(ctx context.Context) PipeGrantOutput {
return pulumi.ToOutputWithContext(ctx, i).(PipeGrantOutput)
}
// PipeGrantArrayInput is an input type that accepts PipeGrantArray and PipeGrantArrayOutput values.
// You can construct a concrete instance of `PipeGrantArrayInput` via:
//
// PipeGrantArray{ PipeGrantArgs{...} }
type PipeGrantArrayInput interface {
pulumi.Input
ToPipeGrantArrayOutput() PipeGrantArrayOutput
ToPipeGrantArrayOutputWithContext(context.Context) PipeGrantArrayOutput
}
type PipeGrantArray []PipeGrantInput
func (PipeGrantArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*PipeGrant)(nil)).Elem()
}
func (i PipeGrantArray) ToPipeGrantArrayOutput() PipeGrantArrayOutput {
return i.ToPipeGrantArrayOutputWithContext(context.Background())
}
func (i PipeGrantArray) ToPipeGrantArrayOutputWithContext(ctx context.Context) PipeGrantArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(PipeGrantArrayOutput)
}
// PipeGrantMapInput is an input type that accepts PipeGrantMap and PipeGrantMapOutput values.
// You can construct a concrete instance of `PipeGrantMapInput` via:
//
// PipeGrantMap{ "key": PipeGrantArgs{...} }
type PipeGrantMapInput interface {
pulumi.Input
ToPipeGrantMapOutput() PipeGrantMapOutput
ToPipeGrantMapOutputWithContext(context.Context) PipeGrantMapOutput
}
type PipeGrantMap map[string]PipeGrantInput
func (PipeGrantMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*PipeGrant)(nil)).Elem()
}
func (i PipeGrantMap) ToPipeGrantMapOutput() PipeGrantMapOutput {
return i.ToPipeGrantMapOutputWithContext(context.Background())
}
func (i PipeGrantMap) ToPipeGrantMapOutputWithContext(ctx context.Context) PipeGrantMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(PipeGrantMapOutput)
}
type PipeGrantOutput struct{ *pulumi.OutputState }
func (PipeGrantOutput) ElementType() reflect.Type {
return reflect.TypeOf((**PipeGrant)(nil)).Elem()
}
func (o PipeGrantOutput) ToPipeGrantOutput() PipeGrantOutput {
return o
}
func (o PipeGrantOutput) ToPipeGrantOutputWithContext(ctx context.Context) PipeGrantOutput {
return o
}
type PipeGrantArrayOutput struct{ *pulumi.OutputState }
func (PipeGrantArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*PipeGrant)(nil)).Elem()
}
func (o PipeGrantArrayOutput) ToPipeGrantArrayOutput() PipeGrantArrayOutput {
return o
}
func (o PipeGrantArrayOutput) ToPipeGrantArrayOutputWithContext(ctx context.Context) PipeGrantArrayOutput {
return o
}
func (o PipeGrantArrayOutput) Index(i pulumi.IntInput) PipeGrantOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *PipeGrant {
return vs[0].([]*PipeGrant)[vs[1].(int)]
}).(PipeGrantOutput)
}
type PipeGrantMapOutput struct{ *pulumi.OutputState }
func (PipeGrantMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*PipeGrant)(nil)).Elem()
}
func (o PipeGrantMapOutput) ToPipeGrantMapOutput() PipeGrantMapOutput {
return o
}
func (o PipeGrantMapOutput) ToPipeGrantMapOutputWithContext(ctx context.Context) PipeGrantMapOutput {
return o
}
func (o PipeGrantMapOutput) MapIndex(k pulumi.StringInput) PipeGrantOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *PipeGrant {
return vs[0].(map[string]*PipeGrant)[vs[1].(string)]
}).(PipeGrantOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*PipeGrantInput)(nil)).Elem(), &PipeGrant{})
pulumi.RegisterInputType(reflect.TypeOf((*PipeGrantArrayInput)(nil)).Elem(), PipeGrantArray{})
pulumi.RegisterInputType(reflect.TypeOf((*PipeGrantMapInput)(nil)).Elem(), PipeGrantMap{})
pulumi.RegisterOutputType(PipeGrantOutput{})
pulumi.RegisterOutputType(PipeGrantArrayOutput{})
pulumi.RegisterOutputType(PipeGrantMapOutput{})
}