From 2f87ab685213e80ebcf723b4bbb5e5a4ae70b181 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 19 Aug 2022 20:22:19 +0000 Subject: [PATCH] chore: remove unused proto imports (#643) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 468735472 Source-Link: https://github.com/googleapis/googleapis/commit/cfa1b3782da7ccae31673d45401a0b79d2d4a84b Source-Link: https://github.com/googleapis/googleapis-gen/commit/09b7666656510f5b00b893f003a0ba5766f9e250 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDliNzY2NjY1NjUxMGY1YjAwYjg5M2YwMDNhMGJhNTc2NmY5ZTI1MCJ9 feat: Add client library support for AssetService v1 BatchGetEffectiveIamPolicies API Committer: haochunzhang@ PiperOrigin-RevId: 468010360 Source-Link: https://github.com/googleapis/googleapis/commit/4bda29977c0ba0f71873967509b4b715875fe393 Source-Link: https://github.com/googleapis/googleapis-gen/commit/8ed040614d04743f16cf4e4844b716fed998f94c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOGVkMDQwNjE0ZDA0NzQzZjE2Y2Y0ZTQ4NDRiNzE2ZmVkOTk4Zjk0YyJ9 feat: Release of query system Committer: lvv@ PiperOrigin-RevId: 466748663 Source-Link: https://github.com/googleapis/googleapis/commit/80d630f734c00f627511254d696149d9e0d7b635 Source-Link: https://github.com/googleapis/googleapis-gen/commit/252f5ade18a31a72f12810bbfd1d83d56a8e72e1 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjUyZjVhZGUxOGEzMWE3MmYxMjgxMGJiZmQxZDgzZDU2YThlNzJlMSJ9 feat: Add client library support for AssetService v1 BatchGetEffectiveIamPolicies API Committer: haochunzhang@ PiperOrigin-RevId: 466134014 Source-Link: https://github.com/googleapis/googleapis/commit/63c73fb06ed5920d9a69aa212cedf7481a4e5b4e Source-Link: https://github.com/googleapis/googleapis-gen/commit/2350945f7a70ecaaecf9a1fdd7d6e70ac50e862d Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjM1MDk0NWY3YTcwZWNhYWVjZjlhMWZkZDdkNmU3MGFjNTBlODYyZCJ9 --- .../v1/asset_service.query_assets.js | 120 ++++++++++++++++++ .../asset_service.search_all_iam_policies.js | 4 +- .../v1/asset_service.search_all_resources.js | 8 ++ ...nippet_metadata.google.cloud.asset.v1.json | 74 ++++++++++- 4 files changed, 203 insertions(+), 3 deletions(-) create mode 100644 asset/snippets/generated/v1/asset_service.query_assets.js diff --git a/asset/snippets/generated/v1/asset_service.query_assets.js b/asset/snippets/generated/v1/asset_service.query_assets.js new file mode 100644 index 00000000000..b84f4a568af --- /dev/null +++ b/asset/snippets/generated/v1/asset_service.query_assets.js @@ -0,0 +1,120 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START cloudasset_v1_generated_AssetService_QueryAssets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The relative name of the root asset. This can only be an + * organization number (such as "organizations/123"), a project ID (such as + * "projects/my-project-id"), or a project number (such as "projects/12345"), + * or a folder number (such as "folders/123"). + * Only assets belonging to the `parent` will be returned. + */ + // const parent = 'abc123' + /** + * Optional. A SQL statement that's compatible with BigQuery Standard + * SQL (http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). + */ + // const statement = 'abc123' + /** + * Optional. Reference to the query job, which is from the + * `QueryAssetsResponse` of previous `QueryAssets` call. + */ + // const jobReference = 'abc123' + /** + * Optional. The maximum number of rows to return in the results. Responses + * are limited to 10 MB and 1000 rows. + * By default, the maximum row count is 1000. When the byte or row count limit + * is reached, the rest of the query results will be paginated. + * The field will be ignored when output_config is specified. + */ + // const pageSize = 1234 + /** + * Optional. A page token received from previous `QueryAssets`. + * The field will be ignored when output_config is specified. + */ + // const pageToken = 'abc123' + /** + * Optional. Specifies the maximum amount of time that the client is willing + * to wait for the query to complete. By default, this limit is 5 min for the + * first query, and 1 minute for the following queries. If the query is + * complete, the `done` field in the `QueryAssetsResponse` is true, otherwise + * false. + * Like BigQuery jobs.query + * API (https://cloud.google.com/bigquery/docs/reference/rest/v2/jobs/query#queryrequest) + * The call is not guaranteed to wait for the specified timeout; it typically + * returns after around 200 seconds (200,000 milliseconds), even if the query + * is not complete. + * The field will be ignored when output_config is specified. + */ + // const timeout = {} + /** + * Optional. start_time is required. start_time must be less than + * end_time Defaults end_time to now if start_time is set and + * end_time isn't. Maximum permitted time range is 7 days. + */ + // const readTimeWindow = {} + /** + * Optional. Queries cloud assets as they appeared at the specified point in + * time. + */ + // const readTime = {} + /** + * Optional. Destination where the query results will be saved. + * When this field is specified, the query results won't be saved in the + * QueryAssetsResponse.query_result. Instead + * QueryAssetsResponse.output_config will be set. + * Meanwhile, QueryAssetsResponse.job_reference will be set and can be used + * to check the status of the query job when passed to a following + * QueryAssets API call. + */ + // const outputConfig = {} + + // Imports the Asset library + const {AssetServiceClient} = require('@google-cloud/asset').v1; + + // Instantiates a client + const assetClient = new AssetServiceClient(); + + async function callQueryAssets() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await assetClient.queryAssets(request); + console.log(response); + } + + callQueryAssets(); + // [END cloudasset_v1_generated_AssetService_QueryAssets_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/asset/snippets/generated/v1/asset_service.search_all_iam_policies.js b/asset/snippets/generated/v1/asset_service.search_all_iam_policies.js index 110dd00f85c..4149c7d86ef 100644 --- a/asset/snippets/generated/v1/asset_service.search_all_iam_policies.js +++ b/asset/snippets/generated/v1/asset_service.search_all_iam_policies.js @@ -46,8 +46,8 @@ function main(scope) { * compared against each Cloud IAM policy binding, including its principals, * roles, and Cloud IAM conditions. The returned Cloud IAM policies will only * contain the bindings that match your query. To learn more about the IAM - * policy structure, see IAM policy - * doc (https://cloud.google.com/iam/docs/policies#structure). + * policy structure, see the IAM policy + * documentation (https://cloud.google.com/iam/help/allow-policies/structure). * Examples: * * `policy:amy@gmail.com` to find IAM policy bindings that specify user * "amy@gmail.com". diff --git a/asset/snippets/generated/v1/asset_service.search_all_resources.js b/asset/snippets/generated/v1/asset_service.search_all_resources.js index 8c22917886c..a893363d6fd 100644 --- a/asset/snippets/generated/v1/asset_service.search_all_resources.js +++ b/asset/snippets/generated/v1/asset_service.search_all_resources.js @@ -59,6 +59,14 @@ function main(scope) { * * `labels.env:*` to find Cloud resources that have a label "env". * * `kmsKey:key` to find Cloud resources encrypted with a customer-managed * encryption key whose name contains the word "key". + * * `relationships:instance-group-1` to find Cloud resources that have + * relationships with "instance-group-1" in the related resource name. + * * `relationships:INSTANCE_TO_INSTANCEGROUP` to find compute instances that + * have relationships of type "INSTANCE_TO_INSTANCEGROUP". + * * `relationships.INSTANCE_TO_INSTANCEGROUP:instance-group-1` to find + * compute instances that have relationships with "instance-group-1" in the + * compute instance group resource name, for relationship type + * "INSTANCE_TO_INSTANCEGROUP". * * `state:ACTIVE` to find Cloud resources whose state contains "ACTIVE" as a * word. * * `NOT state:ACTIVE` to find Cloud resources whose state doesn't contain diff --git a/asset/snippets/generated/v1/snippet_metadata.google.cloud.asset.v1.json b/asset/snippets/generated/v1/snippet_metadata.google.cloud.asset.v1.json index 8d55ae162da..df028f8ba00 100644 --- a/asset/snippets/generated/v1/snippet_metadata.google.cloud.asset.v1.json +++ b/asset/snippets/generated/v1/snippet_metadata.google.cloud.asset.v1.json @@ -414,7 +414,7 @@ "segments": [ { "start": 25, - "end": 185, + "end": 193, "type": "FULL" } ], @@ -671,6 +671,78 @@ } } }, + { + "regionTag": "cloudasset_v1_generated_AssetService_QueryAssets_async", + "title": "AssetService queryAssets Sample", + "origin": "API_DEFINITION", + "description": " Issue a job that queries assets using a SQL statement compatible with [BigQuery Standard SQL](http://cloud/bigquery/docs/reference/standard-sql/enabling-standard-sql). If the query execution finishes within timeout and there's no pagination, the full query results will be returned in the `QueryAssetsResponse`. Otherwise, full query results can be obtained by issuing extra requests with the `job_reference` from the a previous `QueryAssets` call. Note, the query result has approximately 10 GB limitation enforced by BigQuery https://cloud.google.com/bigquery/docs/best-practices-performance-output, queries return larger results will result in errors.", + "canonical": true, + "file": "asset_service.query_assets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 112, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "QueryAssets", + "fullName": "google.cloud.asset.v1.AssetService.QueryAssets", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "statement", + "type": "TYPE_STRING" + }, + { + "name": "job_reference", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "timeout", + "type": ".google.protobuf.Duration" + }, + { + "name": "read_time_window", + "type": ".google.cloud.asset.v1.TimeWindow" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "output_config", + "type": ".google.cloud.asset.v1.QueryAssetsOutputConfig" + } + ], + "resultType": ".google.cloud.asset.v1.QueryAssetsResponse", + "client": { + "shortName": "AssetServiceClient", + "fullName": "google.cloud.asset.v1.AssetServiceClient" + }, + "method": { + "shortName": "QueryAssets", + "fullName": "google.cloud.asset.v1.AssetService.QueryAssets", + "service": { + "shortName": "AssetService", + "fullName": "google.cloud.asset.v1.AssetService" + } + } + } + }, { "regionTag": "cloudasset_v1_generated_AssetService_CreateSavedQuery_async", "title": "AssetService createSavedQuery Sample",