Skip to content

list_access_grants async

list_access_grants(
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    domain_id: Optional[DomainId] = None,
    space_id: Optional[SpaceId] = None,
    principal_id: Optional[PrincipalId] = None,
    principal_type: Optional[AccessGrantPrincipalType] = None,
    permission: Optional[AccessGrantPermission] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[int] = None,
) -> ListAccessGrantsOutput

Returns AccessGrants, with optional filtering by domain, space, principal, or permission. A grant is returned only when it matches every filter supplied. With no filters, returns the grants for the current account and Region.

Parameters:

  • domain_id (Optional[DomainId], default: None ) –

    Filter by domain ID.

  • space_id (Optional[SpaceId], default: None ) –

    Filter by space ID.

  • principal_id (Optional[PrincipalId], default: None ) –

    Filter by principal ID.

  • principal_type (Optional[AccessGrantPrincipalType], default: None ) –

    Filter by principal type.

  • permission (Optional[AccessGrantPermission], default: None ) –

    Filter by permission level.

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

    A token to retrieve the next page of results. Supply the same filters used on the request that returned it. Tokens expire after 24 hours.

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

    The maximum number of access grants to return per page. Defaults to 100. A page can contain fewer results than this value even when more results remain; continue while nextToken is present.

Raises:

Examples:

List access grants in a space The following example lists the first page of access grants in a space and returns a nextToken to retrieve the next page. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> await client.list_access_grants(domain_id='d-1a2b3c4d5e', space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', max_results=50)
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
async def list_access_grants(
    self,
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    domain_id: Optional["capo_cloudwatchomni.types.domain_id.DomainId"] = None,
    space_id: Optional["capo_cloudwatchomni.types.space_id.SpaceId"] = None,
    principal_id: Optional[
        "capo_cloudwatchomni.types.principal_id.PrincipalId"
    ] = None,
    principal_type: Optional[
        "capo_cloudwatchomni.types.access_grant_principal_type.AccessGrantPrincipalType"
    ] = None,
    permission: Optional[
        "capo_cloudwatchomni.types.access_grant_permission.AccessGrantPermission"
    ] = None,
    next_token: Optional["capo_cloudwatchomni.types.next_token.NextToken"] = None,
    max_results: Optional[int] = None,
) -> "capo_cloudwatchomni.types.list_access_grants_output.ListAccessGrantsOutput":
    """Returns AccessGrants, with optional filtering by domain, space, principal, or permission. A grant is returned only when it matches every filter supplied. With no filters, returns the grants for the current account and Region.

    Args:
        domain_id: Filter by domain ID.
        space_id: Filter by space ID.
        principal_id: Filter by principal ID.
        principal_type: Filter by principal type.
        permission: Filter by permission level.
        next_token: A token to retrieve the next page of results. Supply the same filters used on the request that returned it. Tokens expire after 24 hours.
        max_results: The maximum number of access grants to return per page. Defaults to 100. A page can contain fewer results than this value even when more results remain; continue while nextToken is present.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        List access grants in a space
        The following example lists the first page of access grants in a space and returns a nextToken to retrieve the next page. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.list_access_grants(domain_id='d-1a2b3c4d5e', space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', max_results=50)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatchomni.types.list_access_grants_input.ListAccessGrantsInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatchomni.types.list_access_grants_output.ListAccessGrantsOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.list_access_grants

        (
            output,
            http_response,
        ) = await capo_cloudwatchomni._operations.cloud_watch_omni_frontend.list_access_grants.async_list_access_grants(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListAccessGrants")
    )
    input_: capo_cloudwatchomni.types.list_access_grants_input.ListAccessGrantsInput = {}
    if domain_id is not None:
        input_["domain_id"] = domain_id
    if space_id is not None:
        input_["space_id"] = space_id
    if principal_id is not None:
        input_["principal_id"] = principal_id
    if principal_type is not None:
        input_["principal_type"] = principal_type
    if permission is not None:
        input_["permission"] = permission
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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