Find instances of resources (v2)

POST /v2/resources/search

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

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

Only resources that belong to the account ID and that are accessible by the client are returned.

The usage of this API is deprecated for cases when the provider is not specified or `provider=ghost`. `/v3/resources/search` replaces this API for the deprecated cases.

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

SearchBody

It contains the query filters, the list of fields to be returned, and the search token (initially set to null or undefined)

query

Required *

string

The query string

fields

array

The list of the fields that are returned by the search. The CRN is always returned.

token

string

An opaque token. Initially set to null or undefined, then passes the value that was returned by the previous call

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.

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.

offset

integer

The offset is the index of the item you want to start returning data from. Default is 0.

sort

string

Comma separated properties name that is used for sorting

provider

string

Search providers. Supported values are `ghost` and `ims`. If not specified, the defaults to `ghost`. Specify a single provider.

Response

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

token

string

The search token to use on the next call.

more_data

boolean

If false, there is no more data to retrieve on the next page. If true, it's possible that there is more data to retrieve on the next page.

items

array

The array of results. Each item represents a resource and contains all visible properties that are associated with it.

filter_error

boolean

It is set to true if the result is a partial of an IAM error when user authorization is validated on one or more resources. This field is DEPRECATED and will be removed in future versions of this API

partial_data

integer

Indicates if the result that is set might be partial or not. Value 0 means that the result set is complete. A value greater than 0 means that the result set might be incomplete. Its single bits identify the cause. The first bit means that the error is in the IAM filter. The second bit means that errors are in elasticsearch shards.

offset

integer

Offset parameter specified by the user

limit

integer

Limit parameter specified by the user

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

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