Skip to content

create_user

create_user(
    *,
    config_overrides: Optional[AppStreamClientConfig] = None,
    user_name: Optional[Username] = None,
    message_action: Optional[MessageAction] = None,
    first_name: Optional[UserAttributeValue] = None,
    last_name: Optional[UserAttributeValue] = None,
    authentication_type: Optional[AuthenticationType] = None,
) -> CreateUserResult

Creates a new user in the user pool.

Parameters:

  • user_name (Optional[Username], default: None ) –

    The email address of the user.

    Users' email addresses are case-sensitive. During login, if they specify an email address that doesn't use the same capitalization as the email address specified when their user pool account was created, a "user does not exist" error message displays.

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

    The action to take for the welcome email that is sent to a user after the user is created in the user pool. If you specify SUPPRESS, no email is sent. If you specify RESEND, do not specify the first name or last name of the user. If the value is null, the email is sent.

    The temporary password in the welcome email is valid for only 7 days. If users don’t set their passwords within 7 days, you must send them a new welcome email.

  • first_name (Optional[UserAttributeValue], default: None ) –

    The first name, or given name, of the user.

  • last_name (Optional[UserAttributeValue], default: None ) –

    The last name, or surname, of the user.

  • authentication_type (Optional[AuthenticationType], default: None ) –

    The authentication type for the user. You must specify USERPOOL.

Raises:

Source code in docs_src/capo_appstream/_services/app_stream.py
def create_user(
    self,
    *,
    config_overrides: Optional[AppStreamClientConfig] = None,
    user_name: Optional["capo_appstream.types.username.Username"] = None,
    message_action: Optional[
        "capo_appstream.types.message_action.MessageAction"
    ] = None,
    first_name: Optional[
        "capo_appstream.types.user_attribute_value.UserAttributeValue"
    ] = None,
    last_name: Optional[
        "capo_appstream.types.user_attribute_value.UserAttributeValue"
    ] = None,
    authentication_type: Optional[
        "capo_appstream.types.authentication_type.AuthenticationType"
    ] = None,
) -> "capo_appstream.types.create_user_result.CreateUserResult":
    """<p>Creates a new user in the user pool.</p>

    Args:
        user_name: <p>The email address of the user.</p> <note> <p>Users' email addresses are case-sensitive. During login, if they specify an email address that doesn't use the same capitalization as the email address specified when their user pool account was created, a "user does not exist" error message displays.</p> </note>
        message_action: <p>The action to take for the welcome email that is sent to a user after the user is created in the user pool. If you specify SUPPRESS, no email is sent. If you specify RESEND, do not specify the first name or last name of the user. If the value is null, the email is sent. </p> <note> <p>The temporary password in the welcome email is valid for only 7 days. If users don’t set their passwords within 7 days, you must send them a new welcome email.</p> </note>
        first_name: <p>The first name, or given name, of the user.</p>
        last_name: <p>The last name, or surname, of the user.</p>
        authentication_type: <p>The authentication type for the user. You must specify USERPOOL. </p>

    Raises:
        capo_appstream.errors.invalid_account_status_exception.InvalidAccountStatusException: <p>The resource cannot be created because your AWS account is suspended. For assistance, contact AWS Support. </p>
        capo_appstream.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Indicates an incorrect combination of parameters, or a missing parameter.</p>
        capo_appstream.errors.limit_exceeded_exception.LimitExceededException: <p>The requested limit exceeds the permitted limit for an account.</p>
        capo_appstream.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>The attempted operation is not permitted.</p>
        capo_appstream.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The specified resource already exists.</p>
        capo_appstream.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_appstream.types.create_user_request.CreateUserRequest]",
    ) -> OperationResponse[
        "capo_appstream.types.create_user_result.CreateUserResult"
    ]:
        import capo_appstream._operations.photon_admin_proxy_service.create_user

        output, http_response = (
            capo_appstream._operations.photon_admin_proxy_service.create_user.create_user(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_appstream.types.create_user_request.CreateUserRequest",
    ) -> dict[str, Any]:
        import capo_appstream.types.create_user_request

        return capo_appstream.types.create_user_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateUser", redact_input=_redact_input)
    )
    input_: capo_appstream.types.create_user_request.CreateUserRequest = {}
    if user_name is not None:
        input_["user_name"] = user_name
    if message_action is not None:
        input_["message_action"] = message_action
    if first_name is not None:
        input_["first_name"] = first_name
    if last_name is not None:
        input_["last_name"] = last_name
    if authentication_type is not None:
        input_["authentication_type"] = authentication_type

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