Skip to content

create_user async

create_user(
    username: UsernameType,
    given_name: UserAttributeValueType,
    surname: UserAttributeValueType,
    password: PasswordType,
    *,
    config_overrides: Optional[AsyncWorkDocsClientConfig] = None,
    organization_id: Optional[IdType] = None,
    email_address: Optional[EmailAddressType] = None,
    time_zone_id: Optional[TimeZoneIdType] = None,
    storage_rule: Optional[StorageRuleType] = None,
    authentication_token: Optional[AuthenticationHeaderType] = None,
) -> CreateUserResponse

Creates a user in a Simple AD or Microsoft AD directory. The status of a newly created user is "ACTIVE". New users can access Amazon WorkDocs.

Parameters:

Raises:

Source code in docs_src/capo_workdocs/_services/async_work_docs.py
async def create_user(
    self,
    username: "capo_workdocs.types.username_type.UsernameType",
    given_name: "capo_workdocs.types.user_attribute_value_type.UserAttributeValueType",
    surname: "capo_workdocs.types.user_attribute_value_type.UserAttributeValueType",
    password: "capo_workdocs.types.password_type.PasswordType",
    *,
    config_overrides: Optional[AsyncWorkDocsClientConfig] = None,
    organization_id: Optional["capo_workdocs.types.id_type.IdType"] = None,
    email_address: Optional[
        "capo_workdocs.types.email_address_type.EmailAddressType"
    ] = None,
    time_zone_id: Optional[
        "capo_workdocs.types.time_zone_id_type.TimeZoneIdType"
    ] = None,
    storage_rule: Optional[
        "capo_workdocs.types.storage_rule_type.StorageRuleType"
    ] = None,
    authentication_token: Optional[
        "capo_workdocs.types.authentication_header_type.AuthenticationHeaderType"
    ] = None,
) -> "capo_workdocs.types.create_user_response.CreateUserResponse":
    """<p>Creates a user in a Simple AD or Microsoft AD directory. The status of a newly created user is "ACTIVE". New users can access Amazon WorkDocs.</p>

    Args:
        organization_id: <p>The ID of the organization.</p>
        username: <p>The login name of the user.</p>
        email_address: <p>The email address of the user.</p>
        given_name: <p>The given name of the user.</p>
        surname: <p>The surname of the user.</p>
        password: <p>The password of the user.</p>
        time_zone_id: <p>The time zone ID of the user.</p>
        storage_rule: <p>The amount of storage for the user.</p>
        authentication_token: <p>Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.</p>

    Raises:
        capo_workdocs.errors.entity_already_exists_exception.EntityAlreadyExistsException: <p>The resource already exists.</p>
        capo_workdocs.errors.failed_dependency_exception.FailedDependencyException: <p>The Directory Service cannot reach an on-premises instance. Or a dependency under the control of the organization is failing, such as a connected Active Directory.</p>
        capo_workdocs.errors.service_unavailable_exception.ServiceUnavailableException: <p>One or more of the dependencies is unavailable.</p>
        capo_workdocs.errors.unauthorized_operation_exception.UnauthorizedOperationException: <p>The operation is not permitted.</p>
        capo_workdocs.errors.unauthorized_resource_access_exception.UnauthorizedResourceAccessException: <p>The caller does not have access to perform the action on the resource.</p>
        capo_workdocs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

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

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

        return capo_workdocs.types.create_user_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_workdocs.types.create_user_response.CreateUserResponse",
    ) -> dict[str, Any]:
        import capo_workdocs.types.create_user_response

        return capo_workdocs.types.create_user_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateUser", redact_input=_redact_input, redact_output=_redact_output
        ),
    )
    input_: capo_workdocs.types.create_user_request.CreateUserRequest = {
        "username": username,
        "given_name": given_name,
        "surname": surname,
        "password": password,
    }
    if organization_id is not None:
        input_["organization_id"] = organization_id
    if email_address is not None:
        input_["email_address"] = email_address
    if time_zone_id is not None:
        input_["time_zone_id"] = time_zone_id
    if storage_rule is not None:
        input_["storage_rule"] = storage_rule
    if authentication_token is not None:
        input_["authentication_token"] = authentication_token

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