Skip to main content

saved_queries

Creates, updates, deletes, gets or lists a saved_queries resource.

Overview​

Namesaved_queries
TypeResource
Idgoogle.cloudasset.saved_queries

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe resource name of the saved query. The format must be: * projects/project_number/savedQueries/saved_query_id * folders/folder_number/savedQueries/saved_query_id * organizations/organization_number/savedQueries/saved_query_id
contentobjectThe query content. (id: QueryContent)
createTimestring (google-datetime)Output only. The create time of this saved query.
creatorstringOutput only. The account's email address who has created this saved query.
descriptionstringThe description of this saved query. This value should be fewer than 255 characters.
labelsobjectLabels applied on the resource. This value should not contain more than 10 entries. The key and value of each entry must be non-empty and fewer than 64 characters.
lastUpdateTimestring (google-datetime)Output only. The last update time of this saved query.
lastUpdaterstringOutput only. The account's email address who has updated this saved query most recently.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectparentType, parentfilter, pageSize, pageTokenLists all saved queries in a parent project/folder/organization.
createinsertparentType, parentsavedQueryIdCreates a saved query in a parent project/folder/organization.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
parentstring
parentTypestring
filterstring
pageSizeinteger (int32)
pageTokenstring
savedQueryIdstring

SELECT examples​

Lists all saved queries in a parent project/folder/organization.

SELECT
name,
content,
createTime,
creator,
description,
labels,
lastUpdateTime,
lastUpdater
FROM google.cloudasset.saved_queries
WHERE parentType = '{{ parentType }}' -- required
AND parent = '{{ parent }}' -- required
AND filter = '{{ filter }}'
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
;

INSERT examples​

Creates a saved query in a parent project/folder/organization.

INSERT INTO google.cloudasset.saved_queries (
data__content,
data__description,
data__labels,
data__name,
parentType,
parent,
savedQueryId
)
SELECT
'{{ content }}',
'{{ description }}',
'{{ labels }}',
'{{ name }}',
'{{ parentType }}',
'{{ parent }}',
'{{ savedQueryId }}'
RETURNING
name,
content,
createTime,
creator,
description,
labels,
lastUpdateTime,
lastUpdater
;