Skip to content

reset_password async

reset_password(
    organization_id: OrganizationId,
    user_id: WorkMailIdentifier,
    password: Password,
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
) -> ResetPasswordResponse

Allows the administrator to reset the password for a user.

Parameters:

  • organization_id (OrganizationId) –

    The identifier of the organization that contains the user for which the password is reset.

  • user_id (WorkMailIdentifier) –

    The identifier of the user for whom the password is reset.

  • password (Password) –

    The new password for the user.

Raises:

Source code in docs_src/capo_workmail/_services/async_work_mail.py
async def reset_password(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    user_id: "capo_workmail.types.work_mail_identifier.WorkMailIdentifier",
    password: "capo_workmail.types.password.Password",
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
) -> "capo_workmail.types.reset_password_response.ResetPasswordResponse":
    """<p>Allows the administrator to reset the password for a user.</p>

    Args:
        organization_id: <p>The identifier of the organization that contains the user for which the password is reset.</p>
        user_id: <p>The identifier of the user for whom the password is reset.</p>
        password: <p>The new password for the user.</p>

    Raises:
        capo_workmail.errors.directory_service_authentication_failed_exception.DirectoryServiceAuthenticationFailedException: <p>The directory service doesn't recognize the credentials supplied by WorkMail.</p>
        capo_workmail.errors.directory_unavailable_exception.DirectoryUnavailableException: <p>The directory is unavailable. It might be located in another Region or deleted.</p>
        capo_workmail.errors.entity_not_found_exception.EntityNotFoundException: <p>The identifier supplied for the user, group, or resource does not exist in your organization.</p>
        capo_workmail.errors.entity_state_exception.EntityStateException: <p>You are performing an operation on a user, group, or resource that isn't in the expected state, such as trying to delete an active user.</p>
        capo_workmail.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the input parameters don't match the service's restrictions.</p>
        capo_workmail.errors.invalid_password_exception.InvalidPasswordException: <p>The supplied password doesn't match the minimum security constraints, such as length or use of special characters.</p>
        capo_workmail.errors.organization_not_found_exception.OrganizationNotFoundException: <p>An operation received a valid organization identifier that either doesn't belong or exist in the system.</p>
        capo_workmail.errors.organization_state_exception.OrganizationStateException: <p>The organization must have a valid state to perform certain operations on the organization or its members.</p>
        capo_workmail.errors.unsupported_operation_exception.UnsupportedOperationException: <p>You can't perform a write operation against a read-only directory.</p>
        capo_workmail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workmail.types.reset_password_request.ResetPasswordRequest]",
    ) -> AsyncOperationResponse[
        "capo_workmail.types.reset_password_response.ResetPasswordResponse"
    ]:
        import capo_workmail._operations.work_mail_service.reset_password

        (
            output,
            http_response,
        ) = await capo_workmail._operations.work_mail_service.reset_password.async_reset_password(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_workmail.types.reset_password_request.ResetPasswordRequest",
    ) -> dict[str, Any]:
        import capo_workmail.types.reset_password_request

        return capo_workmail.types.reset_password_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("ResetPassword", redact_input=_redact_input),
    )
    input_: capo_workmail.types.reset_password_request.ResetPasswordRequest = {
        "organization_id": organization_id,
        "user_id": user_id,
        "password": password,
    }

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