Skip to content

list_resources

list_resources(
    type_name: TypeName,
    *,
    config_overrides: Optional[CloudControlClientConfig] = None,
    type_version_id: Optional[TypeVersionId] = None,
    role_arn: Optional[RoleArn] = None,
    next_token: Optional[HandlerNextToken] = None,
    max_results: Optional[MaxResults] = None,
    resource_model: Optional[Properties] = None,
) -> ListResourcesOutput

Returns information about the specified resources. For more information, see Discovering resources in the Amazon Web Services Cloud Control API User Guide.

You can use this action to return information about existing resources in your account and Amazon Web Services Region, whether those resources were provisioned using Cloud Control API.

Parameters:

  • type_name (TypeName) –

    The name of the resource type.

  • type_version_id (Optional[TypeVersionId], default: None ) –

    For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.

  • role_arn (Optional[RoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the handlers section of the resource type definition schema.

    If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials.

    For more information, see Specifying credentials in the Amazon Web Services Cloud Control API User Guide.

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

    If the previous paginated request didn't return all of the remaining results, the response object's NextToken parameter value is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's NextToken parameter. If there are no remaining results, the previous response object's NextToken parameter is set to null.

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

    Reserved.

  • resource_model (Optional[Properties], default: None ) –

    The resource model to use to select the resources to return.

Raises:

  • AlreadyExistsException –

    The resource with the name requested already exists.

  • GeneralServiceException –

    The resource handler has returned that the downstream service generated an error that doesn't map to any other handler error code.

  • HandlerFailureException –

    The resource handler has failed without a returning a more specific error code. This can include timeouts.

  • HandlerInternalFailureException –

    The resource handler has returned that an unexpected error occurred within the resource handler.

  • InvalidCredentialsException –

    The resource handler has returned that the credentials provided by the user are invalid.

  • InvalidRequestException –

    The resource handler has returned that invalid input from the user has generated a generic exception.

  • NetworkFailureException –

    The resource handler has returned that the request couldn't be completed due to networking issues, such as a failure to receive a response from the server.

  • NotStabilizedException –

    The resource handler has returned that the downstream resource failed to complete all of its ready-state checks.

  • NotUpdatableException –

    One or more properties included in this resource operation are defined as create-only, and therefore can't be updated.

  • PrivateTypeException –

    Cloud Control API hasn't received a valid response from the resource handler, due to a configuration error. This includes issues such as the resource handler returning an invalid response, or timing out.

  • ResourceConflictException –

    The resource is temporarily unavailable to be acted upon. For example, if the resource is currently undergoing an operation and can't be acted upon until that operation is finished.

  • ResourceNotFoundException –

    A resource with the specified identifier can't be found.

  • ServiceInternalErrorException –

    The resource handler has returned that the downstream service returned an internal error, typically with a 5XX HTTP status code.

  • ServiceLimitExceededException –

    The resource handler has returned that a non-transient resource limit was reached on the service side.

  • ThrottlingException –

    The request was denied due to request throttling.

  • TypeNotFoundException –

    The specified extension doesn't exist in the CloudFormation registry.

  • UnsupportedActionException –

    The specified resource doesn't support this resource operation.

  • UnknownServiceError –

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

Source code in docs_src/capo_cloudcontrol/_services/cloud_control.py
def list_resources(
    self,
    type_name: "capo_cloudcontrol.types.type_name.TypeName",
    *,
    config_overrides: Optional[CloudControlClientConfig] = None,
    type_version_id: Optional[
        "capo_cloudcontrol.types.type_version_id.TypeVersionId"
    ] = None,
    role_arn: Optional["capo_cloudcontrol.types.role_arn.RoleArn"] = None,
    next_token: Optional[
        "capo_cloudcontrol.types.handler_next_token.HandlerNextToken"
    ] = None,
    max_results: Optional["capo_cloudcontrol.types.max_results.MaxResults"] = None,
    resource_model: Optional[
        "capo_cloudcontrol.types.properties.Properties"
    ] = None,
) -> "capo_cloudcontrol.types.list_resources_output.ListResourcesOutput":
    """<p>Returns information about the specified resources. For more information, see <a href="https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations-list.html">Discovering resources</a> in the <i>Amazon Web Services Cloud Control API User Guide</i>.</p> <p>You can use this action to return information about existing resources in your account and Amazon Web Services Region, whether those resources were provisioned using Cloud Control API.</p>

    Args:
        type_name: <p>The name of the resource type.</p>
        type_version_id: <p>For private resource types, the type version to use in this resource operation. If you do not specify a resource version, CloudFormation uses the default version.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role for Cloud Control API to use when performing this resource operation. The role specified must have the permissions required for this operation. The necessary permissions for each event handler are defined in the <code> <a href="https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html#schema-properties-handlers">handlers</a> </code> section of the <a href="https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-schema.html">resource type definition schema</a>.</p> <p>If you do not specify a role, Cloud Control API uses a temporary session created using your Amazon Web Services user credentials.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/resource-operations.html#resource-operations-permissions">Specifying credentials</a> in the <i>Amazon Web Services Cloud Control API User Guide</i>.</p>
        next_token: <p>If the previous paginated request didn't return all of the remaining results, the response object's <code>NextToken</code> parameter value is set to a token. To retrieve the next set of results, call this action again and assign that token to the request object's <code>NextToken</code> parameter. If there are no remaining results, the previous response object's <code>NextToken</code> parameter is set to <code>null</code>.</p>
        max_results: <p>Reserved.</p>
        resource_model: <p>The resource model to use to select the resources to return.</p>

    Raises:
        capo_cloudcontrol.errors.already_exists_exception.AlreadyExistsException: <p>The resource with the name requested already exists.</p>
        capo_cloudcontrol.errors.general_service_exception.GeneralServiceException: <p>The resource handler has returned that the downstream service generated an error that doesn't map to any other handler error code.</p>
        capo_cloudcontrol.errors.handler_failure_exception.HandlerFailureException: <p>The resource handler has failed without a returning a more specific error code. This can include timeouts.</p>
        capo_cloudcontrol.errors.handler_internal_failure_exception.HandlerInternalFailureException: <p>The resource handler has returned that an unexpected error occurred within the resource handler.</p>
        capo_cloudcontrol.errors.invalid_credentials_exception.InvalidCredentialsException: <p>The resource handler has returned that the credentials provided by the user are invalid.</p>
        capo_cloudcontrol.errors.invalid_request_exception.InvalidRequestException: <p>The resource handler has returned that invalid input from the user has generated a generic exception.</p>
        capo_cloudcontrol.errors.network_failure_exception.NetworkFailureException: <p>The resource handler has returned that the request couldn't be completed due to networking issues, such as a failure to receive a response from the server.</p>
        capo_cloudcontrol.errors.not_stabilized_exception.NotStabilizedException: <p>The resource handler has returned that the downstream resource failed to complete all of its ready-state checks.</p>
        capo_cloudcontrol.errors.not_updatable_exception.NotUpdatableException: <p>One or more properties included in this resource operation are defined as create-only, and therefore can't be updated.</p>
        capo_cloudcontrol.errors.private_type_exception.PrivateTypeException: <p>Cloud Control API hasn't received a valid response from the resource handler, due to a configuration error. This includes issues such as the resource handler returning an invalid response, or timing out.</p>
        capo_cloudcontrol.errors.resource_conflict_exception.ResourceConflictException: <p>The resource is temporarily unavailable to be acted upon. For example, if the resource is currently undergoing an operation and can't be acted upon until that operation is finished.</p>
        capo_cloudcontrol.errors.resource_not_found_exception.ResourceNotFoundException: <p>A resource with the specified identifier can't be found.</p>
        capo_cloudcontrol.errors.service_internal_error_exception.ServiceInternalErrorException: <p>The resource handler has returned that the downstream service returned an internal error, typically with a <code>5XX HTTP</code> status code.</p>
        capo_cloudcontrol.errors.service_limit_exceeded_exception.ServiceLimitExceededException: <p>The resource handler has returned that a non-transient resource limit was reached on the service side.</p>
        capo_cloudcontrol.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_cloudcontrol.errors.type_not_found_exception.TypeNotFoundException: <p>The specified extension doesn't exist in the CloudFormation registry.</p>
        capo_cloudcontrol.errors.unsupported_action_exception.UnsupportedActionException: <p>The specified resource doesn't support this resource operation.</p>
        capo_cloudcontrol.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cloudcontrol.types.list_resources_input.ListResourcesInput]",
    ) -> OperationResponse[
        "capo_cloudcontrol.types.list_resources_output.ListResourcesOutput"
    ]:
        import capo_cloudcontrol._operations.cloud_api_service.list_resources

        output, http_response = (
            capo_cloudcontrol._operations.cloud_api_service.list_resources.list_resources(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_cloudcontrol.types.list_resources_input.ListResourcesInput",
    ) -> dict[str, Any]:
        import capo_cloudcontrol.types.list_resources_input

        return capo_cloudcontrol.types.list_resources_input.redact_sensitive(input_)

    def _redact_output(
        output: "capo_cloudcontrol.types.list_resources_output.ListResourcesOutput",
    ) -> dict[str, Any]:
        import capo_cloudcontrol.types.list_resources_output

        return capo_cloudcontrol.types.list_resources_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "ListResources",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_cloudcontrol.types.list_resources_input.ListResourcesInput = {
        "type_name": type_name
    }
    if type_version_id is not None:
        input_["type_version_id"] = type_version_id
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if resource_model is not None:
        input_["resource_model"] = resource_model

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