Skip to content

admin_create_user

admin_create_user(
    user_pool_id: UserPoolIdType,
    username: UsernameType,
    *,
    config_overrides: Optional[CognitoIdentityProviderClientConfig] = None,
    user_attributes: Optional[AttributeListType] = None,
    validation_data: Optional[AttributeListType] = None,
    temporary_password: Optional[PasswordType] = None,
    force_alias_creation: Optional[ForceAliasCreation] = None,
    message_action: Optional[MessageActionType] = None,
    desired_delivery_mediums: Optional[DeliveryMediumListType] = None,
    client_metadata: Optional[ClientMetadataType] = None,
) -> AdminCreateUserResponse

Creates a new user in the specified user pool.

If MessageAction isn't set, the default is to send a welcome message via email or phone (SMS).

This message is based on a template that you configured in your call to create or update a user pool. This template includes your custom sign-up instructions and placeholders for user name and temporary password.

Alternatively, you can call AdminCreateUser with SUPPRESS for the MessageAction parameter, and Amazon Cognito won't send any email.

In either case, if the user has a password, they will be in the FORCE_CHANGE_PASSWORD state until they sign in and set their password. Your invitation message template must have the {####} password placeholder if your users have passwords. If your template doesn't have this placeholder, Amazon Cognito doesn't deliver the invitation message. In this case, you must update your message template and resend the password with a new AdminCreateUser request with a MessageAction value of RESEND.

This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with Amazon Pinpoint. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.

If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In sandbox mode , you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see SMS message settings for Amazon Cognito user pools in the Amazon Cognito Developer Guide.

Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Parameters:

  • user_pool_id (UserPoolIdType) –

    The ID of the user pool where you want to create a user.

  • username (UsernameType) –

    The value that you want to set as the username sign-in attribute. The following conditions apply to the username parameter.

    • The username can't be a duplicate of another username in the same user pool.

    • You can't change the value of a username after you create it.

    • You can only provide a value if usernames are a valid sign-in attribute for your user pool. If your user pool only supports phone numbers or email addresses as sign-in attributes, Amazon Cognito automatically generates a username value. For more information, see Customizing sign-in attributes.

  • user_attributes (Optional[AttributeListType], default: None ) –

    An array of name-value pairs that contain user attributes and attribute values to be set for the user to be created. You can create a user without specifying any attributes other than Username. However, any attributes that you specify as required (when creating a user pool or in the Attributes tab of the console) either you should supply (in your call to AdminCreateUser) or the user should supply (when they sign up in response to your welcome message).

    For custom attributes, you must prepend the custom: prefix to the attribute name.

    To send a message inviting the user to sign up, you must specify the user's email address or phone number. You can do this in your call to AdminCreateUser or in the Users tab of the Amazon Cognito console for managing your user pools.

    You must also provide an email address or phone number when you expect the user to do passwordless sign-in with an email or SMS OTP. These attributes must be provided when passwordless options are the only available, or when you don't submit a TemporaryPassword.

    In your AdminCreateUser request, you can set the email_verified and phone_number_verified attributes to true. The following conditions apply:

    email

    The email address where you want the user to receive their confirmation code and username. You must provide a value for email when you want to set email_verified to true, or if you set EMAIL in the DesiredDeliveryMediums parameter.

    phone_number

    The phone number where you want the user to receive their confirmation code and username. You must provide a value for phone_number when you want to set phone_number_verified to true, or if you set SMS in the DesiredDeliveryMediums parameter.

  • validation_data (Optional[AttributeListType], default: None ) –

    Temporary user attributes that contribute to the outcomes of your pre sign-up Lambda trigger. This set of key-value pairs are for custom validation of information that you collect from your users but don't need to retain.

    Your Lambda function can analyze this additional data and act on it. Your function can automatically confirm and verify select users or perform external API operations like logging user attributes and validation data to Amazon CloudWatch Logs.

    For more information about the pre sign-up Lambda trigger, see Pre sign-up Lambda trigger.

  • temporary_password (Optional[PasswordType], default: None ) –

    The user's temporary password. This password must conform to the password policy that you specified when you created the user pool.

    The exception to the requirement for a password is when your user pool supports passwordless sign-in with email or SMS OTPs. To create a user with no password, omit this parameter or submit a blank value. You can only create a passwordless user when passwordless sign-in is available.

    The temporary password is valid only once. To complete the Admin Create User flow, the user must enter the temporary password in the sign-in page, along with a new password to be used in all future sign-ins.

    If you don't specify a value, Amazon Cognito generates one for you unless you have passwordless options active for your user pool.

    The temporary password can only be used until the user account expiration limit that you set for your user pool. To reset the account after that time limit, you must call AdminCreateUser again and specify RESEND for the MessageAction parameter.

  • force_alias_creation (Optional[ForceAliasCreation], default: None ) –

    This parameter is used only if the phone_number_verified or email_verified attribute is set to True. Otherwise, it is ignored.

    If this parameter is set to True and the phone number or email address specified in the UserAttributes parameter already exists as an alias with a different user, this request migrates the alias from the previous user to the newly-created user. The previous user will no longer be able to log in using that alias.

    If this parameter is set to False, the API throws an AliasExistsException error if the alias already exists. The default value is False.

  • message_action (Optional[MessageActionType], default: None ) –

    Set to RESEND to resend the invitation message to a user that already exists, and to reset the temporary-password duration with a new temporary password. Set to SUPPRESS to suppress sending the message. You can specify only one value.

  • desired_delivery_mediums (Optional[DeliveryMediumListType], default: None ) –

    Specify EMAIL if email will be used to send the welcome message. Specify SMS if the phone number will be used. The default value is SMS. You can specify more than one value.

  • client_metadata (Optional[ClientMetadataType], default: None ) –

    A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers. You create custom workflows by assigning Lambda functions to user pool triggers.

    When Amazon Cognito invokes any of these functions, it passes a JSON payload, which the function receives as input. This payload contains a clientMetadata attribute that provides the data that you assigned to the ClientMetadata parameter in your request. In your function code, you can process the clientMetadata value to enhance your workflow for your specific needs.

    To review the Lambda trigger types that Amazon Cognito invokes at runtime with API requests, see Connecting API actions to Lambda triggers in the Amazon Cognito Developer Guide.

    When you use the ClientMetadata parameter, note that Amazon Cognito won't do the following:

    • Store the ClientMetadata value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the ClientMetadata parameter serves no purpose.

    • Validate the ClientMetadata value.

    • Encrypt the ClientMetadata value. Don't send sensitive information in this parameter.

Raises:

  • CodeDeliveryFailureException –

    This exception is thrown when a verification code fails to deliver successfully.

  • InternalErrorException –

    This exception is thrown when Amazon Cognito encounters an internal error.

  • InvalidLambdaResponseException –

    This exception is thrown when Amazon Cognito encounters an invalid Lambda response.

  • InvalidParameterException –

    This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

  • InvalidPasswordException –

    This exception is thrown when Amazon Cognito encounters an invalid password.

  • InvalidSmsRoleAccessPolicyException –

    This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.

  • InvalidSmsRoleTrustRelationshipException –

    This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust cognito-idp.amazonaws.com or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.

  • NotAuthorizedException –

    This exception is thrown when a user isn't authorized.

  • OperationNotEnabledException –

    This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.

  • PreconditionNotMetException –

    This exception is thrown when a precondition is not met.

  • ResourceNotFoundException –

    This exception is thrown when the Amazon Cognito service can't find the requested resource.

  • TooManyRequestsException –

    This exception is thrown when the user has made too many requests for a given operation.

  • UnexpectedLambdaException –

    This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.

  • UnsupportedUserStateException –

    The request failed because the user is in an unsupported state.

  • UserLambdaValidationException –

    This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.

  • UsernameExistsException –

    This exception is thrown when Amazon Cognito encounters a user name that already exists in the user pool.

  • UserNotFoundException –

    This exception is thrown when a user isn't found.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

An AdminCreateUser request for for a test user named John. This request submits a value for all possible parameters for AdminCreateUser.

>>> client.admin_create_user(user_pool_id='us-east-1_EXAMPLE', username='testuser', desired_delivery_mediums=['SMS'], message_action='SUPPRESS', temporary_password='This-is-my-test-99!', user_attributes=[{'Name': 'name', 'Value': 'John'}, {'Name': 'phone_number', 'Value': '+12065551212'}, {'Name': 'email', 'Value': '[email protected]'}])
Source code in docs_src/capo_cognito_identity_provider/_services/cognito_identity_provider.py
def admin_create_user(
    self,
    user_pool_id: "capo_cognito_identity_provider.types.user_pool_id_type.UserPoolIdType",
    username: "capo_cognito_identity_provider.types.username_type.UsernameType",
    *,
    config_overrides: Optional[CognitoIdentityProviderClientConfig] = None,
    user_attributes: Optional[
        "capo_cognito_identity_provider.types.attribute_list_type.AttributeListType"
    ] = None,
    validation_data: Optional[
        "capo_cognito_identity_provider.types.attribute_list_type.AttributeListType"
    ] = None,
    temporary_password: Optional[
        "capo_cognito_identity_provider.types.password_type.PasswordType"
    ] = None,
    force_alias_creation: Optional[
        "capo_cognito_identity_provider.types.force_alias_creation.ForceAliasCreation"
    ] = None,
    message_action: Optional[
        "capo_cognito_identity_provider.types.message_action_type.MessageActionType"
    ] = None,
    desired_delivery_mediums: Optional[
        "capo_cognito_identity_provider.types.delivery_medium_list_type.DeliveryMediumListType"
    ] = None,
    client_metadata: Optional[
        "capo_cognito_identity_provider.types.client_metadata_type.ClientMetadataType"
    ] = None,
) -> "capo_cognito_identity_provider.types.admin_create_user_response.AdminCreateUserResponse":
    """<p>Creates a new user in the specified user pool.</p> <p>If <code>MessageAction</code> isn't set, the default is to send a welcome message via email or phone (SMS).</p> <p>This message is based on a template that you configured in your call to create or update a user pool. This template includes your custom sign-up instructions and placeholders for user name and temporary password.</p> <p>Alternatively, you can call <code>AdminCreateUser</code> with <code>SUPPRESS</code> for the <code>MessageAction</code> parameter, and Amazon Cognito won't send any email. </p> <p>In either case, if the user has a password, they will be in the <code>FORCE_CHANGE_PASSWORD</code> state until they sign in and set their password. Your invitation message template must have the <code>{####}</code> password placeholder if your users have passwords. If your template doesn't have this placeholder, Amazon Cognito doesn't deliver the invitation message. In this case, you must update your message template and resend the password with a new <code>AdminCreateUser</code> request with a <code>MessageAction</code> value of <code>RESEND</code>.</p> <note> <p>This action might generate an SMS text message. Starting June 1, 2021, US telecom carriers require you to register an origination phone number before you can send SMS messages to US phone numbers. If you use SMS text messages in Amazon Cognito, you must register a phone number with <a href="https://console.aws.amazon.com/pinpoint/home/">Amazon Pinpoint</a>. Amazon Cognito uses the registered number automatically. Otherwise, Amazon Cognito users who must receive SMS messages might not be able to sign up, activate their accounts, or sign in.</p> <p>If you have never used SMS text messages with Amazon Cognito or any other Amazon Web Services service, Amazon Simple Notification Service might place your account in the SMS sandbox. In <i> <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-sms-sandbox.html">sandbox mode</a> </i>, you can send messages only to verified phone numbers. After you test your app while in the sandbox environment, you can move out of the sandbox and into production. For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-sms-settings.html"> SMS message settings for Amazon Cognito user pools</a> in the <i>Amazon Cognito Developer Guide</i>.</p> </note> <note> <p>Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.</p> <p class="title"> <b>Learn more</b> </p> <ul> <li> <p> <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-signing.html">Signing Amazon Web Services API Requests</a> </p> </li> <li> <p> <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pools-API-operations.html">Using the Amazon Cognito user pools API and user pool endpoints</a> </p> </li> </ul> </note>

    Args:
        user_pool_id: <p>The ID of the user pool where you want to create a user.</p>
        username: <p>The value that you want to set as the username sign-in attribute. The following conditions apply to the username parameter.</p> <ul> <li> <p>The username can't be a duplicate of another username in the same user pool.</p> </li> <li> <p>You can't change the value of a username after you create it.</p> </li> <li> <p>You can only provide a value if usernames are a valid sign-in attribute for your user pool. If your user pool only supports phone numbers or email addresses as sign-in attributes, Amazon Cognito automatically generates a username value. For more information, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-aliases">Customizing sign-in attributes</a>.</p> </li> </ul>
        user_attributes: <p>An array of name-value pairs that contain user attributes and attribute values to be set for the user to be created. You can create a user without specifying any attributes other than <code>Username</code>. However, any attributes that you specify as required (when creating a user pool or in the <b>Attributes</b> tab of the console) either you should supply (in your call to <code>AdminCreateUser</code>) or the user should supply (when they sign up in response to your welcome message).</p> <p>For custom attributes, you must prepend the <code>custom:</code> prefix to the attribute name.</p> <p>To send a message inviting the user to sign up, you must specify the user's email address or phone number. You can do this in your call to AdminCreateUser or in the <b>Users</b> tab of the Amazon Cognito console for managing your user pools.</p> <p>You must also provide an email address or phone number when you expect the user to do passwordless sign-in with an email or SMS OTP. These attributes must be provided when passwordless options are the only available, or when you don't submit a <code>TemporaryPassword</code>.</p> <p>In your <code>AdminCreateUser</code> request, you can set the <code>email_verified</code> and <code>phone_number_verified</code> attributes to <code>true</code>. The following conditions apply:</p> <dl> <dt>email</dt> <dd> <p>The email address where you want the user to receive their confirmation code and username. You must provide a value for <code>email</code> when you want to set <code>email_verified</code> to <code>true</code>, or if you set <code>EMAIL</code> in the <code>DesiredDeliveryMediums</code> parameter.</p> </dd> <dt>phone_number</dt> <dd> <p>The phone number where you want the user to receive their confirmation code and username. You must provide a value for <code>phone_number</code> when you want to set <code>phone_number_verified</code> to <code>true</code>, or if you set <code>SMS</code> in the <code>DesiredDeliveryMediums</code> parameter.</p> </dd> </dl>
        validation_data: <p>Temporary user attributes that contribute to the outcomes of your pre sign-up Lambda trigger. This set of key-value pairs are for custom validation of information that you collect from your users but don't need to retain.</p> <p>Your Lambda function can analyze this additional data and act on it. Your function can automatically confirm and verify select users or perform external API operations like logging user attributes and validation data to Amazon CloudWatch Logs.</p> <p>For more information about the pre sign-up Lambda trigger, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-pre-sign-up.html">Pre sign-up Lambda trigger</a>.</p>
        temporary_password: <p>The user's temporary password. This password must conform to the password policy that you specified when you created the user pool.</p> <p>The exception to the requirement for a password is when your user pool supports passwordless sign-in with email or SMS OTPs. To create a user with no password, omit this parameter or submit a blank value. You can only create a passwordless user when passwordless sign-in is available.</p> <p>The temporary password is valid only once. To complete the Admin Create User flow, the user must enter the temporary password in the sign-in page, along with a new password to be used in all future sign-ins.</p> <p>If you don't specify a value, Amazon Cognito generates one for you unless you have passwordless options active for your user pool.</p> <p>The temporary password can only be used until the user account expiration limit that you set for your user pool. To reset the account after that time limit, you must call <code>AdminCreateUser</code> again and specify <code>RESEND</code> for the <code>MessageAction</code> parameter.</p>
        force_alias_creation: <p>This parameter is used only if the <code>phone_number_verified</code> or <code>email_verified</code> attribute is set to <code>True</code>. Otherwise, it is ignored.</p> <p>If this parameter is set to <code>True</code> and the phone number or email address specified in the <code>UserAttributes</code> parameter already exists as an alias with a different user, this request migrates the alias from the previous user to the newly-created user. The previous user will no longer be able to log in using that alias.</p> <p>If this parameter is set to <code>False</code>, the API throws an <code>AliasExistsException</code> error if the alias already exists. The default value is <code>False</code>.</p>
        message_action: <p>Set to <code>RESEND</code> to resend the invitation message to a user that already exists, and to reset the temporary-password duration with a new temporary password. Set to <code>SUPPRESS</code> to suppress sending the message. You can specify only one value.</p>
        desired_delivery_mediums: <p>Specify <code>EMAIL</code> if email will be used to send the welcome message. Specify <code>SMS</code> if the phone number will be used. The default value is <code>SMS</code>. You can specify more than one value.</p>
        client_metadata: <p>A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers. You create custom workflows by assigning Lambda functions to user pool triggers.</p> <p>When Amazon Cognito invokes any of these functions, it passes a JSON payload, which the function receives as input. This payload contains a <code>clientMetadata</code> attribute that provides the data that you assigned to the ClientMetadata parameter in your request. In your function code, you can process the <code>clientMetadata</code> value to enhance your workflow for your specific needs.</p> <p>To review the Lambda trigger types that Amazon Cognito invokes at runtime with API requests, see <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-working-with-lambda-triggers.html#lambda-triggers-by-event"> Connecting API actions to Lambda triggers</a> in the <i>Amazon Cognito Developer Guide</i>.</p> <note> <p>When you use the <code>ClientMetadata</code> parameter, note that Amazon Cognito won't do the following:</p> <ul> <li> <p>Store the <code>ClientMetadata</code> value. This data is available only to Lambda triggers that are assigned to a user pool to support custom workflows. If your user pool configuration doesn't include triggers, the <code>ClientMetadata</code> parameter serves no purpose.</p> </li> <li> <p>Validate the <code>ClientMetadata</code> value.</p> </li> <li> <p>Encrypt the <code>ClientMetadata</code> value. Don't send sensitive information in this parameter.</p> </li> </ul> </note>

    Raises:
        capo_cognito_identity_provider.errors.code_delivery_failure_exception.CodeDeliveryFailureException: <p>This exception is thrown when a verification code fails to deliver successfully.</p>
        capo_cognito_identity_provider.errors.internal_error_exception.InternalErrorException: <p>This exception is thrown when Amazon Cognito encounters an internal error.</p>
        capo_cognito_identity_provider.errors.invalid_lambda_response_exception.InvalidLambdaResponseException: <p>This exception is thrown when Amazon Cognito encounters an invalid Lambda response.</p>
        capo_cognito_identity_provider.errors.invalid_parameter_exception.InvalidParameterException: <p>This exception is thrown when the Amazon Cognito service encounters an invalid parameter.</p>
        capo_cognito_identity_provider.errors.invalid_password_exception.InvalidPasswordException: <p>This exception is thrown when Amazon Cognito encounters an invalid password.</p>
        capo_cognito_identity_provider.errors.invalid_sms_role_access_policy_exception.InvalidSmsRoleAccessPolicyException: <p>This exception is returned when the role provided for SMS configuration doesn't have permission to publish using Amazon SNS.</p>
        capo_cognito_identity_provider.errors.invalid_sms_role_trust_relationship_exception.InvalidSmsRoleTrustRelationshipException: <p>This exception is thrown when the trust relationship is not valid for the role provided for SMS configuration. This can happen if you don't trust <code>cognito-idp.amazonaws.com</code> or the external ID provided in the role does not match what is provided in the SMS configuration for the user pool.</p>
        capo_cognito_identity_provider.errors.not_authorized_exception.NotAuthorizedException: <p>This exception is thrown when a user isn't authorized.</p>
        capo_cognito_identity_provider.errors.operation_not_enabled_exception.OperationNotEnabledException: <p>This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.</p>
        capo_cognito_identity_provider.errors.precondition_not_met_exception.PreconditionNotMetException: <p>This exception is thrown when a precondition is not met.</p>
        capo_cognito_identity_provider.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when the Amazon Cognito service can't find the requested resource.</p>
        capo_cognito_identity_provider.errors.too_many_requests_exception.TooManyRequestsException: <p>This exception is thrown when the user has made too many requests for a given operation.</p>
        capo_cognito_identity_provider.errors.unexpected_lambda_exception.UnexpectedLambdaException: <p>This exception is thrown when Amazon Cognito encounters an unexpected exception with Lambda.</p>
        capo_cognito_identity_provider.errors.unsupported_user_state_exception.UnsupportedUserStateException: <p>The request failed because the user is in an unsupported state.</p>
        capo_cognito_identity_provider.errors.user_lambda_validation_exception.UserLambdaValidationException: <p>This exception is thrown when the Amazon Cognito service encounters a user validation exception with the Lambda service.</p>
        capo_cognito_identity_provider.errors.username_exists_exception.UsernameExistsException: <p>This exception is thrown when Amazon Cognito encounters a user name that already exists in the user pool.</p>
        capo_cognito_identity_provider.errors.user_not_found_exception.UserNotFoundException: <p>This exception is thrown when a user isn't found.</p>
        capo_cognito_identity_provider.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        An AdminCreateUser request for for a test user named John.
        This request submits a value for all possible parameters for AdminCreateUser.

        >>> client.admin_create_user(user_pool_id='us-east-1_EXAMPLE', username='testuser', desired_delivery_mediums=['SMS'], message_action='SUPPRESS', temporary_password='This-is-my-test-99!', user_attributes=[{'Name': 'name', 'Value': 'John'}, {'Name': 'phone_number', 'Value': '+12065551212'}, {'Name': 'email', 'Value': '[email protected]'}])
    """

    def _handler(
        req: "OperationRequest[capo_cognito_identity_provider.types.admin_create_user_request.AdminCreateUserRequest]",
    ) -> OperationResponse[
        "capo_cognito_identity_provider.types.admin_create_user_response.AdminCreateUserResponse"
    ]:
        import capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.admin_create_user

        output, http_response = (
            capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.admin_create_user.admin_create_user(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_cognito_identity_provider.types.admin_create_user_request.AdminCreateUserRequest",
    ) -> dict[str, Any]:
        import capo_cognito_identity_provider.types.admin_create_user_request

        return capo_cognito_identity_provider.types.admin_create_user_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_cognito_identity_provider.types.admin_create_user_response.AdminCreateUserResponse",
    ) -> dict[str, Any]:
        import capo_cognito_identity_provider.types.admin_create_user_response

        return capo_cognito_identity_provider.types.admin_create_user_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "AdminCreateUser",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_cognito_identity_provider.types.admin_create_user_request.AdminCreateUserRequest = {
        "user_pool_id": user_pool_id,
        "username": username,
    }
    if user_attributes is not None:
        input_["user_attributes"] = user_attributes
    if validation_data is not None:
        input_["validation_data"] = validation_data
    if temporary_password is not None:
        input_["temporary_password"] = temporary_password
    if force_alias_creation is not None:
        input_["force_alias_creation"] = force_alias_creation
    if message_action is not None:
        input_["message_action"] = message_action
    if desired_delivery_mediums is not None:
        input_["desired_delivery_mediums"] = desired_delivery_mediums
    if client_metadata is not None:
        input_["client_metadata"] = client_metadata

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output