Class v1beta1.PrivateCatalogClient (2.1.2)

PrivateCatalog allows catalog consumers to retrieve Catalog, Product and Version resources under a target resource context.

Catalog is computed based on the s linked to the target resource and its ancestors. Each association's is transformed into a Catalog. If multiple associations have the same parent , they are de-duplicated into one Catalog. Users must have cloudprivatecatalog.catalogTargets.get IAM permission on the resource context in order to access catalogs. Catalog contains the resource name and a subset of data of the original .

Product is child resource of the catalog. A Product contains the resource name and a subset of the data of the original .

Version is child resource of the product. A Version contains the resource name and a subset of the data of the original . v1beta1

Package

@google-cloud/private-catalog

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of PrivateCatalogClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof gax.fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new PrivateCatalogClient({fallback: 'rest'}, gax); ```

Properties

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

privateCatalogStub

privateCatalogStub?: Promise<{
        [name: string]: Function;
    }>;

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

catalogPath(catalog)

catalogPath(catalog: string): string;

Return a fully-qualified catalog resource name string.

Parameter
NameDescription
catalog string
Returns
TypeDescription
string

{string} Resource name string.

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

matchCatalogFromCatalogName(catalogName)

matchCatalogFromCatalogName(catalogName: string): string | number;

Parse the catalog from Catalog resource.

Parameter
NameDescription
catalogName string

A fully-qualified path representing Catalog resource.

Returns
TypeDescription
string | number

{string} A string representing the catalog.

matchCatalogFromVersionName(versionName)

matchCatalogFromVersionName(versionName: string): string | number;

Parse the catalog from Version resource.

Parameter
NameDescription
versionName string

A fully-qualified path representing Version resource.

Returns
TypeDescription
string | number

{string} A string representing the catalog.

matchProductFromProductName(productName)

matchProductFromProductName(productName: string): string | number;

Parse the product from Product resource.

Parameter
NameDescription
productName string

A fully-qualified path representing Product resource.

Returns
TypeDescription
string | number

{string} A string representing the product.

matchProductFromVersionName(versionName)

matchProductFromVersionName(versionName: string): string | number;

Parse the product from Version resource.

Parameter
NameDescription
versionName string

A fully-qualified path representing Version resource.

Returns
TypeDescription
string | number

{string} A string representing the product.

matchVersionFromVersionName(versionName)

matchVersionFromVersionName(versionName: string): string | number;

Parse the version from Version resource.

Parameter
NameDescription
versionName string

A fully-qualified path representing Version resource.

Returns
TypeDescription
string | number

{string} A string representing the version.

productPath(product)

productPath(product: string): string;

Return a fully-qualified product resource name string.

Parameter
NameDescription
product string
Returns
TypeDescription
string

{string} Resource name string.

searchCatalogs(request, options)

searchCatalogs(request?: protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.privatecatalog.v1beta1.ICatalog[],
        protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest | null,
        protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsResponse
    ]>;

Search resources that consumers have access to, within the scope of the consumer cloud resource hierarchy context.

Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.privatecatalog.v1beta1.ICatalog[], protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest | null, protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using searchCatalogsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

searchCatalogs(request, options, callback)

searchCatalogs(request: protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.ICatalog>): void;
Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.ICatalog>
Returns
TypeDescription
void

searchCatalogs(request, callback)

searchCatalogs(request: protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest, callback: PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.ICatalog>): void;
Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest
callback PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.ICatalog>
Returns
TypeDescription
void

searchCatalogsAsync(request, options)

searchCatalogsAsync(request?: protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.privatecatalog.v1beta1.ICatalog>;

Equivalent to searchCatalogs, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.privatecatalog.v1beta1.ICatalog>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * 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 callSearchCatalogs() {
    // Construct request
    const request = {
      resource,
    };

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

  callSearchCatalogs();

searchCatalogsStream(request, options)

searchCatalogsStream(request?: protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchCatalogsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using searchCatalogsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

searchProducts(request, options)

searchProducts(request?: protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.privatecatalog.v1beta1.IProduct[],
        protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest | null,
        protos.google.cloud.privatecatalog.v1beta1.ISearchProductsResponse
    ]>;

Search resources that consumers have access to, within the scope of the consumer cloud resource hierarchy context.

Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.privatecatalog.v1beta1.IProduct[], protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest | null, protos.google.cloud.privatecatalog.v1beta1.ISearchProductsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using searchProductsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

searchProducts(request, options, callback)

searchProducts(request: protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchProductsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.IProduct>): void;
Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchProductsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.IProduct>
Returns
TypeDescription
void

searchProducts(request, callback)

searchProducts(request: protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest, callback: PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchProductsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.IProduct>): void;
Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest
callback PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchProductsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.IProduct>
Returns
TypeDescription
void

searchProductsAsync(request, options)

searchProductsAsync(request?: protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.privatecatalog.v1beta1.IProduct>;

Equivalent to searchProducts, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.privatecatalog.v1beta1.IProduct>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * 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 callSearchProducts() {
    // Construct request
    const request = {
      resource,
    };

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

  callSearchProducts();

searchProductsStream(request, options)

searchProductsStream(request?: protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchProductsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using searchProductsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

searchVersions(request, options)

searchVersions(request?: protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.privatecatalog.v1beta1.IVersion[],
        protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest | null,
        protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsResponse
    ]>;

Search resources that consumers have access to, within the scope of the consumer cloud resource hierarchy context.

Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.privatecatalog.v1beta1.IVersion[], protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest | null, protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of . The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using searchVersionsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

searchVersions(request, options, callback)

searchVersions(request: protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.IVersion>): void;
Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.IVersion>
Returns
TypeDescription
void

searchVersions(request, callback)

searchVersions(request: protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest, callback: PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.IVersion>): void;
Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest
callback PaginationCallback<protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest, protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsResponse | null | undefined, protos.google.cloud.privatecatalog.v1beta1.IVersion>
Returns
TypeDescription
void

searchVersionsAsync(request, options)

searchVersionsAsync(request?: protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.privatecatalog.v1beta1.IVersion>;

Equivalent to searchVersions, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.cloud.privatecatalog.v1beta1.IVersion>

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * 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 callSearchVersions() {
    // Construct request
    const request = {
      resource,
      query,
    };

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

  callSearchVersions();

searchVersionsStream(request, options)

searchVersionsStream(request?: protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request protos.google.cloud.privatecatalog.v1beta1.ISearchVersionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using searchVersionsAsync() method described below for async iteration which you can stop as needed. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

versionPath(catalog, product, version)

versionPath(catalog: string, product: string, version: string): string;

Return a fully-qualified version resource name string.

Parameters
NameDescription
catalog string
product string
version string
Returns
TypeDescription
string

{string} Resource name string.