AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Represents the response from the server for the request to create a user pool.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceResponse
    Amazon.CognitoIdentityProvider.Model.CreateUserPoolResponse

Namespace: Amazon.CognitoIdentityProvider.Model
Assembly: AWSSDK.CognitoIdentityProvider.dll
Version: 3.x.y.z

Syntax

C#
public class CreateUserPoolResponse : AmazonWebServiceResponse

The CreateUserPoolResponse type exposes the following members

Constructors

NameDescription
Public Method CreateUserPoolResponse()

Properties

NameTypeDescription
Public Property ContentLength System.Int64 Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property HttpStatusCode System.Net.HttpStatusCode Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property ResponseMetadata Amazon.Runtime.ResponseMetadata Inherited from Amazon.Runtime.AmazonWebServiceResponse.
Public Property UserPool Amazon.CognitoIdentityProvider.Model.UserPoolType

Gets and sets the property UserPool.

A container for the user pool details.

Examples

The following example creates a user pool with all configurable properties set to an example value. The resulting user pool allows sign-in with username or email address, has optional MFA, and has a Lambda function assigned to each possible trigger.

Example user pool with email and username sign-in


var client = new AmazonCognitoIdentityProviderClient();
var response = client.CreateUserPool(new CreateUserPoolRequest 
{
    AccountRecoverySetting = new AccountRecoverySettingType { RecoveryMechanisms = new List<RecoveryOptionType> {
        new RecoveryOptionType {
            Name = "verified_email",
            Priority = 1
        }
    } },
    AdminCreateUserConfig = new AdminCreateUserConfigType {
        AllowAdminCreateUserOnly = false,
        InviteMessageTemplate = new MessageTemplateType {
            EmailMessage = "Your username is {username} and temporary password is {####}.",
            EmailSubject = "Your sign-in information",
            SMSMessage = "Your username is {username} and temporary password is {####}."
        }
    },
    AliasAttributes = new List<string> {
        "email"
    },
    AutoVerifiedAttributes = new List<string> {
        "email"
    },
    DeletionProtection = "ACTIVE",
    DeviceConfiguration = new DeviceConfigurationType {
        ChallengeRequiredOnNewDevice = true,
        DeviceOnlyRememberedOnUserPrompt = true
    },
    EmailConfiguration = new EmailConfigurationType {
        ConfigurationSet = "my-test-ses-configuration-set",
        EmailSendingAccount = "DEVELOPER",
        From = "support@example.com",
        ReplyToEmailAddress = "support@example.com",
        SourceArn = "arn:aws:ses:us-east-1:123456789012:identity/support@example.com"
    },
    EmailVerificationMessage = "Your verification code is {####}.",
    EmailVerificationSubject = "Verify your email address",
    LambdaConfig = new LambdaConfigType {
        CustomEmailSender = new CustomEmailLambdaVersionConfigType {
            LambdaArn = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
            LambdaVersion = "V1_0"
        },
        CustomMessage = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
        CustomSMSSender = new CustomSMSLambdaVersionConfigType {
            LambdaArn = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
            LambdaVersion = "V1_0"
        },
        DefineAuthChallenge = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
        KMSKeyID = "arn:aws:kms:us-east-1:123456789012:key/a6c4f8e2-0c45-47db-925f-87854bc9e357",
        PostAuthentication = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
        PostConfirmation = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
        PreAuthentication = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
        PreSignUp = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
        PreTokenGeneration = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
        UserMigration = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction",
        VerifyAuthChallengeResponse = "arn:aws:lambda:us-east-1:123456789012:function:MyFunction"
    },
    MfaConfiguration = "OPTIONAL",
    Policies = new UserPoolPolicyType { PasswordPolicy = new PasswordPolicyType {
        MinimumLength = 6,
        RequireLowercase = true,
        RequireNumbers = true,
        RequireSymbols = true,
        RequireUppercase = true,
        TemporaryPasswordValidityDays = 7
    } },
    PoolName = "my-test-user-pool",
    Schema = new List<SchemaAttributeType> {
        new SchemaAttributeType {
            AttributeDataType = "Number",
            DeveloperOnlyAttribute = true,
            Mutable = true,
            Name = "mydev",
            NumberAttributeConstraints = new NumberAttributeConstraintsType {
                MaxValue = "99",
                MinValue = "1"
            },
            Required = false,
            StringAttributeConstraints = new StringAttributeConstraintsType {
                MaxLength = "99",
                MinLength = "1"
            }
        }
    },
    SmsAuthenticationMessage = "Your verification code is {####}.",
    SmsConfiguration = new SmsConfigurationType {
        ExternalId = "my-role-external-id",
        SnsCallerArn = "arn:aws:iam::123456789012:role/service-role/test-cognito-SMS-Role"
    },
    SmsVerificationMessage = "Your verification code is {####}.",
    UserAttributeUpdateSettings = new UserAttributeUpdateSettingsType { AttributesRequireVerificationBeforeUpdate = new List<string> {
        "email"
    } },
    UserPoolAddOns = new UserPoolAddOnsType { AdvancedSecurityMode = "OFF" },
    UserPoolTags = new Dictionary<string, string> {
        { "my-test-tag-key", "my-test-tag-key" }
    },
    UsernameConfiguration = new UsernameConfigurationType { CaseSensitive = true },
    VerificationMessageTemplate = new VerificationMessageTemplateType {
        DefaultEmailOption = "CONFIRM_WITH_CODE",
        EmailMessage = "Your confirmation code is {####}",
        EmailMessageByLink = "Choose this link to {##verify your email##}",
        EmailSubject = "Here is your confirmation code",
        EmailSubjectByLink = "Here is your confirmation link",
        SmsMessage = "Your confirmation code is {####}"
    }
});

UserPoolType userPool = response.UserPool;

            

Version Information

.NET Core App:
Supported in: 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.5, 4.0, 3.5