Skip to content

list_permissions

list_permissions(
    *,
    config_overrides: Optional[RAMClientConfig] = None,
    resource_type: Optional[String] = None,
    next_token: Optional[String] = None,
    max_results: Optional[MaxResults] = None,
    permission_type: Optional[PermissionTypeFilter] = None,
) -> ListPermissionsResponse

Retrieves a list of available RAM permissions that you can use for the supported resource types.

Always check the NextToken response parameter for a null value when calling a paginated operation. These operations can occasionally return an empty set of results even when there are more results available. The NextToken response parameter value is null only when there are no more results to display.

Parameters:

  • resource_type (Optional[String], default: None ) –

    Specifies that you want to list only those permissions that apply to the specified resource type. This parameter is not case sensitive.

    For example, to list only permissions that apply to Amazon EC2 subnets, specify ec2:subnet. You can use the ListResourceTypes operation to get the specific string required.

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

    Specifies that you want to receive the next page of results. Valid only if you received a NextToken response in the previous request. If you did, it indicates that more output is available. Set this parameter to the value provided by the previous call's NextToken response to request the next page of results.

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

    Specifies the total number of results that you want included on each page of the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the number you specify, the NextToken response element is returned with a value (not null). Include the specified value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that the service might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

  • permission_type (Optional[PermissionTypeFilter], default: None ) –

    Specifies that you want to list only permissions of this type:

    • AWS – returns only Amazon Web Services managed permissions.

    • LOCAL – returns only customer managed permissions

    • ALL – returns both Amazon Web Services managed permissions and customer managed permissions.

    If you don't specify this parameter, the default is All.

Raises:

  • InvalidNextTokenException –

    The operation failed because the specified value for NextToken isn't valid. You must specify a value you received in the NextToken response of a previous call to this operation.

  • InvalidParameterException –

    The operation failed because a parameter you specified isn't valid.

  • OperationNotPermittedException –

    The operation failed because the requested operation isn't permitted.

  • ServerInternalException –

    The operation failed because the service could not respond to the request due to an internal problem. Try again later.

  • ServiceUnavailableException –

    The operation failed because the service isn't available. Try again later.

  • UnknownServiceError –

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

Source code in docs_src/capo_ram/_services/ram.py
def list_permissions(
    self,
    *,
    config_overrides: Optional[RAMClientConfig] = None,
    resource_type: Optional["capo_ram.types.string.String"] = None,
    next_token: Optional["capo_ram.types.string.String"] = None,
    max_results: Optional["capo_ram.types.max_results.MaxResults"] = None,
    permission_type: Optional[
        "capo_ram.types.permission_type_filter.PermissionTypeFilter"
    ] = None,
) -> "capo_ram.types.list_permissions_response.ListPermissionsResponse":
    """<p>Retrieves a list of available RAM permissions that you can use for the supported resource types. </p> <note> <p>Always check the <code>NextToken</code> response parameter for a <code>null</code> value when calling a paginated operation. These operations can occasionally return an empty set of results even when there are more results available. The <code>NextToken</code> response parameter value is <code>null</code> <i>only</i> when there are no more results to display.</p> </note>

    Args:
        resource_type: <p>Specifies that you want to list only those permissions that apply to the specified resource type. This parameter is not case sensitive.</p> <p>For example, to list only permissions that apply to Amazon EC2 subnets, specify <code>ec2:subnet</code>. You can use the <a>ListResourceTypes</a> operation to get the specific string required.</p>
        next_token: <p>Specifies that you want to receive the next page of results. Valid only if you received a <code>NextToken</code> response in the previous request. If you did, it indicates that more output is available. Set this parameter to the value provided by the previous call's <code>NextToken</code> response to request the next page of results.</p>
        max_results: <p>Specifies the total number of results that you want included on each page of the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the number you specify, the <code>NextToken</code> response element is returned with a value (not null). Include the specified value as the <code>NextToken</code> request parameter in the next call to the operation to get the next part of the results. Note that the service might return fewer results than the maximum even when there are more results available. You should check <code>NextToken</code> after every operation to ensure that you receive all of the results.</p>
        permission_type: <p>Specifies that you want to list only permissions of this type:</p> <ul> <li> <p> <code>AWS</code> – returns only Amazon Web Services managed permissions.</p> </li> <li> <p> <code>LOCAL</code> – returns only customer managed permissions</p> </li> <li> <p> <code>ALL</code> – returns both Amazon Web Services managed permissions and customer managed permissions.</p> </li> </ul> <p>If you don't specify this parameter, the default is <code>All</code>.</p>

    Raises:
        capo_ram.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The operation failed because the specified value for <code>NextToken</code> isn't valid. You must specify a value you received in the <code>NextToken</code> response of a previous call to this operation.</p>
        capo_ram.errors.invalid_parameter_exception.InvalidParameterException: <p>The operation failed because a parameter you specified isn't valid.</p>
        capo_ram.errors.operation_not_permitted_exception.OperationNotPermittedException: <p>The operation failed because the requested operation isn't permitted.</p>
        capo_ram.errors.server_internal_exception.ServerInternalException: <p>The operation failed because the service could not respond to the request due to an internal problem. Try again later.</p>
        capo_ram.errors.service_unavailable_exception.ServiceUnavailableException: <p>The operation failed because the service isn't available. Try again later.</p>
        capo_ram.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ram.types.list_permissions_request.ListPermissionsRequest]",
    ) -> OperationResponse[
        "capo_ram.types.list_permissions_response.ListPermissionsResponse"
    ]:
        import capo_ram._operations.amazon_resource_sharing.list_permissions

        output, http_response = (
            capo_ram._operations.amazon_resource_sharing.list_permissions.list_permissions(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListPermissions")
    )
    input_: capo_ram.types.list_permissions_request.ListPermissionsRequest = {}
    if resource_type is not None:
        input_["resource_type"] = resource_type
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if permission_type is not None:
        input_["permission_type"] = permission_type

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output