-
Notifications
You must be signed in to change notification settings - Fork 151
/
identityProvider.go
321 lines (275 loc) · 13.1 KB
/
identityProvider.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
// *** 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 Identity Provider resource.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cognito"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{
// AutoVerifiedAttributes: pulumi.StringArray{
// pulumi.String("email"),
// },
// })
// if err != nil {
// return err
// }
// _, err = cognito.NewIdentityProvider(ctx, "exampleProvider", &cognito.IdentityProviderArgs{
// UserPoolId: example.ID(),
// ProviderName: pulumi.String("Google"),
// ProviderType: pulumi.String("Google"),
// ProviderDetails: pulumi.StringMap{
// "authorize_scopes": pulumi.String("email"),
// "client_id": pulumi.String("your client_id"),
// "client_secret": pulumi.String("your client_secret"),
// },
// AttributeMapping: pulumi.StringMap{
// "email": pulumi.String("email"),
// "username": pulumi.String("sub"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// `aws_cognito_identity_provider` resources can be imported using their User Pool ID and Provider Name, e.g.,
//
// ```sh
// $ pulumi import aws:cognito/identityProvider:IdentityProvider example xxx_yyyyy:example
// ```
type IdentityProvider struct {
pulumi.CustomResourceState
// The map of attribute mapping of user pool attributes. [AttributeMapping in AWS API documentation](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-AttributeMapping)
AttributeMapping pulumi.StringMapOutput `pulumi:"attributeMapping"`
// The list of identity providers.
IdpIdentifiers pulumi.StringArrayOutput `pulumi:"idpIdentifiers"`
// The map of identity details, such as access token
ProviderDetails pulumi.StringMapOutput `pulumi:"providerDetails"`
// The provider name
ProviderName pulumi.StringOutput `pulumi:"providerName"`
// The provider type. [See AWS API for valid values](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-ProviderType)
ProviderType pulumi.StringOutput `pulumi:"providerType"`
// The user pool id
UserPoolId pulumi.StringOutput `pulumi:"userPoolId"`
}
// NewIdentityProvider registers a new resource with the given unique name, arguments, and options.
func NewIdentityProvider(ctx *pulumi.Context,
name string, args *IdentityProviderArgs, opts ...pulumi.ResourceOption) (*IdentityProvider, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ProviderDetails == nil {
return nil, errors.New("invalid value for required argument 'ProviderDetails'")
}
if args.ProviderName == nil {
return nil, errors.New("invalid value for required argument 'ProviderName'")
}
if args.ProviderType == nil {
return nil, errors.New("invalid value for required argument 'ProviderType'")
}
if args.UserPoolId == nil {
return nil, errors.New("invalid value for required argument 'UserPoolId'")
}
var resource IdentityProvider
err := ctx.RegisterResource("aws:cognito/identityProvider:IdentityProvider", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetIdentityProvider gets an existing IdentityProvider 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 GetIdentityProvider(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *IdentityProviderState, opts ...pulumi.ResourceOption) (*IdentityProvider, error) {
var resource IdentityProvider
err := ctx.ReadResource("aws:cognito/identityProvider:IdentityProvider", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering IdentityProvider resources.
type identityProviderState struct {
// The map of attribute mapping of user pool attributes. [AttributeMapping in AWS API documentation](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-AttributeMapping)
AttributeMapping map[string]string `pulumi:"attributeMapping"`
// The list of identity providers.
IdpIdentifiers []string `pulumi:"idpIdentifiers"`
// The map of identity details, such as access token
ProviderDetails map[string]string `pulumi:"providerDetails"`
// The provider name
ProviderName *string `pulumi:"providerName"`
// The provider type. [See AWS API for valid values](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-ProviderType)
ProviderType *string `pulumi:"providerType"`
// The user pool id
UserPoolId *string `pulumi:"userPoolId"`
}
type IdentityProviderState struct {
// The map of attribute mapping of user pool attributes. [AttributeMapping in AWS API documentation](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-AttributeMapping)
AttributeMapping pulumi.StringMapInput
// The list of identity providers.
IdpIdentifiers pulumi.StringArrayInput
// The map of identity details, such as access token
ProviderDetails pulumi.StringMapInput
// The provider name
ProviderName pulumi.StringPtrInput
// The provider type. [See AWS API for valid values](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-ProviderType)
ProviderType pulumi.StringPtrInput
// The user pool id
UserPoolId pulumi.StringPtrInput
}
func (IdentityProviderState) ElementType() reflect.Type {
return reflect.TypeOf((*identityProviderState)(nil)).Elem()
}
type identityProviderArgs struct {
// The map of attribute mapping of user pool attributes. [AttributeMapping in AWS API documentation](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-AttributeMapping)
AttributeMapping map[string]string `pulumi:"attributeMapping"`
// The list of identity providers.
IdpIdentifiers []string `pulumi:"idpIdentifiers"`
// The map of identity details, such as access token
ProviderDetails map[string]string `pulumi:"providerDetails"`
// The provider name
ProviderName string `pulumi:"providerName"`
// The provider type. [See AWS API for valid values](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-ProviderType)
ProviderType string `pulumi:"providerType"`
// The user pool id
UserPoolId string `pulumi:"userPoolId"`
}
// The set of arguments for constructing a IdentityProvider resource.
type IdentityProviderArgs struct {
// The map of attribute mapping of user pool attributes. [AttributeMapping in AWS API documentation](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-AttributeMapping)
AttributeMapping pulumi.StringMapInput
// The list of identity providers.
IdpIdentifiers pulumi.StringArrayInput
// The map of identity details, such as access token
ProviderDetails pulumi.StringMapInput
// The provider name
ProviderName pulumi.StringInput
// The provider type. [See AWS API for valid values](https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_CreateIdentityProvider.html#CognitoUserPools-CreateIdentityProvider-request-ProviderType)
ProviderType pulumi.StringInput
// The user pool id
UserPoolId pulumi.StringInput
}
func (IdentityProviderArgs) ElementType() reflect.Type {
return reflect.TypeOf((*identityProviderArgs)(nil)).Elem()
}
type IdentityProviderInput interface {
pulumi.Input
ToIdentityProviderOutput() IdentityProviderOutput
ToIdentityProviderOutputWithContext(ctx context.Context) IdentityProviderOutput
}
func (*IdentityProvider) ElementType() reflect.Type {
return reflect.TypeOf((**IdentityProvider)(nil)).Elem()
}
func (i *IdentityProvider) ToIdentityProviderOutput() IdentityProviderOutput {
return i.ToIdentityProviderOutputWithContext(context.Background())
}
func (i *IdentityProvider) ToIdentityProviderOutputWithContext(ctx context.Context) IdentityProviderOutput {
return pulumi.ToOutputWithContext(ctx, i).(IdentityProviderOutput)
}
// IdentityProviderArrayInput is an input type that accepts IdentityProviderArray and IdentityProviderArrayOutput values.
// You can construct a concrete instance of `IdentityProviderArrayInput` via:
//
// IdentityProviderArray{ IdentityProviderArgs{...} }
type IdentityProviderArrayInput interface {
pulumi.Input
ToIdentityProviderArrayOutput() IdentityProviderArrayOutput
ToIdentityProviderArrayOutputWithContext(context.Context) IdentityProviderArrayOutput
}
type IdentityProviderArray []IdentityProviderInput
func (IdentityProviderArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*IdentityProvider)(nil)).Elem()
}
func (i IdentityProviderArray) ToIdentityProviderArrayOutput() IdentityProviderArrayOutput {
return i.ToIdentityProviderArrayOutputWithContext(context.Background())
}
func (i IdentityProviderArray) ToIdentityProviderArrayOutputWithContext(ctx context.Context) IdentityProviderArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(IdentityProviderArrayOutput)
}
// IdentityProviderMapInput is an input type that accepts IdentityProviderMap and IdentityProviderMapOutput values.
// You can construct a concrete instance of `IdentityProviderMapInput` via:
//
// IdentityProviderMap{ "key": IdentityProviderArgs{...} }
type IdentityProviderMapInput interface {
pulumi.Input
ToIdentityProviderMapOutput() IdentityProviderMapOutput
ToIdentityProviderMapOutputWithContext(context.Context) IdentityProviderMapOutput
}
type IdentityProviderMap map[string]IdentityProviderInput
func (IdentityProviderMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*IdentityProvider)(nil)).Elem()
}
func (i IdentityProviderMap) ToIdentityProviderMapOutput() IdentityProviderMapOutput {
return i.ToIdentityProviderMapOutputWithContext(context.Background())
}
func (i IdentityProviderMap) ToIdentityProviderMapOutputWithContext(ctx context.Context) IdentityProviderMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(IdentityProviderMapOutput)
}
type IdentityProviderOutput struct{ *pulumi.OutputState }
func (IdentityProviderOutput) ElementType() reflect.Type {
return reflect.TypeOf((**IdentityProvider)(nil)).Elem()
}
func (o IdentityProviderOutput) ToIdentityProviderOutput() IdentityProviderOutput {
return o
}
func (o IdentityProviderOutput) ToIdentityProviderOutputWithContext(ctx context.Context) IdentityProviderOutput {
return o
}
type IdentityProviderArrayOutput struct{ *pulumi.OutputState }
func (IdentityProviderArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*IdentityProvider)(nil)).Elem()
}
func (o IdentityProviderArrayOutput) ToIdentityProviderArrayOutput() IdentityProviderArrayOutput {
return o
}
func (o IdentityProviderArrayOutput) ToIdentityProviderArrayOutputWithContext(ctx context.Context) IdentityProviderArrayOutput {
return o
}
func (o IdentityProviderArrayOutput) Index(i pulumi.IntInput) IdentityProviderOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *IdentityProvider {
return vs[0].([]*IdentityProvider)[vs[1].(int)]
}).(IdentityProviderOutput)
}
type IdentityProviderMapOutput struct{ *pulumi.OutputState }
func (IdentityProviderMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*IdentityProvider)(nil)).Elem()
}
func (o IdentityProviderMapOutput) ToIdentityProviderMapOutput() IdentityProviderMapOutput {
return o
}
func (o IdentityProviderMapOutput) ToIdentityProviderMapOutputWithContext(ctx context.Context) IdentityProviderMapOutput {
return o
}
func (o IdentityProviderMapOutput) MapIndex(k pulumi.StringInput) IdentityProviderOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *IdentityProvider {
return vs[0].(map[string]*IdentityProvider)[vs[1].(string)]
}).(IdentityProviderOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*IdentityProviderInput)(nil)).Elem(), &IdentityProvider{})
pulumi.RegisterInputType(reflect.TypeOf((*IdentityProviderArrayInput)(nil)).Elem(), IdentityProviderArray{})
pulumi.RegisterInputType(reflect.TypeOf((*IdentityProviderMapInput)(nil)).Elem(), IdentityProviderMap{})
pulumi.RegisterOutputType(IdentityProviderOutput{})
pulumi.RegisterOutputType(IdentityProviderArrayOutput{})
pulumi.RegisterOutputType(IdentityProviderMapOutput{})
}