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

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
descriptionstringThe description of this saved query. This value should be fewer than 255 characters.
contentobjectThe query content.
createTimestringOutput only. The create time of this saved query.
creatorstringOutput only. The account's email address who has created this saved query.
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.
lastUpdateTimestringOutput 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

NameAccessible byRequired ParamsDescription
getSELECTnameGets details about a saved query.
listSELECTparent, parentTypeLists all saved queries in a parent project/folder/organization.
createINSERTparent, parentTypeCreates a saved query in a parent project/folder/organization.
deleteDELETEnameDeletes a saved query.
patchUPDATEnameUpdates a saved query.

SELECT examples

Gets details about a saved query.

SELECT
name,
description,
content,
createTime,
creator,
labels,
lastUpdateTime,
lastUpdater
FROM google.cloudasset.saved_queries
WHERE name = '{{ name }}';

INSERT example

Use the following StackQL query and manifest file to create a new saved_queries resource.

/*+ create */
INSERT INTO google.cloudasset.saved_queries (
parent,
parentType,
name,
description,
labels,
content
)
SELECT
'{{ parent }}',
'{{ parentType }}',
'{{ name }}',
'{{ description }}',
'{{ labels }}',
'{{ content }}'
;

UPDATE example

Updates a saved_queries resource.

/*+ update */
UPDATE google.cloudasset.saved_queries
SET
name = '{{ name }}',
description = '{{ description }}',
labels = '{{ labels }}',
content = '{{ content }}'
WHERE
name = '{{ name }}';

DELETE example

Deletes the specified saved_queries resource.

/*+ delete */
DELETE FROM google.cloudasset.saved_queries
WHERE name = '{{ name }}';