Skip to content

Commit 861277e

Browse files
authored
Merge branch 'main' into chore/node-16-upgrade
2 parents cad7ca5 + 9a37b21 commit 861277e

24 files changed

+195
-139
lines changed

batch/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"publish": "echo 'sample test; do not publish'"
1515
},
1616
"dependencies": {
17-
"@google-cloud/batch": "^0.9.0"
17+
"@google-cloud/batch": "^0.10.0"
1818
},
1919
"devDependencies": {
2020
"c8": "^8.0.0",

mediatranslation/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Media Translation API deprication
2+
3+
Media Translation API is [deprecated] and will no longer be available on Google Cloud after July 1, 2024.
4+
All API code samples under this folder are no longer maintained and will be removed after July 1, 2024.
5+
6+
[deprecated]: https://cloud.google.com/translate/media/docs/deprecations

mediatranslation/test/quickstart.test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ const cmd = 'node quickstart.js';
2323
const filePath = path.join(__dirname, '..', 'resources/audio.raw');
2424
const exec = cmd => execSync(cmd, {encoding: 'utf-8'});
2525

26+
// skip this test because testing code sample is deprecated
2627
describe('Quickstart', () => {
27-
it('should translate from a streamed file', async () => {
28+
it.skip('should translate from a streamed file', async () => {
2829
const stdout = exec(`${cmd} ${filePath} linear16 en-US es-ES`);
2930
assert.include(stdout, 'Partial translation');
3031
});

mediatranslation/test/translate_from_file.test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ const cmd = 'node translate_from_file.js';
2323
const filePath = path.join(__dirname, '..', 'resources/audio.raw');
2424
const exec = cmd => execSync(cmd, {encoding: 'utf-8'});
2525

26+
// skip this test because testing code sample is deprecated
2627
describe('MediaTranslation', () => {
27-
it('should translate from a streamed file', async () => {
28+
it.skip('should translate from a streamed file', async () => {
2829
const stdout = exec(`${cmd} ${filePath} linear16 en-US es-ES`);
2930
assert.include(stdout, 'Partial translation');
3031
});

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"eslint-config-prettier": "^8.8.0",
2525
"eslint-plugin-node": "^11.1.0",
2626
"eslint-plugin-prettier": "^4.2.1",
27-
"gts": "^3.1.1",
27+
"gts": "^4.0.1",
2828
"mocha": "^10.2.0",
2929
"nunjucks": "^3.2.4",
3030
"prettier": "^2.8.7",

security-center/snippets/v1/addDeleteSecurityMarks.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'use strict';
1515

1616
/**
17-
* Demostrates adding/updating at the same time as deleting security
17+
* Demonstrates adding/updating at the same time as deleting security
1818
* marks from an asset.
1919
*/
2020
function main(assetName = 'full asset path to add marks to') {
@@ -27,10 +27,10 @@ function main(assetName = 'full asset path to add marks to') {
2727

2828
async function addDeleteSecurityMarks() {
2929
// assetName is the full resource path for the asset to update.
30-
/*
31-
* TODO(developer): Uncomment the following lines
32-
*/
33-
// assetName = "organizations/123123342/assets/12312321";
30+
// Specify the value of 'assetName' in one of the following formats:
31+
// `organizations/${org-id}/assets/${asset-id}`;
32+
// `projects/${project-id}/assets/${asset-id}`;
33+
// `folders/${folder-id}/assets/${asset-id}`;
3434
const [newMarks] = await client.updateSecurityMarks({
3535
securityMarks: {
3636
name: `${assetName}/securityMarks`,

security-center/snippets/v1/addFindingSecurityMarks.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ function main(findingName = 'full finding path to add marks to') {
2929
/*
3030
* TODO(developer): Uncomment the following lines
3131
*/
32-
// const findingName =
33-
// "organizations/123123342/sources/1213/findings/findingid";
32+
// Specify the value of 'findingName' in one of the following formats:
33+
// `organizations/${org-id}/assets/${asset-id}/findings/${finding-id}`;
34+
// `projects/${project-id}/assets/${asset-id}/findings/${finding-id}`;
35+
// `folders/${folder-id}/assets/${asset-id}/findings/${finding-id}`;
3436
const [newMarks] = await client.updateSecurityMarks({
3537
securityMarks: {
3638
name: `${findingName}/securityMarks`,

security-center/snippets/v1/addSecurityMarks.js

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ function main(assetName = 'full asset path to add marks to') {
3030
/*
3131
* TODO(developer): Uncomment the following lines
3232
*/
33+
// Specify the value of 'assetName' in one of the following formats:
34+
// `organizations/${org-id}/assets/${asset-id}`;
35+
// `projects/${project-id}/assets/${asset-id}`;
36+
// `folders/${folder-id}/assets/${asset-id}`;
3337
// const assetName = "organizations/123123342/assets/12312321";
3438
const [newMarks] = await client.updateSecurityMarks({
3539
securityMarks: {

security-center/snippets/v1/createNotificationConfig.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@ function main(
2424

2525
const client = new SecurityCenterClient();
2626

27-
// organizationId = "your-org-id";
27+
// parent: must be in one of the following formats:
28+
// `organizations/${organization_id}`
29+
// `projects/${project_id}`
30+
// `folders/${folder_id}`
2831
// configId = "your-config-name";
2932
// pubsubTopic = "projects/{your-project}/topics/{your-topic}";
3033
// Ensure this Service Account has the "pubsub.topics.setIamPolicy" permission on this topic.
31-
32-
const orgName = client.organizationPath(organizationId);
34+
const parent = `organizations/${organizationId}`;
3335

3436
async function createNotificationConfig() {
3537
const [response] = await client.createNotificationConfig({
36-
parent: orgName,
38+
parent: parent,
3739
configId: configId,
3840
notificationConfig: {
3941
description: 'Sample config for node.js',

security-center/snippets/v1/deleteNotificationConfig.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') {
2020

2121
const client = new SecurityCenterClient();
2222

23-
// organizationId = "your-org-id";
23+
// formattedConfigName: You can also use
24+
// `client.projectNotificationConfigPath(projectId, configId)` or
25+
// `client.folderNotificationConfigPath(folderId, configId)`.
2426
// configId = "your-config-id";
2527
const formattedConfigName = client.organizationNotificationConfigPath(
2628
organizationId,

security-center/snippets/v1/deleteSecurityMarks.js

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ function main(assetName = 'full asset path to add marks to') {
3030
/*
3131
* TODO(developer): Uncomment the following lines
3232
*/
33+
// Specify the value of 'assetName' in one of the following formats:
34+
// `organizations/${org-id}/assets/${asset-id}`;
35+
// `projects/${project-id}/assets/${asset-id}`;
36+
// `folders/${folder-id}/assets/${asset-id}`;
3337
// const assetName = "organizations/123123342/assets/12312321";
3438
const [newMarks] = await client.updateSecurityMarks({
3539
securityMarks: {

security-center/snippets/v1/getNotificationConfig.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') {
2020

2121
const client = new SecurityCenterClient();
2222

23-
// organizationId = "your-org-id";
23+
// formattedConfigName: You can also use
24+
// `client.projectNotificationConfigPath(projectId, configId)` or
25+
// `client.folderNotificationConfigPath(folderId, configId)`.
2426
// configId = "your-config-id";
2527
const formattedConfigName = client.organizationNotificationConfigPath(
2628
organizationId,

security-center/snippets/v1/listAllAssets.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
2626
/*
2727
* TODO(developer): Uncomment the following lines
2828
*/
29-
// const organizationId = "111122222444";
30-
const orgName = client.organizationPath(organizationId);
29+
// parent: must be in one of the following formats:
30+
// `organizations/${organization_id}`
31+
// `projects/${project_id}`
32+
// `folders/${folder_id}`
33+
const parent = `organizations/${organizationId}`;
3134
// Call the API with automatic pagination.
3235
async function listAssets() {
33-
const [response] = await client.listAssets({parent: orgName});
36+
const [response] = await client.listAssets({parent: parent});
3437
let count = 0;
3538
Array.from(response).forEach(result =>
3639
console.log(

security-center/snippets/v1/listAllFindings.js

+17-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
/*
2-
* Copyright 2019, Google, LLC.
3-
* Licensed under the Apache License, Version 2.0 (the "License");
4-
* you may not use this file except in compliance with the License.
5-
* You may obtain a copy of the License at
6-
*
7-
* https://www.apache.org/licenses/LICENSE-2.0
8-
*
9-
* Unless required by applicable law or agreed to in writing, software
10-
* distributed under the License is distributed on an "AS IS" BASIS,
11-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
* See the License for the specific language governing permissions and
13-
* limitations under the License.
14-
*/
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
1514
'use strict';
1615

1716
/** Prints all findings across all sources. */
@@ -31,6 +30,10 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
3130
async function listAllFindings() {
3231
const [response] = await client.listFindings({
3332
// List findings across all sources.
33+
// parent: must be in one of the following formats:
34+
// `organizations/${organization_id}/sources/-`
35+
// `projects/${project_id}/sources/-`
36+
// `folders/${folder_id}/sources/-`
3437
parent: `organizations/${organizationId}/sources/-`,
3538
});
3639
let count = 0;

security-center/snippets/v1/listAllSources.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
2626
/*
2727
* TODO(developer): Uncomment the following lines
2828
*/
29-
// const organizaionId = "111122222444";
30-
const orgName = client.organizationPath(organizationId);
29+
// parent: must be in one of the following formats:
30+
// `organizations/${organization_id}`
31+
// `projects/${project_id}`
32+
// `folders/${folder_id}`
33+
const parent = `organizations/${organizationId}`;
3134
// Call the API with automatic pagination.
3235
async function listSources() {
33-
const [response] = await client.listSources({parent: orgName});
36+
const [response] = await client.listSources({parent: parent});
3437
let count = 0;
3538
console.log('Sources:');
3639
Array.from(response).forEach(source =>

security-center/snippets/v1/listAssetsAndChanges.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
2929
/*
3030
* TODO(developer): Uncomment the following lines
3131
*/
32-
// const organizationId = "1234567777";
33-
const orgName = client.organizationPath(organizationId);
32+
// parent: must be in one of the following formats:
33+
// `organizations/${organization_id}`
34+
// `projects/${project_id}`
35+
// `folders/${folder_id}`
36+
const parent = `organizations/${organizationId}`;
3437
// Call the API with automatic pagination.
3538
async function listAssetsAndChanges() {
3639
const [response] = await client.listAssets({
37-
parent: orgName,
40+
parent: parent,
3841
compareDuration: {seconds: 30 * /*Second in Day=*/ 86400, nanos: 0},
3942
filter:
4043
'security_center_properties.resource_type="google.cloud.resourcemanager.Project"',

security-center/snippets/v1/listAssetsAtTime.js

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
/*
2-
* Copyright 2019, Google, LLC.
3-
* Licensed under the Apache License, Version 2.0 (the "License");
4-
* you may not use this file except in compliance with the License.
5-
* You may obtain a copy of the License at
6-
*
7-
* https://www.apache.org/licenses/LICENSE-2.0
8-
*
9-
* Unless required by applicable law or agreed to in writing, software
10-
* distributed under the License is distributed on an "AS IS" BASIS,
11-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
* See the License for the specific language governing permissions and
13-
* limitations under the License.
14-
*/
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
1514
'use strict';
1615

1716
/**
@@ -28,16 +27,19 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
2827
/*
2928
* TODO(developer): Uncomment the following lines
3029
*/
31-
// const organizationId = "1234567777";
32-
const orgName = client.organizationPath(organizationId);
30+
// parent: must be in one of the following formats:
31+
// `organizations/${organization_id}`
32+
// `projects/${project_id}`
33+
// `folders/${folder_id}`
34+
const parent = `organizations/${organizationId}`;
3335

3436
const oneDayAgo = new Date();
3537
oneDayAgo.setDate(oneDayAgo.getDate() - 1);
3638

3739
// Call the API with automatic pagination.
3840
async function listAssetsAtTime() {
3941
const [response] = await client.listAssets({
40-
parent: orgName,
42+
parent: parent,
4143
filter:
4244
'security_center_properties.resource_type="google.cloud.resourcemanager.Project"',
4345
// readTime must be in the form of a google.protobuf.Timestamp object

security-center/snippets/v1/listAssetsWithSecurityMarks.js

+19-17
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
/*
2-
* Copyright 2019, Google, LLC.
3-
* Licensed under the Apache License, Version 2.0 (the "License");
4-
* you may not use this file except in compliance with the License.
5-
* You may obtain a copy of the License at
6-
*
7-
* https://www.apache.org/licenses/LICENSE-2.0
8-
*
9-
* Unless required by applicable law or agreed to in writing, software
10-
* distributed under the License is distributed on an "AS IS" BASIS,
11-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
* See the License for the specific language governing permissions and
13-
* limitations under the License.
14-
*/
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
1514
'use strict';
1615

1716
/**
@@ -28,13 +27,16 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
2827
/*
2928
* TODO(developer): Uncomment the following lines
3029
*/
31-
// const organizationId = "1234567777";
32-
const orgName = client.organizationPath(organizationId);
30+
// parent: must be in one of the following formats:
31+
// `organizations/${organization_id}`
32+
// `projects/${project_id}`
33+
// `folders/${folder_id}`
34+
const parent = `organizations/${organizationId}`;
3335

3436
// Call the API with automatic pagination.
3537
async function listAssetsWithSecurityMarks() {
3638
const [response] = await client.listAssets({
37-
parent: orgName,
39+
parent: parent,
3840
filter: 'security_marks.marks.key_a="value_a"',
3941
});
4042
let count = 0;

security-center/snippets/v1/listFilteredAssets.js

+15-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
/*
2-
* Copyright 2019, Google, LLC.
3-
* Licensed under the Apache License, Version 2.0 (the "License");
4-
* you may not use this file except in compliance with the License.
5-
* You may obtain a copy of the License at
6-
*
7-
* https://www.apache.org/licenses/LICENSE-2.0
8-
*
9-
* Unless required by applicable law or agreed to in writing, software
10-
* distributed under the License is distributed on an "AS IS" BASIS,
11-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12-
* See the License for the specific language governing permissions and
13-
* limitations under the License.
14-
*/
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
1514
'use strict';
1615

1716
/**
@@ -32,6 +31,8 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
3231
const orgName = client.organizationPath(organizationId);
3332

3433
// Call the API with automatic pagination.
34+
// You can also list assets in a project/ folder. To do so, modify the parent
35+
// value and filter condition.
3536
async function listFilteredAssets() {
3637
const [response] = await client.listAssets({
3738
parent: orgName,

0 commit comments

Comments
 (0)