Returns a list of Amazon Web Services resource identifiers that matches the specified query. The query uses the same format as a resource query in a CreateGroup or UpdateGroupQuery operation.
Minimum permissions
To run this command, you must have the following permissions:
-
resource-groups:SearchResources
-
cloudformation:DescribeStacks
-
cloudformation:ListStackResources
-
tag:GetResources
Parameters:
-
resource_query
(ResourceQuery)
–
The search query, using the same formats that are supported for resource group definition. For more information, see CreateGroup.
-
max_results
(Optional[MaxResults], default:
None
)
–
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 maximum you specify, the NextToken response element is present and has a value (is not null). Include that 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.
-
next_token
(Optional[NextToken], default:
None
)
–
The parameter for receiving additional results if you receive a NextToken response in a previous request. A NextToken response indicates that more output is available. Set this parameter to the value provided by a previous call's NextToken response to indicate where the output should continue from.
Raises:
Source code in docs_src/capo_resource_groups/_services/async_resource_groups.py
| async def search_resources(
self,
resource_query: "capo_resource_groups.types.resource_query.ResourceQuery",
*,
config_overrides: Optional[AsyncResourceGroupsClientConfig] = None,
max_results: Optional[
"capo_resource_groups.types.max_results.MaxResults"
] = None,
next_token: Optional["capo_resource_groups.types.next_token.NextToken"] = None,
) -> "capo_resource_groups.types.search_resources_output.SearchResourcesOutput":
"""<p>Returns a list of Amazon Web Services resource identifiers that matches the specified query. The query uses the same format as a resource query in a <a>CreateGroup</a> or <a>UpdateGroupQuery</a> operation.</p> <p> <b>Minimum permissions</b> </p> <p>To run this command, you must have the following permissions:</p> <ul> <li> <p> <code>resource-groups:SearchResources</code> </p> </li> <li> <p> <code>cloudformation:DescribeStacks</code> </p> </li> <li> <p> <code>cloudformation:ListStackResources</code> </p> </li> <li> <p> <code>tag:GetResources</code> </p> </li> </ul>
Args:
resource_query: <p>The search query, using the same formats that are supported for resource group definition. For more information, see <a>CreateGroup</a>.</p>
max_results: <p>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 maximum you specify, the <code>NextToken</code> response element is present and has a value (is not null). Include that 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>
next_token: <p>The parameter for receiving additional results if you receive a <code>NextToken</code> response in a previous request. A <code>NextToken</code> response indicates that more output is available. Set this parameter to the value provided by a previous call's <code>NextToken</code> response to indicate where the output should continue from.</p>
Raises:
capo_resource_groups.errors.bad_request_exception.BadRequestException: <p>The request includes one or more parameters that violate validation rules.</p>
capo_resource_groups.errors.forbidden_exception.ForbiddenException: <p>The caller isn't authorized to make the request. Check permissions.</p>
capo_resource_groups.errors.internal_server_error_exception.InternalServerErrorException: <p>An internal error occurred while processing the request. Try again later.</p>
capo_resource_groups.errors.method_not_allowed_exception.MethodNotAllowedException: <p>The request uses an HTTP method that isn't allowed for the specified resource.</p>
capo_resource_groups.errors.too_many_requests_exception.TooManyRequestsException: <p>You've exceeded throttling limits by making too many requests in a period of time.</p>
capo_resource_groups.errors.unauthorized_exception.UnauthorizedException: <p>The request was rejected because it doesn't have valid credentials for the target resource.</p>
capo_resource_groups.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_resource_groups.types.search_resources_input.SearchResourcesInput]",
) -> AsyncOperationResponse[
"capo_resource_groups.types.search_resources_output.SearchResourcesOutput"
]:
import capo_resource_groups._operations.ardi.search_resources
(
output,
http_response,
) = await capo_resource_groups._operations.ardi.search_resources.async_search_resources(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("SearchResources")
)
input_: capo_resource_groups.types.search_resources_input.SearchResourcesInput = {
"resource_query": resource_query
}
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
|