Class v1.KeyTrackingServiceClient (1.3.0)

Returns information about the resources in an org that are protected by a given Cloud KMS key via CMEK. v1

Package

@google-cloud/kms-inventory

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of KeyTrackingServiceClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof 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 KeyTrackingServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

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

keyTrackingServiceStub

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

pathTemplates

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

port

static get port(): number;

The port for this API service.

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.

universeDomain

get universeDomain(): string;

warn

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

Methods

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
Type Description
Promise<void>

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

cryptoKeyPath(project, location, keyRing, cryptoKey)

cryptoKeyPath(project: string, location: string, keyRing: string, cryptoKey: string): string;

Return a fully-qualified cryptoKey resource name string.

Parameters
Name Description
project string
location string
keyRing string
cryptoKey string
Returns
Type Description
string

{string} Resource name string.

cryptoKeyVersionPath(project, location, keyRing, cryptoKey, cryptoKeyVersion)

cryptoKeyVersionPath(project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string): string;

Return a fully-qualified cryptoKeyVersion resource name string.

Parameters
Name Description
project string
location string
keyRing string
cryptoKey string
cryptoKeyVersion string
Returns
Type Description
string

{string} Resource name string.

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
void

getProtectedResourcesSummary(request, options)

getProtectedResourcesSummary(request?: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary,
        (protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest | undefined),
        {} | undefined
    ]>;

Returns aggregate information about the resources protected by the given Cloud KMS . Only resources within the same Cloud organization as the key will be returned. The project that holds the key must be part of an organization in order for this call to succeed.

Parameters
Name Description
request IGetProtectedResourcesSummaryRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, (protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing ProtectedResourcesSummary. Please see the documentation 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 resource name of the
   *  CryptoKey google.cloud.kms.v1.CryptoKey.
   */
  // const name = 'abc123'

  // Imports the Inventory library
  const {KeyTrackingServiceClient} = require('@google-cloud/kms-inventory').v1;

  // Instantiates a client
  const inventoryClient = new KeyTrackingServiceClient();

  async function callGetProtectedResourcesSummary() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await inventoryClient.getProtectedResourcesSummary(request);
    console.log(response);
  }

  callGetProtectedResourcesSummary();

getProtectedResourcesSummary(request, options, callback)

getProtectedResourcesSummary(request: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, options: CallOptions, callback: Callback<protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetProtectedResourcesSummaryRequest
options CallOptions
callback Callback<protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getProtectedResourcesSummary(request, callback)

getProtectedResourcesSummary(request: protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest, callback: Callback<protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetProtectedResourcesSummaryRequest
callback Callback<protos.google.cloud.kms.inventory.v1.IProtectedResourcesSummary, protos.google.cloud.kms.inventory.v1.IGetProtectedResourcesSummaryRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

importJobPath(project, location, keyRing, importJob)

importJobPath(project: string, location: string, keyRing: string, importJob: string): string;

Return a fully-qualified importJob resource name string.

Parameters
Name Description
project string
location string
keyRing string
importJob string
Returns
Type Description
string

{string} Resource name string.

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
Type Description
Promise<{ [name: string]: Function; }>

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

keyRingPath(project, location, keyRing)

keyRingPath(project: string, location: string, keyRing: string): string;

Return a fully-qualified keyRing resource name string.

Parameters
Name Description
project string
location string
keyRing string
Returns
Type Description
string

{string} Resource name string.

matchCryptoKeyFromCryptoKeyName(cryptoKeyName)

matchCryptoKeyFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the crypto_key from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key.

matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName)

matchCryptoKeyFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the crypto_key from CryptoKeyVersion resource.

Parameter
Name Description
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key.

matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName)

matchCryptoKeyFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string): string | number;

Parse the crypto_key from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource.

Parameter
Name Description
projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName string

A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key.

matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName)

matchCryptoKeyFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string): string | number;

Parse the crypto_key from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource.

