Find instances of resources (v3)

POST /v3/resources/search

Find IAM-enabled resources or storage and network resources that run on classic infrastructure in a specific account ID.

You must use `/v3/resources/search` when you need to fetch more than `10000` resource items. On the first call, the operation returns a live cursor on the data that you must use on all the subsequent calls to get the next batch of results until you get the empty result set.

To filter results, you can apply query strings following the Lucene query syntax.

By default, the fields that are returned for every resource are crn, name, family, type, and account_id. You can specify the subset of the fields you want in your request using the `fields` request body attribute. Set `"fields": ["*"]` to discover the complete set of fields which are available to request.

Authorization

To call this method, you must be assigned one or more IAM access roles that include the following action.

  • global-search-tagging.resource.read

Request

Request Body

ScanBody

It contains the query filters on the first operation call, or the search_cursor on next calls. On subsequent calls, set the `search_cursor` to the value returned by the previous call. After the first, you must set only the `search_cursor`. Any other parameter but the `search_cursor` are ignored. The `search_cursor` encodes all the information that needs to get the next batch of `limit` data.

query

string

The Lucene-formatted query string. Default to '*' if not set.

fields

array

The list of the fields returned by the search. By default, the returned fields are the `account_id`, `name`, `type`, `family`, and `crn`. For all queries, `crn` is always returned. You may set `"fields": ["*"]` to discover the set of fields available to request.

search_cursor

string

An opaque cursor that is returned on each call and that must be set on the subsequent call to get the next batch of items. You can stop paging when the search returns less items than the specified `limit` or when the `search_cursor` is not present in the response. NOTE: when setting this parameter, any other properties present in the body will be ignored.

Path Parameters

Query Parameters

account_id

string

The account ID to filter resources.

limit

integer

The maximum number of hits to return. Defaults to 10.

timeout

integer

A search timeout in milliseconds, bounding the search request to run within the specified time value and bail with the hits accumulated up to that point when expired. Defaults to the system defined timeout.

sort

array

Comma separated properties names that are used for sorting

is_deleted

string

Determines if deleted documents should be included in result set or not. Possible values are false (default), true or any. If false, only existing documents are returned; if true, only deleted documents are returned; If any, both existing and deleted documents are returned. (for administrators only).

is_reclaimed

string

Determines if reclaimed documents should be included in result set or not. Possible values are false (default), true or any. If false, only not reclaimed documents are returned; if true, only reclaimed documents are returned; If any, both reclaimed and not reclaimed documents are returned.

impersonate_user

string

The user on whose behalf the search must be performed. Only a GhoST admin can impersonate a user, so be sure you set a GhoST admin IAM token in the Authorization header if you set this parameter. (for administrators only).

can_tag

string

Determines if the result set must return the resources that the user can tag or the resources that the user can view (only a GhoST admin can use this parameter). If false (default), only resources user can view are returned; if true, only resources that user has permissions for tagging are returned (for administrators only).

is_project_resource

string

Determines if documents belonging to Project family should be included in result set or not. Possible values are false (default), true or any. If false, documents belonging to all families except Project are returned; if true, only documents belonging to Project family are returned; if any, documents of any family are returned. Only authorized ServiceIds can use this query parameter.

Response

200 - A result paging with the list of resources that match the provided filters.

search_cursor

string

The search cursor to use on all calls after the first one.

limit

integer

Value of the limit parameter specified by the user

items

array

The array of results. Each item represents a resource. For each resource, the requested `fields` are returned. If you did not set the `fields` request body parameter, then the `account_id`, `name`, `type`, `family`, and `crn` are returned. An empty array signals the end of the result set, which means there are no more results to fetch

400 - Bad Request

errors

array

List of errors that were encountered in processing the request

401 - Unauthorized / Wrong auth token type IAM / Auth token not valid

errors

array

List of errors that were encountered in processing the request

403 - Unauthorized operation

errors

array

List of errors that were encountered in processing the request

429 - Too Many Requests

500 - Internal Server Error / IAM not initialized / Malformed IAM credentials

errors

array

List of errors that were encountered in processing the request

502 - Search IAM error

errors

array

List of errors that were encountered in processing the request

default - System problem or unexpected error