/
applicationPassword.go
384 lines (324 loc) · 18.4 KB
/
applicationPassword.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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
// *** 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 azuread
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a password credential associated with an application within Azure Active Directory. These are also referred to as client secrets during authentication.
//
// > **NOTE:** If you're authenticating using a Service Principal then it must have permissions to both `Read and write all applications` and `Sign in and read user profile` within the `Windows Azure Active Directory` API.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azuread/sdk/v4/go/azuread"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleApplication, err := azuread.NewApplication(ctx, "exampleApplication", nil)
// if err != nil {
// return err
// }
// _, err = azuread.NewApplicationPassword(ctx, "exampleApplicationPassword", &azuread.ApplicationPasswordArgs{
// ApplicationObjectId: exampleApplication.ObjectId,
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Passwords can be imported using the `object id` of an Application and the `key id` of the password, e.g.
//
// ```sh
// $ pulumi import azuread:index/applicationPassword:ApplicationPassword test 00000000-0000-0000-0000-000000000000/password/11111111-1111-1111-1111-111111111111
// ```
type ApplicationPassword struct {
pulumi.CustomResourceState
// The Object ID of the Application for which this password should be created. Changing this field forces a new resource to be created.
ApplicationObjectId pulumi.StringOutput `pulumi:"applicationObjectId"`
// Deprecated: This property has been renamed to `display_name` and will be removed in version 2.0 of the AzureAD provider
Description pulumi.StringOutput `pulumi:"description"`
// A display name for the password.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// The End Date which the Password is valid until, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). Changing this field forces a new resource to be created.
EndDate pulumi.StringOutput `pulumi:"endDate"`
// A relative duration for which the Password is valid until, for example `240h` (10 days) or `2400h30m`. Changing this field forces a new resource to be created.
EndDateRelative pulumi.StringPtrOutput `pulumi:"endDateRelative"`
// A GUID used to uniquely identify this Password. If not specified a GUID will be created. Changing this field forces a new resource to be created.
KeyId pulumi.StringOutput `pulumi:"keyId"`
// The Start Date which the Password is valid from, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). If this isn't specified, the current date is used. Changing this field forces a new resource to be created.
StartDate pulumi.StringOutput `pulumi:"startDate"`
// The Password for this Application.
//
// Deprecated: [NOTE] In version 2.0 of the AzureAD provider, this attribute will become read-only as it will no longer be possible to specify a password value. It will be generated by Azure Active Directory and persisted to state for reuse in your Terraform configuration.
Value pulumi.StringOutput `pulumi:"value"`
}
// NewApplicationPassword registers a new resource with the given unique name, arguments, and options.
func NewApplicationPassword(ctx *pulumi.Context,
name string, args *ApplicationPasswordArgs, opts ...pulumi.ResourceOption) (*ApplicationPassword, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApplicationObjectId == nil {
return nil, errors.New("invalid value for required argument 'ApplicationObjectId'")
}
var resource ApplicationPassword
err := ctx.RegisterResource("azuread:index/applicationPassword:ApplicationPassword", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetApplicationPassword gets an existing ApplicationPassword 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 GetApplicationPassword(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ApplicationPasswordState, opts ...pulumi.ResourceOption) (*ApplicationPassword, error) {
var resource ApplicationPassword
err := ctx.ReadResource("azuread:index/applicationPassword:ApplicationPassword", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ApplicationPassword resources.
type applicationPasswordState struct {
// The Object ID of the Application for which this password should be created. Changing this field forces a new resource to be created.
ApplicationObjectId *string `pulumi:"applicationObjectId"`
// Deprecated: This property has been renamed to `display_name` and will be removed in version 2.0 of the AzureAD provider
Description *string `pulumi:"description"`
// A display name for the password.
DisplayName *string `pulumi:"displayName"`
// The End Date which the Password is valid until, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). Changing this field forces a new resource to be created.
EndDate *string `pulumi:"endDate"`
// A relative duration for which the Password is valid until, for example `240h` (10 days) or `2400h30m`. Changing this field forces a new resource to be created.
EndDateRelative *string `pulumi:"endDateRelative"`
// A GUID used to uniquely identify this Password. If not specified a GUID will be created. Changing this field forces a new resource to be created.
KeyId *string `pulumi:"keyId"`
// The Start Date which the Password is valid from, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). If this isn't specified, the current date is used. Changing this field forces a new resource to be created.
StartDate *string `pulumi:"startDate"`
// The Password for this Application.
//
// Deprecated: [NOTE] In version 2.0 of the AzureAD provider, this attribute will become read-only as it will no longer be possible to specify a password value. It will be generated by Azure Active Directory and persisted to state for reuse in your Terraform configuration.
Value *string `pulumi:"value"`
}
type ApplicationPasswordState struct {
// The Object ID of the Application for which this password should be created. Changing this field forces a new resource to be created.
ApplicationObjectId pulumi.StringPtrInput
// Deprecated: This property has been renamed to `display_name` and will be removed in version 2.0 of the AzureAD provider
Description pulumi.StringPtrInput
// A display name for the password.
DisplayName pulumi.StringPtrInput
// The End Date which the Password is valid until, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). Changing this field forces a new resource to be created.
EndDate pulumi.StringPtrInput
// A relative duration for which the Password is valid until, for example `240h` (10 days) or `2400h30m`. Changing this field forces a new resource to be created.
EndDateRelative pulumi.StringPtrInput
// A GUID used to uniquely identify this Password. If not specified a GUID will be created. Changing this field forces a new resource to be created.
KeyId pulumi.StringPtrInput
// The Start Date which the Password is valid from, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). If this isn't specified, the current date is used. Changing this field forces a new resource to be created.
StartDate pulumi.StringPtrInput
// The Password for this Application.
//
// Deprecated: [NOTE] In version 2.0 of the AzureAD provider, this attribute will become read-only as it will no longer be possible to specify a password value. It will be generated by Azure Active Directory and persisted to state for reuse in your Terraform configuration.
Value pulumi.StringPtrInput
}
func (ApplicationPasswordState) ElementType() reflect.Type {
return reflect.TypeOf((*applicationPasswordState)(nil)).Elem()
}
type applicationPasswordArgs struct {
// The Object ID of the Application for which this password should be created. Changing this field forces a new resource to be created.
ApplicationObjectId string `pulumi:"applicationObjectId"`
// Deprecated: This property has been renamed to `display_name` and will be removed in version 2.0 of the AzureAD provider
Description *string `pulumi:"description"`
// A display name for the password.
DisplayName *string `pulumi:"displayName"`
// The End Date which the Password is valid until, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). Changing this field forces a new resource to be created.
EndDate *string `pulumi:"endDate"`
// A relative duration for which the Password is valid until, for example `240h` (10 days) or `2400h30m`. Changing this field forces a new resource to be created.
EndDateRelative *string `pulumi:"endDateRelative"`
// A GUID used to uniquely identify this Password. If not specified a GUID will be created. Changing this field forces a new resource to be created.
KeyId *string `pulumi:"keyId"`
// The Start Date which the Password is valid from, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). If this isn't specified, the current date is used. Changing this field forces a new resource to be created.
StartDate *string `pulumi:"startDate"`
// The Password for this Application.
//
// Deprecated: [NOTE] In version 2.0 of the AzureAD provider, this attribute will become read-only as it will no longer be possible to specify a password value. It will be generated by Azure Active Directory and persisted to state for reuse in your Terraform configuration.
Value *string `pulumi:"value"`
}
// The set of arguments for constructing a ApplicationPassword resource.
type ApplicationPasswordArgs struct {
// The Object ID of the Application for which this password should be created. Changing this field forces a new resource to be created.
ApplicationObjectId pulumi.StringInput
// Deprecated: This property has been renamed to `display_name` and will be removed in version 2.0 of the AzureAD provider
Description pulumi.StringPtrInput
// A display name for the password.
DisplayName pulumi.StringPtrInput
// The End Date which the Password is valid until, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). Changing this field forces a new resource to be created.
EndDate pulumi.StringPtrInput
// A relative duration for which the Password is valid until, for example `240h` (10 days) or `2400h30m`. Changing this field forces a new resource to be created.
EndDateRelative pulumi.StringPtrInput
// A GUID used to uniquely identify this Password. If not specified a GUID will be created. Changing this field forces a new resource to be created.
KeyId pulumi.StringPtrInput
// The Start Date which the Password is valid from, formatted as a RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). If this isn't specified, the current date is used. Changing this field forces a new resource to be created.
StartDate pulumi.StringPtrInput
// The Password for this Application.
//
// Deprecated: [NOTE] In version 2.0 of the AzureAD provider, this attribute will become read-only as it will no longer be possible to specify a password value. It will be generated by Azure Active Directory and persisted to state for reuse in your Terraform configuration.
Value pulumi.StringPtrInput
}
func (ApplicationPasswordArgs) ElementType() reflect.Type {
return reflect.TypeOf((*applicationPasswordArgs)(nil)).Elem()
}
type ApplicationPasswordInput interface {
pulumi.Input
ToApplicationPasswordOutput() ApplicationPasswordOutput
ToApplicationPasswordOutputWithContext(ctx context.Context) ApplicationPasswordOutput
}
func (*ApplicationPassword) ElementType() reflect.Type {
return reflect.TypeOf((*ApplicationPassword)(nil))
}
func (i *ApplicationPassword) ToApplicationPasswordOutput() ApplicationPasswordOutput {
return i.ToApplicationPasswordOutputWithContext(context.Background())
}
func (i *ApplicationPassword) ToApplicationPasswordOutputWithContext(ctx context.Context) ApplicationPasswordOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApplicationPasswordOutput)
}
func (i *ApplicationPassword) ToApplicationPasswordPtrOutput() ApplicationPasswordPtrOutput {
return i.ToApplicationPasswordPtrOutputWithContext(context.Background())
}
func (i *ApplicationPassword) ToApplicationPasswordPtrOutputWithContext(ctx context.Context) ApplicationPasswordPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApplicationPasswordPtrOutput)
}
type ApplicationPasswordPtrInput interface {
pulumi.Input
ToApplicationPasswordPtrOutput() ApplicationPasswordPtrOutput
ToApplicationPasswordPtrOutputWithContext(ctx context.Context) ApplicationPasswordPtrOutput
}
type applicationPasswordPtrType ApplicationPasswordArgs
func (*applicationPasswordPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**ApplicationPassword)(nil))
}
func (i *applicationPasswordPtrType) ToApplicationPasswordPtrOutput() ApplicationPasswordPtrOutput {
return i.ToApplicationPasswordPtrOutputWithContext(context.Background())
}
func (i *applicationPasswordPtrType) ToApplicationPasswordPtrOutputWithContext(ctx context.Context) ApplicationPasswordPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApplicationPasswordPtrOutput)
}
// ApplicationPasswordArrayInput is an input type that accepts ApplicationPasswordArray and ApplicationPasswordArrayOutput values.
// You can construct a concrete instance of `ApplicationPasswordArrayInput` via:
//
// ApplicationPasswordArray{ ApplicationPasswordArgs{...} }
type ApplicationPasswordArrayInput interface {
pulumi.Input
ToApplicationPasswordArrayOutput() ApplicationPasswordArrayOutput
ToApplicationPasswordArrayOutputWithContext(context.Context) ApplicationPasswordArrayOutput
}
type ApplicationPasswordArray []ApplicationPasswordInput
func (ApplicationPasswordArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*ApplicationPassword)(nil))
}
func (i ApplicationPasswordArray) ToApplicationPasswordArrayOutput() ApplicationPasswordArrayOutput {
return i.ToApplicationPasswordArrayOutputWithContext(context.Background())
}
func (i ApplicationPasswordArray) ToApplicationPasswordArrayOutputWithContext(ctx context.Context) ApplicationPasswordArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApplicationPasswordArrayOutput)
}
// ApplicationPasswordMapInput is an input type that accepts ApplicationPasswordMap and ApplicationPasswordMapOutput values.
// You can construct a concrete instance of `ApplicationPasswordMapInput` via:
//
// ApplicationPasswordMap{ "key": ApplicationPasswordArgs{...} }
type ApplicationPasswordMapInput interface {
pulumi.Input
ToApplicationPasswordMapOutput() ApplicationPasswordMapOutput
ToApplicationPasswordMapOutputWithContext(context.Context) ApplicationPasswordMapOutput
}
type ApplicationPasswordMap map[string]ApplicationPasswordInput
func (ApplicationPasswordMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*ApplicationPassword)(nil))
}
func (i ApplicationPasswordMap) ToApplicationPasswordMapOutput() ApplicationPasswordMapOutput {
return i.ToApplicationPasswordMapOutputWithContext(context.Background())
}
func (i ApplicationPasswordMap) ToApplicationPasswordMapOutputWithContext(ctx context.Context) ApplicationPasswordMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ApplicationPasswordMapOutput)
}
type ApplicationPasswordOutput struct {
*pulumi.OutputState
}
func (ApplicationPasswordOutput) ElementType() reflect.Type {
return reflect.TypeOf((*ApplicationPassword)(nil))
}
func (o ApplicationPasswordOutput) ToApplicationPasswordOutput() ApplicationPasswordOutput {
return o
}
func (o ApplicationPasswordOutput) ToApplicationPasswordOutputWithContext(ctx context.Context) ApplicationPasswordOutput {
return o
}
func (o ApplicationPasswordOutput) ToApplicationPasswordPtrOutput() ApplicationPasswordPtrOutput {
return o.ToApplicationPasswordPtrOutputWithContext(context.Background())
}
func (o ApplicationPasswordOutput) ToApplicationPasswordPtrOutputWithContext(ctx context.Context) ApplicationPasswordPtrOutput {
return o.ApplyT(func(v ApplicationPassword) *ApplicationPassword {
return &v
}).(ApplicationPasswordPtrOutput)
}
type ApplicationPasswordPtrOutput struct {
*pulumi.OutputState
}
func (ApplicationPasswordPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ApplicationPassword)(nil))
}
func (o ApplicationPasswordPtrOutput) ToApplicationPasswordPtrOutput() ApplicationPasswordPtrOutput {
return o
}
func (o ApplicationPasswordPtrOutput) ToApplicationPasswordPtrOutputWithContext(ctx context.Context) ApplicationPasswordPtrOutput {
return o
}
type ApplicationPasswordArrayOutput struct{ *pulumi.OutputState }
func (ApplicationPasswordArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]ApplicationPassword)(nil))
}
func (o ApplicationPasswordArrayOutput) ToApplicationPasswordArrayOutput() ApplicationPasswordArrayOutput {
return o
}
func (o ApplicationPasswordArrayOutput) ToApplicationPasswordArrayOutputWithContext(ctx context.Context) ApplicationPasswordArrayOutput {
return o
}
func (o ApplicationPasswordArrayOutput) Index(i pulumi.IntInput) ApplicationPasswordOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) ApplicationPassword {
return vs[0].([]ApplicationPassword)[vs[1].(int)]
}).(ApplicationPasswordOutput)
}
type ApplicationPasswordMapOutput struct{ *pulumi.OutputState }
func (ApplicationPasswordMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]ApplicationPassword)(nil))
}
func (o ApplicationPasswordMapOutput) ToApplicationPasswordMapOutput() ApplicationPasswordMapOutput {
return o
}
func (o ApplicationPasswordMapOutput) ToApplicationPasswordMapOutputWithContext(ctx context.Context) ApplicationPasswordMapOutput {
return o
}
func (o ApplicationPasswordMapOutput) MapIndex(k pulumi.StringInput) ApplicationPasswordOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) ApplicationPassword {
return vs[0].(map[string]ApplicationPassword)[vs[1].(string)]
}).(ApplicationPasswordOutput)
}
func init() {
pulumi.RegisterOutputType(ApplicationPasswordOutput{})
pulumi.RegisterOutputType(ApplicationPasswordPtrOutput{})
pulumi.RegisterOutputType(ApplicationPasswordArrayOutput{})
pulumi.RegisterOutputType(ApplicationPasswordMapOutput{})
}