Skip to content

create_user async

create_user(
    identity_store_id: IdentityStoreId,
    *,
    config_overrides: Optional[AsyncidentitystoreClientConfig] = None,
    user_name: Optional[UserName] = None,
    name: Optional[Name] = None,
    display_name: Optional[SensitiveStringType] = None,
    nick_name: Optional[SensitiveStringType] = None,
    profile_url: Optional[SensitiveStringType] = None,
    emails: Optional[Emails] = None,
    addresses: Optional[Addresses] = None,
    phone_numbers: Optional[PhoneNumbers] = None,
    user_type: Optional[SensitiveStringType] = None,
    title: Optional[SensitiveStringType] = None,
    preferred_language: Optional[SensitiveStringType] = None,
    locale: Optional[SensitiveStringType] = None,
    timezone: Optional[SensitiveStringType] = None,
    photos: Optional[Photos] = None,
    website: Optional[SensitiveStringType] = None,
    birthdate: Optional[SensitiveStringType] = None,
    roles: Optional[Roles] = None,
    extensions: Optional[Extensions] = None,
) -> CreateUserResponse

Creates a user within the specified identity store.

Parameters:

  • identity_store_id (IdentityStoreId) –

    The globally unique identifier for the identity store.

    You can specify the identity store by ID or by Amazon Resource Name (ARN). For example, identity store ID d-1234567890 or identity store ARN arn:aws:identitystore::111122223333:identitystore/d-1234567890.

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

    A unique string used to identify the user. The length limit is 128 characters. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. Administrator and AWSAdministrators are reserved names and can't be used for users or groups.

  • name (Optional[Name], default: None ) –

    An object containing the name of the user. When used in IAM Identity Center, this parameter is required.

  • display_name (Optional[SensitiveStringType], default: None ) –

    A string containing the name of the user. This value is typically formatted for display when the user is referenced. For example, "John Doe." When used in IAM Identity Center, this parameter is required.

  • nick_name (Optional[SensitiveStringType], default: None ) –

    A string containing an alternate name for the user.

  • profile_url (Optional[SensitiveStringType], default: None ) –

    A string containing a URL that might be associated with the user.

  • emails (Optional[Emails], default: None ) –

    A list of Email objects containing email addresses associated with the user.

  • addresses (Optional[Addresses], default: None ) –

    A list of Address objects containing addresses associated with the user.

  • phone_numbers (Optional[PhoneNumbers], default: None ) –

    A list of PhoneNumber objects containing phone numbers associated with the user.

  • user_type (Optional[SensitiveStringType], default: None ) –

    A string indicating the type of user. Possible values are left unspecified. The value can vary based on your specific use case.

  • title (Optional[SensitiveStringType], default: None ) –

    A string containing the title of the user. Possible values are left unspecified. The value can vary based on your specific use case.

  • preferred_language (Optional[SensitiveStringType], default: None ) –

    A string containing the preferred language of the user. For example, "American English" or "en-us."

  • locale (Optional[SensitiveStringType], default: None ) –

    A string containing the geographical region or location of the user.

  • timezone (Optional[SensitiveStringType], default: None ) –

    A string containing the time zone of the user.

  • photos (Optional[Photos], default: None ) –

    A list of photos associated with the user. You can add up to 3 photos per user. Each photo can include a value, type, display name, and primary designation.

  • website (Optional[SensitiveStringType], default: None ) –

    The user's personal website or blog URL. This field allows users to provide a link to their personal or professional website.

  • birthdate (Optional[SensitiveStringType], default: None ) –

    The user's birthdate in YYYY-MM-DD format. This field supports standard date format for storing personal information.

  • roles (Optional[Roles], default: None ) –

    A list of Role objects containing roles associated with the user.

  • extensions (Optional[Extensions], default: None ) –

    A map with additional attribute extensions for the user. Each map key corresponds to an extension name, while map values represent extension data in Document type (not supported by Java V1, Go V1 and older versions of the CLI). aws:identitystore:enterprise is the only supported extension name.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • InternalServerException –

    The request processing has failed because of an unknown error, exception or failure with an internal server.

  • ThrottlingException –

    Indicates that the principal has crossed the throttling limits of the API operations.

  • ConflictException –

    This request cannot be completed for one of the following reasons:

    • Performing the requested operation would violate an existing uniqueness claim in the identity store. Resolve the conflict before retrying this request.

    • The requested resource was being concurrently modified by another request.

  • ResourceNotFoundException –

    Indicates that a requested resource is not found.

  • ServiceQuotaExceededException –

    The request would cause the number of users or groups in the identity store to exceed the maximum allowed.

  • ValidationException –

    The request failed because it contains a syntax error.

  • UnknownServiceError –

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

