Skip to content

accept_primary_email_update async

accept_primary_email_update(
    account_id: AccountId,
    primary_email: PrimaryEmailAddress,
    otp: Otp,
    *,
    config_overrides: Optional[AsyncAccountClientConfig] = None,
) -> AcceptPrimaryEmailUpdateResponse

Accepts the request that originated from StartPrimaryEmailUpdate to update the primary email address (also known as the root user email address) for the specified account.

Parameters:

  • account_id (AccountId) –

    Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. 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 admin account assigned.

    This operation can only be called from the management account or the delegated administrator account of an organization for a member account.

    The management account can't specify its own AccountId.

  • primary_email (PrimaryEmailAddress) –

    The new primary email address for use with the specified account. This must match the PrimaryEmail from the StartPrimaryEmailUpdate API call.

  • otp (Otp) –

    The OTP code sent to the PrimaryEmail specified on the StartPrimaryEmailUpdate API call.

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 accept_primary_email_update(
    self,
    account_id: "capo_account.types.account_id.AccountId",
    primary_email: "capo_account.types.primary_email_address.PrimaryEmailAddress",
    otp: "capo_account.types.otp.Otp",
    *,
    config_overrides: Optional[AsyncAccountClientConfig] = None,
) -> "capo_account.types.accept_primary_email_update_response.AcceptPrimaryEmailUpdateResponse":
    """<p>Accepts the request that originated from <a>StartPrimaryEmailUpdate</a> to update the primary email address (also known as the root user email address) for the specified account.</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. 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. 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/orgs_integrate_services.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 admin</a> account assigned.</p> <p>This operation can only be called from the management account or the delegated administrator account of an organization for a member account.</p> <note> <p>The management account can't specify its own <code>AccountId</code>.</p> </note>
        primary_email: <p>The new primary email address for use with the specified account. This must match the <code>PrimaryEmail</code> from the <code>StartPrimaryEmailUpdate</code> API call.</p>
        otp: <p>The OTP code sent to the <code>PrimaryEmail</code> specified on the <code>StartPrimaryEmailUpdate</code> API call.</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.accept_primary_email_update_request.AcceptPrimaryEmailUpdateRequest]",
    ) -> AsyncOperationResponse[
        "capo_account.types.accept_primary_email_update_response.AcceptPrimaryEmailUpdateResponse"
    ]:
        import capo_account._operations.account.accept_primary_email_update

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

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

        return (
            capo_account.types.accept_primary_email_update_request.redact_sensitive(
                input_
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("AcceptPrimaryEmailUpdate", redact_input=_redact_input),
    )
    input_: capo_account.types.accept_primary_email_update_request.AcceptPrimaryEmailUpdateRequest = {
        "account_id": account_id,
        "primary_email": primary_email,
        "otp": otp,
    }

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