-
Notifications
You must be signed in to change notification settings - Fork 8
/
user.go
294 lines (281 loc) · 11.4 KB
/
user.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
// *** 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 identity
import (
"reflect"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages a V3 User resource within OpenStack Keystone.
//
// Note: You _must_ have admin privileges in your OpenStack cloud to use
// this resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-openstack/sdk/v2/go/openstack/identity"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// project1, err := identity.NewProject(ctx, "project1", nil)
// if err != nil {
// return err
// }
// _, err = identity.NewUser(ctx, "user1", &identity.UserArgs{
// DefaultProjectId: project1.ID(),
// Description: pulumi.String("A user"),
// Extra: pulumi.StringMap{
// "email": pulumi.String("user_1@foobar.com"),
// },
// IgnoreChangePasswordUponFirstUse: pulumi.Bool(true),
// MultiFactorAuthEnabled: pulumi.Bool(true),
// MultiFactorAuthRules: identity.UserMultiFactorAuthRuleArray{
// &identity.UserMultiFactorAuthRuleArgs{
// Rules: pulumi.StringArray{
// pulumi.String("password"),
// pulumi.String("totp"),
// },
// },
// &identity.UserMultiFactorAuthRuleArgs{
// Rules: pulumi.StringArray{
// pulumi.String("password"),
// },
// },
// },
// Password: pulumi.String("password123"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type User struct {
pulumi.CustomResourceState
// The default project this user belongs to.
DefaultProjectId pulumi.StringOutput `pulumi:"defaultProjectId"`
// A description of the user.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The domain this user belongs to.
DomainId pulumi.StringOutput `pulumi:"domainId"`
// Whether the user is enabled or disabled. Valid
// values are `true` and `false`.
Enabled pulumi.BoolPtrOutput `pulumi:"enabled"`
// Free-form key/value pairs of extra information.
Extra pulumi.MapOutput `pulumi:"extra"`
// User will not have to
// change their password upon first use. Valid values are `true` and `false`.
IgnoreChangePasswordUponFirstUse pulumi.BoolPtrOutput `pulumi:"ignoreChangePasswordUponFirstUse"`
// User will not have a failure
// lockout placed on their account. Valid values are `true` and `false`.
IgnoreLockoutFailureAttempts pulumi.BoolPtrOutput `pulumi:"ignoreLockoutFailureAttempts"`
// User's password will not expire.
// Valid values are `true` and `false`.
IgnorePasswordExpiry pulumi.BoolPtrOutput `pulumi:"ignorePasswordExpiry"`
// Whether to enable multi-factor
// authentication. Valid values are `true` and `false`.
MultiFactorAuthEnabled pulumi.BoolPtrOutput `pulumi:"multiFactorAuthEnabled"`
// A multi-factor authentication rule.
// The structure is documented below. Please see the
// [Ocata release notes](https://docs.openstack.org/releasenotes/keystone/ocata.html)
// for more information on how to use mulit-factor rules.
MultiFactorAuthRules UserMultiFactorAuthRuleArrayOutput `pulumi:"multiFactorAuthRules"`
// The name of the user.
Name pulumi.StringOutput `pulumi:"name"`
// The password for the user.
Password pulumi.StringPtrOutput `pulumi:"password"`
// The region in which to obtain the V3 Keystone client.
// If omitted, the `region` argument of the provider is used. Changing this
// creates a new User.
Region pulumi.StringOutput `pulumi:"region"`
}
// NewUser registers a new resource with the given unique name, arguments, and options.
func NewUser(ctx *pulumi.Context,
name string, args *UserArgs, opts ...pulumi.ResourceOption) (*User, error) {
if args == nil {
args = &UserArgs{}
}
var resource User
err := ctx.RegisterResource("openstack:identity/user:User", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUser gets an existing User 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 GetUser(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UserState, opts ...pulumi.ResourceOption) (*User, error) {
var resource User
err := ctx.ReadResource("openstack:identity/user:User", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering User resources.
type userState struct {
// The default project this user belongs to.
DefaultProjectId *string `pulumi:"defaultProjectId"`
// A description of the user.
Description *string `pulumi:"description"`
// The domain this user belongs to.
DomainId *string `pulumi:"domainId"`
// Whether the user is enabled or disabled. Valid
// values are `true` and `false`.
Enabled *bool `pulumi:"enabled"`
// Free-form key/value pairs of extra information.
Extra map[string]interface{} `pulumi:"extra"`
// User will not have to
// change their password upon first use. Valid values are `true` and `false`.
IgnoreChangePasswordUponFirstUse *bool `pulumi:"ignoreChangePasswordUponFirstUse"`
// User will not have a failure
// lockout placed on their account. Valid values are `true` and `false`.
IgnoreLockoutFailureAttempts *bool `pulumi:"ignoreLockoutFailureAttempts"`
// User's password will not expire.
// Valid values are `true` and `false`.
IgnorePasswordExpiry *bool `pulumi:"ignorePasswordExpiry"`
// Whether to enable multi-factor
// authentication. Valid values are `true` and `false`.
MultiFactorAuthEnabled *bool `pulumi:"multiFactorAuthEnabled"`
// A multi-factor authentication rule.
// The structure is documented below. Please see the
// [Ocata release notes](https://docs.openstack.org/releasenotes/keystone/ocata.html)
// for more information on how to use mulit-factor rules.
MultiFactorAuthRules []UserMultiFactorAuthRule `pulumi:"multiFactorAuthRules"`
// The name of the user.
Name *string `pulumi:"name"`
// The password for the user.
Password *string `pulumi:"password"`
// The region in which to obtain the V3 Keystone client.
// If omitted, the `region` argument of the provider is used. Changing this
// creates a new User.
Region *string `pulumi:"region"`
}
type UserState struct {
// The default project this user belongs to.
DefaultProjectId pulumi.StringPtrInput
// A description of the user.
Description pulumi.StringPtrInput
// The domain this user belongs to.
DomainId pulumi.StringPtrInput
// Whether the user is enabled or disabled. Valid
// values are `true` and `false`.
Enabled pulumi.BoolPtrInput
// Free-form key/value pairs of extra information.
Extra pulumi.MapInput
// User will not have to
// change their password upon first use. Valid values are `true` and `false`.
IgnoreChangePasswordUponFirstUse pulumi.BoolPtrInput
// User will not have a failure
// lockout placed on their account. Valid values are `true` and `false`.
IgnoreLockoutFailureAttempts pulumi.BoolPtrInput
// User's password will not expire.
// Valid values are `true` and `false`.
IgnorePasswordExpiry pulumi.BoolPtrInput
// Whether to enable multi-factor
// authentication. Valid values are `true` and `false`.
MultiFactorAuthEnabled pulumi.BoolPtrInput
// A multi-factor authentication rule.
// The structure is documented below. Please see the
// [Ocata release notes](https://docs.openstack.org/releasenotes/keystone/ocata.html)
// for more information on how to use mulit-factor rules.
MultiFactorAuthRules UserMultiFactorAuthRuleArrayInput
// The name of the user.
Name pulumi.StringPtrInput
// The password for the user.
Password pulumi.StringPtrInput
// The region in which to obtain the V3 Keystone client.
// If omitted, the `region` argument of the provider is used. Changing this
// creates a new User.
Region pulumi.StringPtrInput
}
func (UserState) ElementType() reflect.Type {
return reflect.TypeOf((*userState)(nil)).Elem()
}
type userArgs struct {
// The default project this user belongs to.
DefaultProjectId *string `pulumi:"defaultProjectId"`
// A description of the user.
Description *string `pulumi:"description"`
// The domain this user belongs to.
DomainId *string `pulumi:"domainId"`
// Whether the user is enabled or disabled. Valid
// values are `true` and `false`.
Enabled *bool `pulumi:"enabled"`
// Free-form key/value pairs of extra information.
Extra map[string]interface{} `pulumi:"extra"`
// User will not have to
// change their password upon first use. Valid values are `true` and `false`.
IgnoreChangePasswordUponFirstUse *bool `pulumi:"ignoreChangePasswordUponFirstUse"`
// User will not have a failure
// lockout placed on their account. Valid values are `true` and `false`.
IgnoreLockoutFailureAttempts *bool `pulumi:"ignoreLockoutFailureAttempts"`
// User's password will not expire.
// Valid values are `true` and `false`.
IgnorePasswordExpiry *bool `pulumi:"ignorePasswordExpiry"`
// Whether to enable multi-factor
// authentication. Valid values are `true` and `false`.
MultiFactorAuthEnabled *bool `pulumi:"multiFactorAuthEnabled"`
// A multi-factor authentication rule.
// The structure is documented below. Please see the
// [Ocata release notes](https://docs.openstack.org/releasenotes/keystone/ocata.html)
// for more information on how to use mulit-factor rules.
MultiFactorAuthRules []UserMultiFactorAuthRule `pulumi:"multiFactorAuthRules"`
// The name of the user.
Name *string `pulumi:"name"`
// The password for the user.
Password *string `pulumi:"password"`
// The region in which to obtain the V3 Keystone client.
// If omitted, the `region` argument of the provider is used. Changing this
// creates a new User.
Region *string `pulumi:"region"`
}
// The set of arguments for constructing a User resource.
type UserArgs struct {
// The default project this user belongs to.
DefaultProjectId pulumi.StringPtrInput
// A description of the user.
Description pulumi.StringPtrInput
// The domain this user belongs to.
DomainId pulumi.StringPtrInput
// Whether the user is enabled or disabled. Valid
// values are `true` and `false`.
Enabled pulumi.BoolPtrInput
// Free-form key/value pairs of extra information.
Extra pulumi.MapInput
// User will not have to
// change their password upon first use. Valid values are `true` and `false`.
IgnoreChangePasswordUponFirstUse pulumi.BoolPtrInput
// User will not have a failure
// lockout placed on their account. Valid values are `true` and `false`.
IgnoreLockoutFailureAttempts pulumi.BoolPtrInput
// User's password will not expire.
// Valid values are `true` and `false`.
IgnorePasswordExpiry pulumi.BoolPtrInput
// Whether to enable multi-factor
// authentication. Valid values are `true` and `false`.
MultiFactorAuthEnabled pulumi.BoolPtrInput
// A multi-factor authentication rule.
// The structure is documented below. Please see the
// [Ocata release notes](https://docs.openstack.org/releasenotes/keystone/ocata.html)
// for more information on how to use mulit-factor rules.
MultiFactorAuthRules UserMultiFactorAuthRuleArrayInput
// The name of the user.
Name pulumi.StringPtrInput
// The password for the user.
Password pulumi.StringPtrInput
// The region in which to obtain the V3 Keystone client.
// If omitted, the `region` argument of the provider is used. Changing this
// creates a new User.
Region pulumi.StringPtrInput
}
func (UserArgs) ElementType() reflect.Type {
return reflect.TypeOf((*userArgs)(nil)).Elem()
}