Source code in docs_src/capo_identitystore/_services/async_identitystore.py
async def create_user(
    self,
    identity_store_id: "capo_identitystore.types.identity_store_id.IdentityStoreId",
    *,
    config_overrides: Optional[AsyncidentitystoreClientConfig] = None,
    user_name: Optional["capo_identitystore.types.user_name.UserName"] = None,
    name: Optional["capo_identitystore.types.name.Name"] = None,
    display_name: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    nick_name: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    profile_url: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    emails: Optional["capo_identitystore.types.emails.Emails"] = None,
    addresses: Optional["capo_identitystore.types.addresses.Addresses"] = None,
    phone_numbers: Optional[
        "capo_identitystore.types.phone_numbers.PhoneNumbers"
    ] = None,
    user_type: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    title: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    preferred_language: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    locale: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    timezone: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    photos: Optional["capo_identitystore.types.photos.Photos"] = None,
    website: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    birthdate: Optional[
        "capo_identitystore.types.sensitive_string_type.SensitiveStringType"
    ] = None,
    roles: Optional["capo_identitystore.types.roles.Roles"] = None,
    extensions: Optional["capo_identitystore.types.extensions.Extensions"] = None,
) -> "capo_identitystore.types.create_user_response.CreateUserResponse":
    """<p>Creates a user within the specified identity store.</p>

    Args:
        identity_store_id: <p>The globally unique identifier for the identity store.</p> <p>You can specify the identity store by ID or by Amazon Resource Name (ARN). For example, identity store ID <code>d-1234567890</code> or identity store ARN <code>arn:aws:identitystore::111122223333:identitystore/d-1234567890</code>.</p>
        user_name: <p>A unique string used to identify the user. The length limit is 128 characters. This value can consist of letters, accented characters, symbols, numbers, and punctuation. This value is specified at the time the user is created and stored as an attribute of the user object in the identity store. <code>Administrator</code> and <code>AWSAdministrators</code> are reserved names and can't be used for users or groups.</p>
        name: <p>An object containing the name of the user. When used in IAM Identity Center, this parameter is required.</p>
        display_name: <p>A string containing the name of the user. This value is typically formatted for display when the user is referenced. For example, "John Doe." When used in IAM Identity Center, this parameter is required.</p>
        nick_name: <p>A string containing an alternate name for the user.</p>
        profile_url: <p>A string containing a URL that might be associated with the user.</p>
        emails: <p>A list of <code>Email</code> objects containing email addresses associated with the user.</p>
        addresses: <p>A list of <code>Address</code> objects containing addresses associated with the user.</p>
        phone_numbers: <p>A list of <code>PhoneNumber</code> objects containing phone numbers associated with the user.</p>
        user_type: <p>A string indicating the type of user. Possible values are left unspecified. The value can vary based on your specific use case.</p>
        title: <p>A string containing the title of the user. Possible values are left unspecified. The value can vary based on your specific use case.</p>
        preferred_language: <p>A string containing the preferred language of the user. For example, "American English" or "en-us."</p>
        locale: <p>A string containing the geographical region or location of the user.</p>
        timezone: <p>A string containing the time zone of the user.</p>
        photos: <p>A list of photos associated with the user. You can add up to 3 photos per user. Each photo can include a value, type, display name, and primary designation.</p>
        website: <p>The user's personal website or blog URL. This field allows users to provide a link to their personal or professional website.</p>
        birthdate: <p>The user's birthdate in YYYY-MM-DD format. This field supports standard date format for storing personal information.</p>
        roles: <p>A list of <code>Role</code> objects containing roles associated with the user.</p>
        extensions: <p>A map with additional attribute extensions for the user. Each map key corresponds to an extension name, while map values represent extension data in <code>Document</code> type (not supported by Java V1, Go V1 and older versions of the CLI). <code>aws:identitystore:enterprise</code> is the only supported extension name.</p>

    Raises:
        capo_identitystore.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_identitystore.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure with an internal server.</p>
        capo_identitystore.errors.throttling_exception.ThrottlingException: <p>Indicates that the principal has crossed the throttling limits of the API operations.</p>
        capo_identitystore.errors.conflict_exception.ConflictException: <p>This request cannot be completed for one of the following reasons:</p> <ul> <li> <p>Performing the requested operation would violate an existing uniqueness claim in the identity store. Resolve the conflict before retrying this request.</p> </li> <li> <p>The requested resource was being concurrently modified by another request.</p> </li> </ul>
        capo_identitystore.errors.resource_not_found_exception.ResourceNotFoundException: <p>Indicates that a requested resource is not found.</p>
        capo_identitystore.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause the number of users or groups in the identity store to exceed the maximum allowed.</p>
        capo_identitystore.errors.validation_exception.ValidationException: <p>The request failed because it contains a syntax error.</p>
        capo_identitystore.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_identitystore.types.create_user_request.CreateUserRequest]",
    ) -> AsyncOperationResponse[
        "capo_identitystore.types.create_user_response.CreateUserResponse"
    ]:
        import capo_identitystore._operations.aws_identity_store.create_user

        (
            output,
            http_response,
        ) = await capo_identitystore._operations.aws_identity_store.create_user.async_create_user(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

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

        return capo_identitystore.types.create_user_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateUser", redact_input=_redact_input)
    )
    input_: capo_identitystore.types.create_user_request.CreateUserRequest = {
        "identity_store_id": identity_store_id
    }
    if user_name is not None:
        input_["user_name"] = user_name
    if name is not None:
        input_["name"] = name
    if display_name is not None:
        input_["display_name"] = display_name
    if nick_name is not None:
        input_["nick_name"] = nick_name
    if profile_url is not None:
        input_["profile_url"] = profile_url
    if emails is not None:
        input_["emails"] = emails
    if addresses is not None:
        input_["addresses"] = addresses
    if phone_numbers is not None:
        input_["phone_numbers"] = phone_numbers
    if user_type is not None:
        input_["user_type"] = user_type
    if title is not None:
        input_["title"] = title
    if preferred_language is not None:
        input_["preferred_language"] = preferred_language
    if locale is not None:
        input_["locale"] = locale
    if timezone is not None:
        input_["timezone"] = timezone
    if photos is not None:
        input_["photos"] = photos
    if website is not None:
        input_["website"] = website
    if birthdate is not None:
        input_["birthdate"] = birthdate
    if roles is not None:
        input_["roles"] = roles
    if extensions is not None:
        input_["extensions"] = extensions

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output