Skip to content

list_namespaces async

list_namespaces(
    *,
    config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
    filters: Optional[NamespaceFilters] = None,
) -> ListNamespacesResponse

Lists summary information about the namespaces that were created by the current Amazon Web Services account and shared with the current Amazon Web Services account.

Parameters:

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

    For the first ListNamespaces request, omit this value.

    If the response contains NextToken, submit another ListNamespaces request to get the next group of results. Specify the value of NextToken from the previous response in the next request.

    Cloud Map gets MaxResults namespaces and then filters them based on the specified criteria. It's possible that no namespaces in the first MaxResults namespaces matched the specified criteria but that subsequent groups of MaxResults namespaces do contain namespaces that match the criteria.

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

    The maximum number of namespaces that you want Cloud Map to return in the response to a ListNamespaces request. If you don't specify a value for MaxResults, Cloud Map returns up to 100 namespaces.

  • filters (Optional[NamespaceFilters], default: None ) –

    A complex type that contains specifications for the namespaces that you want to list.

    If you specify more than one filter, a namespace must match all filters to be returned by ListNamespaces.

Raises:

  • InvalidInput –

    One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.

  • UnknownServiceError –

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

Examples:

Example: List namespaces Example: List namespaces

>>> await client.list_namespaces()
List namespaces filtered by resource owner
This example shows how to list namespaces that are shared with you from other AWS accounts using the RESOURCE_OWNER filter.
>>> await client.list_namespaces(filters=[{'Name': 'RESOURCE_OWNER', 'Values': ['OTHER_ACCOUNTS']}])
Source code in docs_src/capo_servicediscovery/_services/async_service_discovery.py
async def list_namespaces(
    self,
    *,
    config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
    next_token: Optional["capo_servicediscovery.types.next_token.NextToken"] = None,
    max_results: Optional[
        "capo_servicediscovery.types.max_results.MaxResults"
    ] = None,
    filters: Optional[
        "capo_servicediscovery.types.namespace_filters.NamespaceFilters"
    ] = None,
) -> "capo_servicediscovery.types.list_namespaces_response.ListNamespacesResponse":
    """<p>Lists summary information about the namespaces that were created by the current Amazon Web Services account and shared with the current Amazon Web Services account.</p>

    Args:
        next_token: <p>For the first <code>ListNamespaces</code> request, omit this value.</p> <p>If the response contains <code>NextToken</code>, submit another <code>ListNamespaces</code> request to get the next group of results. Specify the value of <code>NextToken</code> from the previous response in the next request.</p> <note> <p>Cloud Map gets <code>MaxResults</code> namespaces and then filters them based on the specified criteria. It's possible that no namespaces in the first <code>MaxResults</code> namespaces matched the specified criteria but that subsequent groups of <code>MaxResults</code> namespaces do contain namespaces that match the criteria.</p> </note>
        max_results: <p>The maximum number of namespaces that you want Cloud Map to return in the response to a <code>ListNamespaces</code> request. If you don't specify a value for <code>MaxResults</code>, Cloud Map returns up to 100 namespaces.</p>
        filters: <p>A complex type that contains specifications for the namespaces that you want to list.</p> <p>If you specify more than one filter, a namespace must match all filters to be returned by <code>ListNamespaces</code>.</p>

    Raises:
        capo_servicediscovery.errors.invalid_input.InvalidInput: <p>One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.</p>
        capo_servicediscovery.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Example: List namespaces
        Example: List namespaces

        >>> await client.list_namespaces()
        List namespaces filtered by resource owner
        This example shows how to list namespaces that are shared with you from other AWS accounts using the RESOURCE_OWNER filter.

        >>> await client.list_namespaces(filters=[{'Name': 'RESOURCE_OWNER', 'Values': ['OTHER_ACCOUNTS']}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_servicediscovery.types.list_namespaces_request.ListNamespacesRequest]",
    ) -> AsyncOperationResponse[
        "capo_servicediscovery.types.list_namespaces_response.ListNamespacesResponse"
    ]:
        import capo_servicediscovery._operations.route53_auto_naming_v20170314.list_namespaces

        (
            output,
            http_response,
        ) = await capo_servicediscovery._operations.route53_auto_naming_v20170314.list_namespaces.async_list_namespaces(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListNamespaces")
    )
    input_: capo_servicediscovery.types.list_namespaces_request.ListNamespacesRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if filters is not None:
        input_["filters"] = filters

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