Skip to content

list_workspace_enforced_policies async

list_workspace_enforced_policies(
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
    owner: Optional[ResourceOwnerType] = None,
    max_results: Optional[Limit100] = None,
    next_token: Optional[PaginationToken] = None,
) -> ListWorkspaceEnforcedPoliciesResult

Lists the WorkSpace-enforced policies that you can use, including policies that Amazon owns. This operation is paginated. To get the next page, pass the NextToken from the previous response.

Parameters:

  • owner (Optional[ResourceOwnerType], default: None ) –

    If you specify this field, the operation returns only policies with this owner: SELF or AMAZON. Omit it to return both.

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

    The maximum number of items to return. Valid range: 1–100.

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

    If you received a NextToken from a previous call that was paginated, provide this token to receive the next set of results.

Raises:

Examples:

Example – Listing your WorkSpace-enforced policies The following example lists the WorkSpace-enforced policies that you created.

>>> await client.list_workspace_enforced_policies(owner='SELF', max_results=10)
Source code in docs_src/capo_workspaces/_services/async_work_spaces.py
async def list_workspace_enforced_policies(
    self,
    *,
    config_overrides: Optional[AsyncWorkSpacesClientConfig] = None,
    owner: Optional[
        "capo_workspaces.types.resource_owner_type.ResourceOwnerType"
    ] = None,
    max_results: Optional["capo_workspaces.types.limit100.Limit100"] = None,
    next_token: Optional[
        "capo_workspaces.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_workspaces.types.list_workspace_enforced_policies_result.ListWorkspaceEnforcedPoliciesResult":
    """<p>Lists the WorkSpace-enforced policies that you can use, including policies that Amazon owns. This operation is paginated. To get the next page, pass the <code>NextToken</code> from the previous response.</p>

    Args:
        owner: <p>If you specify this field, the operation returns only policies with this owner: <code>SELF</code> or <code>AMAZON</code>. Omit it to return both.</p>
        max_results: <p>The maximum number of items to return. Valid range: 1–100.</p>
        next_token: <p>If you received a <code>NextToken</code> from a previous call that was paginated, provide this token to receive the next set of results.</p>

    Raises:
        capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
        capo_workspaces.errors.throttling_exception.ThrottlingException: <p>The request was throttled. Retry the request with exponential backoff.</p>
        capo_workspaces.errors.validation_exception.ValidationException: <p>Your request failed validation. Check the error message for the parameter that isn't valid.</p>
        capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Example – Listing your WorkSpace-enforced policies
        The following example lists the WorkSpace-enforced policies that you created.

        >>> await client.list_workspace_enforced_policies(owner='SELF', max_results=10)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_workspaces.types.list_workspace_enforced_policies_request.ListWorkspaceEnforcedPoliciesRequest]",
    ) -> AsyncOperationResponse[
        "capo_workspaces.types.list_workspace_enforced_policies_result.ListWorkspaceEnforcedPoliciesResult"
    ]:
        if req.options.protocol == "awsJson1_1":
            import capo_workspaces._operations.workspaces_service.aws_json1_1.list_workspace_enforced_policies

            (
                output,
                http_response,
            ) = await capo_workspaces._operations.workspaces_service.aws_json1_1.list_workspace_enforced_policies.async_list_workspace_enforced_policies(
                req.options, req.input
            )
        elif req.options.protocol == "rpcv2Cbor":
            import capo_workspaces._operations.workspaces_service.rpcv2_cbor.list_workspace_enforced_policies

            (
                output,
                http_response,
            ) = await capo_workspaces._operations.workspaces_service.rpcv2_cbor.list_workspace_enforced_policies.async_list_workspace_enforced_policies(
                req.options, req.input
            )
        else:
            raise ValueError(f"unknown protocol {req.options.protocol!r}")
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListWorkspaceEnforcedPolicies")
    )
    input_: capo_workspaces.types.list_workspace_enforced_policies_request.ListWorkspaceEnforcedPoliciesRequest = {}
    if owner is not None:
        input_["owner"] = owner
    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