- HTTP request
- Path parameters
- Query parameters
- Request body
- Response body
- Authorization scopes
- ResourceSearchResult
- VersionedResource
- AttachedResource
- RelatedResources
- RelatedResource
- AssetEnrichment
- ResourceOwners
- Try it!
Searches all Google Cloud resources within the specified scope, such as a project, folder, or organization. The caller must be granted the cloudasset.assets.searchAllResources
permission on the desired scope, otherwise the request will be rejected.
HTTP request
GET https://cloudasset.googleapis.com/v1/{scope=*/*}:searchAllResources
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
scope |
Required. A scope can be a project, a folder, or an organization. The search is limited to the resources within the The allowed values are:
Authorization requires the following IAM permission on the specified resource
|
Query parameters
Parameters | |
---|---|
query |
Optional. The query statement. See how to construct a query for more information. If not specified or empty, it will search all the resources within the specified Examples:
|
assetTypes[] |
Optional. A list of asset types that this request searches for. If empty, it will search all the asset types supported by search APIs. Regular expressions are also supported. For example:
See RE2 for all supported regular expression syntax. If the regular expression does not match any supported asset type, an INVALID_ARGUMENT error will be returned. |
pageSize |
Optional. The page size for search result pagination. Page size is capped at 500 even if a larger value is given. If set to zero or a negative value, server will pick an appropriate default. Returned results may be fewer than requested. When this happens, there could be more results as long as |
pageToken |
Optional. If present, then retrieve the next batch of results from the preceding call to this method. |
orderBy |
Optional. A comma-separated list of fields specifying the sorting order of the results. The default order is ascending. Add " DESC" after the field name to indicate descending order. Redundant space characters are ignored. Example: "location DESC, name". Only the following fields in the response are sortable:
|
readMask |
Optional. A comma-separated list of fields that you want returned in the results. The following fields are returned by default if not specified:
Some fields of large size, such as This is a comma-separated list of fully qualified names of fields. Example: |
Request body
The request body must be empty.
Response body
Search all resources response.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{
"results": [
{
object ( |
Fields | |
---|---|
results[] |
A list of Resources that match the search query. It contains the resource standard metadata information. |
nextPageToken |
If there are more results than those appearing in this response, then |
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
ResourceSearchResult
A result of Resource Search, containing information of a cloud resource.
JSON representation |
---|
{ "name": string, "assetType": string, "project": string, "folders": [ string ], "organization": string, "displayName": string, "description": string, "location": string, "labels": { string: string, ... }, "networkTags": [ string ], "kmsKey": string, "kmsKeys": [ string ], "createTime": string, "updateTime": string, "state": string, "additionalAttributes": { object }, "parentFullResourceName": string, "versionedResources": [ { object ( |
Fields | |
---|---|
name |
The full resource name of this resource. Example: To search against the
|
assetType |
The type of this resource. Example: To search against the
|
project |
The project that this resource belongs to, in the form of projects/{PROJECT_NUMBER}. This field is available when the resource belongs to a project. To search against
|
folders[] |
The folder(s) that this resource belongs to, in the form of folders/{FOLDER_NUMBER}. This field is available when the resource belongs to one or more folders. To search against
|
organization |
The organization that this resource belongs to, in the form of organizations/{ORGANIZATION_NUMBER}. This field is available when the resource belongs to an organization. To search against
|
displayName |
The display name of this resource. This field is available only when the resource's Protobuf contains it. To search against the
|
description |
One or more paragraphs of text description of this resource. Maximum length could be up to 1M bytes. This field is available only when the resource's Protobuf contains it. To search against the
|
location |
Location can be To search against the
|
labels |
User labels associated with this resource. See Labelling and grouping Google Cloud resources for more information. This field is available only when the resource's Protobuf contains it. To search against the
An object containing a list of |
networkTags[] |
Network tags associated with this resource. Like labels, network tags are a type of annotations used to group Google Cloud resources. See Labelling Google Cloud resources for more information. This field is available only when the resource's Protobuf contains it. To search against the
|
kmsKey |
The Cloud KMS CryptoKey name or CryptoKeyVersion name. This field only presents for the purpose of backward compatibility. Use the To search against the
|
kmsKeys[] |
The Cloud KMS CryptoKey names or CryptoKeyVersion names. This field is available only when the resource's Protobuf contains it. To search against the
|
createTime |
The create timestamp of this resource, at which the resource was created. The granularity is in seconds. Timestamp.nanos will always be 0. This field is available only when the resource's Protobuf contains it. To search against
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
updateTime |
The last update timestamp of this resource, at which the resource was last modified or deleted. The granularity is in seconds. Timestamp.nanos will always be 0. This field is available only when the resource's Protobuf contains it. To search against
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: |
state |
The state of this resource. Different resources types have different state definitions that are mapped from various fields of different resource types. This field is available only when the resource's Protobuf contains it. Example: If the resource is an instance provided by Compute Engine, its state will include PROVISIONING, STAGING, RUNNING, STOPPING, SUSPENDING, SUSPENDED, REPAIRING, and TERMINATED. See To search against the
|
additionalAttributes |
The additional searchable attributes of this resource. The attributes may vary from one resource type to another. Examples: You can search values of these fields through free text search. However, you should not consume the field programically as the field names and values may change as the Google Cloud service updates to a new incompatible API version. To search against the
|
parentFullResourceName |
The full resource name of this resource's parent, if it has one. To search against the
|
versionedResources[] |
Versioned resource representations of this resource. This is repeated because there could be multiple versions of resource representations during version migration. This |
attachedResources[] |
Attached resources of this resource. For example, an OSConfig Inventory is an attached resource of a Compute Instance. This field is repeated because a resource could have multiple attached resources. This |
relationships |
A map of related resources of this resource, keyed by the relationship type. A relationship type is in the format of {SourceType}_{ACTION}_{DestType}. Example: An object containing a list of |
tagKeys[] |
This field is only present for the purpose of backward compatibility. Use the TagKey namespaced names, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}. To search against the
|
tagValues[] |
This field is only present for the purpose of backward compatibility. Use the TagValue namespaced names, in the format of {ORG_ID}/{TAG_KEY_SHORT_NAME}/{TAG_VALUE_SHORT_NAME}. To search against the
|
tagValueIds[] |
This field is only present for the purpose of backward compatibility. Use the TagValue IDs, in the format of tagValues/{TAG_VALUE_ID}. To search against the
|
tags[] |
The tags directly attached to this resource. To search against the
|
effectiveTags[] |
The effective tags on this resource. All of the tags that are both attached to and inherited by a resource are collectively called the effective tags. For more information, see tag inheritance. To search against the
|
enrichments[] |
Enrichments of the asset. Currently supported enrichment types with v1.searchAllResources API:
The corresponding read masks in order to get the enrichment:
The corresponding required permissions:
Example query to get resource owner enrichment:
|
parentAssetType |
The type of this resource's immediate parent, if there is one. To search against the
|
sccSecurityMarks |
The actual content of Security Command Center security marks associated with the asset. To search against SCC SecurityMarks field:
An object containing a list of |
VersionedResource
Resource representation as defined by the corresponding service providing the resource for a given API version.
JSON representation |
---|
{ "version": string, "resource": { object } } |
Fields | |
---|---|
version |
API version of the resource. Example: If the resource is an instance provided by Compute Engine v1 API as defined in |
resource |
JSON representation of the resource as defined by the corresponding service providing this resource. Example: If the resource is an instance provided by Compute Engine, this field will contain the JSON representation of the instance as defined by Compute Engine: You can find the resource definition for each supported resource type in this table: |
AttachedResource
Attached resource representation, which is defined by the corresponding service provider. It represents an attached resource's payload.
JSON representation |
---|
{
"assetType": string,
"versionedResources": [
{
object ( |
Fields | |
---|---|
assetType |
The type of this attached resource. Example: You can find the supported attached asset types of each resource in this table: |
versionedResources[] |
Versioned resource representations of this attached resource. This is repeated because there could be multiple versions of the attached resource representations during version migration. |
RelatedResources
The related resources of the primary resource.
JSON representation |
---|
{
"relatedResources": [
{
object ( |
Fields | |
---|---|
relatedResources[] |
The detailed related resources of the primary resource. |
RelatedResource
The detailed related resource.
JSON representation |
---|
{ "assetType": string, "fullResourceName": string } |
Fields | |
---|---|
assetType |
The type of the asset. Example: |
fullResourceName |
The full resource name of the related resource. Example: |
AssetEnrichment
The enhanced metadata information for a resource.
JSON representation |
---|
{ // Union field |
Fields | |
---|---|
Union field
|
|
resourceOwners |
The resource owners for a resource. Note that this field only contains the members that have "roles/owner" role in the resource's IAM Policy. |
ResourceOwners
The resource owners information.
JSON representation |
---|
{ "resourceOwners": [ string ] } |
Fields | |
---|---|
resourceOwners[] |
List of resource owners. |