/
userRoles.go
299 lines (239 loc) · 9.07 KB
/
userRoles.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
// *** 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 keycloak
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// ## Import
//
// This resource can be imported using the format `{{realm_id}}/{{user_id}}`, where `user_id` is the unique ID that Keycloak assigns to the user upon creation. This value can be found in the GUI when editing the user, and is typically a GUID. Examplebash
//
// ```sh
// $ pulumi import keycloak:index/userRoles:UserRoles user_roles my-realm/b0ae6924-1bd5-4655-9e38-dae7c5e42924
// ```
type UserRoles struct {
pulumi.CustomResourceState
// The realm this user exists in.
RealmId pulumi.StringOutput `pulumi:"realmId"`
// A list of role IDs to map to the user
RoleIds pulumi.StringArrayOutput `pulumi:"roleIds"`
// The ID of the user this resource should manage roles for.
UserId pulumi.StringOutput `pulumi:"userId"`
}
// NewUserRoles registers a new resource with the given unique name, arguments, and options.
func NewUserRoles(ctx *pulumi.Context,
name string, args *UserRolesArgs, opts ...pulumi.ResourceOption) (*UserRoles, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.RealmId == nil {
return nil, errors.New("invalid value for required argument 'RealmId'")
}
if args.RoleIds == nil {
return nil, errors.New("invalid value for required argument 'RoleIds'")
}
if args.UserId == nil {
return nil, errors.New("invalid value for required argument 'UserId'")
}
var resource UserRoles
err := ctx.RegisterResource("keycloak:index/userRoles:UserRoles", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUserRoles gets an existing UserRoles 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 GetUserRoles(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UserRolesState, opts ...pulumi.ResourceOption) (*UserRoles, error) {
var resource UserRoles
err := ctx.ReadResource("keycloak:index/userRoles:UserRoles", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering UserRoles resources.
type userRolesState struct {
// The realm this user exists in.
RealmId *string `pulumi:"realmId"`
// A list of role IDs to map to the user
RoleIds []string `pulumi:"roleIds"`
// The ID of the user this resource should manage roles for.
UserId *string `pulumi:"userId"`
}
type UserRolesState struct {
// The realm this user exists in.
RealmId pulumi.StringPtrInput
// A list of role IDs to map to the user
RoleIds pulumi.StringArrayInput
// The ID of the user this resource should manage roles for.
UserId pulumi.StringPtrInput
}
func (UserRolesState) ElementType() reflect.Type {
return reflect.TypeOf((*userRolesState)(nil)).Elem()
}
type userRolesArgs struct {
// The realm this user exists in.
RealmId string `pulumi:"realmId"`
// A list of role IDs to map to the user
RoleIds []string `pulumi:"roleIds"`
// The ID of the user this resource should manage roles for.
UserId string `pulumi:"userId"`
}
// The set of arguments for constructing a UserRoles resource.
type UserRolesArgs struct {
// The realm this user exists in.
RealmId pulumi.StringInput
// A list of role IDs to map to the user
RoleIds pulumi.StringArrayInput
// The ID of the user this resource should manage roles for.
UserId pulumi.StringInput
}
func (UserRolesArgs) ElementType() reflect.Type {
return reflect.TypeOf((*userRolesArgs)(nil)).Elem()
}
type UserRolesInput interface {
pulumi.Input
ToUserRolesOutput() UserRolesOutput
ToUserRolesOutputWithContext(ctx context.Context) UserRolesOutput
}
func (*UserRoles) ElementType() reflect.Type {
return reflect.TypeOf((*UserRoles)(nil))
}
func (i *UserRoles) ToUserRolesOutput() UserRolesOutput {
return i.ToUserRolesOutputWithContext(context.Background())
}
func (i *UserRoles) ToUserRolesOutputWithContext(ctx context.Context) UserRolesOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserRolesOutput)
}
func (i *UserRoles) ToUserRolesPtrOutput() UserRolesPtrOutput {
return i.ToUserRolesPtrOutputWithContext(context.Background())
}
func (i *UserRoles) ToUserRolesPtrOutputWithContext(ctx context.Context) UserRolesPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserRolesPtrOutput)
}
type UserRolesPtrInput interface {
pulumi.Input
ToUserRolesPtrOutput() UserRolesPtrOutput
ToUserRolesPtrOutputWithContext(ctx context.Context) UserRolesPtrOutput
}
type userRolesPtrType UserRolesArgs
func (*userRolesPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**UserRoles)(nil))
}
func (i *userRolesPtrType) ToUserRolesPtrOutput() UserRolesPtrOutput {
return i.ToUserRolesPtrOutputWithContext(context.Background())
}
func (i *userRolesPtrType) ToUserRolesPtrOutputWithContext(ctx context.Context) UserRolesPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserRolesPtrOutput)
}
// UserRolesArrayInput is an input type that accepts UserRolesArray and UserRolesArrayOutput values.
// You can construct a concrete instance of `UserRolesArrayInput` via:
//
// UserRolesArray{ UserRolesArgs{...} }
type UserRolesArrayInput interface {
pulumi.Input
ToUserRolesArrayOutput() UserRolesArrayOutput
ToUserRolesArrayOutputWithContext(context.Context) UserRolesArrayOutput
}
type UserRolesArray []UserRolesInput
func (UserRolesArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*UserRoles)(nil))
}
func (i UserRolesArray) ToUserRolesArrayOutput() UserRolesArrayOutput {
return i.ToUserRolesArrayOutputWithContext(context.Background())
}
func (i UserRolesArray) ToUserRolesArrayOutputWithContext(ctx context.Context) UserRolesArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserRolesArrayOutput)
}
// UserRolesMapInput is an input type that accepts UserRolesMap and UserRolesMapOutput values.
// You can construct a concrete instance of `UserRolesMapInput` via:
//
// UserRolesMap{ "key": UserRolesArgs{...} }
type UserRolesMapInput interface {
pulumi.Input
ToUserRolesMapOutput() UserRolesMapOutput
ToUserRolesMapOutputWithContext(context.Context) UserRolesMapOutput
}
type UserRolesMap map[string]UserRolesInput
func (UserRolesMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*UserRoles)(nil))
}
func (i UserRolesMap) ToUserRolesMapOutput() UserRolesMapOutput {
return i.ToUserRolesMapOutputWithContext(context.Background())
}
func (i UserRolesMap) ToUserRolesMapOutputWithContext(ctx context.Context) UserRolesMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserRolesMapOutput)
}
type UserRolesOutput struct {
*pulumi.OutputState
}
func (UserRolesOutput) ElementType() reflect.Type {
return reflect.TypeOf((*UserRoles)(nil))
}
func (o UserRolesOutput) ToUserRolesOutput() UserRolesOutput {
return o
}
func (o UserRolesOutput) ToUserRolesOutputWithContext(ctx context.Context) UserRolesOutput {
return o
}
func (o UserRolesOutput) ToUserRolesPtrOutput() UserRolesPtrOutput {
return o.ToUserRolesPtrOutputWithContext(context.Background())
}
func (o UserRolesOutput) ToUserRolesPtrOutputWithContext(ctx context.Context) UserRolesPtrOutput {
return o.ApplyT(func(v UserRoles) *UserRoles {
return &v
}).(UserRolesPtrOutput)
}
type UserRolesPtrOutput struct {
*pulumi.OutputState
}
func (UserRolesPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**UserRoles)(nil))
}
func (o UserRolesPtrOutput) ToUserRolesPtrOutput() UserRolesPtrOutput {
return o
}
func (o UserRolesPtrOutput) ToUserRolesPtrOutputWithContext(ctx context.Context) UserRolesPtrOutput {
return o
}
type UserRolesArrayOutput struct{ *pulumi.OutputState }
func (UserRolesArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]UserRoles)(nil))
}
func (o UserRolesArrayOutput) ToUserRolesArrayOutput() UserRolesArrayOutput {
return o
}
func (o UserRolesArrayOutput) ToUserRolesArrayOutputWithContext(ctx context.Context) UserRolesArrayOutput {
return o
}
func (o UserRolesArrayOutput) Index(i pulumi.IntInput) UserRolesOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) UserRoles {
return vs[0].([]UserRoles)[vs[1].(int)]
}).(UserRolesOutput)
}
type UserRolesMapOutput struct{ *pulumi.OutputState }
func (UserRolesMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]UserRoles)(nil))
}
func (o UserRolesMapOutput) ToUserRolesMapOutput() UserRolesMapOutput {
return o
}
func (o UserRolesMapOutput) ToUserRolesMapOutputWithContext(ctx context.Context) UserRolesMapOutput {
return o
}
func (o UserRolesMapOutput) MapIndex(k pulumi.StringInput) UserRolesOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) UserRoles {
return vs[0].(map[string]UserRoles)[vs[1].(string)]
}).(UserRolesOutput)
}
func init() {
pulumi.RegisterOutputType(UserRolesOutput{})
pulumi.RegisterOutputType(UserRolesPtrOutput{})
pulumi.RegisterOutputType(UserRolesArrayOutput{})
pulumi.RegisterOutputType(UserRolesMapOutput{})
}