/
servicePrincipalTokenSigningCertificate.go
411 lines (358 loc) · 20.7 KB
/
servicePrincipalTokenSigningCertificate.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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
// 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 azuread
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// ## Example Usage
//
// *Using default settings*
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := azuread.NewApplication(ctx, "example", &azuread.ApplicationArgs{
// DisplayName: pulumi.String("example"),
// })
// if err != nil {
// return err
// }
// exampleServicePrincipal, err := azuread.NewServicePrincipal(ctx, "example", &azuread.ServicePrincipalArgs{
// ApplicationId: example.ApplicationId,
// })
// if err != nil {
// return err
// }
// _, err = azuread.NewServicePrincipalTokenSigningCertificate(ctx, "example", &azuread.ServicePrincipalTokenSigningCertificateArgs{
// ServicePrincipalId: exampleServicePrincipal.ID(),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// *Using custom settings*
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := azuread.NewApplication(ctx, "example", &azuread.ApplicationArgs{
// DisplayName: pulumi.String("example"),
// })
// if err != nil {
// return err
// }
// exampleServicePrincipal, err := azuread.NewServicePrincipal(ctx, "example", &azuread.ServicePrincipalArgs{
// ApplicationId: example.ApplicationId,
// })
// if err != nil {
// return err
// }
// _, err = azuread.NewServicePrincipalTokenSigningCertificate(ctx, "example", &azuread.ServicePrincipalTokenSigningCertificateArgs{
// ServicePrincipalId: exampleServicePrincipal.ID(),
// DisplayName: pulumi.String("CN=example.com"),
// EndDate: pulumi.String("2023-05-01T01:02:03Z"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Token signing certificates can be imported using the object ID of the associated service principal and the key ID of the verify certificate credential, e.g.
//
// ```sh
// $ pulumi import azuread:index/servicePrincipalTokenSigningCertificate:ServicePrincipalTokenSigningCertificate example 00000000-0000-0000-0000-000000000000/tokenSigningCertificate/11111111-1111-1111-1111-111111111111
// ```
//
// -> This ID format is unique to Terraform and is composed of the service principal's object ID, the string "tokenSigningCertificate" and the verify certificate's key ID in the format `{ServicePrincipalObjectId}/tokenSigningCertificate/{CertificateKeyId}`.
type ServicePrincipalTokenSigningCertificate struct {
pulumi.CustomResourceState
// Specifies a friendly name for the certificate.
// Must start with `CN=`. Changing this field forces a new resource to be created.
//
// > If not specified, it will default to `CN=Microsoft Azure Federated SSO Certificate`.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// The end date until which the token signing certificate is valid, formatted as an 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 UUID used to uniquely identify the verify certificate.
KeyId pulumi.StringOutput `pulumi:"keyId"`
// The object ID of the service principal for which this certificate should be created. Changing this field forces a new resource to be created.
ServicePrincipalId pulumi.StringOutput `pulumi:"servicePrincipalId"`
// The start date from which the certificate is valid, formatted as an RFC3339 date string (e.g. `2018-01-01T01:02:03Z`).
StartDate pulumi.StringOutput `pulumi:"startDate"`
// A SHA-1 generated thumbprint of the token signing certificate, which can be used to set the preferred signing certificate for a service principal.
Thumbprint pulumi.StringOutput `pulumi:"thumbprint"`
// The certificate data, which is PEM encoded but does not include the
// header `-----BEGIN CERTIFICATE-----\n` or the footer `\n-----END CERTIFICATE-----`.
Value pulumi.StringOutput `pulumi:"value"`
}
// NewServicePrincipalTokenSigningCertificate registers a new resource with the given unique name, arguments, and options.
func NewServicePrincipalTokenSigningCertificate(ctx *pulumi.Context,
name string, args *ServicePrincipalTokenSigningCertificateArgs, opts ...pulumi.ResourceOption) (*ServicePrincipalTokenSigningCertificate, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ServicePrincipalId == nil {
return nil, errors.New("invalid value for required argument 'ServicePrincipalId'")
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"value",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource ServicePrincipalTokenSigningCertificate
err := ctx.RegisterResource("azuread:index/servicePrincipalTokenSigningCertificate:ServicePrincipalTokenSigningCertificate", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetServicePrincipalTokenSigningCertificate gets an existing ServicePrincipalTokenSigningCertificate 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 GetServicePrincipalTokenSigningCertificate(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ServicePrincipalTokenSigningCertificateState, opts ...pulumi.ResourceOption) (*ServicePrincipalTokenSigningCertificate, error) {
var resource ServicePrincipalTokenSigningCertificate
err := ctx.ReadResource("azuread:index/servicePrincipalTokenSigningCertificate:ServicePrincipalTokenSigningCertificate", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ServicePrincipalTokenSigningCertificate resources.
type servicePrincipalTokenSigningCertificateState struct {
// Specifies a friendly name for the certificate.
// Must start with `CN=`. Changing this field forces a new resource to be created.
//
// > If not specified, it will default to `CN=Microsoft Azure Federated SSO Certificate`.
DisplayName *string `pulumi:"displayName"`
// The end date until which the token signing certificate is valid, formatted as an 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 UUID used to uniquely identify the verify certificate.
KeyId *string `pulumi:"keyId"`
// The object ID of the service principal for which this certificate should be created. Changing this field forces a new resource to be created.
ServicePrincipalId *string `pulumi:"servicePrincipalId"`
// The start date from which the certificate is valid, formatted as an RFC3339 date string (e.g. `2018-01-01T01:02:03Z`).
StartDate *string `pulumi:"startDate"`
// A SHA-1 generated thumbprint of the token signing certificate, which can be used to set the preferred signing certificate for a service principal.
Thumbprint *string `pulumi:"thumbprint"`
// The certificate data, which is PEM encoded but does not include the
// header `-----BEGIN CERTIFICATE-----\n` or the footer `\n-----END CERTIFICATE-----`.
Value *string `pulumi:"value"`
}
type ServicePrincipalTokenSigningCertificateState struct {
// Specifies a friendly name for the certificate.
// Must start with `CN=`. Changing this field forces a new resource to be created.
//
// > If not specified, it will default to `CN=Microsoft Azure Federated SSO Certificate`.
DisplayName pulumi.StringPtrInput
// The end date until which the token signing certificate is valid, formatted as an RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). Changing this field forces a new resource to be created.
EndDate pulumi.StringPtrInput
// A UUID used to uniquely identify the verify certificate.
KeyId pulumi.StringPtrInput
// The object ID of the service principal for which this certificate should be created. Changing this field forces a new resource to be created.
ServicePrincipalId pulumi.StringPtrInput
// The start date from which the certificate is valid, formatted as an RFC3339 date string (e.g. `2018-01-01T01:02:03Z`).
StartDate pulumi.StringPtrInput
// A SHA-1 generated thumbprint of the token signing certificate, which can be used to set the preferred signing certificate for a service principal.
Thumbprint pulumi.StringPtrInput
// The certificate data, which is PEM encoded but does not include the
// header `-----BEGIN CERTIFICATE-----\n` or the footer `\n-----END CERTIFICATE-----`.
Value pulumi.StringPtrInput
}
func (ServicePrincipalTokenSigningCertificateState) ElementType() reflect.Type {
return reflect.TypeOf((*servicePrincipalTokenSigningCertificateState)(nil)).Elem()
}
type servicePrincipalTokenSigningCertificateArgs struct {
// Specifies a friendly name for the certificate.
// Must start with `CN=`. Changing this field forces a new resource to be created.
//
// > If not specified, it will default to `CN=Microsoft Azure Federated SSO Certificate`.
DisplayName *string `pulumi:"displayName"`
// The end date until which the token signing certificate is valid, formatted as an RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). Changing this field forces a new resource to be created.
EndDate *string `pulumi:"endDate"`
// The object ID of the service principal for which this certificate should be created. Changing this field forces a new resource to be created.
ServicePrincipalId string `pulumi:"servicePrincipalId"`
}
// The set of arguments for constructing a ServicePrincipalTokenSigningCertificate resource.
type ServicePrincipalTokenSigningCertificateArgs struct {
// Specifies a friendly name for the certificate.
// Must start with `CN=`. Changing this field forces a new resource to be created.
//
// > If not specified, it will default to `CN=Microsoft Azure Federated SSO Certificate`.
DisplayName pulumi.StringPtrInput
// The end date until which the token signing certificate is valid, formatted as an RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). Changing this field forces a new resource to be created.
EndDate pulumi.StringPtrInput
// The object ID of the service principal for which this certificate should be created. Changing this field forces a new resource to be created.
ServicePrincipalId pulumi.StringInput
}
func (ServicePrincipalTokenSigningCertificateArgs) ElementType() reflect.Type {
return reflect.TypeOf((*servicePrincipalTokenSigningCertificateArgs)(nil)).Elem()
}
type ServicePrincipalTokenSigningCertificateInput interface {
pulumi.Input
ToServicePrincipalTokenSigningCertificateOutput() ServicePrincipalTokenSigningCertificateOutput
ToServicePrincipalTokenSigningCertificateOutputWithContext(ctx context.Context) ServicePrincipalTokenSigningCertificateOutput
}
func (*ServicePrincipalTokenSigningCertificate) ElementType() reflect.Type {
return reflect.TypeOf((**ServicePrincipalTokenSigningCertificate)(nil)).Elem()
}
func (i *ServicePrincipalTokenSigningCertificate) ToServicePrincipalTokenSigningCertificateOutput() ServicePrincipalTokenSigningCertificateOutput {
return i.ToServicePrincipalTokenSigningCertificateOutputWithContext(context.Background())
}
func (i *ServicePrincipalTokenSigningCertificate) ToServicePrincipalTokenSigningCertificateOutputWithContext(ctx context.Context) ServicePrincipalTokenSigningCertificateOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServicePrincipalTokenSigningCertificateOutput)
}
// ServicePrincipalTokenSigningCertificateArrayInput is an input type that accepts ServicePrincipalTokenSigningCertificateArray and ServicePrincipalTokenSigningCertificateArrayOutput values.
// You can construct a concrete instance of `ServicePrincipalTokenSigningCertificateArrayInput` via:
//
// ServicePrincipalTokenSigningCertificateArray{ ServicePrincipalTokenSigningCertificateArgs{...} }
type ServicePrincipalTokenSigningCertificateArrayInput interface {
pulumi.Input
ToServicePrincipalTokenSigningCertificateArrayOutput() ServicePrincipalTokenSigningCertificateArrayOutput
ToServicePrincipalTokenSigningCertificateArrayOutputWithContext(context.Context) ServicePrincipalTokenSigningCertificateArrayOutput
}
type ServicePrincipalTokenSigningCertificateArray []ServicePrincipalTokenSigningCertificateInput
func (ServicePrincipalTokenSigningCertificateArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ServicePrincipalTokenSigningCertificate)(nil)).Elem()
}
func (i ServicePrincipalTokenSigningCertificateArray) ToServicePrincipalTokenSigningCertificateArrayOutput() ServicePrincipalTokenSigningCertificateArrayOutput {
return i.ToServicePrincipalTokenSigningCertificateArrayOutputWithContext(context.Background())
}
func (i ServicePrincipalTokenSigningCertificateArray) ToServicePrincipalTokenSigningCertificateArrayOutputWithContext(ctx context.Context) ServicePrincipalTokenSigningCertificateArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServicePrincipalTokenSigningCertificateArrayOutput)
}
// ServicePrincipalTokenSigningCertificateMapInput is an input type that accepts ServicePrincipalTokenSigningCertificateMap and ServicePrincipalTokenSigningCertificateMapOutput values.
// You can construct a concrete instance of `ServicePrincipalTokenSigningCertificateMapInput` via:
//
// ServicePrincipalTokenSigningCertificateMap{ "key": ServicePrincipalTokenSigningCertificateArgs{...} }
type ServicePrincipalTokenSigningCertificateMapInput interface {
pulumi.Input
ToServicePrincipalTokenSigningCertificateMapOutput() ServicePrincipalTokenSigningCertificateMapOutput
ToServicePrincipalTokenSigningCertificateMapOutputWithContext(context.Context) ServicePrincipalTokenSigningCertificateMapOutput
}
type ServicePrincipalTokenSigningCertificateMap map[string]ServicePrincipalTokenSigningCertificateInput
func (ServicePrincipalTokenSigningCertificateMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ServicePrincipalTokenSigningCertificate)(nil)).Elem()
}
func (i ServicePrincipalTokenSigningCertificateMap) ToServicePrincipalTokenSigningCertificateMapOutput() ServicePrincipalTokenSigningCertificateMapOutput {
return i.ToServicePrincipalTokenSigningCertificateMapOutputWithContext(context.Background())
}
func (i ServicePrincipalTokenSigningCertificateMap) ToServicePrincipalTokenSigningCertificateMapOutputWithContext(ctx context.Context) ServicePrincipalTokenSigningCertificateMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ServicePrincipalTokenSigningCertificateMapOutput)
}
type ServicePrincipalTokenSigningCertificateOutput struct{ *pulumi.OutputState }
func (ServicePrincipalTokenSigningCertificateOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ServicePrincipalTokenSigningCertificate)(nil)).Elem()
}
func (o ServicePrincipalTokenSigningCertificateOutput) ToServicePrincipalTokenSigningCertificateOutput() ServicePrincipalTokenSigningCertificateOutput {
return o
}
func (o ServicePrincipalTokenSigningCertificateOutput) ToServicePrincipalTokenSigningCertificateOutputWithContext(ctx context.Context) ServicePrincipalTokenSigningCertificateOutput {
return o
}
// Specifies a friendly name for the certificate.
// Must start with `CN=`. Changing this field forces a new resource to be created.
//
// > If not specified, it will default to `CN=Microsoft Azure Federated SSO Certificate`.
func (o ServicePrincipalTokenSigningCertificateOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v *ServicePrincipalTokenSigningCertificate) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
}
// The end date until which the token signing certificate is valid, formatted as an RFC3339 date string (e.g. `2018-01-01T01:02:03Z`). Changing this field forces a new resource to be created.
func (o ServicePrincipalTokenSigningCertificateOutput) EndDate() pulumi.StringOutput {
return o.ApplyT(func(v *ServicePrincipalTokenSigningCertificate) pulumi.StringOutput { return v.EndDate }).(pulumi.StringOutput)
}
// A UUID used to uniquely identify the verify certificate.
func (o ServicePrincipalTokenSigningCertificateOutput) KeyId() pulumi.StringOutput {
return o.ApplyT(func(v *ServicePrincipalTokenSigningCertificate) pulumi.StringOutput { return v.KeyId }).(pulumi.StringOutput)
}
// The object ID of the service principal for which this certificate should be created. Changing this field forces a new resource to be created.
func (o ServicePrincipalTokenSigningCertificateOutput) ServicePrincipalId() pulumi.StringOutput {
return o.ApplyT(func(v *ServicePrincipalTokenSigningCertificate) pulumi.StringOutput { return v.ServicePrincipalId }).(pulumi.StringOutput)
}
// The start date from which the certificate is valid, formatted as an RFC3339 date string (e.g. `2018-01-01T01:02:03Z`).
func (o ServicePrincipalTokenSigningCertificateOutput) StartDate() pulumi.StringOutput {
return o.ApplyT(func(v *ServicePrincipalTokenSigningCertificate) pulumi.StringOutput { return v.StartDate }).(pulumi.StringOutput)
}
// A SHA-1 generated thumbprint of the token signing certificate, which can be used to set the preferred signing certificate for a service principal.
func (o ServicePrincipalTokenSigningCertificateOutput) Thumbprint() pulumi.StringOutput {
return o.ApplyT(func(v *ServicePrincipalTokenSigningCertificate) pulumi.StringOutput { return v.Thumbprint }).(pulumi.StringOutput)
}
// The certificate data, which is PEM encoded but does not include the
// header `-----BEGIN CERTIFICATE-----\n` or the footer `\n-----END CERTIFICATE-----`.
func (o ServicePrincipalTokenSigningCertificateOutput) Value() pulumi.StringOutput {
return o.ApplyT(func(v *ServicePrincipalTokenSigningCertificate) pulumi.StringOutput { return v.Value }).(pulumi.StringOutput)
}
type ServicePrincipalTokenSigningCertificateArrayOutput struct{ *pulumi.OutputState }
func (ServicePrincipalTokenSigningCertificateArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ServicePrincipalTokenSigningCertificate)(nil)).Elem()
}
func (o ServicePrincipalTokenSigningCertificateArrayOutput) ToServicePrincipalTokenSigningCertificateArrayOutput() ServicePrincipalTokenSigningCertificateArrayOutput {
return o
}
func (o ServicePrincipalTokenSigningCertificateArrayOutput) ToServicePrincipalTokenSigningCertificateArrayOutputWithContext(ctx context.Context) ServicePrincipalTokenSigningCertificateArrayOutput {
return o
}
func (o ServicePrincipalTokenSigningCertificateArrayOutput) Index(i pulumi.IntInput) ServicePrincipalTokenSigningCertificateOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ServicePrincipalTokenSigningCertificate {
return vs[0].([]*ServicePrincipalTokenSigningCertificate)[vs[1].(int)]
}).(ServicePrincipalTokenSigningCertificateOutput)
}
type ServicePrincipalTokenSigningCertificateMapOutput struct{ *pulumi.OutputState }
func (ServicePrincipalTokenSigningCertificateMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ServicePrincipalTokenSigningCertificate)(nil)).Elem()
}
func (o ServicePrincipalTokenSigningCertificateMapOutput) ToServicePrincipalTokenSigningCertificateMapOutput() ServicePrincipalTokenSigningCertificateMapOutput {
return o
}
func (o ServicePrincipalTokenSigningCertificateMapOutput) ToServicePrincipalTokenSigningCertificateMapOutputWithContext(ctx context.Context) ServicePrincipalTokenSigningCertificateMapOutput {
return o
}
func (o ServicePrincipalTokenSigningCertificateMapOutput) MapIndex(k pulumi.StringInput) ServicePrincipalTokenSigningCertificateOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ServicePrincipalTokenSigningCertificate {
return vs[0].(map[string]*ServicePrincipalTokenSigningCertificate)[vs[1].(string)]
}).(ServicePrincipalTokenSigningCertificateOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ServicePrincipalTokenSigningCertificateInput)(nil)).Elem(), &ServicePrincipalTokenSigningCertificate{})
pulumi.RegisterInputType(reflect.TypeOf((*ServicePrincipalTokenSigningCertificateArrayInput)(nil)).Elem(), ServicePrincipalTokenSigningCertificateArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ServicePrincipalTokenSigningCertificateMapInput)(nil)).Elem(), ServicePrincipalTokenSigningCertificateMap{})
pulumi.RegisterOutputType(ServicePrincipalTokenSigningCertificateOutput{})
pulumi.RegisterOutputType(ServicePrincipalTokenSigningCertificateArrayOutput{})
pulumi.RegisterOutputType(ServicePrincipalTokenSigningCertificateMapOutput{})
}