Parameter
Name Description
projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName string

A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key.

matchCryptoKeyFromPublicKeyName(publicKeyName)

matchCryptoKeyFromPublicKeyName(publicKeyName: string): string | number;

Parse the crypto_key from PublicKey resource.

Parameter
Name Description
publicKeyName string

A fully-qualified path representing PublicKey resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key.

matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName)

matchCryptoKeyVersionFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the crypto_key_version from CryptoKeyVersion resource.

Parameter
Name Description
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key_version.

matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName)

matchCryptoKeyVersionFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string): string | number;

Parse the crypto_key_version from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource.

Parameter
Name Description
projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName string

A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key_version.

matchCryptoKeyVersionFromPublicKeyName(publicKeyName)

matchCryptoKeyVersionFromPublicKeyName(publicKeyName: string): string | number;

Parse the crypto_key_version from PublicKey resource.

Parameter
Name Description
publicKeyName string

A fully-qualified path representing PublicKey resource.

Returns
Type Description
string | number

{string} A string representing the crypto_key_version.

matchImportJobFromImportJobName(importJobName)

matchImportJobFromImportJobName(importJobName: string): string | number;

Parse the import_job from ImportJob resource.

Parameter
Name Description
importJobName string

A fully-qualified path representing ImportJob resource.

Returns
Type Description
string | number

{string} A string representing the import_job.

matchKeyRingFromCryptoKeyName(cryptoKeyName)

matchKeyRingFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the key_ring from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the key_ring.

matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName)

matchKeyRingFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the key_ring from CryptoKeyVersion resource.

Parameter
Name Description
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
Type Description
string | number

{string} A string representing the key_ring.

matchKeyRingFromImportJobName(importJobName)

matchKeyRingFromImportJobName(importJobName: string): string | number;

Parse the key_ring from ImportJob resource.

Parameter
Name Description
importJobName string

A fully-qualified path representing ImportJob resource.

Returns
Type Description
string | number

{string} A string representing the key_ring.

matchKeyRingFromKeyRingName(keyRingName)

matchKeyRingFromKeyRingName(keyRingName: string): string | number;

Parse the key_ring from KeyRing resource.

Parameter
Name Description
keyRingName string

A fully-qualified path representing KeyRing resource.

Returns
Type Description
string | number

{string} A string representing the key_ring.

matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName)

matchKeyRingFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string): string | number;

Parse the key_ring from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource.

Parameter
Name Description
projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName string

A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource.

Returns
Type Description
string | number

{string} A string representing the key_ring.

matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName)

matchKeyRingFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string): string | number;

Parse the key_ring from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource.

Parameter
Name Description
projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName string

A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource.

Returns
Type Description
string | number

{string} A string representing the key_ring.

matchKeyRingFromPublicKeyName(publicKeyName)

matchKeyRingFromPublicKeyName(publicKeyName: string): string | number;

Parse the key_ring from PublicKey resource.

Parameter
Name Description
publicKeyName string

A fully-qualified path representing PublicKey resource.

Returns
Type Description
string | number

{string} A string representing the key_ring.

matchLocationFromCryptoKeyName(cryptoKeyName)

matchLocationFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the location from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName)

matchLocationFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the location from CryptoKeyVersion resource.

Parameter
Name Description
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromImportJobName(importJobName)

matchLocationFromImportJobName(importJobName: string): string | number;

Parse the location from ImportJob resource.

Parameter
Name Description
importJobName string

A fully-qualified path representing ImportJob resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromKeyRingName(keyRingName)

matchLocationFromKeyRingName(keyRingName: string): string | number;

Parse the location from KeyRing resource.

Parameter
Name Description
keyRingName string

A fully-qualified path representing KeyRing resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName)

matchLocationFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string): string | number;

Parse the location from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource.

Parameter
Name Description
projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName string

A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName)

matchLocationFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string): string | number;

