Skip to content

list_mail_domains async

list_mail_domains(
    organization_id: OrganizationId,
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> ListMailDomainsResponse

Lists the mail domains in a given WorkMail organization.

Parameters:

  • organization_id (OrganizationId) –

    The WorkMail organization for which to list domains.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return in a single call.

  • next_token (Optional[NextToken], default: None ) –

    The token to use to retrieve the next page of results. The first call does not require a token.

Raises:

Source code in docs_src/capo_workmail/_services/async_work_mail.py
async def list_mail_domains(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    *,
    config_overrides: Optional[AsyncWorkMailClientConfig] = None,
    max_results: Optional["capo_workmail.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_workmail.types.next_token.NextToken"] = None,
) -> "capo_workmail.types.list_mail_domains_response.ListMailDomainsResponse":
    """<p>Lists the mail domains in a given WorkMail organization.</p>

    Args:
        organization_id: <p>The WorkMail organization for which to list domains.</p>
        max_results: <p>The maximum number of results to return in a single call.</p>
        next_token: <p>The token to use to retrieve the next page of results. The first call does not require a token.</p>

    Raises:
        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.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.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workmail.types.list_mail_domains_request.ListMailDomainsRequest]",
    ) -> AsyncOperationResponse[
        "capo_workmail.types.list_mail_domains_response.ListMailDomainsResponse"
    ]:
        import capo_workmail._operations.work_mail_service.list_mail_domains

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListMailDomains")
    )
    input_: capo_workmail.types.list_mail_domains_request.ListMailDomainsRequest = {
        "organization_id": organization_id
    }
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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