Skip to content

Commit 217a4ec

Browse files
authored
Merge branch 'main' into rebeccaellis-import-user-events-from-big-query
2 parents 603f559 + 3270d61 commit 217a4ec

21 files changed

+856
-5
lines changed

retail/interactive-tutorials/events/write-user-event.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
'use strict';
1616

17+
// [START retail_write_user_event]
1718
async function main() {
1819
// Imports the Google Cloud client library.
1920
const {UserEventServiceClient} = require('@google-cloud/retail').v2;
@@ -66,3 +67,4 @@ process.on('unhandledRejection', err => {
6667
});
6768

6869
main();
70+
// [END retail_write_user_event]

retail/interactive-tutorials/product/add-fulfillment-places.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
'use strict';
16-
16+
// [START retail_add_fulfillment_places]
1717
async function main(generatedProductId) {
1818
// Imports the Google Cloud client library.
1919
const {ProductServiceClient} = require('@google-cloud/retail').v2;
@@ -89,3 +89,4 @@ process.on('unhandledRejection', err => {
8989
});
9090

9191
main(...process.argv.slice(2));
92+
// [END retail_add_fulfillment_places]

retail/interactive-tutorials/product/import-products-inline-source.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
'use strict';
16-
16+
// [START retail_import_products_from_inline_source]
1717
async function main(id1, id2) {
1818
// Imports the Google Cloud client library.
1919
const {ProductServiceClient} = require('@google-cloud/retail').v2;
@@ -126,3 +126,4 @@ process.on('unhandledRejection', err => {
126126
});
127127

128128
main(...process.argv.slice(2));
129+
// [END retail_import_products_from_inline_source]

retail/interactive-tutorials/product/remove-fulfillment-places.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
'use strict';
1616

17+
// [START retail_remove_fulfillment_places]
18+
1719
async function main(generatedProductId) {
1820
// Imports the Google Cloud client library.
1921
const {ProductServiceClient} = require('@google-cloud/retail').v2;
@@ -84,3 +86,5 @@ process.on('unhandledRejection', err => {
8486
});
8587

8688
main(...process.argv.slice(2));
89+
90+
// [END retail_remove_fulfillment_places]

retail/interactive-tutorials/product/set-inventory.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14+
// [START retail_set_inventory]
1415

1516
'use strict';
1617

@@ -99,3 +100,4 @@ process.on('unhandledRejection', err => {
99100
});
100101

101102
main(...process.argv.slice(2));
103+
// [END retail_set_inventory]

retail/interactive-tutorials/search/search-with-boost-spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14+
// [START retail_search_with_boost_spec]
1415

1516
'use strict';
1617

@@ -89,3 +90,4 @@ process.on('unhandledRejection', err => {
8990
});
9091

9192
main();
93+
// [END retail_search_with_boost_spec]

retail/interactive-tutorials/search/search-with-query-expansion-spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
'use strict';
1616

17+
// [START retail_search_for_products_with_query_expansion_specification]
18+
1719
async function main() {
1820
// Imports the Google Cloud client library.
1921
const {SearchServiceClient} = require('@google-cloud/retail');
@@ -82,3 +84,5 @@ process.on('unhandledRejection', err => {
8284
});
8385

8486
main();
87+
88+
// [END retail_search_for_products_with_query_expansion_specification]

retail/interactive-tutorials/test/search-with-pagination.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ describe('Search with pagination', () => {
3838
assert.match(stdout, /Search start/);
3939
});
4040

41-
it('should contain next page token', () => {
41+
// TODO(#4136): Re-enable this test. See https://github.com/GoogleCloudPlatform/nodejs-docs-samples/issues/4136
42+
it.skip('should contain next page token', () => {
4243
assert.match(stdout, /Next page token/);
4344
});
4445

retail/interactive-tutorials/test/search-with-query-expansion-spec.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ describe('Search with query expansion spec', () => {
9797
}
9898
});
9999

100-
it('should contain expanded query', () => {
100+
// TODO(#4136): Re-enable this test. See https://github.com/GoogleCloudPlatform/nodejs-docs-samples/issues/4136
101+
it.skip('should contain expanded query', () => {
101102
const searchResponse = response[IResponseParams.ISearchResponse];
102103
expect(
103104
searchResponse.queryExpansionInfo,

secret-manager/bindTagsToSecret.js

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2025 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+
// 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+
15+
'use strict';
16+
17+
async function main(projectId, secretId, tagValue) {
18+
// [START secretmanager_bind_tags_to_secret]
19+
/**
20+
* TODO(developer): Uncomment these variables before running the sample.
21+
*/
22+
// const projectId = 'my-project';
23+
// const secretId = 'my-secret';
24+
// const tagValue = 'tagValues/281476592621530';
25+
const parent = `projects/${projectId}`;
26+
27+
// Imports the library
28+
const {SecretManagerServiceClient} = require('@google-cloud/secret-manager');
29+
const {TagBindingsClient} = require('@google-cloud/resource-manager').v3;
30+
31+
// Instantiates a client
32+
const client = new SecretManagerServiceClient();
33+
const resourcemanagerClient = new TagBindingsClient();
34+
35+
async function bindTagsToSecret() {
36+
const [secret] = await client.createSecret({
37+
parent: parent,
38+
secretId: secretId,
39+
secret: {
40+
replication: {
41+
automatic: {},
42+
},
43+
},
44+
});
45+
46+
console.log(`Created secret ${secret.name}`);
47+
48+
const [operation] = await resourcemanagerClient.createTagBinding({
49+
tagBinding: {
50+
parent: `//secretmanager.googleapis.com/${secret.name}`,
51+
tagValue: tagValue,
52+
},
53+
});
54+
const [response] = await operation.promise();
55+
console.log('Created Tag Binding', response.name);
56+
}
57+
58+
bindTagsToSecret();
59+
// [END secretmanager_bind_tags_to_secret]
60+
}
61+
62+
const args = process.argv.slice(2);
63+
main(...args).catch(console.error);

0 commit comments

Comments
 (0)