github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/cognito/identityProvider.go (about) 1 // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT. 2 // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! *** 3 4 package cognito 5 6 import ( 7 "context" 8 "reflect" 9 10 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a Cognito User Identity Provider resource. 16 // 17 // ## Example Usage 18 // 19 // <!--Start PulumiCodeChooser --> 20 // ```go 21 // package main 22 // 23 // import ( 24 // 25 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/cognito" 26 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 27 // 28 // ) 29 // 30 // func main() { 31 // pulumi.Run(func(ctx *pulumi.Context) error { 32 // example, err := cognito.NewUserPool(ctx, "example", &cognito.UserPoolArgs{ 33 // Name: pulumi.String("example-pool"), 34 // AutoVerifiedAttributes: pulumi.StringArray{ 35 // pulumi.String("email"), 36 // }, 37 // }) 38 // if err != nil { 39 // return err 40 // } 41 // _, err = cognito.NewIdentityProvider(ctx, "example_provider", &cognito.IdentityProviderArgs{ 42 // UserPoolId: example.ID(), 43 // ProviderName: pulumi.String("Google"), 44 // ProviderType: pulumi.String("Google"), 45 // ProviderDetails: pulumi.StringMap{ 46 // "authorize_scopes": pulumi.String("email"), 47 // "client_id": pulumi.String("your client_id"), 48 // "client_secret": pulumi.String("your client_secret"), 49 // }, 50 // AttributeMapping: pulumi.StringMap{ 51 // "email": pulumi.String("email"), 52 // "username": pulumi.String("sub"), 53 // }, 54 // }) 55 // if err != nil { 56 // return err 57 // } 58 // return nil 59 // }) 60 // } 61 // 62 // ``` 63 // <!--End PulumiCodeChooser --> 64 // 65 // ## Import 66 // 67 // Using `pulumi import`, import `aws_cognito_identity_provider` resources using their User Pool ID and Provider Name. For example: 68 // 69 // ```sh 70 // $ pulumi import aws:cognito/identityProvider:IdentityProvider example us-west-2_abc123:CorpAD 71 // ``` 72 type IdentityProvider struct { 73 pulumi.CustomResourceState 74 75 // 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) 76 AttributeMapping pulumi.StringMapOutput `pulumi:"attributeMapping"` 77 // The list of identity providers. 78 IdpIdentifiers pulumi.StringArrayOutput `pulumi:"idpIdentifiers"` 79 // The map of identity details, such as access token 80 ProviderDetails pulumi.StringMapOutput `pulumi:"providerDetails"` 81 // The provider name 82 ProviderName pulumi.StringOutput `pulumi:"providerName"` 83 // 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) 84 ProviderType pulumi.StringOutput `pulumi:"providerType"` 85 // The user pool id 86 UserPoolId pulumi.StringOutput `pulumi:"userPoolId"` 87 } 88 89 // NewIdentityProvider registers a new resource with the given unique name, arguments, and options. 90 func NewIdentityProvider(ctx *pulumi.Context, 91 name string, args *IdentityProviderArgs, opts ...pulumi.ResourceOption) (*IdentityProvider, error) { 92 if args == nil { 93 return nil, errors.New("missing one or more required arguments") 94 } 95 96 if args.ProviderDetails == nil { 97 return nil, errors.New("invalid value for required argument 'ProviderDetails'") 98 } 99 if args.ProviderName == nil { 100 return nil, errors.New("invalid value for required argument 'ProviderName'") 101 } 102 if args.ProviderType == nil { 103 return nil, errors.New("invalid value for required argument 'ProviderType'") 104 } 105 if args.UserPoolId == nil { 106 return nil, errors.New("invalid value for required argument 'UserPoolId'") 107 } 108 opts = internal.PkgResourceDefaultOpts(opts) 109 var resource IdentityProvider 110 err := ctx.RegisterResource("aws:cognito/identityProvider:IdentityProvider", name, args, &resource, opts...) 111 if err != nil { 112 return nil, err 113 } 114 return &resource, nil 115 } 116 117 // GetIdentityProvider gets an existing IdentityProvider resource's state with the given name, ID, and optional 118 // state properties that are used to uniquely qualify the lookup (nil if not required). 119 func GetIdentityProvider(ctx *pulumi.Context, 120 name string, id pulumi.IDInput, state *IdentityProviderState, opts ...pulumi.ResourceOption) (*IdentityProvider, error) { 121 var resource IdentityProvider 122 err := ctx.ReadResource("aws:cognito/identityProvider:IdentityProvider", name, id, state, &resource, opts...) 123 if err != nil { 124 return nil, err 125 } 126 return &resource, nil 127 } 128 129 // Input properties used for looking up and filtering IdentityProvider resources. 130 type identityProviderState struct { 131 // 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) 132 AttributeMapping map[string]string `pulumi:"attributeMapping"` 133 // The list of identity providers. 134 IdpIdentifiers []string `pulumi:"idpIdentifiers"` 135 // The map of identity details, such as access token 136 ProviderDetails map[string]string `pulumi:"providerDetails"` 137 // The provider name 138 ProviderName *string `pulumi:"providerName"` 139 // 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) 140 ProviderType *string `pulumi:"providerType"` 141 // The user pool id 142 UserPoolId *string `pulumi:"userPoolId"` 143 } 144 145 type IdentityProviderState struct { 146 // 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) 147 AttributeMapping pulumi.StringMapInput 148 // The list of identity providers. 149 IdpIdentifiers pulumi.StringArrayInput 150 // The map of identity details, such as access token 151 ProviderDetails pulumi.StringMapInput 152 // The provider name 153 ProviderName pulumi.StringPtrInput 154 // 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) 155 ProviderType pulumi.StringPtrInput 156 // The user pool id 157 UserPoolId pulumi.StringPtrInput 158 } 159 160 func (IdentityProviderState) ElementType() reflect.Type { 161 return reflect.TypeOf((*identityProviderState)(nil)).Elem() 162 } 163 164 type identityProviderArgs struct { 165 // 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) 166 AttributeMapping map[string]string `pulumi:"attributeMapping"` 167 // The list of identity providers. 168 IdpIdentifiers []string `pulumi:"idpIdentifiers"` 169 // The map of identity details, such as access token 170 ProviderDetails map[string]string `pulumi:"providerDetails"` 171 // The provider name 172 ProviderName string `pulumi:"providerName"` 173 // 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) 174 ProviderType string `pulumi:"providerType"` 175 // The user pool id 176 UserPoolId string `pulumi:"userPoolId"` 177 } 178 179 // The set of arguments for constructing a IdentityProvider resource. 180 type IdentityProviderArgs struct { 181 // 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) 182 AttributeMapping pulumi.StringMapInput 183 // The list of identity providers. 184 IdpIdentifiers pulumi.StringArrayInput 185 // The map of identity details, such as access token 186 ProviderDetails pulumi.StringMapInput 187 // The provider name 188 ProviderName pulumi.StringInput 189 // 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) 190 ProviderType pulumi.StringInput 191 // The user pool id 192 UserPoolId pulumi.StringInput 193 } 194 195 func (IdentityProviderArgs) ElementType() reflect.Type { 196 return reflect.TypeOf((*identityProviderArgs)(nil)).Elem() 197 } 198 199 type IdentityProviderInput interface { 200 pulumi.Input 201 202 ToIdentityProviderOutput() IdentityProviderOutput 203 ToIdentityProviderOutputWithContext(ctx context.Context) IdentityProviderOutput 204 } 205 206 func (*IdentityProvider) ElementType() reflect.Type { 207 return reflect.TypeOf((**IdentityProvider)(nil)).Elem() 208 } 209 210 func (i *IdentityProvider) ToIdentityProviderOutput() IdentityProviderOutput { 211 return i.ToIdentityProviderOutputWithContext(context.Background()) 212 } 213 214 func (i *IdentityProvider) ToIdentityProviderOutputWithContext(ctx context.Context) IdentityProviderOutput { 215 return pulumi.ToOutputWithContext(ctx, i).(IdentityProviderOutput) 216 } 217 218 // IdentityProviderArrayInput is an input type that accepts IdentityProviderArray and IdentityProviderArrayOutput values. 219 // You can construct a concrete instance of `IdentityProviderArrayInput` via: 220 // 221 // IdentityProviderArray{ IdentityProviderArgs{...} } 222 type IdentityProviderArrayInput interface { 223 pulumi.Input 224 225 ToIdentityProviderArrayOutput() IdentityProviderArrayOutput 226 ToIdentityProviderArrayOutputWithContext(context.Context) IdentityProviderArrayOutput 227 } 228 229 type IdentityProviderArray []IdentityProviderInput 230 231 func (IdentityProviderArray) ElementType() reflect.Type { 232 return reflect.TypeOf((*[]*IdentityProvider)(nil)).Elem() 233 } 234 235 func (i IdentityProviderArray) ToIdentityProviderArrayOutput() IdentityProviderArrayOutput { 236 return i.ToIdentityProviderArrayOutputWithContext(context.Background()) 237 } 238 239 func (i IdentityProviderArray) ToIdentityProviderArrayOutputWithContext(ctx context.Context) IdentityProviderArrayOutput { 240 return pulumi.ToOutputWithContext(ctx, i).(IdentityProviderArrayOutput) 241 } 242 243 // IdentityProviderMapInput is an input type that accepts IdentityProviderMap and IdentityProviderMapOutput values. 244 // You can construct a concrete instance of `IdentityProviderMapInput` via: 245 // 246 // IdentityProviderMap{ "key": IdentityProviderArgs{...} } 247 type IdentityProviderMapInput interface { 248 pulumi.Input 249 250 ToIdentityProviderMapOutput() IdentityProviderMapOutput 251 ToIdentityProviderMapOutputWithContext(context.Context) IdentityProviderMapOutput 252 } 253 254 type IdentityProviderMap map[string]IdentityProviderInput 255 256 func (IdentityProviderMap) ElementType() reflect.Type { 257 return reflect.TypeOf((*map[string]*IdentityProvider)(nil)).Elem() 258 } 259 260 func (i IdentityProviderMap) ToIdentityProviderMapOutput() IdentityProviderMapOutput { 261 return i.ToIdentityProviderMapOutputWithContext(context.Background()) 262 } 263 264 func (i IdentityProviderMap) ToIdentityProviderMapOutputWithContext(ctx context.Context) IdentityProviderMapOutput { 265 return pulumi.ToOutputWithContext(ctx, i).(IdentityProviderMapOutput) 266 } 267 268 type IdentityProviderOutput struct{ *pulumi.OutputState } 269 270 func (IdentityProviderOutput) ElementType() reflect.Type { 271 return reflect.TypeOf((**IdentityProvider)(nil)).Elem() 272 } 273 274 func (o IdentityProviderOutput) ToIdentityProviderOutput() IdentityProviderOutput { 275 return o 276 } 277 278 func (o IdentityProviderOutput) ToIdentityProviderOutputWithContext(ctx context.Context) IdentityProviderOutput { 279 return o 280 } 281 282 // 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) 283 func (o IdentityProviderOutput) AttributeMapping() pulumi.StringMapOutput { 284 return o.ApplyT(func(v *IdentityProvider) pulumi.StringMapOutput { return v.AttributeMapping }).(pulumi.StringMapOutput) 285 } 286 287 // The list of identity providers. 288 func (o IdentityProviderOutput) IdpIdentifiers() pulumi.StringArrayOutput { 289 return o.ApplyT(func(v *IdentityProvider) pulumi.StringArrayOutput { return v.IdpIdentifiers }).(pulumi.StringArrayOutput) 290 } 291 292 // The map of identity details, such as access token 293 func (o IdentityProviderOutput) ProviderDetails() pulumi.StringMapOutput { 294 return o.ApplyT(func(v *IdentityProvider) pulumi.StringMapOutput { return v.ProviderDetails }).(pulumi.StringMapOutput) 295 } 296 297 // The provider name 298 func (o IdentityProviderOutput) ProviderName() pulumi.StringOutput { 299 return o.ApplyT(func(v *IdentityProvider) pulumi.StringOutput { return v.ProviderName }).(pulumi.StringOutput) 300 } 301 302 // 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) 303 func (o IdentityProviderOutput) ProviderType() pulumi.StringOutput { 304 return o.ApplyT(func(v *IdentityProvider) pulumi.StringOutput { return v.ProviderType }).(pulumi.StringOutput) 305 } 306 307 // The user pool id 308 func (o IdentityProviderOutput) UserPoolId() pulumi.StringOutput { 309 return o.ApplyT(func(v *IdentityProvider) pulumi.StringOutput { return v.UserPoolId }).(pulumi.StringOutput) 310 } 311 312 type IdentityProviderArrayOutput struct{ *pulumi.OutputState } 313 314 func (IdentityProviderArrayOutput) ElementType() reflect.Type { 315 return reflect.TypeOf((*[]*IdentityProvider)(nil)).Elem() 316 } 317 318 func (o IdentityProviderArrayOutput) ToIdentityProviderArrayOutput() IdentityProviderArrayOutput { 319 return o 320 } 321 322 func (o IdentityProviderArrayOutput) ToIdentityProviderArrayOutputWithContext(ctx context.Context) IdentityProviderArrayOutput { 323 return o 324 } 325 326 func (o IdentityProviderArrayOutput) Index(i pulumi.IntInput) IdentityProviderOutput { 327 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *IdentityProvider { 328 return vs[0].([]*IdentityProvider)[vs[1].(int)] 329 }).(IdentityProviderOutput) 330 } 331 332 type IdentityProviderMapOutput struct{ *pulumi.OutputState } 333 334 func (IdentityProviderMapOutput) ElementType() reflect.Type { 335 return reflect.TypeOf((*map[string]*IdentityProvider)(nil)).Elem() 336 } 337 338 func (o IdentityProviderMapOutput) ToIdentityProviderMapOutput() IdentityProviderMapOutput { 339 return o 340 } 341 342 func (o IdentityProviderMapOutput) ToIdentityProviderMapOutputWithContext(ctx context.Context) IdentityProviderMapOutput { 343 return o 344 } 345 346 func (o IdentityProviderMapOutput) MapIndex(k pulumi.StringInput) IdentityProviderOutput { 347 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *IdentityProvider { 348 return vs[0].(map[string]*IdentityProvider)[vs[1].(string)] 349 }).(IdentityProviderOutput) 350 } 351 352 func init() { 353 pulumi.RegisterInputType(reflect.TypeOf((*IdentityProviderInput)(nil)).Elem(), &IdentityProvider{}) 354 pulumi.RegisterInputType(reflect.TypeOf((*IdentityProviderArrayInput)(nil)).Elem(), IdentityProviderArray{}) 355 pulumi.RegisterInputType(reflect.TypeOf((*IdentityProviderMapInput)(nil)).Elem(), IdentityProviderMap{}) 356 pulumi.RegisterOutputType(IdentityProviderOutput{}) 357 pulumi.RegisterOutputType(IdentityProviderArrayOutput{}) 358 pulumi.RegisterOutputType(IdentityProviderMapOutput{}) 359 }