Skip to content

Commit

Permalink
docs(samples): add auto-generated samples for Node with api short nam…
Browse files Browse the repository at this point in the history
…e in region tag (#43)

* docs(samples): add auto-generated samples for Node with api short name in region tag

PiperOrigin-RevId: 399287285

Source-Link: googleapis/googleapis@1575986

Source-Link: googleapis/googleapis-gen@b27fff6
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjI3ZmZmNjIzYTVkOGQ1ODZiNzAzYjVlNDkxOTg1NmFiZTdjMmViMyJ9

* 🦉 Updates from OwlBot

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
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Sep 28, 2021
1 parent e03944c commit 9d2ed6b
Show file tree
Hide file tree
Showing 4 changed files with 233 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright 2021 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
//
// http://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.

'use strict';

function main(resource) {
// [START cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchCatalogs_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the resource context. It can be in following formats:
* * `projects/{project}`
* * `folders/{folder}`
* * `organizations/{organization}`
*/
// const resource = 'abc123'
/**
* The query to filter the catalogs. The supported queries are:
* * Get a single catalog: `name=catalogs/{catalog}`
*/
// const query = 'abc123'
/**
* The maximum number of entries that are requested.
*/
// const pageSize = 1234
/**
* A pagination token returned from a previous call to SearchCatalogs that
* indicates where this listing should continue from.
*/
// const pageToken = 'abc123'

// Imports the Privatecatalog library
const {PrivateCatalogClient} =
require('@google-cloud/private-catalog').v1beta1;

// Instantiates a client
const privatecatalogClient = new PrivateCatalogClient();

async function searchCatalogs() {
// Construct request
const request = {
resource,
};

// Run request
const iterable = await privatecatalogClient.searchCatalogsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}

searchCatalogs();
// [END cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchCatalogs_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright 2021 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
//
// http://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.

'use strict';

function main(resource) {
// [START cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchProducts_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the resource context. See [SearchCatalogsRequest.resource][google.cloud.privatecatalog.v1beta1.SearchCatalogsRequest.resource]
* for details.
*/
// const resource = 'abc123'
/**
* The query to filter the products.
* The supported queries are:
* * List products of all catalogs: empty
* * List products under a catalog: `parent=catalogs/{catalog}`
* * Get a product by name:
* `name=catalogs/{catalog}/products/{product}`
*/
// const query = 'abc123'
/**
* The maximum number of entries that are requested.
*/
// const pageSize = 1234
/**
* A pagination token returned from a previous call to SearchProducts that
* indicates where this listing should continue from.
*/
// const pageToken = 'abc123'

// Imports the Privatecatalog library
const {PrivateCatalogClient} =
require('@google-cloud/private-catalog').v1beta1;

// Instantiates a client
const privatecatalogClient = new PrivateCatalogClient();

async function searchProducts() {
// Construct request
const request = {
resource,
};

// Run request
const iterable = await privatecatalogClient.searchProductsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}

searchProducts();
// [END cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchProducts_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright 2021 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
//
// http://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.

'use strict';

function main(resource, query) {
// [START cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchVersions_async]
/**
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the resource context. See [SearchCatalogsRequest.resource][google.cloud.privatecatalog.v1beta1.SearchCatalogsRequest.resource]
* for details.
*/
// const resource = 'abc123'
/**
* Required. The query to filter the versions.
* The supported queries are:
* * List versions under a product:
* `parent=catalogs/{catalog}/products/{product}`
* * Get a version by name:
* `name=catalogs/{catalog}/products/{product}/versions/{version}`
*/
// const query = 'abc123'
/**
* The maximum number of entries that are requested.
*/
// const pageSize = 1234
/**
* A pagination token returned from a previous call to SearchVersions
* that indicates where this listing should continue from.
*/
// const pageToken = 'abc123'

// Imports the Privatecatalog library
const {PrivateCatalogClient} =
require('@google-cloud/private-catalog').v1beta1;

// Instantiates a client
const privatecatalogClient = new PrivateCatalogClient();

async function searchVersions() {
// Construct request
const request = {
resource,
query,
};

// Run request
const iterable = await privatecatalogClient.searchVersionsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}

searchVersions();
// [END cloudprivatecatalog_v1beta1_generated_PrivateCatalog_SearchVersions_async]
}

process.on('unhandledRejection', err => {
console.error(err.message);
process.exitCode = 1;
});
main(...process.argv.slice(2));
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,8 @@ export class PrivateCatalogClient {
gax.routingHeader.fromParams({
resource: request.resource || '',
});
const callSettings = new gax.CallSettings(options);
const defaultCallSettings = this._defaults['searchCatalogs'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.searchCatalogs.createStream(
this.innerApiCalls.searchCatalogs as gax.GaxCall,
Expand Down Expand Up @@ -564,7 +565,8 @@ export class PrivateCatalogClient {
resource: request.resource || '',
});
options = options || {};
const callSettings = new gax.CallSettings(options);
const defaultCallSettings = this._defaults['searchCatalogs'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.searchCatalogs.asyncIterate(
this.innerApiCalls['searchCatalogs'] as GaxCall,
Expand Down Expand Up @@ -726,7 +728,8 @@ export class PrivateCatalogClient {
gax.routingHeader.fromParams({
resource: request.resource || '',
});
const callSettings = new gax.CallSettings(options);
const defaultCallSettings = this._defaults['searchProducts'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.searchProducts.createStream(
this.innerApiCalls.searchProducts as gax.GaxCall,
Expand Down Expand Up @@ -786,7 +789,8 @@ export class PrivateCatalogClient {
resource: request.resource || '',
});
options = options || {};
const callSettings = new gax.CallSettings(options);
const defaultCallSettings = this._defaults['searchProducts'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.searchProducts.asyncIterate(
this.innerApiCalls['searchProducts'] as GaxCall,
Expand Down Expand Up @@ -948,7 +952,8 @@ export class PrivateCatalogClient {
gax.routingHeader.fromParams({
resource: request.resource || '',
});
const callSettings = new gax.CallSettings(options);
const defaultCallSettings = this._defaults['searchVersions'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.searchVersions.createStream(
this.innerApiCalls.searchVersions as gax.GaxCall,
Expand Down Expand Up @@ -1008,7 +1013,8 @@ export class PrivateCatalogClient {
resource: request.resource || '',
});
options = options || {};
const callSettings = new gax.CallSettings(options);
const defaultCallSettings = this._defaults['searchVersions'];
const callSettings = defaultCallSettings.merge(options);
this.initialize();
return this.descriptors.page.searchVersions.asyncIterate(
this.innerApiCalls['searchVersions'] as GaxCall,
Expand Down

0 comments on commit 9d2ed6b

Please sign in to comment.