Parse the location from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource.

Parameter
Name Description
projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName string

A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromPublicKeyName(publicKeyName)

matchLocationFromPublicKeyName(publicKeyName: string): string | number;

Parse the location from PublicKey resource.

Parameter
Name Description
publicKeyName string

A fully-qualified path representing PublicKey resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchOrganizationFromOrganizationName(organizationName)

matchOrganizationFromOrganizationName(organizationName: string): string | number;

Parse the organization from Organization resource.

Parameter
Name Description
organizationName string

A fully-qualified path representing Organization resource.

Returns
Type Description
string | number

{string} A string representing the organization.

matchProjectFromCryptoKeyName(cryptoKeyName)

matchProjectFromCryptoKeyName(cryptoKeyName: string): string | number;

Parse the project from CryptoKey resource.

Parameter
Name Description
cryptoKeyName string

A fully-qualified path representing CryptoKey resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName)

matchProjectFromCryptoKeyVersionName(cryptoKeyVersionName: string): string | number;

Parse the project from CryptoKeyVersion resource.

Parameter
Name Description
cryptoKeyVersionName string

A fully-qualified path representing CryptoKeyVersion resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromImportJobName(importJobName)

matchProjectFromImportJobName(importJobName: string): string | number;

Parse the project from ImportJob resource.

Parameter
Name Description
importJobName string

A fully-qualified path representing ImportJob resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromKeyRingName(keyRingName)

matchProjectFromKeyRingName(keyRingName: string): string | number;

Parse the project from KeyRing resource.

Parameter
Name Description
keyRingName string

A fully-qualified path representing KeyRing resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName)

matchProjectFromProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName: string): string | number;

Parse the project from ProjectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource.

Parameter
Name Description
projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryName string

A fully-qualified path representing project_location_key_ring_crypto_key_crypto_key_version_protectedResourcesSummary resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName)

matchProjectFromProjectLocationKeyRingCryptoKeyProtectedResourcesSummaryName(projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName: string): string | number;

Parse the project from ProjectLocationKeyRingCryptoKeyProtectedResourcesSummary resource.

Parameter
Name Description
projectLocationKeyRingCryptoKeyProtectedResourcesSummaryName string

A fully-qualified path representing project_location_key_ring_crypto_key_protectedResourcesSummary resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromPublicKeyName(publicKeyName)

matchProjectFromPublicKeyName(publicKeyName: string): string | number;

Parse the project from PublicKey resource.

Parameter
Name Description
publicKeyName string

A fully-qualified path representing PublicKey resource.

Returns
Type Description
string | number

{string} A string representing the project.

organizationPath(organization)

organizationPath(organization: string): string;

Return a fully-qualified organization resource name string.

Parameter
Name Description
organization string
Returns
Type Description
string

{string} Resource name string.

projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath(project, location, keyRing, cryptoKey, cryptoKeyVersion)

projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummaryPath(project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string): string;

Return a fully-qualified projectLocationKeyRingCryptoKeyCryptoKeyVersionProtectedResourcesSummary resource name string.

Parameters
Name Description
project string
location string
keyRing string
cryptoKey string
cryptoKeyVersion string
Returns
Type Description
string

{string} Resource name string.

projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath(project, location, keyRing, cryptoKey)

projectLocationKeyRingCryptoKeyProtectedResourcesSummaryPath(project: string, location: string, keyRing: string, cryptoKey: string): string;

Return a fully-qualified projectLocationKeyRingCryptoKeyProtectedResourcesSummary resource name string.

Parameters
Name Description
project string
location string
keyRing string
cryptoKey string
Returns
Type Description
string

{string} Resource name string.

publicKeyPath(project, location, keyRing, cryptoKey, cryptoKeyVersion)

publicKeyPath(project: string, location: string, keyRing: string, cryptoKey: string, cryptoKeyVersion: string): string;

Return a fully-qualified publicKey resource name string.

