-
Notifications
You must be signed in to change notification settings - Fork 7
/
clientCredentials.go
420 lines (364 loc) · 19.1 KB
/
clientCredentials.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
412
413
414
415
416
417
418
419
420
// 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 auth0
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-auth0/sdk/v2/go/auth0/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumix"
)
// With this resource, you can configure the method to use when making requests to any endpoint that requires this client to authenticate.
//
// > Refer to the client secret rotation guide
// for instructions on how to rotate client secrets with zero downtime.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-auth0/sdk/v2/go/auth0"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// myClient, err := auth0.NewClient(ctx, "myClient", &auth0.ClientArgs{
// AppType: pulumi.String("non_interactive"),
// JwtConfiguration: &auth0.ClientJwtConfigurationArgs{
// Alg: pulumi.String("RS256"),
// },
// })
// if err != nil {
// return err
// }
// _, err = auth0.NewClientCredentials(ctx, "testClientCredentials", &auth0.ClientCredentialsArgs{
// ClientId: myClient.ID(),
// AuthenticationMethod: pulumi.String("client_secret_post"),
// })
// if err != nil {
// return err
// }
// _, err = auth0.NewClientCredentials(ctx, "testIndex/clientCredentialsClientCredentials", &auth0.ClientCredentialsArgs{
// ClientId: myClient.ID(),
// AuthenticationMethod: pulumi.String("client_secret_basic"),
// })
// if err != nil {
// return err
// }
// _, err = auth0.NewClientCredentials(ctx, "testAuth0Index/clientCredentialsClientCredentials", &auth0.ClientCredentialsArgs{
// ClientId: myClient.ID(),
// AuthenticationMethod: pulumi.String("none"),
// })
// if err != nil {
// return err
// }
// _, err = auth0.NewClientCredentials(ctx, "testAuth0Index/clientCredentialsClientCredentials1", &auth0.ClientCredentialsArgs{
// ClientId: myClient.ID(),
// AuthenticationMethod: pulumi.String("private_key_jwt"),
// PrivateKeyJwt: &auth0.ClientCredentialsPrivateKeyJwtArgs{
// Credentials: auth0.ClientCredentialsPrivateKeyJwtCredentialArray{
// &auth0.ClientCredentialsPrivateKeyJwtCredentialArgs{
// Name: pulumi.String("Testing Credentials 1"),
// CredentialType: pulumi.String("public_key"),
// Algorithm: pulumi.String("RS256"),
// ParseExpiryFromCert: pulumi.Bool(true),
// Pem: pulumi.String("-----BEGIN CERTIFICATE-----\nMIIFWDCCA0ACCQDXqpBo3R...G9w0BAQsFADBuMQswCQYDVQQGEwJl\n-----END CERTIFICATE-----\n"),
// },
// },
// },
// })
// if err != nil {
// return err
// }
// _, err = auth0.NewClientCredentials(ctx, "testAuth0Index/clientCredentialsClientCredentials2", &auth0.ClientCredentialsArgs{
// ClientId: myClient.ID(),
// AuthenticationMethod: pulumi.String("client_secret_basic"),
// ClientSecret: pulumi.String("LUFqPx+sRLjbL7peYRPFmFu-bbvE7u7og4YUNe_C345=683341"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// A client credentials resource can be imported using the client's ID. # Example
//
// ```sh
//
// $ pulumi import auth0:index/clientCredentials:ClientCredentials my_creds AaiyAPdpYdesoKnqjj8HJqRn4T5titww
//
// ```
//
// ~> Importing this resource when the `authentication_method` is set to `private_key_jwt` will force the resource to be recreated. This is to be expected, because the pem file can't be checked for differences.
type ClientCredentials struct {
pulumi.CustomResourceState
// Configure the method to use when making requests to any endpoint that requires this client to authenticate. Options include `none` (public client without a client secret), `clientSecretPost` (confidential client using HTTP POST parameters), `clientSecretBasic` (confidential client using HTTP Basic), `privateKeyJwt` (confidential client using a Private Key JWT).
AuthenticationMethod pulumi.StringOutput `pulumi:"authenticationMethod"`
// The ID of the client for which to configure the authentication method.
ClientId pulumi.StringOutput `pulumi:"clientId"`
// Secret for the client when using `client_secret_post` or `client_secret_basic` authentication method. Keep this private.
// To access this attribute you need to add the `read:client_keys` scope to the Terraform client. Otherwise, the attribute
// will contain an empty string. The attribute will also be an empty string in case `private_key_jwt` is selected as an
// authentication method.
ClientSecret pulumi.StringOutput `pulumi:"clientSecret"`
// Defines `privateKeyJwt` client authentication method.
PrivateKeyJwt ClientCredentialsPrivateKeyJwtPtrOutput `pulumi:"privateKeyJwt"`
}
// NewClientCredentials registers a new resource with the given unique name, arguments, and options.
func NewClientCredentials(ctx *pulumi.Context,
name string, args *ClientCredentialsArgs, opts ...pulumi.ResourceOption) (*ClientCredentials, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AuthenticationMethod == nil {
return nil, errors.New("invalid value for required argument 'AuthenticationMethod'")
}
if args.ClientId == nil {
return nil, errors.New("invalid value for required argument 'ClientId'")
}
if args.ClientSecret != nil {
args.ClientSecret = pulumi.ToSecret(args.ClientSecret).(pulumi.StringPtrInput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"clientSecret",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource ClientCredentials
err := ctx.RegisterResource("auth0:index/clientCredentials:ClientCredentials", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetClientCredentials gets an existing ClientCredentials 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 GetClientCredentials(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ClientCredentialsState, opts ...pulumi.ResourceOption) (*ClientCredentials, error) {
var resource ClientCredentials
err := ctx.ReadResource("auth0:index/clientCredentials:ClientCredentials", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ClientCredentials resources.
type clientCredentialsState struct {
// Configure the method to use when making requests to any endpoint that requires this client to authenticate. Options include `none` (public client without a client secret), `clientSecretPost` (confidential client using HTTP POST parameters), `clientSecretBasic` (confidential client using HTTP Basic), `privateKeyJwt` (confidential client using a Private Key JWT).
AuthenticationMethod *string `pulumi:"authenticationMethod"`
// The ID of the client for which to configure the authentication method.
ClientId *string `pulumi:"clientId"`
// Secret for the client when using `client_secret_post` or `client_secret_basic` authentication method. Keep this private.
// To access this attribute you need to add the `read:client_keys` scope to the Terraform client. Otherwise, the attribute
// will contain an empty string. The attribute will also be an empty string in case `private_key_jwt` is selected as an
// authentication method.
ClientSecret *string `pulumi:"clientSecret"`
// Defines `privateKeyJwt` client authentication method.
PrivateKeyJwt *ClientCredentialsPrivateKeyJwt `pulumi:"privateKeyJwt"`
}
type ClientCredentialsState struct {
// Configure the method to use when making requests to any endpoint that requires this client to authenticate. Options include `none` (public client without a client secret), `clientSecretPost` (confidential client using HTTP POST parameters), `clientSecretBasic` (confidential client using HTTP Basic), `privateKeyJwt` (confidential client using a Private Key JWT).
AuthenticationMethod pulumi.StringPtrInput
// The ID of the client for which to configure the authentication method.
ClientId pulumi.StringPtrInput
// Secret for the client when using `client_secret_post` or `client_secret_basic` authentication method. Keep this private.
// To access this attribute you need to add the `read:client_keys` scope to the Terraform client. Otherwise, the attribute
// will contain an empty string. The attribute will also be an empty string in case `private_key_jwt` is selected as an
// authentication method.
ClientSecret pulumi.StringPtrInput
// Defines `privateKeyJwt` client authentication method.
PrivateKeyJwt ClientCredentialsPrivateKeyJwtPtrInput
}
func (ClientCredentialsState) ElementType() reflect.Type {
return reflect.TypeOf((*clientCredentialsState)(nil)).Elem()
}
type clientCredentialsArgs struct {
// Configure the method to use when making requests to any endpoint that requires this client to authenticate. Options include `none` (public client without a client secret), `clientSecretPost` (confidential client using HTTP POST parameters), `clientSecretBasic` (confidential client using HTTP Basic), `privateKeyJwt` (confidential client using a Private Key JWT).
AuthenticationMethod string `pulumi:"authenticationMethod"`
// The ID of the client for which to configure the authentication method.
ClientId string `pulumi:"clientId"`
// Secret for the client when using `client_secret_post` or `client_secret_basic` authentication method. Keep this private.
// To access this attribute you need to add the `read:client_keys` scope to the Terraform client. Otherwise, the attribute
// will contain an empty string. The attribute will also be an empty string in case `private_key_jwt` is selected as an
// authentication method.
ClientSecret *string `pulumi:"clientSecret"`
// Defines `privateKeyJwt` client authentication method.
PrivateKeyJwt *ClientCredentialsPrivateKeyJwt `pulumi:"privateKeyJwt"`
}
// The set of arguments for constructing a ClientCredentials resource.
type ClientCredentialsArgs struct {
// Configure the method to use when making requests to any endpoint that requires this client to authenticate. Options include `none` (public client without a client secret), `clientSecretPost` (confidential client using HTTP POST parameters), `clientSecretBasic` (confidential client using HTTP Basic), `privateKeyJwt` (confidential client using a Private Key JWT).
AuthenticationMethod pulumi.StringInput
// The ID of the client for which to configure the authentication method.
ClientId pulumi.StringInput
// Secret for the client when using `client_secret_post` or `client_secret_basic` authentication method. Keep this private.
// To access this attribute you need to add the `read:client_keys` scope to the Terraform client. Otherwise, the attribute
// will contain an empty string. The attribute will also be an empty string in case `private_key_jwt` is selected as an
// authentication method.
ClientSecret pulumi.StringPtrInput
// Defines `privateKeyJwt` client authentication method.
PrivateKeyJwt ClientCredentialsPrivateKeyJwtPtrInput
}
func (ClientCredentialsArgs) ElementType() reflect.Type {
return reflect.TypeOf((*clientCredentialsArgs)(nil)).Elem()
}
type ClientCredentialsInput interface {
pulumi.Input
ToClientCredentialsOutput() ClientCredentialsOutput
ToClientCredentialsOutputWithContext(ctx context.Context) ClientCredentialsOutput
}
func (*ClientCredentials) ElementType() reflect.Type {
return reflect.TypeOf((**ClientCredentials)(nil)).Elem()
}
func (i *ClientCredentials) ToClientCredentialsOutput() ClientCredentialsOutput {
return i.ToClientCredentialsOutputWithContext(context.Background())
}
func (i *ClientCredentials) ToClientCredentialsOutputWithContext(ctx context.Context) ClientCredentialsOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClientCredentialsOutput)
}
func (i *ClientCredentials) ToOutput(ctx context.Context) pulumix.Output[*ClientCredentials] {
return pulumix.Output[*ClientCredentials]{
OutputState: i.ToClientCredentialsOutputWithContext(ctx).OutputState,
}
}
// ClientCredentialsArrayInput is an input type that accepts ClientCredentialsArray and ClientCredentialsArrayOutput values.
// You can construct a concrete instance of `ClientCredentialsArrayInput` via:
//
// ClientCredentialsArray{ ClientCredentialsArgs{...} }
type ClientCredentialsArrayInput interface {
pulumi.Input
ToClientCredentialsArrayOutput() ClientCredentialsArrayOutput
ToClientCredentialsArrayOutputWithContext(context.Context) ClientCredentialsArrayOutput
}
type ClientCredentialsArray []ClientCredentialsInput
func (ClientCredentialsArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ClientCredentials)(nil)).Elem()
}
func (i ClientCredentialsArray) ToClientCredentialsArrayOutput() ClientCredentialsArrayOutput {
return i.ToClientCredentialsArrayOutputWithContext(context.Background())
}
func (i ClientCredentialsArray) ToClientCredentialsArrayOutputWithContext(ctx context.Context) ClientCredentialsArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClientCredentialsArrayOutput)
}
func (i ClientCredentialsArray) ToOutput(ctx context.Context) pulumix.Output[[]*ClientCredentials] {
return pulumix.Output[[]*ClientCredentials]{
OutputState: i.ToClientCredentialsArrayOutputWithContext(ctx).OutputState,
}
}
// ClientCredentialsMapInput is an input type that accepts ClientCredentialsMap and ClientCredentialsMapOutput values.
// You can construct a concrete instance of `ClientCredentialsMapInput` via:
//
// ClientCredentialsMap{ "key": ClientCredentialsArgs{...} }
type ClientCredentialsMapInput interface {
pulumi.Input
ToClientCredentialsMapOutput() ClientCredentialsMapOutput
ToClientCredentialsMapOutputWithContext(context.Context) ClientCredentialsMapOutput
}
type ClientCredentialsMap map[string]ClientCredentialsInput
func (ClientCredentialsMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ClientCredentials)(nil)).Elem()
}
func (i ClientCredentialsMap) ToClientCredentialsMapOutput() ClientCredentialsMapOutput {
return i.ToClientCredentialsMapOutputWithContext(context.Background())
}
func (i ClientCredentialsMap) ToClientCredentialsMapOutputWithContext(ctx context.Context) ClientCredentialsMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ClientCredentialsMapOutput)
}
func (i ClientCredentialsMap) ToOutput(ctx context.Context) pulumix.Output[map[string]*ClientCredentials] {
return pulumix.Output[map[string]*ClientCredentials]{
OutputState: i.ToClientCredentialsMapOutputWithContext(ctx).OutputState,
}
}
type ClientCredentialsOutput struct{ *pulumi.OutputState }
func (ClientCredentialsOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ClientCredentials)(nil)).Elem()
}
func (o ClientCredentialsOutput) ToClientCredentialsOutput() ClientCredentialsOutput {
return o
}
func (o ClientCredentialsOutput) ToClientCredentialsOutputWithContext(ctx context.Context) ClientCredentialsOutput {
return o
}
func (o ClientCredentialsOutput) ToOutput(ctx context.Context) pulumix.Output[*ClientCredentials] {
return pulumix.Output[*ClientCredentials]{
OutputState: o.OutputState,
}
}
// Configure the method to use when making requests to any endpoint that requires this client to authenticate. Options include `none` (public client without a client secret), `clientSecretPost` (confidential client using HTTP POST parameters), `clientSecretBasic` (confidential client using HTTP Basic), `privateKeyJwt` (confidential client using a Private Key JWT).
func (o ClientCredentialsOutput) AuthenticationMethod() pulumi.StringOutput {
return o.ApplyT(func(v *ClientCredentials) pulumi.StringOutput { return v.AuthenticationMethod }).(pulumi.StringOutput)
}
// The ID of the client for which to configure the authentication method.
func (o ClientCredentialsOutput) ClientId() pulumi.StringOutput {
return o.ApplyT(func(v *ClientCredentials) pulumi.StringOutput { return v.ClientId }).(pulumi.StringOutput)
}
// Secret for the client when using `client_secret_post` or `client_secret_basic` authentication method. Keep this private.
// To access this attribute you need to add the `read:client_keys` scope to the Terraform client. Otherwise, the attribute
// will contain an empty string. The attribute will also be an empty string in case `private_key_jwt` is selected as an
// authentication method.
func (o ClientCredentialsOutput) ClientSecret() pulumi.StringOutput {
return o.ApplyT(func(v *ClientCredentials) pulumi.StringOutput { return v.ClientSecret }).(pulumi.StringOutput)
}
// Defines `privateKeyJwt` client authentication method.
func (o ClientCredentialsOutput) PrivateKeyJwt() ClientCredentialsPrivateKeyJwtPtrOutput {
return o.ApplyT(func(v *ClientCredentials) ClientCredentialsPrivateKeyJwtPtrOutput { return v.PrivateKeyJwt }).(ClientCredentialsPrivateKeyJwtPtrOutput)
}
type ClientCredentialsArrayOutput struct{ *pulumi.OutputState }
func (ClientCredentialsArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ClientCredentials)(nil)).Elem()
}
func (o ClientCredentialsArrayOutput) ToClientCredentialsArrayOutput() ClientCredentialsArrayOutput {
return o
}
func (o ClientCredentialsArrayOutput) ToClientCredentialsArrayOutputWithContext(ctx context.Context) ClientCredentialsArrayOutput {
return o
}
func (o ClientCredentialsArrayOutput) ToOutput(ctx context.Context) pulumix.Output[[]*ClientCredentials] {
return pulumix.Output[[]*ClientCredentials]{
OutputState: o.OutputState,
}
}
func (o ClientCredentialsArrayOutput) Index(i pulumi.IntInput) ClientCredentialsOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ClientCredentials {
return vs[0].([]*ClientCredentials)[vs[1].(int)]
}).(ClientCredentialsOutput)
}
type ClientCredentialsMapOutput struct{ *pulumi.OutputState }
func (ClientCredentialsMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ClientCredentials)(nil)).Elem()
}
func (o ClientCredentialsMapOutput) ToClientCredentialsMapOutput() ClientCredentialsMapOutput {
return o
}
func (o ClientCredentialsMapOutput) ToClientCredentialsMapOutputWithContext(ctx context.Context) ClientCredentialsMapOutput {
return o
}
func (o ClientCredentialsMapOutput) ToOutput(ctx context.Context) pulumix.Output[map[string]*ClientCredentials] {
return pulumix.Output[map[string]*ClientCredentials]{
OutputState: o.OutputState,
}
}
func (o ClientCredentialsMapOutput) MapIndex(k pulumi.StringInput) ClientCredentialsOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ClientCredentials {
return vs[0].(map[string]*ClientCredentials)[vs[1].(string)]
}).(ClientCredentialsOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ClientCredentialsInput)(nil)).Elem(), &ClientCredentials{})
pulumi.RegisterInputType(reflect.TypeOf((*ClientCredentialsArrayInput)(nil)).Elem(), ClientCredentialsArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ClientCredentialsMapInput)(nil)).Elem(), ClientCredentialsMap{})
pulumi.RegisterOutputType(ClientCredentialsOutput{})
pulumi.RegisterOutputType(ClientCredentialsArrayOutput{})
pulumi.RegisterOutputType(ClientCredentialsMapOutput{})
}