1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package cognitoidentity
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/aws-sdk-go-v2/service/cognitoidentity/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates a new identity pool. The identity pool is a store of user identity
15// information that is specific to your AWS account. The keys for
16// SupportedLoginProviders are as follows:
17//
18// * Facebook: graph.facebook.com
19//
20// *
21// Google: accounts.google.com
22//
23// * Amazon: www.amazon.com
24//
25// * Twitter:
26// api.twitter.com
27//
28// * Digits: www.digits.com
29//
30// You must use AWS Developer
31// credentials to call this API.
32func (c *Client) CreateIdentityPool(ctx context.Context, params *CreateIdentityPoolInput, optFns ...func(*Options)) (*CreateIdentityPoolOutput, error) {
33	if params == nil {
34		params = &CreateIdentityPoolInput{}
35	}
36
37	result, metadata, err := c.invokeOperation(ctx, "CreateIdentityPool", params, optFns, addOperationCreateIdentityPoolMiddlewares)
38	if err != nil {
39		return nil, err
40	}
41
42	out := result.(*CreateIdentityPoolOutput)
43	out.ResultMetadata = metadata
44	return out, nil
45}
46
47// Input to the CreateIdentityPool action.
48type CreateIdentityPoolInput struct {
49
50	// TRUE if the identity pool supports unauthenticated logins.
51	//
52	// This member is required.
53	AllowUnauthenticatedIdentities bool
54
55	// A string that you provide.
56	//
57	// This member is required.
58	IdentityPoolName *string
59
60	// Enables or disables the Basic (Classic) authentication flow. For more
61	// information, see Identity Pools (Federated Identities) Authentication Flow
62	// (https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html)
63	// in the Amazon Cognito Developer Guide.
64	AllowClassicFlow *bool
65
66	// An array of Amazon Cognito user pools and their client IDs.
67	CognitoIdentityProviders []types.CognitoIdentityProvider
68
69	// The "domain" by which Cognito will refer to your users. This name acts as a
70	// placeholder that allows your backend and the Cognito service to communicate
71	// about the developer provider. For the DeveloperProviderName, you can use letters
72	// as well as period (.), underscore (_), and dash (-). Once you have set a
73	// developer provider name, you cannot change it. Please take care in setting this
74	// parameter.
75	DeveloperProviderName *string
76
77	// Tags to assign to the identity pool. A tag is a label that you can apply to
78	// identity pools to categorize and manage them in different ways, such as by
79	// purpose, owner, environment, or other criteria.
80	IdentityPoolTags map[string]string
81
82	// The Amazon Resource Names (ARN) of the OpenID Connect providers.
83	OpenIdConnectProviderARNs []string
84
85	// An array of Amazon Resource Names (ARNs) of the SAML provider for your identity
86	// pool.
87	SamlProviderARNs []string
88
89	// Optional key:value pairs mapping provider names to provider app IDs.
90	SupportedLoginProviders map[string]string
91}
92
93// An object representing an Amazon Cognito identity pool.
94type CreateIdentityPoolOutput struct {
95
96	// TRUE if the identity pool supports unauthenticated logins.
97	//
98	// This member is required.
99	AllowUnauthenticatedIdentities bool
100
101	// An identity pool ID in the format REGION:GUID.
102	//
103	// This member is required.
104	IdentityPoolId *string
105
106	// A string that you provide.
107	//
108	// This member is required.
109	IdentityPoolName *string
110
111	// Enables or disables the Basic (Classic) authentication flow. For more
112	// information, see Identity Pools (Federated Identities) Authentication Flow
113	// (https://docs.aws.amazon.com/cognito/latest/developerguide/authentication-flow.html)
114	// in the Amazon Cognito Developer Guide.
115	AllowClassicFlow *bool
116
117	// A list representing an Amazon Cognito user pool and its client ID.
118	CognitoIdentityProviders []types.CognitoIdentityProvider
119
120	// The "domain" by which Cognito will refer to your users.
121	DeveloperProviderName *string
122
123	// The tags that are assigned to the identity pool. A tag is a label that you can
124	// apply to identity pools to categorize and manage them in different ways, such as
125	// by purpose, owner, environment, or other criteria.
126	IdentityPoolTags map[string]string
127
128	// The ARNs of the OpenID Connect providers.
129	OpenIdConnectProviderARNs []string
130
131	// An array of Amazon Resource Names (ARNs) of the SAML provider for your identity
132	// pool.
133	SamlProviderARNs []string
134
135	// Optional key:value pairs mapping provider names to provider app IDs.
136	SupportedLoginProviders map[string]string
137
138	// Metadata pertaining to the operation's result.
139	ResultMetadata middleware.Metadata
140}
141
142func addOperationCreateIdentityPoolMiddlewares(stack *middleware.Stack, options Options) (err error) {
143	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateIdentityPool{}, middleware.After)
144	if err != nil {
145		return err
146	}
147	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateIdentityPool{}, middleware.After)
148	if err != nil {
149		return err
150	}
151	if err = addSetLoggerMiddleware(stack, options); err != nil {
152		return err
153	}
154	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
155		return err
156	}
157	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
158		return err
159	}
160	if err = addResolveEndpointMiddleware(stack, options); err != nil {
161		return err
162	}
163	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
164		return err
165	}
166	if err = addRetryMiddlewares(stack, options); err != nil {
167		return err
168	}
169	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
170		return err
171	}
172	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
173		return err
174	}
175	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
176		return err
177	}
178	if err = addClientUserAgent(stack); err != nil {
179		return err
180	}
181	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
182		return err
183	}
184	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
185		return err
186	}
187	if err = addOpCreateIdentityPoolValidationMiddleware(stack); err != nil {
188		return err
189	}
190	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateIdentityPool(options.Region), middleware.Before); err != nil {
191		return err
192	}
193	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
194		return err
195	}
196	if err = addResponseErrorMiddleware(stack); err != nil {
197		return err
198	}
199	if err = addRequestResponseLogging(stack, options); err != nil {
200		return err
201	}
202	return nil
203}
204
205func newServiceMetadataMiddleware_opCreateIdentityPool(region string) *awsmiddleware.RegisterServiceMetadata {
206	return &awsmiddleware.RegisterServiceMetadata{
207		Region:        region,
208		ServiceID:     ServiceID,
209		SigningName:   "cognito-identity",
210		OperationName: "CreateIdentityPool",
211	}
212}
213