-
Notifications
You must be signed in to change notification settings - Fork 8
/
applicationCredential.go
348 lines (335 loc) · 14.9 KB
/
applicationCredential.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
// *** 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 Application Credential resource within OpenStack Keystone.
//
// > **Note:** All arguments including the application credential name and secret
// will be stored in the raw state as plain-text. [Read more about sensitive data
// in state](https://www.terraform.io/docs/state/sensitive-data.html).
//
// > **Note:** An Application Credential is created within the authenticated user
// project scope and is not visible by an admin or other accounts.
// The Application Credential visibility is similar to
// `compute.Keypair`.
//
// ## Example Usage
// ### Predefined secret
//
// Application credential below will have only one `swiftoperator` role.
//
// ```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 {
// _, err := identity.NewApplicationCredential(ctx, "swift", &identity.ApplicationCredentialArgs{
// Description: pulumi.String("Swift technical application credential"),
// ExpiresAt: pulumi.String("2019-02-13T12:12:12Z"),
// Roles: pulumi.StringArray{
// pulumi.String("swiftoperator"),
// },
// Secret: pulumi.String("supersecret"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// ### Unrestricted with autogenerated secret and unlimited TTL
//
// Application credential below will inherit all the current user's roles.
//
// !> **WARNING:** Restrictions on these Identity operations are deliberately
// imposed as a safeguard to prevent a compromised application credential from
// regenerating itself. Disabling this restriction poses an inherent added risk.
//
// ```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 {
// unrestricted, err := identity.NewApplicationCredential(ctx, "unrestricted", &identity.ApplicationCredentialArgs{
// Description: pulumi.String("Unrestricted application credential"),
// Unrestricted: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// ctx.Export("applicationCredentialSecret", unrestricted.Secret)
// return nil
// })
// }
// ```
// ### Application credential with access rules
//
// > **Note:** Application Credential access rules are supported only in Keystone
// starting from [Train](https://releases.openstack.org/train/highlights.html#keystone-identity-service) release.
//
// ```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 {
// _, err := identity.NewApplicationCredential(ctx, "monitoring", &identity.ApplicationCredentialArgs{
// AccessRules: identity.ApplicationCredentialAccessRuleArray{
// &identity.ApplicationCredentialAccessRuleArgs{
// Method: pulumi.String("GET"),
// Path: pulumi.String("/v2.0/metrics"),
// Service: pulumi.String("monitoring"),
// },
// &identity.ApplicationCredentialAccessRuleArgs{
// Method: pulumi.String("PUT"),
// Path: pulumi.String("/v2.0/metrics"),
// Service: pulumi.String("monitoring"),
// },
// },
// ExpiresAt: pulumi.String("2019-02-13T12:12:12Z"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type ApplicationCredential struct {
pulumi.CustomResourceState
// A collection of one or more access rules, which
// this application credential allows to follow. The structure is described
// below. Changing this creates a new application credential.
AccessRules ApplicationCredentialAccessRuleArrayOutput `pulumi:"accessRules"`
// A description of the application credential.
// Changing this creates a new application credential.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The expiration time of the application credential
// in the RFC3339 timestamp format (e.g. `2019-03-09T12:58:49Z`). If omitted,
// an application credential will never expire. Changing this creates a new
// application credential.
ExpiresAt pulumi.StringPtrOutput `pulumi:"expiresAt"`
// A name of the application credential. Changing this
// creates a new application credential.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the project the application credential was created
// for and that authentication requests using this application credential will
// be scoped to.
ProjectId pulumi.StringOutput `pulumi:"projectId"`
// 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 application credential.
Region pulumi.StringOutput `pulumi:"region"`
// A collection of one or more role names, which this
// application credential has to be associated with its project. If omitted,
// all the current user's roles within the scoped project will be inherited by
// a new application credential. Changing this creates a new application
// credential.
Roles pulumi.StringArrayOutput `pulumi:"roles"`
// The secret for the application credential. If omitted,
// it will be generated by the server. Changing this creates a new application
// credential.
Secret pulumi.StringOutput `pulumi:"secret"`
// A flag indicating whether the application
// credential may be used for creation or destruction of other application
// credentials or trusts. Changing this creates a new application credential.
Unrestricted pulumi.BoolPtrOutput `pulumi:"unrestricted"`
}
// NewApplicationCredential registers a new resource with the given unique name, arguments, and options.
func NewApplicationCredential(ctx *pulumi.Context,
name string, args *ApplicationCredentialArgs, opts ...pulumi.ResourceOption) (*ApplicationCredential, error) {
if args == nil {
args = &ApplicationCredentialArgs{}
}
var resource ApplicationCredential
err := ctx.RegisterResource("openstack:identity/applicationCredential:ApplicationCredential", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetApplicationCredential gets an existing ApplicationCredential 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 GetApplicationCredential(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ApplicationCredentialState, opts ...pulumi.ResourceOption) (*ApplicationCredential, error) {
var resource ApplicationCredential
err := ctx.ReadResource("openstack:identity/applicationCredential:ApplicationCredential", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ApplicationCredential resources.
type applicationCredentialState struct {
// A collection of one or more access rules, which
// this application credential allows to follow. The structure is described
// below. Changing this creates a new application credential.
AccessRules []ApplicationCredentialAccessRule `pulumi:"accessRules"`
// A description of the application credential.
// Changing this creates a new application credential.
Description *string `pulumi:"description"`
// The expiration time of the application credential
// in the RFC3339 timestamp format (e.g. `2019-03-09T12:58:49Z`). If omitted,
// an application credential will never expire. Changing this creates a new
// application credential.
ExpiresAt *string `pulumi:"expiresAt"`
// A name of the application credential. Changing this
// creates a new application credential.
Name *string `pulumi:"name"`
// The ID of the project the application credential was created
// for and that authentication requests using this application credential will
// be scoped to.
ProjectId *string `pulumi:"projectId"`
// 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 application credential.
Region *string `pulumi:"region"`
// A collection of one or more role names, which this
// application credential has to be associated with its project. If omitted,
// all the current user's roles within the scoped project will be inherited by
// a new application credential. Changing this creates a new application
// credential.
Roles []string `pulumi:"roles"`
// The secret for the application credential. If omitted,
// it will be generated by the server. Changing this creates a new application
// credential.
Secret *string `pulumi:"secret"`
// A flag indicating whether the application
// credential may be used for creation or destruction of other application
// credentials or trusts. Changing this creates a new application credential.
Unrestricted *bool `pulumi:"unrestricted"`
}
type ApplicationCredentialState struct {
// A collection of one or more access rules, which
// this application credential allows to follow. The structure is described
// below. Changing this creates a new application credential.
AccessRules ApplicationCredentialAccessRuleArrayInput
// A description of the application credential.
// Changing this creates a new application credential.
Description pulumi.StringPtrInput
// The expiration time of the application credential
// in the RFC3339 timestamp format (e.g. `2019-03-09T12:58:49Z`). If omitted,
// an application credential will never expire. Changing this creates a new
// application credential.
ExpiresAt pulumi.StringPtrInput
// A name of the application credential. Changing this
// creates a new application credential.
Name pulumi.StringPtrInput
// The ID of the project the application credential was created
// for and that authentication requests using this application credential will
// be scoped to.
ProjectId 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 application credential.
Region pulumi.StringPtrInput
// A collection of one or more role names, which this
// application credential has to be associated with its project. If omitted,
// all the current user's roles within the scoped project will be inherited by
// a new application credential. Changing this creates a new application
// credential.
Roles pulumi.StringArrayInput
// The secret for the application credential. If omitted,
// it will be generated by the server. Changing this creates a new application
// credential.
Secret pulumi.StringPtrInput
// A flag indicating whether the application
// credential may be used for creation or destruction of other application
// credentials or trusts. Changing this creates a new application credential.
Unrestricted pulumi.BoolPtrInput
}
func (ApplicationCredentialState) ElementType() reflect.Type {
return reflect.TypeOf((*applicationCredentialState)(nil)).Elem()
}
type applicationCredentialArgs struct {
// A collection of one or more access rules, which
// this application credential allows to follow. The structure is described
// below. Changing this creates a new application credential.
AccessRules []ApplicationCredentialAccessRule `pulumi:"accessRules"`
// A description of the application credential.
// Changing this creates a new application credential.
Description *string `pulumi:"description"`
// The expiration time of the application credential
// in the RFC3339 timestamp format (e.g. `2019-03-09T12:58:49Z`). If omitted,
// an application credential will never expire. Changing this creates a new
// application credential.
ExpiresAt *string `pulumi:"expiresAt"`
// A name of the application credential. Changing this
// creates a new application credential.
Name *string `pulumi:"name"`
// 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 application credential.
Region *string `pulumi:"region"`
// A collection of one or more role names, which this
// application credential has to be associated with its project. If omitted,
// all the current user's roles within the scoped project will be inherited by
// a new application credential. Changing this creates a new application
// credential.
Roles []string `pulumi:"roles"`
// The secret for the application credential. If omitted,
// it will be generated by the server. Changing this creates a new application
// credential.
Secret *string `pulumi:"secret"`
// A flag indicating whether the application
// credential may be used for creation or destruction of other application
// credentials or trusts. Changing this creates a new application credential.
Unrestricted *bool `pulumi:"unrestricted"`
}
// The set of arguments for constructing a ApplicationCredential resource.
type ApplicationCredentialArgs struct {
// A collection of one or more access rules, which
// this application credential allows to follow. The structure is described
// below. Changing this creates a new application credential.
AccessRules ApplicationCredentialAccessRuleArrayInput
// A description of the application credential.
// Changing this creates a new application credential.
Description pulumi.StringPtrInput
// The expiration time of the application credential
// in the RFC3339 timestamp format (e.g. `2019-03-09T12:58:49Z`). If omitted,
// an application credential will never expire. Changing this creates a new
// application credential.
ExpiresAt pulumi.StringPtrInput
// A name of the application credential. Changing this
// creates a new application credential.
Name 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 application credential.
Region pulumi.StringPtrInput
// A collection of one or more role names, which this
// application credential has to be associated with its project. If omitted,
// all the current user's roles within the scoped project will be inherited by
// a new application credential. Changing this creates a new application
// credential.
Roles pulumi.StringArrayInput
// The secret for the application credential. If omitted,
// it will be generated by the server. Changing this creates a new application
// credential.
Secret pulumi.StringPtrInput
// A flag indicating whether the application
// credential may be used for creation or destruction of other application
// credentials or trusts. Changing this creates a new application credential.
Unrestricted pulumi.BoolPtrInput
}
func (ApplicationCredentialArgs) ElementType() reflect.Type {
return reflect.TypeOf((*applicationCredentialArgs)(nil)).Elem()
}