Skip to content

verify_phone_number async

verify_phone_number(
    otp: Otp,
    *,
    config_overrides: Optional[AsyncAccountClientConfig] = None,
    account_id: Optional[AccountId] = None,
) -> VerifyPhoneNumberResponse

Verifies the phone number in the primary contact information of an Amazon Web Services account by submitting the one-time passcode that SendPhoneNumberVerification sent to that phone number.

For complete details about how to use the primary contact operations, see Update the primary contact for your Amazon Web Services account.

Parameters:

  • account_id (Optional[AccountId], default: None ) –

    Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation.

    If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation.

    To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated administrator account assigned.

    The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.

    To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.

  • otp (Otp) –

    The one-time passcode sent to the phone number in the primary contact information by the SendPhoneNumberVerification operation.

Raises:

  • AccessDeniedException –

    The operation failed because the calling identity doesn't have the minimum required permissions.

  • ConflictException –

    The request could not be processed because of a conflict in the current status of the resource. For example, this happens if you try to enable a Region that is currently being disabled (in a status of DISABLING) or if you try to change an account’s root user email to an email address which is already in use.

  • InternalServerException –

    The operation failed because of an error internal to Amazon Web Services. Try your operation again later.

  • ResourceNotFoundException –

    The operation failed because it specified a resource that can't be found.

  • TooManyRequestsException –

    The operation failed because it was called too frequently and exceeded a throttle limit.

  • ValidationException –

    The operation failed because one of the input parameters was invalid.

  • UnknownServiceError –

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

Source code in docs_src/capo_account/_services/async_account.py
async def verify_phone_number(
    self,
    otp: "capo_account.types.otp.Otp",
    *,
    config_overrides: Optional[AsyncAccountClientConfig] = None,
    account_id: Optional["capo_account.types.account_id.AccountId"] = None,
) -> "capo_account.types.verify_phone_number_response.VerifyPhoneNumberResponse":
    """<p>Verifies the phone number in the primary contact information of an Amazon Web Services account by submitting the one-time passcode that <a>SendPhoneNumberVerification</a> sent to that phone number.</p> <p>For complete details about how to use the primary contact operations, see <a href="https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-update-contact-primary.html">Update the primary contact for your Amazon Web Services account</a>.</p>

    Args:
        account_id: <p>Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation.</p> <p>If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation.</p> <p>To use this parameter, the caller must be an identity in the <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account">organization's management account</a> or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html">all features enabled</a>, and the organization must have <a href="https://docs.aws.amazon.com/organizations/latest/userguide/services-that-can-integrate-account.html">trusted access</a> enabled for the Account Management service, and optionally a <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#delegated-admin">delegated administrator</a> account assigned.</p> <note> <p>The management account can't specify its own <code>AccountId</code>; it must call the operation in standalone context by not including the <code>AccountId</code> parameter.</p> </note> <p>To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.</p>
        otp: <p>The one-time passcode sent to the phone number in the primary contact information by the <code>SendPhoneNumberVerification</code> operation.</p>

    Raises:
        capo_account.errors.access_denied_exception.AccessDeniedException: <p>The operation failed because the calling identity doesn't have the minimum required permissions.</p>
        capo_account.errors.conflict_exception.ConflictException: <p>The request could not be processed because of a conflict in the current status of the resource. For example, this happens if you try to enable a Region that is currently being disabled (in a status of DISABLING) or if you try to change an account’s root user email to an email address which is already in use.</p>
        capo_account.errors.internal_server_exception.InternalServerException: <p>The operation failed because of an error internal to Amazon Web Services. Try your operation again later.</p>
        capo_account.errors.resource_not_found_exception.ResourceNotFoundException: <p>The operation failed because it specified a resource that can't be found.</p>
        capo_account.errors.too_many_requests_exception.TooManyRequestsException: <p>The operation failed because it was called too frequently and exceeded a throttle limit.</p>
        capo_account.errors.validation_exception.ValidationException: <p>The operation failed because one of the input parameters was invalid.</p>
        capo_account.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_account.types.verify_phone_number_request.VerifyPhoneNumberRequest]",
    ) -> AsyncOperationResponse[
        "capo_account.types.verify_phone_number_response.VerifyPhoneNumberResponse"
    ]:
        import capo_account._operations.account.verify_phone_number

        (
            output,
            http_response,
        ) = await capo_account._operations.account.verify_phone_number.async_verify_phone_number(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_account.types.verify_phone_number_request.VerifyPhoneNumberRequest",
    ) -> dict[str, Any]:
        import capo_account.types.verify_phone_number_request

        return capo_account.types.verify_phone_number_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("VerifyPhoneNumber", redact_input=_redact_input),
    )
    input_: capo_account.types.verify_phone_number_request.VerifyPhoneNumberRequest = {
        "otp": otp
    }
    if account_id is not None:
        input_["account_id"] = account_id

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