-
Notifications
You must be signed in to change notification settings - Fork 150
/
userPoolUICustomization.go
377 lines (331 loc) · 16.2 KB
/
userPoolUICustomization.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
// *** 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 cognito
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Cognito User Pool UI Customization resource.
//
// > **Note:** To use this resource, the user pool must have a domain associated with it. For more information, see the Amazon Cognito Developer Guide on [Customizing the Built-in Sign-In and Sign-up Webpages](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-app-ui-customization.html).
//
// ## Example Usage
// ### UI customization settings for a single client
//
// ```go
// package main
//
// import (
// "encoding/base64"
// "io/ioutil"
//
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cognito"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func filebase64OrPanic(path string) pulumi.StringPtrInput {
// if fileData, err := ioutil.ReadFile(path); err == nil {
// return pulumi.String(base64.StdEncoding.EncodeToString(fileData[:]))
// } else {
// panic(err.Error())
// }
// }
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleUserPool, err := cognito.NewUserPool(ctx, "exampleUserPool", nil)
// if err != nil {
// return err
// }
// exampleUserPoolDomain, err := cognito.NewUserPoolDomain(ctx, "exampleUserPoolDomain", &cognito.UserPoolDomainArgs{
// Domain: pulumi.String("example"),
// UserPoolId: exampleUserPool.ID(),
// })
// if err != nil {
// return err
// }
// exampleUserPoolClient, err := cognito.NewUserPoolClient(ctx, "exampleUserPoolClient", &cognito.UserPoolClientArgs{
// UserPoolId: exampleUserPool.ID(),
// })
// if err != nil {
// return err
// }
// _, err = cognito.NewUserPoolUICustomization(ctx, "exampleUserPoolUICustomization", &cognito.UserPoolUICustomizationArgs{
// ClientId: exampleUserPoolClient.ID(),
// Css: pulumi.String(".label-customizable {font-weight: 400;}"),
// ImageFile: filebase64OrPanic("logo.png"),
// UserPoolId: exampleUserPoolDomain.UserPoolId,
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// ### UI customization settings for all clients
//
// ```go
// package main
//
// import (
// "encoding/base64"
// "io/ioutil"
//
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cognito"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func filebase64OrPanic(path string) pulumi.StringPtrInput {
// if fileData, err := ioutil.ReadFile(path); err == nil {
// return pulumi.String(base64.StdEncoding.EncodeToString(fileData[:]))
// } else {
// panic(err.Error())
// }
// }
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleUserPool, err := cognito.NewUserPool(ctx, "exampleUserPool", nil)
// if err != nil {
// return err
// }
// exampleUserPoolDomain, err := cognito.NewUserPoolDomain(ctx, "exampleUserPoolDomain", &cognito.UserPoolDomainArgs{
// Domain: pulumi.String("example"),
// UserPoolId: exampleUserPool.ID(),
// })
// if err != nil {
// return err
// }
// _, err = cognito.NewUserPoolUICustomization(ctx, "exampleUserPoolUICustomization", &cognito.UserPoolUICustomizationArgs{
// Css: pulumi.String(".label-customizable {font-weight: 400;}"),
// ImageFile: filebase64OrPanic("logo.png"),
// UserPoolId: exampleUserPoolDomain.UserPoolId,
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Cognito User Pool UI Customizations can be imported using the `user_pool_id` and `client_id` separated by `,`, e.g.,
//
// ```sh
// $ pulumi import aws:cognito/userPoolUICustomization:UserPoolUICustomization example us-west-2_ZCTarbt5C,12bu4fuk3mlgqa2rtrujgp6egq
// ```
type UserPoolUICustomization struct {
pulumi.CustomResourceState
// The client ID for the client app. Defaults to `ALL`. If `ALL` is specified, the `css` and/or `imageFile` settings will be used for every client that has no UI customization set previously.
ClientId pulumi.StringPtrOutput `pulumi:"clientId"`
// The creation date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) for the UI customization.
CreationDate pulumi.StringOutput `pulumi:"creationDate"`
// The CSS values in the UI customization, provided as a String. At least one of `css` or `imageFile` is required.
Css pulumi.StringPtrOutput `pulumi:"css"`
// The CSS version number.
CssVersion pulumi.StringOutput `pulumi:"cssVersion"`
// The uploaded logo image for the UI customization, provided as a base64-encoded String. Drift detection is not possible for this argument. At least one of `css` or `imageFile` is required.
ImageFile pulumi.StringPtrOutput `pulumi:"imageFile"`
// The logo image URL for the UI customization.
ImageUrl pulumi.StringOutput `pulumi:"imageUrl"`
// The last-modified date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) for the UI customization.
LastModifiedDate pulumi.StringOutput `pulumi:"lastModifiedDate"`
// The user pool ID for the user pool.
UserPoolId pulumi.StringOutput `pulumi:"userPoolId"`
}
// NewUserPoolUICustomization registers a new resource with the given unique name, arguments, and options.
func NewUserPoolUICustomization(ctx *pulumi.Context,
name string, args *UserPoolUICustomizationArgs, opts ...pulumi.ResourceOption) (*UserPoolUICustomization, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.UserPoolId == nil {
return nil, errors.New("invalid value for required argument 'UserPoolId'")
}
var resource UserPoolUICustomization
err := ctx.RegisterResource("aws:cognito/userPoolUICustomization:UserPoolUICustomization", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUserPoolUICustomization gets an existing UserPoolUICustomization 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 GetUserPoolUICustomization(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UserPoolUICustomizationState, opts ...pulumi.ResourceOption) (*UserPoolUICustomization, error) {
var resource UserPoolUICustomization
err := ctx.ReadResource("aws:cognito/userPoolUICustomization:UserPoolUICustomization", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering UserPoolUICustomization resources.
type userPoolUICustomizationState struct {
// The client ID for the client app. Defaults to `ALL`. If `ALL` is specified, the `css` and/or `imageFile` settings will be used for every client that has no UI customization set previously.
ClientId *string `pulumi:"clientId"`
// The creation date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) for the UI customization.
CreationDate *string `pulumi:"creationDate"`
// The CSS values in the UI customization, provided as a String. At least one of `css` or `imageFile` is required.
Css *string `pulumi:"css"`
// The CSS version number.
CssVersion *string `pulumi:"cssVersion"`
// The uploaded logo image for the UI customization, provided as a base64-encoded String. Drift detection is not possible for this argument. At least one of `css` or `imageFile` is required.
ImageFile *string `pulumi:"imageFile"`
// The logo image URL for the UI customization.
ImageUrl *string `pulumi:"imageUrl"`
// The last-modified date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) for the UI customization.
LastModifiedDate *string `pulumi:"lastModifiedDate"`
// The user pool ID for the user pool.
UserPoolId *string `pulumi:"userPoolId"`
}
type UserPoolUICustomizationState struct {
// The client ID for the client app. Defaults to `ALL`. If `ALL` is specified, the `css` and/or `imageFile` settings will be used for every client that has no UI customization set previously.
ClientId pulumi.StringPtrInput
// The creation date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) for the UI customization.
CreationDate pulumi.StringPtrInput
// The CSS values in the UI customization, provided as a String. At least one of `css` or `imageFile` is required.
Css pulumi.StringPtrInput
// The CSS version number.
CssVersion pulumi.StringPtrInput
// The uploaded logo image for the UI customization, provided as a base64-encoded String. Drift detection is not possible for this argument. At least one of `css` or `imageFile` is required.
ImageFile pulumi.StringPtrInput
// The logo image URL for the UI customization.
ImageUrl pulumi.StringPtrInput
// The last-modified date in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) for the UI customization.
LastModifiedDate pulumi.StringPtrInput
// The user pool ID for the user pool.
UserPoolId pulumi.StringPtrInput
}
func (UserPoolUICustomizationState) ElementType() reflect.Type {
return reflect.TypeOf((*userPoolUICustomizationState)(nil)).Elem()
}
type userPoolUICustomizationArgs struct {
// The client ID for the client app. Defaults to `ALL`. If `ALL` is specified, the `css` and/or `imageFile` settings will be used for every client that has no UI customization set previously.
ClientId *string `pulumi:"clientId"`
// The CSS values in the UI customization, provided as a String. At least one of `css` or `imageFile` is required.
Css *string `pulumi:"css"`
// The uploaded logo image for the UI customization, provided as a base64-encoded String. Drift detection is not possible for this argument. At least one of `css` or `imageFile` is required.
ImageFile *string `pulumi:"imageFile"`
// The user pool ID for the user pool.
UserPoolId string `pulumi:"userPoolId"`
}
// The set of arguments for constructing a UserPoolUICustomization resource.
type UserPoolUICustomizationArgs struct {
// The client ID for the client app. Defaults to `ALL`. If `ALL` is specified, the `css` and/or `imageFile` settings will be used for every client that has no UI customization set previously.
ClientId pulumi.StringPtrInput
// The CSS values in the UI customization, provided as a String. At least one of `css` or `imageFile` is required.
Css pulumi.StringPtrInput
// The uploaded logo image for the UI customization, provided as a base64-encoded String. Drift detection is not possible for this argument. At least one of `css` or `imageFile` is required.
ImageFile pulumi.StringPtrInput
// The user pool ID for the user pool.
UserPoolId pulumi.StringInput
}
func (UserPoolUICustomizationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*userPoolUICustomizationArgs)(nil)).Elem()
}
type UserPoolUICustomizationInput interface {
pulumi.Input
ToUserPoolUICustomizationOutput() UserPoolUICustomizationOutput
ToUserPoolUICustomizationOutputWithContext(ctx context.Context) UserPoolUICustomizationOutput
}
func (*UserPoolUICustomization) ElementType() reflect.Type {
return reflect.TypeOf((**UserPoolUICustomization)(nil)).Elem()
}
func (i *UserPoolUICustomization) ToUserPoolUICustomizationOutput() UserPoolUICustomizationOutput {
return i.ToUserPoolUICustomizationOutputWithContext(context.Background())
}
func (i *UserPoolUICustomization) ToUserPoolUICustomizationOutputWithContext(ctx context.Context) UserPoolUICustomizationOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserPoolUICustomizationOutput)
}
// UserPoolUICustomizationArrayInput is an input type that accepts UserPoolUICustomizationArray and UserPoolUICustomizationArrayOutput values.
// You can construct a concrete instance of `UserPoolUICustomizationArrayInput` via:
//
// UserPoolUICustomizationArray{ UserPoolUICustomizationArgs{...} }
type UserPoolUICustomizationArrayInput interface {
pulumi.Input
ToUserPoolUICustomizationArrayOutput() UserPoolUICustomizationArrayOutput
ToUserPoolUICustomizationArrayOutputWithContext(context.Context) UserPoolUICustomizationArrayOutput
}
type UserPoolUICustomizationArray []UserPoolUICustomizationInput
func (UserPoolUICustomizationArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*UserPoolUICustomization)(nil)).Elem()
}
func (i UserPoolUICustomizationArray) ToUserPoolUICustomizationArrayOutput() UserPoolUICustomizationArrayOutput {
return i.ToUserPoolUICustomizationArrayOutputWithContext(context.Background())
}
func (i UserPoolUICustomizationArray) ToUserPoolUICustomizationArrayOutputWithContext(ctx context.Context) UserPoolUICustomizationArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserPoolUICustomizationArrayOutput)
}
// UserPoolUICustomizationMapInput is an input type that accepts UserPoolUICustomizationMap and UserPoolUICustomizationMapOutput values.
// You can construct a concrete instance of `UserPoolUICustomizationMapInput` via:
//
// UserPoolUICustomizationMap{ "key": UserPoolUICustomizationArgs{...} }
type UserPoolUICustomizationMapInput interface {
pulumi.Input
ToUserPoolUICustomizationMapOutput() UserPoolUICustomizationMapOutput
ToUserPoolUICustomizationMapOutputWithContext(context.Context) UserPoolUICustomizationMapOutput
}
type UserPoolUICustomizationMap map[string]UserPoolUICustomizationInput
func (UserPoolUICustomizationMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*UserPoolUICustomization)(nil)).Elem()
}
func (i UserPoolUICustomizationMap) ToUserPoolUICustomizationMapOutput() UserPoolUICustomizationMapOutput {
return i.ToUserPoolUICustomizationMapOutputWithContext(context.Background())
}
func (i UserPoolUICustomizationMap) ToUserPoolUICustomizationMapOutputWithContext(ctx context.Context) UserPoolUICustomizationMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserPoolUICustomizationMapOutput)
}
type UserPoolUICustomizationOutput struct{ *pulumi.OutputState }
func (UserPoolUICustomizationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**UserPoolUICustomization)(nil)).Elem()
}
func (o UserPoolUICustomizationOutput) ToUserPoolUICustomizationOutput() UserPoolUICustomizationOutput {
return o
}
func (o UserPoolUICustomizationOutput) ToUserPoolUICustomizationOutputWithContext(ctx context.Context) UserPoolUICustomizationOutput {
return o
}
type UserPoolUICustomizationArrayOutput struct{ *pulumi.OutputState }
func (UserPoolUICustomizationArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*UserPoolUICustomization)(nil)).Elem()
}
func (o UserPoolUICustomizationArrayOutput) ToUserPoolUICustomizationArrayOutput() UserPoolUICustomizationArrayOutput {
return o
}
func (o UserPoolUICustomizationArrayOutput) ToUserPoolUICustomizationArrayOutputWithContext(ctx context.Context) UserPoolUICustomizationArrayOutput {
return o
}
func (o UserPoolUICustomizationArrayOutput) Index(i pulumi.IntInput) UserPoolUICustomizationOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UserPoolUICustomization {
return vs[0].([]*UserPoolUICustomization)[vs[1].(int)]
}).(UserPoolUICustomizationOutput)
}
type UserPoolUICustomizationMapOutput struct{ *pulumi.OutputState }
func (UserPoolUICustomizationMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*UserPoolUICustomization)(nil)).Elem()
}
func (o UserPoolUICustomizationMapOutput) ToUserPoolUICustomizationMapOutput() UserPoolUICustomizationMapOutput {
return o
}
func (o UserPoolUICustomizationMapOutput) ToUserPoolUICustomizationMapOutputWithContext(ctx context.Context) UserPoolUICustomizationMapOutput {
return o
}
func (o UserPoolUICustomizationMapOutput) MapIndex(k pulumi.StringInput) UserPoolUICustomizationOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UserPoolUICustomization {
return vs[0].(map[string]*UserPoolUICustomization)[vs[1].(string)]
}).(UserPoolUICustomizationOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*UserPoolUICustomizationInput)(nil)).Elem(), &UserPoolUICustomization{})
pulumi.RegisterInputType(reflect.TypeOf((*UserPoolUICustomizationArrayInput)(nil)).Elem(), UserPoolUICustomizationArray{})
pulumi.RegisterInputType(reflect.TypeOf((*UserPoolUICustomizationMapInput)(nil)).Elem(), UserPoolUICustomizationMap{})
pulumi.RegisterOutputType(UserPoolUICustomizationOutput{})
pulumi.RegisterOutputType(UserPoolUICustomizationArrayOutput{})
pulumi.RegisterOutputType(UserPoolUICustomizationMapOutput{})
}