Skip to content

list_networks async

list_networks(
    *,
    config_overrides: Optional[AsyncWickrClientConfig] = None,
    max_results: Optional[int] = None,
    sort_fields: Optional[GenericString] = None,
    sort_direction: Optional[SortDirection] = None,
    next_token: Optional[GenericString] = None,
) -> ListNetworksResponse

Retrieves a paginated list of all Wickr networks associated with your Amazon Web Services account. You can sort the results by network ID or name.

Parameters:

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

    The maximum number of networks to return in a single page. Valid range is 1-100. Default is 10.

  • sort_fields (Optional[GenericString], default: None ) –

    The field to sort networks by. Accepted values are 'networkId' and 'networkName'. Default is 'networkId'.

  • sort_direction (Optional[SortDirection], default: None ) –

    The direction to sort results. Valid values are 'ASC' (ascending) or 'DESC' (descending). Default is 'DESC'.

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

    The token for retrieving the next page of results. This is returned from a previous request when there are more results available.

Raises:

  • BadRequestError –

    The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.

  • ForbiddenError –

    Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.

  • InternalServerError –

    An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.

  • RateLimitError –

    The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.

  • UnauthorizedError –

    The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.

  • ValidationError –

    One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.

  • UnknownServiceError –

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

Examples:

List networks with pagination

>>> await client.list_networks(max_results=10, sort_fields='networkName', sort_direction='ASC')
List networks - first page
>>> await client.list_networks(max_results=10)
Source code in docs_src/capo_wickr/_services/async_wickr.py
async def list_networks(
    self,
    *,
    config_overrides: Optional[AsyncWickrClientConfig] = None,
    max_results: Optional[int] = None,
    sort_fields: Optional["capo_wickr.types.generic_string.GenericString"] = None,
    sort_direction: Optional[
        "capo_wickr.types.sort_direction.SortDirection"
    ] = None,
    next_token: Optional["capo_wickr.types.generic_string.GenericString"] = None,
) -> "capo_wickr.types.list_networks_response.ListNetworksResponse":
    """<p>Retrieves a paginated list of all Wickr networks associated with your Amazon Web Services account. You can sort the results by network ID or name.</p>

    Args:
        max_results: <p>The maximum number of networks to return in a single page. Valid range is 1-100. Default is 10.</p>
        sort_fields: <p>The field to sort networks by. Accepted values are 'networkId' and 'networkName'. Default is 'networkId'.</p>
        sort_direction: <p>The direction to sort results. Valid values are 'ASC' (ascending) or 'DESC' (descending). Default is 'DESC'.</p>
        next_token: <p>The token for retrieving the next page of results. This is returned from a previous request when there are more results available.</p>

    Raises:
        capo_wickr.errors.bad_request_error.BadRequestError: <p>The request was invalid or malformed. This error occurs when the request parameters do not meet the API requirements, such as invalid field values, missing required parameters, or improperly formatted data.</p>
        capo_wickr.errors.forbidden_error.ForbiddenError: <p>Access to the requested resource is forbidden. This error occurs when the authenticated user does not have the necessary permissions to perform the requested operation, even though they are authenticated.</p>
        capo_wickr.errors.internal_server_error.InternalServerError: <p>An unexpected error occurred on the server while processing the request. This indicates a problem with the Wickr service itself rather than with the request. If this error persists, contact Amazon Web Services Support.</p>
        capo_wickr.errors.rate_limit_error.RateLimitError: <p>The request was throttled because too many requests were sent in a short period of time. Wait a moment and retry the request. Consider implementing exponential backoff in your application.</p>
        capo_wickr.errors.unauthorized_error.UnauthorizedError: <p>The request was not authenticated or the authentication credentials were invalid. This error occurs when the request lacks valid authentication credentials or the credentials have expired.</p>
        capo_wickr.errors.validation_error.ValidationError: <p>One or more fields in the request failed validation. This error provides detailed information about which fields were invalid and why, allowing you to correct the request and retry.</p>
        capo_wickr.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        List networks with pagination

        >>> await client.list_networks(max_results=10, sort_fields='networkName', sort_direction='ASC')
        List networks - first page

        >>> await client.list_networks(max_results=10)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_wickr.types.list_networks_request.ListNetworksRequest]",
    ) -> AsyncOperationResponse[
        "capo_wickr.types.list_networks_response.ListNetworksResponse"
    ]:
        import capo_wickr._operations.wickr_admin_api.list_networks

        (
            output,
            http_response,
        ) = await capo_wickr._operations.wickr_admin_api.list_networks.async_list_networks(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListNetworks")
    )
    input_: capo_wickr.types.list_networks_request.ListNetworksRequest = {}
    if max_results is not None:
        input_["max_results"] = max_results
    if sort_fields is not None:
        input_["sort_fields"] = sort_fields
    if sort_direction is not None:
        input_["sort_direction"] = sort_direction
    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