This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
generated from pulumi/pulumi-tf-provider-boilerplate
/
customRole.go
354 lines (302 loc) · 13.7 KB
/
customRole.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
// 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 launchdarkly
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a LaunchDarkly custom role resource.
//
// > **Note:** Custom roles are available to customers on an Enterprise LaunchDarkly plan. To learn more, read about our pricing. To upgrade your plan, [contact LaunchDarkly Sales](https://launchdarkly.com/contact-sales/).
//
// This resource allows you to create and manage custom roles within your LaunchDarkly organization.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/lbrlabs/pulumi-launchdarkly/sdk/go/launchdarkly"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := launchdarkly.NewCustomRole(ctx, "example", &launchdarkly.CustomRoleArgs{
// Description: pulumi.String("This is an example role"),
// Key: pulumi.String("example-role-key-1"),
// PolicyStatements: launchdarkly.CustomRolePolicyStatementArray{
// &launchdarkly.CustomRolePolicyStatementArgs{
// Actions: pulumi.StringArray{
// pulumi.String("*"),
// },
// Effect: pulumi.String("allow"),
// Resources: pulumi.StringArray{
// pulumi.String("proj/*:env/production:flag/*"),
// },
// },
// &launchdarkly.CustomRolePolicyStatementArgs{
// Actions: pulumi.StringArray{
// pulumi.String("*"),
// },
// Effect: pulumi.String("allow"),
// Resources: pulumi.StringArray{
// pulumi.String("proj/*:env/production"),
// },
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// You can import LaunchDarkly custom roles by using an existing custom role `key`. For example
//
// ```sh
//
// $ pulumi import launchdarkly:index/customRole:CustomRole example example-role-key-1
//
// ```
type CustomRole struct {
pulumi.CustomResourceState
// The base permission level. Either `reader` or `noAccess`. Defaults to `reader` if not set.
BasePermissions pulumi.StringPtrOutput `pulumi:"basePermissions"`
// The description of the custom role.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The unique key that references the custom role. A change in this field will force the destruction of the existing resource and the creation of a new one.
Key pulumi.StringOutput `pulumi:"key"`
// The human-readable name for the custom role.
Name pulumi.StringOutput `pulumi:"name"`
// Deprecated: 'policy' is now deprecated. Please migrate to 'policy_statements' to maintain future compatability.
Policies CustomRolePolicyArrayOutput `pulumi:"policies"`
// The custom role policy block. To learn more, read [Using policies](https://docs.launchdarkly.com/home/members/role-policies).
PolicyStatements CustomRolePolicyStatementArrayOutput `pulumi:"policyStatements"`
}
// NewCustomRole registers a new resource with the given unique name, arguments, and options.
func NewCustomRole(ctx *pulumi.Context,
name string, args *CustomRoleArgs, opts ...pulumi.ResourceOption) (*CustomRole, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Key == nil {
return nil, errors.New("invalid value for required argument 'Key'")
}
opts = pkgResourceDefaultOpts(opts)
var resource CustomRole
err := ctx.RegisterResource("launchdarkly:index/customRole:CustomRole", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetCustomRole gets an existing CustomRole 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 GetCustomRole(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *CustomRoleState, opts ...pulumi.ResourceOption) (*CustomRole, error) {
var resource CustomRole
err := ctx.ReadResource("launchdarkly:index/customRole:CustomRole", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering CustomRole resources.
type customRoleState struct {
// The base permission level. Either `reader` or `noAccess`. Defaults to `reader` if not set.
BasePermissions *string `pulumi:"basePermissions"`
// The description of the custom role.
Description *string `pulumi:"description"`
// The unique key that references the custom role. A change in this field will force the destruction of the existing resource and the creation of a new one.
Key *string `pulumi:"key"`
// The human-readable name for the custom role.
Name *string `pulumi:"name"`
// Deprecated: 'policy' is now deprecated. Please migrate to 'policy_statements' to maintain future compatability.
Policies []CustomRolePolicy `pulumi:"policies"`
// The custom role policy block. To learn more, read [Using policies](https://docs.launchdarkly.com/home/members/role-policies).
PolicyStatements []CustomRolePolicyStatement `pulumi:"policyStatements"`
}
type CustomRoleState struct {
// The base permission level. Either `reader` or `noAccess`. Defaults to `reader` if not set.
BasePermissions pulumi.StringPtrInput
// The description of the custom role.
Description pulumi.StringPtrInput
// The unique key that references the custom role. A change in this field will force the destruction of the existing resource and the creation of a new one.
Key pulumi.StringPtrInput
// The human-readable name for the custom role.
Name pulumi.StringPtrInput
// Deprecated: 'policy' is now deprecated. Please migrate to 'policy_statements' to maintain future compatability.
Policies CustomRolePolicyArrayInput
// The custom role policy block. To learn more, read [Using policies](https://docs.launchdarkly.com/home/members/role-policies).
PolicyStatements CustomRolePolicyStatementArrayInput
}
func (CustomRoleState) ElementType() reflect.Type {
return reflect.TypeOf((*customRoleState)(nil)).Elem()
}
type customRoleArgs struct {
// The base permission level. Either `reader` or `noAccess`. Defaults to `reader` if not set.
BasePermissions *string `pulumi:"basePermissions"`
// The description of the custom role.
Description *string `pulumi:"description"`
// The unique key that references the custom role. A change in this field will force the destruction of the existing resource and the creation of a new one.
Key string `pulumi:"key"`
// The human-readable name for the custom role.
Name *string `pulumi:"name"`
// Deprecated: 'policy' is now deprecated. Please migrate to 'policy_statements' to maintain future compatability.
Policies []CustomRolePolicy `pulumi:"policies"`
// The custom role policy block. To learn more, read [Using policies](https://docs.launchdarkly.com/home/members/role-policies).
PolicyStatements []CustomRolePolicyStatement `pulumi:"policyStatements"`
}
// The set of arguments for constructing a CustomRole resource.
type CustomRoleArgs struct {
// The base permission level. Either `reader` or `noAccess`. Defaults to `reader` if not set.
BasePermissions pulumi.StringPtrInput
// The description of the custom role.
Description pulumi.StringPtrInput
// The unique key that references the custom role. A change in this field will force the destruction of the existing resource and the creation of a new one.
Key pulumi.StringInput
// The human-readable name for the custom role.
Name pulumi.StringPtrInput
// Deprecated: 'policy' is now deprecated. Please migrate to 'policy_statements' to maintain future compatability.
Policies CustomRolePolicyArrayInput
// The custom role policy block. To learn more, read [Using policies](https://docs.launchdarkly.com/home/members/role-policies).
PolicyStatements CustomRolePolicyStatementArrayInput
}
func (CustomRoleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*customRoleArgs)(nil)).Elem()
}
type CustomRoleInput interface {
pulumi.Input
ToCustomRoleOutput() CustomRoleOutput
ToCustomRoleOutputWithContext(ctx context.Context) CustomRoleOutput
}
func (*CustomRole) ElementType() reflect.Type {
return reflect.TypeOf((**CustomRole)(nil)).Elem()
}
func (i *CustomRole) ToCustomRoleOutput() CustomRoleOutput {
return i.ToCustomRoleOutputWithContext(context.Background())
}
func (i *CustomRole) ToCustomRoleOutputWithContext(ctx context.Context) CustomRoleOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomRoleOutput)
}
// CustomRoleArrayInput is an input type that accepts CustomRoleArray and CustomRoleArrayOutput values.
// You can construct a concrete instance of `CustomRoleArrayInput` via:
//
// CustomRoleArray{ CustomRoleArgs{...} }
type CustomRoleArrayInput interface {
pulumi.Input
ToCustomRoleArrayOutput() CustomRoleArrayOutput
ToCustomRoleArrayOutputWithContext(context.Context) CustomRoleArrayOutput
}
type CustomRoleArray []CustomRoleInput
func (CustomRoleArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CustomRole)(nil)).Elem()
}
func (i CustomRoleArray) ToCustomRoleArrayOutput() CustomRoleArrayOutput {
return i.ToCustomRoleArrayOutputWithContext(context.Background())
}
func (i CustomRoleArray) ToCustomRoleArrayOutputWithContext(ctx context.Context) CustomRoleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomRoleArrayOutput)
}
// CustomRoleMapInput is an input type that accepts CustomRoleMap and CustomRoleMapOutput values.
// You can construct a concrete instance of `CustomRoleMapInput` via:
//
// CustomRoleMap{ "key": CustomRoleArgs{...} }
type CustomRoleMapInput interface {
pulumi.Input
ToCustomRoleMapOutput() CustomRoleMapOutput
ToCustomRoleMapOutputWithContext(context.Context) CustomRoleMapOutput
}
type CustomRoleMap map[string]CustomRoleInput
func (CustomRoleMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CustomRole)(nil)).Elem()
}
func (i CustomRoleMap) ToCustomRoleMapOutput() CustomRoleMapOutput {
return i.ToCustomRoleMapOutputWithContext(context.Background())
}
func (i CustomRoleMap) ToCustomRoleMapOutputWithContext(ctx context.Context) CustomRoleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(CustomRoleMapOutput)
}
type CustomRoleOutput struct{ *pulumi.OutputState }
func (CustomRoleOutput) ElementType() reflect.Type {
return reflect.TypeOf((**CustomRole)(nil)).Elem()
}
func (o CustomRoleOutput) ToCustomRoleOutput() CustomRoleOutput {
return o
}
func (o CustomRoleOutput) ToCustomRoleOutputWithContext(ctx context.Context) CustomRoleOutput {
return o
}
// The base permission level. Either `reader` or `noAccess`. Defaults to `reader` if not set.
func (o CustomRoleOutput) BasePermissions() pulumi.StringPtrOutput {
return o.ApplyT(func(v *CustomRole) pulumi.StringPtrOutput { return v.BasePermissions }).(pulumi.StringPtrOutput)
}
// The description of the custom role.
func (o CustomRoleOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *CustomRole) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// The unique key that references the custom role. A change in this field will force the destruction of the existing resource and the creation of a new one.
func (o CustomRoleOutput) Key() pulumi.StringOutput {
return o.ApplyT(func(v *CustomRole) pulumi.StringOutput { return v.Key }).(pulumi.StringOutput)
}
// The human-readable name for the custom role.
func (o CustomRoleOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *CustomRole) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// Deprecated: 'policy' is now deprecated. Please migrate to 'policy_statements' to maintain future compatability.
func (o CustomRoleOutput) Policies() CustomRolePolicyArrayOutput {
return o.ApplyT(func(v *CustomRole) CustomRolePolicyArrayOutput { return v.Policies }).(CustomRolePolicyArrayOutput)
}
// The custom role policy block. To learn more, read [Using policies](https://docs.launchdarkly.com/home/members/role-policies).
func (o CustomRoleOutput) PolicyStatements() CustomRolePolicyStatementArrayOutput {
return o.ApplyT(func(v *CustomRole) CustomRolePolicyStatementArrayOutput { return v.PolicyStatements }).(CustomRolePolicyStatementArrayOutput)
}
type CustomRoleArrayOutput struct{ *pulumi.OutputState }
func (CustomRoleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*CustomRole)(nil)).Elem()
}
func (o CustomRoleArrayOutput) ToCustomRoleArrayOutput() CustomRoleArrayOutput {
return o
}
func (o CustomRoleArrayOutput) ToCustomRoleArrayOutputWithContext(ctx context.Context) CustomRoleArrayOutput {
return o
}
func (o CustomRoleArrayOutput) Index(i pulumi.IntInput) CustomRoleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *CustomRole {
return vs[0].([]*CustomRole)[vs[1].(int)]
}).(CustomRoleOutput)
}
type CustomRoleMapOutput struct{ *pulumi.OutputState }
func (CustomRoleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*CustomRole)(nil)).Elem()
}
func (o CustomRoleMapOutput) ToCustomRoleMapOutput() CustomRoleMapOutput {
return o
}
func (o CustomRoleMapOutput) ToCustomRoleMapOutputWithContext(ctx context.Context) CustomRoleMapOutput {
return o
}
func (o CustomRoleMapOutput) MapIndex(k pulumi.StringInput) CustomRoleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *CustomRole {
return vs[0].(map[string]*CustomRole)[vs[1].(string)]
}).(CustomRoleOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*CustomRoleInput)(nil)).Elem(), &CustomRole{})
pulumi.RegisterInputType(reflect.TypeOf((*CustomRoleArrayInput)(nil)).Elem(), CustomRoleArray{})
pulumi.RegisterInputType(reflect.TypeOf((*CustomRoleMapInput)(nil)).Elem(), CustomRoleMap{})
pulumi.RegisterOutputType(CustomRoleOutput{})
pulumi.RegisterOutputType(CustomRoleArrayOutput{})
pulumi.RegisterOutputType(CustomRoleMapOutput{})
}