/
userAdminRoles.go
310 lines (261 loc) · 11.6 KB
/
userAdminRoles.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
// 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 okta
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Resource to manage a set of admin roles for a specific user.
//
// This resource allows you to manage admin roles for a single user, independent of the user schema itself.
//
// When using this with a `user.User` resource, you should add a lifecycle ignore for admin roles to avoid conflicts
// in desired state.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-okta/sdk/v3/go/okta"
// "github.com/pulumi/pulumi-okta/sdk/v3/go/okta/user"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// testUser, err := user.NewUser(ctx, "testUser", &user.UserArgs{
// FirstName: pulumi.String("TestAcc"),
// LastName: pulumi.String("Smith"),
// Login: pulumi.String("testAcc-replace_with_uuid@example.com"),
// Email: pulumi.String("testAcc-replace_with_uuid@example.com"),
// })
// if err != nil {
// return err
// }
// _, err = okta.NewUserAdminRoles(ctx, "testUserAdminRoles", &okta.UserAdminRolesArgs{
// UserId: testUser.ID(),
// AdminRoles: pulumi.StringArray{
// pulumi.String("APP_ADMIN"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Existing user admin roles can be imported via the Okta User ID.
//
// ```sh
//
// $ pulumi import okta:index/userAdminRoles:UserAdminRoles example <user id>
//
// ```
type UserAdminRoles struct {
pulumi.CustomResourceState
// The list of Okta user admin roles, e.g. `["APP_ADMIN", "USER_ADMIN"]` See [API Docs](https://developer.okta.com/docs/reference/api/roles/#role-types).
AdminRoles pulumi.StringArrayOutput `pulumi:"adminRoles"`
// When this setting is enabled, the admins won't receive any of the default Okta
// administrator emails. These admins also won't have access to contact Okta Support and open support cases on behalf of your org.
DisableNotifications pulumi.BoolPtrOutput `pulumi:"disableNotifications"`
// Okta user ID.
UserId pulumi.StringOutput `pulumi:"userId"`
}
// NewUserAdminRoles registers a new resource with the given unique name, arguments, and options.
func NewUserAdminRoles(ctx *pulumi.Context,
name string, args *UserAdminRolesArgs, opts ...pulumi.ResourceOption) (*UserAdminRoles, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AdminRoles == nil {
return nil, errors.New("invalid value for required argument 'AdminRoles'")
}
if args.UserId == nil {
return nil, errors.New("invalid value for required argument 'UserId'")
}
var resource UserAdminRoles
err := ctx.RegisterResource("okta:index/userAdminRoles:UserAdminRoles", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUserAdminRoles gets an existing UserAdminRoles 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 GetUserAdminRoles(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UserAdminRolesState, opts ...pulumi.ResourceOption) (*UserAdminRoles, error) {
var resource UserAdminRoles
err := ctx.ReadResource("okta:index/userAdminRoles:UserAdminRoles", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering UserAdminRoles resources.
type userAdminRolesState struct {
// The list of Okta user admin roles, e.g. `["APP_ADMIN", "USER_ADMIN"]` See [API Docs](https://developer.okta.com/docs/reference/api/roles/#role-types).
AdminRoles []string `pulumi:"adminRoles"`
// When this setting is enabled, the admins won't receive any of the default Okta
// administrator emails. These admins also won't have access to contact Okta Support and open support cases on behalf of your org.
DisableNotifications *bool `pulumi:"disableNotifications"`
// Okta user ID.
UserId *string `pulumi:"userId"`
}
type UserAdminRolesState struct {
// The list of Okta user admin roles, e.g. `["APP_ADMIN", "USER_ADMIN"]` See [API Docs](https://developer.okta.com/docs/reference/api/roles/#role-types).
AdminRoles pulumi.StringArrayInput
// When this setting is enabled, the admins won't receive any of the default Okta
// administrator emails. These admins also won't have access to contact Okta Support and open support cases on behalf of your org.
DisableNotifications pulumi.BoolPtrInput
// Okta user ID.
UserId pulumi.StringPtrInput
}
func (UserAdminRolesState) ElementType() reflect.Type {
return reflect.TypeOf((*userAdminRolesState)(nil)).Elem()
}
type userAdminRolesArgs struct {
// The list of Okta user admin roles, e.g. `["APP_ADMIN", "USER_ADMIN"]` See [API Docs](https://developer.okta.com/docs/reference/api/roles/#role-types).
AdminRoles []string `pulumi:"adminRoles"`
// When this setting is enabled, the admins won't receive any of the default Okta
// administrator emails. These admins also won't have access to contact Okta Support and open support cases on behalf of your org.
DisableNotifications *bool `pulumi:"disableNotifications"`
// Okta user ID.
UserId string `pulumi:"userId"`
}
// The set of arguments for constructing a UserAdminRoles resource.
type UserAdminRolesArgs struct {
// The list of Okta user admin roles, e.g. `["APP_ADMIN", "USER_ADMIN"]` See [API Docs](https://developer.okta.com/docs/reference/api/roles/#role-types).
AdminRoles pulumi.StringArrayInput
// When this setting is enabled, the admins won't receive any of the default Okta
// administrator emails. These admins also won't have access to contact Okta Support and open support cases on behalf of your org.
DisableNotifications pulumi.BoolPtrInput
// Okta user ID.
UserId pulumi.StringInput
}
func (UserAdminRolesArgs) ElementType() reflect.Type {
return reflect.TypeOf((*userAdminRolesArgs)(nil)).Elem()
}
type UserAdminRolesInput interface {
pulumi.Input
ToUserAdminRolesOutput() UserAdminRolesOutput
ToUserAdminRolesOutputWithContext(ctx context.Context) UserAdminRolesOutput
}
func (*UserAdminRoles) ElementType() reflect.Type {
return reflect.TypeOf((**UserAdminRoles)(nil)).Elem()
}
func (i *UserAdminRoles) ToUserAdminRolesOutput() UserAdminRolesOutput {
return i.ToUserAdminRolesOutputWithContext(context.Background())
}
func (i *UserAdminRoles) ToUserAdminRolesOutputWithContext(ctx context.Context) UserAdminRolesOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserAdminRolesOutput)
}
// UserAdminRolesArrayInput is an input type that accepts UserAdminRolesArray and UserAdminRolesArrayOutput values.
// You can construct a concrete instance of `UserAdminRolesArrayInput` via:
//
// UserAdminRolesArray{ UserAdminRolesArgs{...} }
type UserAdminRolesArrayInput interface {
pulumi.Input
ToUserAdminRolesArrayOutput() UserAdminRolesArrayOutput
ToUserAdminRolesArrayOutputWithContext(context.Context) UserAdminRolesArrayOutput
}
type UserAdminRolesArray []UserAdminRolesInput
func (UserAdminRolesArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*UserAdminRoles)(nil)).Elem()
}
func (i UserAdminRolesArray) ToUserAdminRolesArrayOutput() UserAdminRolesArrayOutput {
return i.ToUserAdminRolesArrayOutputWithContext(context.Background())
}
func (i UserAdminRolesArray) ToUserAdminRolesArrayOutputWithContext(ctx context.Context) UserAdminRolesArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserAdminRolesArrayOutput)
}
// UserAdminRolesMapInput is an input type that accepts UserAdminRolesMap and UserAdminRolesMapOutput values.
// You can construct a concrete instance of `UserAdminRolesMapInput` via:
//
// UserAdminRolesMap{ "key": UserAdminRolesArgs{...} }
type UserAdminRolesMapInput interface {
pulumi.Input
ToUserAdminRolesMapOutput() UserAdminRolesMapOutput
ToUserAdminRolesMapOutputWithContext(context.Context) UserAdminRolesMapOutput
}
type UserAdminRolesMap map[string]UserAdminRolesInput
func (UserAdminRolesMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*UserAdminRoles)(nil)).Elem()
}
func (i UserAdminRolesMap) ToUserAdminRolesMapOutput() UserAdminRolesMapOutput {
return i.ToUserAdminRolesMapOutputWithContext(context.Background())
}
func (i UserAdminRolesMap) ToUserAdminRolesMapOutputWithContext(ctx context.Context) UserAdminRolesMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserAdminRolesMapOutput)
}
type UserAdminRolesOutput struct{ *pulumi.OutputState }
func (UserAdminRolesOutput) ElementType() reflect.Type {
return reflect.TypeOf((**UserAdminRoles)(nil)).Elem()
}
func (o UserAdminRolesOutput) ToUserAdminRolesOutput() UserAdminRolesOutput {
return o
}
func (o UserAdminRolesOutput) ToUserAdminRolesOutputWithContext(ctx context.Context) UserAdminRolesOutput {
return o
}
// The list of Okta user admin roles, e.g. `["APP_ADMIN", "USER_ADMIN"]` See [API Docs](https://developer.okta.com/docs/reference/api/roles/#role-types).
func (o UserAdminRolesOutput) AdminRoles() pulumi.StringArrayOutput {
return o.ApplyT(func(v *UserAdminRoles) pulumi.StringArrayOutput { return v.AdminRoles }).(pulumi.StringArrayOutput)
}
// When this setting is enabled, the admins won't receive any of the default Okta
// administrator emails. These admins also won't have access to contact Okta Support and open support cases on behalf of your org.
func (o UserAdminRolesOutput) DisableNotifications() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *UserAdminRoles) pulumi.BoolPtrOutput { return v.DisableNotifications }).(pulumi.BoolPtrOutput)
}
// Okta user ID.
func (o UserAdminRolesOutput) UserId() pulumi.StringOutput {
return o.ApplyT(func(v *UserAdminRoles) pulumi.StringOutput { return v.UserId }).(pulumi.StringOutput)
}
type UserAdminRolesArrayOutput struct{ *pulumi.OutputState }
func (UserAdminRolesArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*UserAdminRoles)(nil)).Elem()
}
func (o UserAdminRolesArrayOutput) ToUserAdminRolesArrayOutput() UserAdminRolesArrayOutput {
return o
}
func (o UserAdminRolesArrayOutput) ToUserAdminRolesArrayOutputWithContext(ctx context.Context) UserAdminRolesArrayOutput {
return o
}
func (o UserAdminRolesArrayOutput) Index(i pulumi.IntInput) UserAdminRolesOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UserAdminRoles {
return vs[0].([]*UserAdminRoles)[vs[1].(int)]
}).(UserAdminRolesOutput)
}
type UserAdminRolesMapOutput struct{ *pulumi.OutputState }
func (UserAdminRolesMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*UserAdminRoles)(nil)).Elem()
}
func (o UserAdminRolesMapOutput) ToUserAdminRolesMapOutput() UserAdminRolesMapOutput {
return o
}
func (o UserAdminRolesMapOutput) ToUserAdminRolesMapOutputWithContext(ctx context.Context) UserAdminRolesMapOutput {
return o
}
func (o UserAdminRolesMapOutput) MapIndex(k pulumi.StringInput) UserAdminRolesOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UserAdminRoles {
return vs[0].(map[string]*UserAdminRoles)[vs[1].(string)]
}).(UserAdminRolesOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*UserAdminRolesInput)(nil)).Elem(), &UserAdminRoles{})
pulumi.RegisterInputType(reflect.TypeOf((*UserAdminRolesArrayInput)(nil)).Elem(), UserAdminRolesArray{})
pulumi.RegisterInputType(reflect.TypeOf((*UserAdminRolesMapInput)(nil)).Elem(), UserAdminRolesMap{})
pulumi.RegisterOutputType(UserAdminRolesOutput{})
pulumi.RegisterOutputType(UserAdminRolesArrayOutput{})
pulumi.RegisterOutputType(UserAdminRolesMapOutput{})
}