-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add SavedQuery CURD support (#627)
* feat: Add SavedQuery CURD support feat: Add tags support feat!:*Add RelatedAsset and deprecate RelatedAssets for relationship GA *The previous representation of the relationship feature is deprecated and unimplemented. The RelatedAsset message represents the new stable format. PiperOrigin-RevId: 449306805 Source-Link: googleapis/googleapis@3d7bd9d Source-Link: https://github.com/googleapis/googleapis-gen/commit/71a93d05d6076271d04b7592f7fad0d3f0c7a040 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzFhOTNkMDVkNjA3NjI3MWQwNGI3NTkyZjdmYWQwZDNmMGM3YTA0MCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
41027fe
commit a9b112e
Showing
15 changed files
with
805 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
asset/snippets/generated/v1/asset_service.batch_get_effective_iam_policies.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// 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(scope, names) { | ||
// [START cloudasset_v1_generated_AssetService_BatchGetEffectiveIamPolicies_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. Only IAM policies on or below the scope will be returned. | ||
* This can only be an organization number (such as "organizations/123"), a | ||
* folder number (such as "folders/123"), a project ID (such as | ||
* "projects/my-project-id"), or a project number (such as "projects/12345"). | ||
* To know how to get organization id, visit here | ||
* (https://cloud.google.com/resource-manager/docs/creating-managing-organization#retrieving_your_organization_id). | ||
* To know how to get folder or project id, visit here | ||
* (https://cloud.google.com/resource-manager/docs/creating-managing-folders#viewing_or_listing_folders_and_projects). | ||
*/ | ||
// const scope = 'abc123' | ||
/** | ||
* Required. The names refer to the full_resource_names | ||
* (https://cloud.google.com/asset-inventory/docs/resource-name-format) | ||
* of searchable asset | ||
* types (https://cloud.google.com/asset-inventory/docs/supported-asset-types#searchable_asset_types). | ||
* A maximum of 20 resources' effective policies can be retrieved in a batch. | ||
*/ | ||
// const names = 'abc123' | ||
|
||
// Imports the Asset library | ||
const {AssetServiceClient} = require('@google-cloud/asset').v1; | ||
|
||
// Instantiates a client | ||
const assetClient = new AssetServiceClient(); | ||
|
||
async function callBatchGetEffectiveIamPolicies() { | ||
// Construct request | ||
const request = { | ||
scope, | ||
names, | ||
}; | ||
|
||
// Run request | ||
const response = await assetClient.batchGetEffectiveIamPolicies(request); | ||
console.log(response); | ||
} | ||
|
||
callBatchGetEffectiveIamPolicies(); | ||
// [END cloudasset_v1_generated_AssetService_BatchGetEffectiveIamPolicies_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
asset/snippets/generated/v1/asset_service.create_saved_query.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// 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, savedQuery, savedQueryId) { | ||
// [START cloudasset_v1_generated_AssetService_CreateSavedQuery_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the project/folder/organization where this | ||
* saved_query should be created in. It can only be an organization number | ||
* (such as "organizations/123"), a folder number (such as "folders/123"), a | ||
* project ID (such as "projects/my-project-id")", or a project number (such | ||
* as "projects/12345"). | ||
*/ | ||
// const parent = 'abc123' | ||
/** | ||
* Required. The saved_query details. The `name` field must be empty as it | ||
* will be generated based on the parent and saved_query_id. | ||
*/ | ||
// const savedQuery = {} | ||
/** | ||
* Required. The ID to use for the saved query, which must be unique in the | ||
* specified parent. It will become the final component of the saved query's | ||
* resource name. | ||
* This value should be 4-63 characters, and valid characters | ||
* are /[a-z][0-9]-/. | ||
* Notice that this field is required in the saved query creation, and the | ||
* `name` field of the `saved_query` will be ignored. | ||
*/ | ||
// const savedQueryId = 'abc123' | ||
|
||
// Imports the Asset library | ||
const {AssetServiceClient} = require('@google-cloud/asset').v1; | ||
|
||
// Instantiates a client | ||
const assetClient = new AssetServiceClient(); | ||
|
||
async function callCreateSavedQuery() { | ||
// Construct request | ||
const request = { | ||
parent, | ||
savedQuery, | ||
savedQueryId, | ||
}; | ||
|
||
// Run request | ||
const response = await assetClient.createSavedQuery(request); | ||
console.log(response); | ||
} | ||
|
||
callCreateSavedQuery(); | ||
// [END cloudasset_v1_generated_AssetService_CreateSavedQuery_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
62 changes: 62 additions & 0 deletions
62
asset/snippets/generated/v1/asset_service.delete_saved_query.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// 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(name) { | ||
// [START cloudasset_v1_generated_AssetService_DeleteSavedQuery_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the saved query to delete. It must be in the format | ||
* of: | ||
* * projects/project_number/savedQueries/saved_query_id | ||
* * folders/folder_number/savedQueries/saved_query_id | ||
* * organizations/organization_number/savedQueries/saved_query_id | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Asset library | ||
const {AssetServiceClient} = require('@google-cloud/asset').v1; | ||
|
||
// Instantiates a client | ||
const assetClient = new AssetServiceClient(); | ||
|
||
async function callDeleteSavedQuery() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await assetClient.deleteSavedQuery(request); | ||
console.log(response); | ||
} | ||
|
||
callDeleteSavedQuery(); | ||
// [END cloudasset_v1_generated_AssetService_DeleteSavedQuery_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
asset/snippets/generated/v1/asset_service.get_saved_query.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// 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(name) { | ||
// [START cloudasset_v1_generated_AssetService_GetSavedQuery_async] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
/** | ||
* Required. The name of the saved query and it must be in the format of: | ||
* * projects/project_number/savedQueries/saved_query_id | ||
* * folders/folder_number/savedQueries/saved_query_id | ||
* * organizations/organization_number/savedQueries/saved_query_id | ||
*/ | ||
// const name = 'abc123' | ||
|
||
// Imports the Asset library | ||
const {AssetServiceClient} = require('@google-cloud/asset').v1; | ||
|
||
// Instantiates a client | ||
const assetClient = new AssetServiceClient(); | ||
|
||
async function callGetSavedQuery() { | ||
// Construct request | ||
const request = { | ||
name, | ||
}; | ||
|
||
// Run request | ||
const response = await assetClient.getSavedQuery(request); | ||
console.log(response); | ||
} | ||
|
||
callGetSavedQuery(); | ||
// [END cloudasset_v1_generated_AssetService_GetSavedQuery_async] | ||
} | ||
|
||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); | ||
main(...process.argv.slice(2)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.