Skip to content

get_primary_email

get_primary_email(
    account_id: AccountId, *, config_overrides: Optional[AccountClientConfig] = None
) -> GetPrimaryEmailResponse

Retrieves the primary 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.

Raises:

  • AccessDeniedException –

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

  • 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/account.py
def get_primary_email(
    self,
    account_id: "capo_account.types.account_id.AccountId",
    *,
    config_overrides: Optional[AccountClientConfig] = None,
) -> "capo_account.types.get_primary_email_response.GetPrimaryEmailResponse":
    """<p>Retrieves the primary 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>

    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.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.
    """

    def _handler(
        req: "OperationRequest[capo_account.types.get_primary_email_request.GetPrimaryEmailRequest]",
    ) -> OperationResponse[
        "capo_account.types.get_primary_email_response.GetPrimaryEmailResponse"
    ]:
        import capo_account._operations.account.get_primary_email

        output, http_response = (
            capo_account._operations.account.get_primary_email.get_primary_email(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_account.types.get_primary_email_response.GetPrimaryEmailResponse",
    ) -> dict[str, Any]:
        import capo_account.types.get_primary_email_response

        return capo_account.types.get_primary_email_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetPrimaryEmail", redact_output=_redact_output),
    )
    input_: capo_account.types.get_primary_email_request.GetPrimaryEmailRequest = {
        "account_id": account_id
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output