Parameters
Name Description
project string
location string
keyRing string
cryptoKey string
cryptoKeyVersion string
Returns
Type Description
string

{string} Resource name string.

searchProtectedResources(request, options)

searchProtectedResources(request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.inventory.v1.IProtectedResource[],
        protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest | null,
        protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse
    ]>;

Returns metadata about the resources protected by the given Cloud KMS in the given Cloud organization.

Parameters
Name Description
request ISearchProtectedResourcesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.inventory.v1.IProtectedResource[], protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest | null, protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of ProtectedResource. 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 searchProtectedResourcesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

searchProtectedResources(request, options, callback)

searchProtectedResources(request: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse | null | undefined, protos.google.cloud.kms.inventory.v1.IProtectedResource>): void;
Parameters
Name Description
request ISearchProtectedResourcesRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse | null | undefined, protos.google.cloud.kms.inventory.v1.IProtectedResource>
Returns
Type Description
void

searchProtectedResources(request, callback)

searchProtectedResources(request: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, callback: PaginationCallback<protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse | null | undefined, protos.google.cloud.kms.inventory.v1.IProtectedResource>): void;
Parameters
Name Description
request ISearchProtectedResourcesRequest
callback PaginationCallback<protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesResponse | null | undefined, protos.google.cloud.kms.inventory.v1.IProtectedResource>
Returns
Type Description
void

searchProtectedResourcesAsync(request, options)

searchProtectedResourcesAsync(request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.kms.inventory.v1.IProtectedResource>;

Equivalent to searchProtectedResources, but returns an iterable object.

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

Parameters
Name Description
request ISearchProtectedResourcesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.cloud.kms.inventory.v1.IProtectedResource>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing ProtectedResource. 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 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. Resource name of the organization.
   *  Example: organizations/123
   */
  // const scope = 'abc123'
  /**
   *  Required. The resource name of the
   *  CryptoKey google.cloud.kms.v1.CryptoKey.
   */
  // const cryptoKey = 'abc123'
  /**
   *  The maximum number of resources to return. The service may return fewer
   *  than this value.
   *  If unspecified, at most 500 resources will be returned.
   *  The maximum value is 500; values above 500 will be coerced to 500.
   */
  // const pageSize = 1234
  /**
   *  A page token, received from a previous
   *  KeyTrackingService.SearchProtectedResources google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources 
   *  call. Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to
   *  KeyTrackingService.SearchProtectedResources google.cloud.kms.inventory.v1.KeyTrackingService.SearchProtectedResources 
   *  must match the call that provided the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. A list of resource types that this request searches for. If
   *  empty, it will search all the trackable resource
   *  types (https://cloud.google.com/kms/docs/view-key-usage#tracked-resource-types).
   *  Regular expressions are also supported. For example:
   *  * `compute.googleapis.com.*` snapshots resources whose type starts
   *  with `compute.googleapis.com`.
   *  * `.*Image` snapshots resources whose type ends with `Image`.
   *  * `.*Image.*` snapshots resources whose type contains `Image`.
   *  See RE2 (https://github.com/google/re2/wiki/Syntax) for all supported
   *  regular expression syntax. If the regular expression does not match any
   *  supported resource type, an INVALID_ARGUMENT error will be returned.
   */
  // const resourceTypes = ['abc','def']

  // Imports the Inventory library
  const {KeyTrackingServiceClient} = require('@google-cloud/kms-inventory').v1;

  // Instantiates a client
  const inventoryClient = new KeyTrackingServiceClient();

  async function callSearchProtectedResources() {
    // Construct request
    const request = {
      scope,
      cryptoKey,
    };

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

  callSearchProtectedResources();

searchProtectedResourcesStream(request, options)

searchProtectedResourcesStream(request?: protos.google.cloud.kms.inventory.v1.ISearchProtectedResourcesRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request ISearchProtectedResourcesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing ProtectedResource 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 searchProtectedResourcesAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.