Class v1.KeyManagementServiceClient (4.3.0)

Google Cloud Key Management Service

Manages cryptographic keys and operations using those keys. Implements a REST model with the following objects:

* KeyRing * * *

If you are using manual gRPC libraries, see [Using gRPC with Cloud KMS](https://cloud.google.com/kms/docs/grpc). v1

Package

@google-cloud/kms

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of KeyManagementServiceClient.

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 KeyManagementServiceClient({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;

iamClient

iamClient: IamClient;

innerApiCalls

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

keyManagementServiceStub

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

locationsClient

locationsClient: LocationsClient;

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

asymmetricDecrypt(request, options)

asymmetricDecrypt(request?: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IAsymmetricDecryptResponse,
        protos.google.cloud.kms.v1.IAsymmetricDecryptRequest | undefined,
        {} | undefined
    ]>;

Decrypts data that was encrypted with a public key retrieved from corresponding to a with ASYMMETRIC_DECRYPT.

Parameters
Name Description
request IAsymmetricDecryptRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, protos.google.cloud.kms.v1.IAsymmetricDecryptRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AsymmetricDecryptResponse. 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
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  to use for
   *  decryption.
   */
  // const name = 'abc123'
  /**
   *  Required. The data encrypted with the named
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion's public key using
   *  OAEP.
   */
  // const ciphertext = Buffer.from('string')
  /**
   *  Optional. An optional CRC32C checksum of the
   *  AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received
   *  AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext 
   *  using this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(AsymmetricDecryptRequest.ciphertext google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext)
   *  is equal to
   *  AsymmetricDecryptRequest.ciphertext_crc32c google.cloud.kms.v1.AsymmetricDecryptRequest.ciphertext_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const ciphertextCrc32c = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.asymmetricDecrypt(request);
    console.log(response);
  }

  callAsymmetricDecrypt();

asymmetricDecrypt(request, options, callback)

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

asymmetricDecrypt(request, callback)

asymmetricDecrypt(request: protos.google.cloud.kms.v1.IAsymmetricDecryptRequest, callback: Callback<protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, protos.google.cloud.kms.v1.IAsymmetricDecryptRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IAsymmetricDecryptRequest
callback Callback<protos.google.cloud.kms.v1.IAsymmetricDecryptResponse, protos.google.cloud.kms.v1.IAsymmetricDecryptRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

asymmetricSign(request, options)

asymmetricSign(request?: protos.google.cloud.kms.v1.IAsymmetricSignRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IAsymmetricSignResponse,
        protos.google.cloud.kms.v1.IAsymmetricSignRequest | undefined,
        {} | undefined
    ]>;

Signs data using a with ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from .

Parameters
Name Description
request IAsymmetricSignRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IAsymmetricSignResponse, protos.google.cloud.kms.v1.IAsymmetricSignRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AsymmetricSignResponse. 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
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  to use for
   *  signing.
   */
  // const name = 'abc123'
  /**
   *  Optional. The digest of the data to sign. The digest must be produced with
   *  the same digest algorithm as specified by the key version's
   *  algorithm google.cloud.kms.v1.CryptoKeyVersion.algorithm.
   *  This field may not be supplied if
   *  AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data 
   *  is supplied.
   */
  // const digest = {}
  /**
   *  Optional. An optional CRC32C checksum of the
   *  AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received
   *  AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest 
   *  using this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest)
   *  is equal to
   *  AsymmetricSignRequest.digest_crc32c google.cloud.kms.v1.AsymmetricSignRequest.digest_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const digestCrc32c = {}
  /**
   *  Optional. The data to sign.
   *  It can't be supplied if
   *  AsymmetricSignRequest.digest google.cloud.kms.v1.AsymmetricSignRequest.digest 
   *  is supplied.
   */
  // const data = Buffer.from('string')
  /**
   *  Optional. An optional CRC32C checksum of the
   *  AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received
   *  AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data 
   *  using this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(AsymmetricSignRequest.data google.cloud.kms.v1.AsymmetricSignRequest.data)
   *  is equal to
   *  AsymmetricSignRequest.data_crc32c google.cloud.kms.v1.AsymmetricSignRequest.data_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const dataCrc32c = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.asymmetricSign(request);
    console.log(response);
  }

  callAsymmetricSign();

asymmetricSign(request, options, callback)

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

asymmetricSign(request, callback)

asymmetricSign(request: protos.google.cloud.kms.v1.IAsymmetricSignRequest, callback: Callback<protos.google.cloud.kms.v1.IAsymmetricSignResponse, protos.google.cloud.kms.v1.IAsymmetricSignRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IAsymmetricSignRequest
callback Callback<protos.google.cloud.kms.v1.IAsymmetricSignResponse, protos.google.cloud.kms.v1.IAsymmetricSignRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

autokeyConfigPath(folder)

autokeyConfigPath(folder: string): string;

Return a fully-qualified autokeyConfig resource name string.

Parameter
Name Description
folder string
Returns
Type Description
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
Type Description
Promise<void>

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

createCryptoKey(request, options)

createCryptoKey(request?: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKey,
        protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | undefined,
        {} | undefined
    ]>;

Create a new within a KeyRing.

and CryptoKey.version_template.algorithm are required.

Parameters
Name Description
request ICreateCryptoKeyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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 name google.cloud.kms.v1.KeyRing.name  of the KeyRing
   *  associated with the CryptoKeys google.cloud.kms.v1.CryptoKey.
   */
  // const parent = 'abc123'
  /**
   *  Required. It must be unique within a KeyRing and match the regular
   *  expression `[a-zA-Z0-9_-]{1,63}`
   */
  // const cryptoKeyId = 'abc123'
  /**
   *  Required. A CryptoKey google.cloud.kms.v1.CryptoKey  with initial field
   *  values.
   */
  // const cryptoKey = {}
  /**
   *  If set to true, the request will create a
   *  CryptoKey google.cloud.kms.v1.CryptoKey  without any
   *  CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion. You must
   *  manually call
   *  CreateCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion 
   *  or
   *  ImportCryptoKeyVersion google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion 
   *  before you can use this CryptoKey google.cloud.kms.v1.CryptoKey.
   */
  // const skipInitialVersionCreation = true

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callCreateCryptoKey() {
    // Construct request
    const request = {
      parent,
      cryptoKeyId,
      cryptoKey,
    };

    // Run request
    const response = await kmsClient.createCryptoKey(request);
    console.log(response);
  }

  callCreateCryptoKey();

createCryptoKey(request, options, callback)

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

createCryptoKey(request, callback)

createCryptoKey(request: protos.google.cloud.kms.v1.ICreateCryptoKeyRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateCryptoKeyRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.ICreateCryptoKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createCryptoKeyVersion(request, options)

createCryptoKeyVersion(request?: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKeyVersion,
        protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest | undefined,
        {} | undefined
    ]>;

Create a new in a .

The server will assign the next sequential id. If unset, will be set to .

Parameters
Name Description
request ICreateCryptoKeyVersionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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 name google.cloud.kms.v1.CryptoKey.name  of the
   *  CryptoKey google.cloud.kms.v1.CryptoKey  associated with the
   *  CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion.
   */
  // const parent = 'abc123'
  /**
   *  Required. A CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  with
   *  initial field values.
   */
  // const cryptoKeyVersion = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callCreateCryptoKeyVersion() {
    // Construct request
    const request = {
      parent,
      cryptoKeyVersion,
    };

    // Run request
    const response = await kmsClient.createCryptoKeyVersion(request);
    console.log(response);
  }

  callCreateCryptoKeyVersion();

createCryptoKeyVersion(request, options, callback)

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

createCryptoKeyVersion(request, callback)

createCryptoKeyVersion(request: protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateCryptoKeyVersionRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.ICreateCryptoKeyVersionRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createImportJob(request, options)

createImportJob(request?: protos.google.cloud.kms.v1.ICreateImportJobRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IImportJob,
        protos.google.cloud.kms.v1.ICreateImportJobRequest | undefined,
        {} | undefined
    ]>;

Create a new within a KeyRing.

is required.

Parameters
Name Description
request ICreateImportJobRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IImportJob, protos.google.cloud.kms.v1.ICreateImportJobRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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 name google.cloud.kms.v1.KeyRing.name  of the
   *  KeyRing google.cloud.kms.v1.KeyRing  associated with the
   *  ImportJobs google.cloud.kms.v1.ImportJob.
   */
  // const parent = 'abc123'
  /**
   *  Required. It must be unique within a KeyRing and match the regular
   *  expression `[a-zA-Z0-9_-]{1,63}`
   */
  // const importJobId = 'abc123'
  /**
   *  Required. An ImportJob google.cloud.kms.v1.ImportJob  with initial field
   *  values.
   */
  // const importJob = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callCreateImportJob() {
    // Construct request
    const request = {
      parent,
      importJobId,
      importJob,
    };

    // Run request
    const response = await kmsClient.createImportJob(request);
    console.log(response);
  }

  callCreateImportJob();

createImportJob(request, options, callback)

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

createImportJob(request, callback)

createImportJob(request: protos.google.cloud.kms.v1.ICreateImportJobRequest, callback: Callback<protos.google.cloud.kms.v1.IImportJob, protos.google.cloud.kms.v1.ICreateImportJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateImportJobRequest
callback Callback<protos.google.cloud.kms.v1.IImportJob, protos.google.cloud.kms.v1.ICreateImportJobRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createKeyRing(request, options)

createKeyRing(request?: protos.google.cloud.kms.v1.ICreateKeyRingRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IKeyRing,
        protos.google.cloud.kms.v1.ICreateKeyRingRequest | undefined,
        {} | undefined
    ]>;

Create a new KeyRing in a given Project and Location.

Parameters
Name Description
request ICreateKeyRingRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IKeyRing, protos.google.cloud.kms.v1.ICreateKeyRingRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing KeyRing. 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 location associated with the
   *  KeyRings google.cloud.kms.v1.KeyRing, in the format
   *  `projects/* /locations/*`.
   */
  // const parent = 'abc123'
  /**
   *  Required. It must be unique within a location and match the regular
   *  expression `[a-zA-Z0-9_-]{1,63}`
   */
  // const keyRingId = 'abc123'
  /**
   *  Required. A KeyRing google.cloud.kms.v1.KeyRing  with initial field
   *  values.
   */
  // const keyRing = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callCreateKeyRing() {
    // Construct request
    const request = {
      parent,
      keyRingId,
      keyRing,
    };

    // Run request
    const response = await kmsClient.createKeyRing(request);
    console.log(response);
  }

  callCreateKeyRing();

createKeyRing(request, options, callback)

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

createKeyRing(request, callback)

createKeyRing(request: protos.google.cloud.kms.v1.ICreateKeyRingRequest, callback: Callback<protos.google.cloud.kms.v1.IKeyRing, protos.google.cloud.kms.v1.ICreateKeyRingRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateKeyRingRequest
callback Callback<protos.google.cloud.kms.v1.IKeyRing, protos.google.cloud.kms.v1.ICreateKeyRingRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

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.

decrypt(request, options)

decrypt(request?: protos.google.cloud.kms.v1.IDecryptRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IDecryptResponse,
        protos.google.cloud.kms.v1.IDecryptRequest | undefined,
        {} | undefined
    ]>;

Decrypts data that was protected by . The must be .

Parameters
Name Description
request IDecryptRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IDecryptResponse, protos.google.cloud.kms.v1.IDecryptRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing DecryptResponse. 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  to use for decryption. The
   *  server will choose the appropriate version.
   */
  // const name = 'abc123'
  /**
   *  Required. The encrypted data originally returned in
   *  EncryptResponse.ciphertext google.cloud.kms.v1.EncryptResponse.ciphertext.
   */
  // const ciphertext = Buffer.from('string')
  /**
   *  Optional. Optional data that must match the data originally supplied in
   *  EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data.
   */
  // const additionalAuthenticatedData = Buffer.from('string')
  /**
   *  Optional. An optional CRC32C checksum of the
   *  DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received
   *  DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext 
   *  using this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(DecryptRequest.ciphertext google.cloud.kms.v1.DecryptRequest.ciphertext)
   *  is equal to
   *  DecryptRequest.ciphertext_crc32c google.cloud.kms.v1.DecryptRequest.ciphertext_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const ciphertextCrc32c = {}
  /**
   *  Optional. An optional CRC32C checksum of the
   *  DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received
   *  DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data 
   *  using this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data)
   *  is equal to
   *  DecryptRequest.additional_authenticated_data_crc32c google.cloud.kms.v1.DecryptRequest.additional_authenticated_data_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const additionalAuthenticatedDataCrc32c = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.decrypt(request);
    console.log(response);
  }

  callDecrypt();

decrypt(request, options, callback)

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

decrypt(request, callback)

decrypt(request: protos.google.cloud.kms.v1.IDecryptRequest, callback: Callback<protos.google.cloud.kms.v1.IDecryptResponse, protos.google.cloud.kms.v1.IDecryptRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDecryptRequest
callback Callback<protos.google.cloud.kms.v1.IDecryptResponse, protos.google.cloud.kms.v1.IDecryptRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

destroyCryptoKeyVersion(request, options)

destroyCryptoKeyVersion(request?: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKeyVersion,
        protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest | undefined,
        {} | undefined
    ]>;

Schedule a for destruction.

Upon calling this method, will be set to , and will be set to the time in the future. At that time, the will automatically change to , and the key material will be irrevocably destroyed.

Before the is reached, may be called to reverse the process.

Parameters
Name Description
request IDestroyCryptoKeyVersionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest | undefined, {} | undefined ]>

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

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.destroyCryptoKeyVersion(request);
    console.log(response);
  }

  callDestroyCryptoKeyVersion();

destroyCryptoKeyVersion(request, options, callback)

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

destroyCryptoKeyVersion(request, callback)

destroyCryptoKeyVersion(request: protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDestroyCryptoKeyVersionRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IDestroyCryptoKeyVersionRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

ekmConfigPath(project, location)

ekmConfigPath(project: string, location: string): string;

Return a fully-qualified ekmConfig resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

ekmConnectionPath(project, location, ekmConnection)

ekmConnectionPath(project: string, location: string, ekmConnection: string): string;

Return a fully-qualified ekmConnection resource name string.

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

{string} Resource name string.

encrypt(request, options)

encrypt(request?: protos.google.cloud.kms.v1.IEncryptRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IEncryptResponse,
        protos.google.cloud.kms.v1.IEncryptRequest | undefined,
        {} | undefined
    ]>;

Encrypts data, so that it can only be recovered by a call to . The must be .

Parameters
Name Description
request IEncryptRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IEncryptResponse, protos.google.cloud.kms.v1.IEncryptRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing EncryptResponse. 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  or
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  to use for
   *  encryption.
   *  If a CryptoKey google.cloud.kms.v1.CryptoKey  is specified, the server
   *  will use its primary version google.cloud.kms.v1.CryptoKey.primary.
   */
  // const name = 'abc123'
  /**
   *  Required. The data to encrypt. Must be no larger than 64KiB.
   *  The maximum size depends on the key version's
   *  protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level.
   *  For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE,
   *  EXTERNAL google.cloud.kms.v1.ProtectionLevel.EXTERNAL, and
   *  EXTERNAL_VPC google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC  keys, the
   *  plaintext must be no larger than 64KiB. For
   *  HSM google.cloud.kms.v1.ProtectionLevel.HSM  keys, the combined length of
   *  the plaintext and additional_authenticated_data fields must be no larger
   *  than 8KiB.
   */
  // const plaintext = Buffer.from('string')
  /**
   *  Optional. Optional data that, if specified, must also be provided during
   *  decryption through
   *  DecryptRequest.additional_authenticated_data google.cloud.kms.v1.DecryptRequest.additional_authenticated_data.
   *  The maximum size depends on the key version's
   *  protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level.
   *  For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE,
   *  EXTERNAL google.cloud.kms.v1.ProtectionLevel.EXTERNAL, and
   *  EXTERNAL_VPC google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC  keys the
   *  AAD must be no larger than 64KiB. For
   *  HSM google.cloud.kms.v1.ProtectionLevel.HSM  keys, the combined length of
   *  the plaintext and additional_authenticated_data fields must be no larger
   *  than 8KiB.
   */
  // const additionalAuthenticatedData = Buffer.from('string')
  /**
   *  Optional. An optional CRC32C checksum of the
   *  EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received
   *  EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext 
   *  using this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(EncryptRequest.plaintext google.cloud.kms.v1.EncryptRequest.plaintext)
   *  is equal to
   *  EncryptRequest.plaintext_crc32c google.cloud.kms.v1.EncryptRequest.plaintext_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const plaintextCrc32c = {}
  /**
   *  Optional. An optional CRC32C checksum of the
   *  EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received
   *  EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data 
   *  using this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(EncryptRequest.additional_authenticated_data google.cloud.kms.v1.EncryptRequest.additional_authenticated_data)
   *  is equal to
   *  EncryptRequest.additional_authenticated_data_crc32c google.cloud.kms.v1.EncryptRequest.additional_authenticated_data_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const additionalAuthenticatedDataCrc32c = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.encrypt(request);
    console.log(response);
  }

  callEncrypt();

encrypt(request, options, callback)

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

encrypt(request, callback)

encrypt(request: protos.google.cloud.kms.v1.IEncryptRequest, callback: Callback<protos.google.cloud.kms.v1.IEncryptResponse, protos.google.cloud.kms.v1.IEncryptRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IEncryptRequest
callback Callback<protos.google.cloud.kms.v1.IEncryptResponse, protos.google.cloud.kms.v1.IEncryptRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

generateRandomBytes(request, options)

generateRandomBytes(request?: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IGenerateRandomBytesResponse,
        protos.google.cloud.kms.v1.IGenerateRandomBytesRequest | undefined,
        {} | undefined
    ]>;

Generate random bytes using the Cloud KMS randomness source in the provided location.

Parameters
Name Description
request IGenerateRandomBytesRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, protos.google.cloud.kms.v1.IGenerateRandomBytesRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing GenerateRandomBytesResponse. 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.
   */
  /**
   *  The project-specific location in which to generate random bytes.
   *  For example, "projects/my-project/locations/us-central1".
   */
  // const location = 'abc123'
  /**
   *  The length in bytes of the amount of randomness to retrieve.  Minimum 8
   *  bytes, maximum 1024 bytes.
   */
  // const lengthBytes = 1234
  /**
   *  The ProtectionLevel google.cloud.kms.v1.ProtectionLevel  to use when
   *  generating the random data. Currently, only
   *  HSM google.cloud.kms.v1.ProtectionLevel.HSM  protection level is
   *  supported.
   */
  // const protectionLevel = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callGenerateRandomBytes() {
    // Construct request
    const request = {
    };

    // Run request
    const response = await kmsClient.generateRandomBytes(request);
    console.log(response);
  }

  callGenerateRandomBytes();

generateRandomBytes(request, options, callback)

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

generateRandomBytes(request, callback)

generateRandomBytes(request: protos.google.cloud.kms.v1.IGenerateRandomBytesRequest, callback: Callback<protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, protos.google.cloud.kms.v1.IGenerateRandomBytesRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGenerateRandomBytesRequest
callback Callback<protos.google.cloud.kms.v1.IGenerateRandomBytesResponse, protos.google.cloud.kms.v1.IGenerateRandomBytesRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getCryptoKey(request, options)

getCryptoKey(request?: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKey,
        protos.google.cloud.kms.v1.IGetCryptoKeyRequest | undefined,
        {} | undefined
    ]>;

Returns metadata for a given , as well as its .

Parameters
Name Description
request IGetCryptoKeyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.IGetCryptoKeyRequest | undefined, {} | undefined ]>

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

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.getCryptoKey(request);
    console.log(response);
  }

  callGetCryptoKey();

getCryptoKey(request, options, callback)

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

getCryptoKey(request, callback)

getCryptoKey(request: protos.google.cloud.kms.v1.IGetCryptoKeyRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.IGetCryptoKeyRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetCryptoKeyRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.IGetCryptoKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getCryptoKeyVersion(request, options)

getCryptoKeyVersion(request?: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKeyVersion,
        protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest | undefined,
        {} | undefined
    ]>;

Returns metadata for a given .

Parameters
Name Description
request IGetCryptoKeyVersionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest | undefined, {} | undefined ]>

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

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.getCryptoKeyVersion(request);
    console.log(response);
  }

  callGetCryptoKeyVersion();

getCryptoKeyVersion(request, options, callback)

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

getCryptoKeyVersion(request, callback)

getCryptoKeyVersion(request: protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetCryptoKeyVersionRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IGetCryptoKeyVersionRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getIamPolicy(request, options, callback)

getIamPolicy(request: IamProtos.google.iam.v1.GetIamPolicyRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.Policy]>;

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

Parameters
Name Description
request IamProtos.google.iam.v1.GetIamPolicyRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.Policy, google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.Policy, google.iam.v1.GetIamPolicyRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.Policy]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

getImportJob(request, options)

getImportJob(request?: protos.google.cloud.kms.v1.IGetImportJobRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IImportJob,
        protos.google.cloud.kms.v1.IGetImportJobRequest | undefined,
        {} | undefined
    ]>;

Returns metadata for a given .

Parameters
Name Description
request IGetImportJobRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IImportJob, protos.google.cloud.kms.v1.IGetImportJobRequest | undefined, {} | undefined ]>

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

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.getImportJob(request);
    console.log(response);
  }

  callGetImportJob();

getImportJob(request, options, callback)

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

getImportJob(request, callback)

getImportJob(request: protos.google.cloud.kms.v1.IGetImportJobRequest, callback: Callback<protos.google.cloud.kms.v1.IImportJob, protos.google.cloud.kms.v1.IGetImportJobRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetImportJobRequest
callback Callback<protos.google.cloud.kms.v1.IImportJob, protos.google.cloud.kms.v1.IGetImportJobRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getKeyRing(request, options)

getKeyRing(request?: protos.google.cloud.kms.v1.IGetKeyRingRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IKeyRing,
        protos.google.cloud.kms.v1.IGetKeyRingRequest | undefined,
        {} | undefined
    ]>;

Returns metadata for a given KeyRing.

Parameters
Name Description
request IGetKeyRingRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IKeyRing, protos.google.cloud.kms.v1.IGetKeyRingRequest | undefined, {} | undefined ]>

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

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.getKeyRing(request);
    console.log(response);
  }

  callGetKeyRing();

getKeyRing(request, options, callback)

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

getKeyRing(request, callback)

getKeyRing(request: protos.google.cloud.kms.v1.IGetKeyRingRequest, callback: Callback<protos.google.cloud.kms.v1.IKeyRing, protos.google.cloud.kms.v1.IGetKeyRingRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetKeyRingRequest
callback Callback<protos.google.cloud.kms.v1.IKeyRing, protos.google.cloud.kms.v1.IGetKeyRingRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getLocation(request, options, callback)

getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;

Gets information about a location.

Parameters
Name Description
request LocationProtos.google.cloud.location.IGetLocationRequest

The request object that will be sent.

options CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
Promise<google.cloud.location.ILocation>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.

Example

const [response] = await client.getLocation(request);

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

getPublicKey(request, options)

getPublicKey(request?: protos.google.cloud.kms.v1.IGetPublicKeyRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IPublicKey,
        protos.google.cloud.kms.v1.IGetPublicKeyRequest | undefined,
        {} | undefined
    ]>;

Returns the public key for the given . The must be or .

Parameters
Name Description
request IGetPublicKeyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IPublicKey, protos.google.cloud.kms.v1.IGetPublicKeyRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing PublicKey. 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 name google.cloud.kms.v1.CryptoKeyVersion.name  of the
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  public key to get.
   */
  // const name = 'abc123'

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.getPublicKey(request);
    console.log(response);
  }

  callGetPublicKey();

getPublicKey(request, options, callback)

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

getPublicKey(request, callback)

getPublicKey(request: protos.google.cloud.kms.v1.IGetPublicKeyRequest, callback: Callback<protos.google.cloud.kms.v1.IPublicKey, protos.google.cloud.kms.v1.IGetPublicKeyRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetPublicKeyRequest
callback Callback<protos.google.cloud.kms.v1.IPublicKey, protos.google.cloud.kms.v1.IGetPublicKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

importCryptoKeyVersion(request, options)

importCryptoKeyVersion(request?: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKeyVersion,
        protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest | undefined,
        {} | undefined
    ]>;

Import wrapped key material into a .

All requests must specify a . If a is additionally specified in the request, key material will be reimported into that version. Otherwise, a new version will be created, and will be assigned the next sequential id within the .

Parameters
Name Description
request IImportCryptoKeyVersionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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 name google.cloud.kms.v1.CryptoKey.name  of the
   *  CryptoKey google.cloud.kms.v1.CryptoKey  to be imported into.
   *  The create permission is only required on this key when creating a new
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion.
   */
  // const parent = 'abc123'
  /**
   *  Optional. The optional name google.cloud.kms.v1.CryptoKeyVersion.name  of
   *  an existing CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  to
   *  target for an import operation. If this field is not present, a new
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  containing the
   *  supplied key material is created.
   *  If this field is present, the supplied key material is imported into
   *  the existing CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion. To
   *  import into an existing
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion, the
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  must be a child of
   *  ImportCryptoKeyVersionRequest.parent google.cloud.kms.v1.ImportCryptoKeyVersionRequest.parent,
   *  have been previously created via ImportCryptoKeyVersion , and be in
   *  DESTROYED google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED 
   *  or
   *  IMPORT_FAILED google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.IMPORT_FAILED 
   *  state. The key material and algorithm must match the previous
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  exactly if the
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  has ever contained
   *  key material.
   */
  // const cryptoKeyVersion = 'abc123'
  /**
   *  Required. The
   *  algorithm google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionAlgorithm 
   *  of the key being imported. This does not need to match the
   *  version_template google.cloud.kms.v1.CryptoKey.version_template  of the
   *  CryptoKey google.cloud.kms.v1.CryptoKey  this version imports into.
   */
  // const algorithm = {}
  /**
   *  Required. The name google.cloud.kms.v1.ImportJob.name  of the
   *  ImportJob google.cloud.kms.v1.ImportJob  that was used to wrap this key
   *  material.
   */
  // const importJob = 'abc123'
  /**
   *  Optional. The wrapped key material to import.
   *  Before wrapping, key material must be formatted. If importing symmetric key
   *  material, the expected key material format is plain bytes. If importing
   *  asymmetric key material, the expected key material format is PKCS#8-encoded
   *  DER (the PrivateKeyInfo structure from RFC 5208).
   *  When wrapping with import methods
   *  (RSA_OAEP_3072_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256 
   *  or
   *  RSA_OAEP_4096_SHA1_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256 
   *  or
   *  RSA_OAEP_3072_SHA256_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256 
   *  or
   *  RSA_OAEP_4096_SHA256_AES_256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256),
   *  this field must contain the concatenation of:
   *  
    *
  1. An ephemeral AES-256 wrapping key wrapped with the * public_key google.cloud.kms.v1.ImportJob.public_key using * RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty * label. *
  2. *
  3. The formatted key to be imported, wrapped with the ephemeral AES-256 * key using AES-KWP (RFC 5649). *
  4. *
* This format is the same as the format produced by PKCS#11 mechanism * CKM_RSA_AES_KEY_WRAP. * When wrapping with import methods * (RSA_OAEP_3072_SHA256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256 * or * RSA_OAEP_4096_SHA256 google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256), * this field must contain the formatted key to be imported, wrapped with the * public_key google.cloud.kms.v1.ImportJob.public_key using RSAES-OAEP * with SHA-256, MGF1 with SHA-256, and an empty label. */ // const wrappedKey = Buffer.from('string') /** * Optional. This field has the same meaning as * wrapped_key google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key. * Prefer to use that field in new work. Either that field or this field * (but not both) must be specified. */ // const rsaAesWrappedKey = Buffer.from('string') // Imports the Kms library const {KeyManagementServiceClient} = require('@google-cloud/kms').v1; // Instantiates a client const kmsClient = new KeyManagementServiceClient(); async function callImportCryptoKeyVersion() { // Construct request const request = { parent, algorithm, importJob, }; // Run request const response = await kmsClient.importCryptoKeyVersion(request); console.log(response); } callImportCryptoKeyVersion();

importCryptoKeyVersion(request, options, callback)

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

importCryptoKeyVersion(request, callback)

importCryptoKeyVersion(request: protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IImportCryptoKeyVersionRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IImportCryptoKeyVersionRequest | 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.

keyHandlePath(project, location, keyHandle)

keyHandlePath(project: string, location: string, keyHandle: string): string;

Return a fully-qualified keyHandle resource name string.

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

{string} Resource name string.

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.

listCryptoKeys(request, options)

listCryptoKeys(request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKey[],
        protos.google.cloud.kms.v1.IListCryptoKeysRequest | null,
        protos.google.cloud.kms.v1.IListCryptoKeysResponse
    ]>;

Lists .

Parameters
Name Description
request IListCryptoKeysRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKey[], protos.google.cloud.kms.v1.IListCryptoKeysRequest | null, protos.google.cloud.kms.v1.IListCryptoKeysResponse ]>

{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 listCryptoKeysAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listCryptoKeys(request, options, callback)

listCryptoKeys(request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.kms.v1.IListCryptoKeysRequest, protos.google.cloud.kms.v1.IListCryptoKeysResponse | null | undefined, protos.google.cloud.kms.v1.ICryptoKey>): void;
Parameters
Name Description
request IListCryptoKeysRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.kms.v1.IListCryptoKeysRequest, protos.google.cloud.kms.v1.IListCryptoKeysResponse | null | undefined, protos.google.cloud.kms.v1.ICryptoKey>
Returns
Type Description
void

listCryptoKeys(request, callback)

listCryptoKeys(request: protos.google.cloud.kms.v1.IListCryptoKeysRequest, callback: PaginationCallback<protos.google.cloud.kms.v1.IListCryptoKeysRequest, protos.google.cloud.kms.v1.IListCryptoKeysResponse | null | undefined, protos.google.cloud.kms.v1.ICryptoKey>): void;
Parameters
Name Description
request IListCryptoKeysRequest
callback PaginationCallback<protos.google.cloud.kms.v1.IListCryptoKeysRequest, protos.google.cloud.kms.v1.IListCryptoKeysResponse | null | undefined, protos.google.cloud.kms.v1.ICryptoKey>
Returns
Type Description
void

listCryptoKeysAsync(request, options)

listCryptoKeysAsync(request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.kms.v1.ICryptoKey>;

Equivalent to listCryptoKeys, but returns an iterable object.

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

Parameters
Name Description
request IListCryptoKeysRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Object} An iterable Object that allows async iteration. 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 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 KeyRing google.cloud.kms.v1.KeyRing 
   *  to list, in the format `projects/* /locations/* /keyRings/*`.
   */
  // const parent = 'abc123'
  /**
   *  Optional. Optional limit on the number of
   *  CryptoKeys google.cloud.kms.v1.CryptoKey  to include in the response.
   *  Further CryptoKeys google.cloud.kms.v1.CryptoKey  can subsequently be
   *  obtained by including the
   *  ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token 
   *  in a subsequent request.  If unspecified, the server will pick an
   *  appropriate default.
   */
  // const pageSize = 1234
  /**
   *  Optional. Optional pagination token, returned earlier via
   *  ListCryptoKeysResponse.next_page_token google.cloud.kms.v1.ListCryptoKeysResponse.next_page_token.
   */
  // const pageToken = 'abc123'
  /**
   *  The fields of the primary version to include in the response.
   */
  // const versionView = {}
  /**
   *  Optional. Only include resources that match the filter in the response. For
   *  more information, see
   *  Sorting and filtering list
   *  results (https://cloud.google.com/kms/docs/sorting-and-filtering).
   */
  // const filter = 'abc123'
  /**
   *  Optional. Specify how the results should be sorted. If not specified, the
   *  results will be sorted in the default order. For more information, see
   *  Sorting and filtering list
   *  results (https://cloud.google.com/kms/docs/sorting-and-filtering).
   */
  // const orderBy = 'abc123'

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callListCryptoKeys() {
    // Construct request
    const request = {
      parent,
    };

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

  callListCryptoKeys();

listCryptoKeysStream(request, options)

listCryptoKeysStream(request?: protos.google.cloud.kms.v1.IListCryptoKeysRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListCryptoKeysRequest

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 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 listCryptoKeysAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listCryptoKeyVersions(request, options)

listCryptoKeyVersions(request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKeyVersion[],
        protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest | null,
        protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse
    ]>;

Lists .

Parameters
Name Description
request IListCryptoKeyVersionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKeyVersion[], protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest | null, protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse ]>

{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 listCryptoKeyVersionsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listCryptoKeyVersions(request, options, callback)

listCryptoKeyVersions(request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse | null | undefined, protos.google.cloud.kms.v1.ICryptoKeyVersion>): void;
Parameters
Name Description
request IListCryptoKeyVersionsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse | null | undefined, protos.google.cloud.kms.v1.ICryptoKeyVersion>
Returns
Type Description
void

listCryptoKeyVersions(request, callback)

listCryptoKeyVersions(request: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, callback: PaginationCallback<protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse | null | undefined, protos.google.cloud.kms.v1.ICryptoKeyVersion>): void;
Parameters
Name Description
request IListCryptoKeyVersionsRequest
callback PaginationCallback<protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, protos.google.cloud.kms.v1.IListCryptoKeyVersionsResponse | null | undefined, protos.google.cloud.kms.v1.ICryptoKeyVersion>
Returns
Type Description
void

listCryptoKeyVersionsAsync(request, options)

listCryptoKeyVersionsAsync(request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.kms.v1.ICryptoKeyVersion>;

Equivalent to listCryptoKeyVersions, but returns an iterable object.

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

Parameters
Name Description
request IListCryptoKeyVersionsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Object} An iterable Object that allows async iteration. 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 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  to list, in the format
   *  `projects/* /locations/* /keyRings/* /cryptoKeys/*`.
   */
  // const parent = 'abc123'
  /**
   *  Optional. Optional limit on the number of
   *  CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion  to include in the
   *  response. Further CryptoKeyVersions google.cloud.kms.v1.CryptoKeyVersion 
   *  can subsequently be obtained by including the
   *  ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token 
   *  in a subsequent request. If unspecified, the server will pick an
   *  appropriate default.
   */
  // const pageSize = 1234
  /**
   *  Optional. Optional pagination token, returned earlier via
   *  ListCryptoKeyVersionsResponse.next_page_token google.cloud.kms.v1.ListCryptoKeyVersionsResponse.next_page_token.
   */
  // const pageToken = 'abc123'
  /**
   *  The fields to include in the response.
   */
  // const view = {}
  /**
   *  Optional. Only include resources that match the filter in the response. For
   *  more information, see
   *  Sorting and filtering list
   *  results (https://cloud.google.com/kms/docs/sorting-and-filtering).
   */
  // const filter = 'abc123'
  /**
   *  Optional. Specify how the results should be sorted. If not specified, the
   *  results will be sorted in the default order. For more information, see
   *  Sorting and filtering list
   *  results (https://cloud.google.com/kms/docs/sorting-and-filtering).
   */
  // const orderBy = 'abc123'

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callListCryptoKeyVersions() {
    // Construct request
    const request = {
      parent,
    };

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

  callListCryptoKeyVersions();

listCryptoKeyVersionsStream(request, options)

listCryptoKeyVersionsStream(request?: protos.google.cloud.kms.v1.IListCryptoKeyVersionsRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListCryptoKeyVersionsRequest

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 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 listCryptoKeyVersionsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listImportJobs(request, options)

listImportJobs(request?: protos.google.cloud.kms.v1.IListImportJobsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IImportJob[],
        protos.google.cloud.kms.v1.IListImportJobsRequest | null,
        protos.google.cloud.kms.v1.IListImportJobsResponse
    ]>;

Lists .

Parameters
Name Description
request IListImportJobsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IImportJob[], protos.google.cloud.kms.v1.IListImportJobsRequest | null, protos.google.cloud.kms.v1.IListImportJobsResponse ]>

{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 listImportJobsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listImportJobs(request, options, callback)

listImportJobs(request: protos.google.cloud.kms.v1.IListImportJobsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.kms.v1.IListImportJobsRequest, protos.google.cloud.kms.v1.IListImportJobsResponse | null | undefined, protos.google.cloud.kms.v1.IImportJob>): void;
Parameters
Name Description
request IListImportJobsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.kms.v1.IListImportJobsRequest, protos.google.cloud.kms.v1.IListImportJobsResponse | null | undefined, protos.google.cloud.kms.v1.IImportJob>
Returns
Type Description
void

listImportJobs(request, callback)

listImportJobs(request: protos.google.cloud.kms.v1.IListImportJobsRequest, callback: PaginationCallback<protos.google.cloud.kms.v1.IListImportJobsRequest, protos.google.cloud.kms.v1.IListImportJobsResponse | null | undefined, protos.google.cloud.kms.v1.IImportJob>): void;
Parameters
Name Description
request IListImportJobsRequest
callback PaginationCallback<protos.google.cloud.kms.v1.IListImportJobsRequest, protos.google.cloud.kms.v1.IListImportJobsResponse | null | undefined, protos.google.cloud.kms.v1.IImportJob>
Returns
Type Description
void

listImportJobsAsync(request, options)

listImportJobsAsync(request?: protos.google.cloud.kms.v1.IListImportJobsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.kms.v1.IImportJob>;

Equivalent to listImportJobs, but returns an iterable object.

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

Parameters
Name Description
request IListImportJobsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Object} An iterable Object that allows async iteration. 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 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 KeyRing google.cloud.kms.v1.KeyRing 
   *  to list, in the format `projects/* /locations/* /keyRings/*`.
   */
  // const parent = 'abc123'
  /**
   *  Optional. Optional limit on the number of
   *  ImportJobs google.cloud.kms.v1.ImportJob  to include in the response.
   *  Further ImportJobs google.cloud.kms.v1.ImportJob  can subsequently be
   *  obtained by including the
   *  ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token 
   *  in a subsequent request. If unspecified, the server will pick an
   *  appropriate default.
   */
  // const pageSize = 1234
  /**
   *  Optional. Optional pagination token, returned earlier via
   *  ListImportJobsResponse.next_page_token google.cloud.kms.v1.ListImportJobsResponse.next_page_token.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. Only include resources that match the filter in the response. For
   *  more information, see
   *  Sorting and filtering list
   *  results (https://cloud.google.com/kms/docs/sorting-and-filtering).
   */
  // const filter = 'abc123'
  /**
   *  Optional. Specify how the results should be sorted. If not specified, the
   *  results will be sorted in the default order. For more information, see
   *  Sorting and filtering list
   *  results (https://cloud.google.com/kms/docs/sorting-and-filtering).
   */
  // const orderBy = 'abc123'

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callListImportJobs() {
    // Construct request
    const request = {
      parent,
    };

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

  callListImportJobs();

listImportJobsStream(request, options)

listImportJobsStream(request?: protos.google.cloud.kms.v1.IListImportJobsRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListImportJobsRequest

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 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 listImportJobsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listKeyRings(request, options)

listKeyRings(request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IKeyRing[],
        protos.google.cloud.kms.v1.IListKeyRingsRequest | null,
        protos.google.cloud.kms.v1.IListKeyRingsResponse
    ]>;

Lists KeyRings.

Parameters
Name Description
request IListKeyRingsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IKeyRing[], protos.google.cloud.kms.v1.IListKeyRingsRequest | null, protos.google.cloud.kms.v1.IListKeyRingsResponse ]>

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

listKeyRings(request, options, callback)

listKeyRings(request: protos.google.cloud.kms.v1.IListKeyRingsRequest, options: CallOptions, callback: PaginationCallback<protos.google.cloud.kms.v1.IListKeyRingsRequest, protos.google.cloud.kms.v1.IListKeyRingsResponse | null | undefined, protos.google.cloud.kms.v1.IKeyRing>): void;
Parameters
Name Description
request IListKeyRingsRequest
options CallOptions
callback PaginationCallback<protos.google.cloud.kms.v1.IListKeyRingsRequest, protos.google.cloud.kms.v1.IListKeyRingsResponse | null | undefined, protos.google.cloud.kms.v1.IKeyRing>
Returns
Type Description
void

listKeyRings(request, callback)

listKeyRings(request: protos.google.cloud.kms.v1.IListKeyRingsRequest, callback: PaginationCallback<protos.google.cloud.kms.v1.IListKeyRingsRequest, protos.google.cloud.kms.v1.IListKeyRingsResponse | null | undefined, protos.google.cloud.kms.v1.IKeyRing>): void;
Parameters
Name Description
request IListKeyRingsRequest
callback PaginationCallback<protos.google.cloud.kms.v1.IListKeyRingsRequest, protos.google.cloud.kms.v1.IListKeyRingsResponse | null | undefined, protos.google.cloud.kms.v1.IKeyRing>
Returns
Type Description
void

listKeyRingsAsync(request, options)

listKeyRingsAsync(request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, options?: CallOptions): AsyncIterable<protos.google.cloud.kms.v1.IKeyRing>;

Equivalent to listKeyRings, but returns an iterable object.

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

Parameters
Name Description
request IListKeyRingsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing KeyRing. 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. The resource name of the location associated with the
   *  KeyRings google.cloud.kms.v1.KeyRing, in the format
   *  `projects/* /locations/*`.
   */
  // const parent = 'abc123'
  /**
   *  Optional. Optional limit on the number of
   *  KeyRings google.cloud.kms.v1.KeyRing  to include in the response. Further
   *  KeyRings google.cloud.kms.v1.KeyRing  can subsequently be obtained by
   *  including the
   *  ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token 
   *  in a subsequent request.  If unspecified, the server will pick an
   *  appropriate default.
   */
  // const pageSize = 1234
  /**
   *  Optional. Optional pagination token, returned earlier via
   *  ListKeyRingsResponse.next_page_token google.cloud.kms.v1.ListKeyRingsResponse.next_page_token.
   */
  // const pageToken = 'abc123'
  /**
   *  Optional. Only include resources that match the filter in the response. For
   *  more information, see
   *  Sorting and filtering list
   *  results (https://cloud.google.com/kms/docs/sorting-and-filtering).
   */
  // const filter = 'abc123'
  /**
   *  Optional. Specify how the results should be sorted. If not specified, the
   *  results will be sorted in the default order.  For more information, see
   *  Sorting and filtering list
   *  results (https://cloud.google.com/kms/docs/sorting-and-filtering).
   */
  // const orderBy = 'abc123'

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callListKeyRings() {
    // Construct request
    const request = {
      parent,
    };

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

  callListKeyRings();

listKeyRingsStream(request, options)

listKeyRingsStream(request?: protos.google.cloud.kms.v1.IListKeyRingsRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListKeyRingsRequest

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 KeyRing 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 listKeyRingsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listLocationsAsync(request, options)

listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;

Lists information about the supported locations for this service. Returns an iterable object.

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

Parameters
Name Description
request LocationProtos.google.cloud.location.IListLocationsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<google.cloud.location.ILocation>

{Object} An iterable Object that allows async iteration. 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 for more details and examples.

Example

const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
  // process response
}

locationPath(project, location)

locationPath(project: string, location: string): string;

Return a fully-qualified location resource name string.

Parameters
Name Description
project string
location string
Returns
Type Description
string

{string} Resource name string.

macSign(request, options)

macSign(request?: protos.google.cloud.kms.v1.IMacSignRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IMacSignResponse,
        protos.google.cloud.kms.v1.IMacSignRequest | undefined,
        {} | undefined
    ]>;

Signs data using a with MAC, producing a tag that can be verified by another source with the same key.

Parameters
Name Description
request IMacSignRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IMacSignResponse, protos.google.cloud.kms.v1.IMacSignRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing MacSignResponse. 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
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  to use for
   *  signing.
   */
  // const name = 'abc123'
  /**
   *  Required. The data to sign. The MAC tag is computed over this data field
   *  based on the specific algorithm.
   */
  // const data = Buffer.from('string')
  /**
   *  Optional. An optional CRC32C checksum of the
   *  MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data. If
   *  specified, KeyManagementService google.cloud.kms.v1.KeyManagementService 
   *  will verify the integrity of the received
   *  MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data  using this
   *  checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService 
   *  will report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data) is
   *  equal to
   *  MacSignRequest.data_crc32c google.cloud.kms.v1.MacSignRequest.data_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const dataCrc32c = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.macSign(request);
    console.log(response);
  }

  callMacSign();

macSign(request, options, callback)

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

macSign(request, callback)

macSign(request: protos.google.cloud.kms.v1.IMacSignRequest, callback: Callback<protos.google.cloud.kms.v1.IMacSignResponse, protos.google.cloud.kms.v1.IMacSignRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IMacSignRequest
callback Callback<protos.google.cloud.kms.v1.IMacSignResponse, protos.google.cloud.kms.v1.IMacSignRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

macVerify(request, options)

macVerify(request?: protos.google.cloud.kms.v1.IMacVerifyRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IMacVerifyResponse,
        protos.google.cloud.kms.v1.IMacVerifyRequest | undefined,
        {} | undefined
    ]>;

Verifies MAC tag using a with MAC, and returns a response that indicates whether or not the verification was successful.

Parameters
Name Description
request IMacVerifyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IMacVerifyResponse, protos.google.cloud.kms.v1.IMacVerifyRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing MacVerifyResponse. 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
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  to use for
   *  verification.
   */
  // const name = 'abc123'
  /**
   *  Required. The data used previously as a
   *  MacSignRequest.data google.cloud.kms.v1.MacSignRequest.data  to generate
   *  the MAC tag.
   */
  // const data = Buffer.from('string')
  /**
   *  Optional. An optional CRC32C checksum of the
   *  MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data. If
   *  specified, KeyManagementService google.cloud.kms.v1.KeyManagementService 
   *  will verify the integrity of the received
   *  MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data  using
   *  this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(MacVerifyRequest.data google.cloud.kms.v1.MacVerifyRequest.data)
   *  is equal to
   *  MacVerifyRequest.data_crc32c google.cloud.kms.v1.MacVerifyRequest.data_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const dataCrc32c = {}
  /**
   *  Required. The signature to verify.
   */
  // const mac = Buffer.from('string')
  /**
   *  Optional. An optional CRC32C checksum of the
   *  MacVerifyRequest.mac google.cloud.kms.v1.MacVerifyRequest.mac. If
   *  specified, KeyManagementService google.cloud.kms.v1.KeyManagementService 
   *  will verify the integrity of the received
   *  MacVerifyRequest.mac google.cloud.kms.v1.MacVerifyRequest.mac  using this
   *  checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService 
   *  will report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(MacVerifyRequest.tag ) is equal to
   *  MacVerifyRequest.mac_crc32c google.cloud.kms.v1.MacVerifyRequest.mac_crc32c,
   *  and if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum. Note: This
   *  field is defined as int64 for reasons of compatibility across different
   *  languages. However, it is a non-negative integer, which will never exceed
   *  2^32-1, and can be safely downconverted to uint32 in languages that support
   *  this type.
   */
  // const macCrc32c = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callMacVerify() {
    // Construct request
    const request = {
      name,
      data,
      mac,
    };

    // Run request
    const response = await kmsClient.macVerify(request);
    console.log(response);
  }

  callMacVerify();

macVerify(request, options, callback)

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

macVerify(request, callback)

macVerify(request: protos.google.cloud.kms.v1.IMacVerifyRequest, callback: Callback<protos.google.cloud.kms.v1.IMacVerifyResponse, protos.google.cloud.kms.v1.IMacVerifyRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IMacVerifyRequest
callback Callback<protos.google.cloud.kms.v1.IMacVerifyResponse, protos.google.cloud.kms.v1.IMacVerifyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

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.

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.

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.

matchEkmConnectionFromEkmConnectionName(ekmConnectionName)

matchEkmConnectionFromEkmConnectionName(ekmConnectionName: string): string | number;

Parse the ekm_connection from EkmConnection resource.

Parameter
Name Description
ekmConnectionName string

A fully-qualified path representing EkmConnection resource.

Returns
Type Description
string | number

{string} A string representing the ekm_connection.

matchFolderFromAutokeyConfigName(autokeyConfigName)

matchFolderFromAutokeyConfigName(autokeyConfigName: string): string | number;

Parse the folder from AutokeyConfig resource.

Parameter
Name Description
autokeyConfigName string

A fully-qualified path representing AutokeyConfig resource.

Returns
Type Description
string | number

{string} A string representing the folder.

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.

matchKeyHandleFromKeyHandleName(keyHandleName)

matchKeyHandleFromKeyHandleName(keyHandleName: string): string | number;

Parse the key_handle from KeyHandle resource.

Parameter
Name Description
keyHandleName string

A fully-qualified path representing KeyHandle resource.

Returns
Type Description
string | number

{string} A string representing the key_handle.

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.

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.

matchLocationFromEkmConfigName(ekmConfigName)

matchLocationFromEkmConfigName(ekmConfigName: string): string | number;

Parse the location from EkmConfig resource.

Parameter
Name Description
ekmConfigName string

A fully-qualified path representing EkmConfig resource.

Returns
Type Description
string | number

{string} A string representing the location.

matchLocationFromEkmConnectionName(ekmConnectionName)

matchLocationFromEkmConnectionName(ekmConnectionName: string): string | number;

Parse the location from EkmConnection resource.

Parameter
Name Description
ekmConnectionName string

A fully-qualified path representing EkmConnection 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.

matchLocationFromKeyHandleName(keyHandleName)

matchLocationFromKeyHandleName(keyHandleName: string): string | number;

Parse the location from KeyHandle resource.

Parameter
Name Description
keyHandleName string

A fully-qualified path representing KeyHandle 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.

matchLocationFromLocationName(locationName)

matchLocationFromLocationName(locationName: string): string | number;

Parse the location from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location 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.

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.

matchProjectFromEkmConfigName(ekmConfigName)

matchProjectFromEkmConfigName(ekmConfigName: string): string | number;

Parse the project from EkmConfig resource.

Parameter
Name Description
ekmConfigName string

A fully-qualified path representing EkmConfig resource.

Returns
Type Description
string | number

{string} A string representing the project.

matchProjectFromEkmConnectionName(ekmConnectionName)

matchProjectFromEkmConnectionName(ekmConnectionName: string): string | number;

Parse the project from EkmConnection resource.

Parameter
Name Description
ekmConnectionName string

A fully-qualified path representing EkmConnection 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.

matchProjectFromKeyHandleName(keyHandleName)

matchProjectFromKeyHandleName(keyHandleName: string): string | number;

Parse the project from KeyHandle resource.

Parameter
Name Description
keyHandleName string

A fully-qualified path representing KeyHandle 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.

matchProjectFromLocationName(locationName)

matchProjectFromLocationName(locationName: string): string | number;

Parse the project from Location resource.

Parameter
Name Description
locationName string

A fully-qualified path representing Location 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.

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.

rawDecrypt(request, options)

rawDecrypt(request?: protos.google.cloud.kms.v1.IRawDecryptRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IRawDecryptResponse,
        protos.google.cloud.kms.v1.IRawDecryptRequest | undefined,
        {} | undefined
    ]>;

Decrypts data that was originally encrypted using a raw cryptographic mechanism. The must be .

Parameters
Name Description
request IRawDecryptRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IRawDecryptResponse, protos.google.cloud.kms.v1.IRawDecryptRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing RawDecryptResponse. 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
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  to use for
   *  decryption.
   */
  // const name = 'abc123'
  /**
   *  Required. The encrypted data originally returned in
   *  RawEncryptResponse.ciphertext google.cloud.kms.v1.RawEncryptResponse.ciphertext.
   */
  // const ciphertext = Buffer.from('string')
  /**
   *  Optional. Optional data that must match the data originally supplied in
   *  RawEncryptRequest.additional_authenticated_data google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data.
   */
  // const additionalAuthenticatedData = Buffer.from('string')
  /**
   *  Required. The initialization vector (IV) used during encryption, which must
   *  match the data originally provided in
   *  RawEncryptResponse.initialization_vector google.cloud.kms.v1.RawEncryptResponse.initialization_vector.
   */
  // const initializationVector = Buffer.from('string')
  /**
   *  The length of the authentication tag that is appended to the end of
   *  the ciphertext. If unspecified (0), the default value for the key's
   *  algorithm will be used (for AES-GCM, the default value is 16).
   */
  // const tagLength = 1234
  /**
   *  Optional. An optional CRC32C checksum of the
   *  RawDecryptRequest.ciphertext google.cloud.kms.v1.RawDecryptRequest.ciphertext.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received ciphertext using this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that CRC32C(ciphertext) is equal
   *  to ciphertext_crc32c, and if so, perform a limited number of retries. A
   *  persistent mismatch may indicate an issue in your computation of the CRC32C
   *  checksum. Note: This field is defined as int64 for reasons of compatibility
   *  across different languages. However, it is a non-negative integer, which
   *  will never exceed 2^32-1, and can be safely downconverted to uint32 in
   *  languages that support this type.
   */
  // const ciphertextCrc32c = {}
  /**
   *  Optional. An optional CRC32C checksum of the
   *  RawDecryptRequest.additional_authenticated_data google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received additional_authenticated_data using
   *  this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(additional_authenticated_data) is equal to
   *  additional_authenticated_data_crc32c, and if so, perform
   *  a limited number of retries. A persistent mismatch may indicate an issue in
   *  your computation of the CRC32C checksum.
   *  Note: This field is defined as int64 for reasons of compatibility across
   *  different languages. However, it is a non-negative integer, which will
   *  never exceed 2^32-1, and can be safely downconverted to uint32 in languages
   *  that support this type.
   */
  // const additionalAuthenticatedDataCrc32c = {}
  /**
   *  Optional. An optional CRC32C checksum of the
   *  RawDecryptRequest.initialization_vector google.cloud.kms.v1.RawDecryptRequest.initialization_vector.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received initialization_vector using this
   *  checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService 
   *  will report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(initialization_vector) is equal to initialization_vector_crc32c, and
   *  if so, perform a limited number of retries. A persistent mismatch may
   *  indicate an issue in your computation of the CRC32C checksum.
   *  Note: This field is defined as int64 for reasons of compatibility across
   *  different languages. However, it is a non-negative integer, which will
   *  never exceed 2^32-1, and can be safely downconverted to uint32 in languages
   *  that support this type.
   */
  // const initializationVectorCrc32c = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callRawDecrypt() {
    // Construct request
    const request = {
      name,
      ciphertext,
      initializationVector,
    };

    // Run request
    const response = await kmsClient.rawDecrypt(request);
    console.log(response);
  }

  callRawDecrypt();

rawDecrypt(request, options, callback)

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

rawDecrypt(request, callback)

rawDecrypt(request: protos.google.cloud.kms.v1.IRawDecryptRequest, callback: Callback<protos.google.cloud.kms.v1.IRawDecryptResponse, protos.google.cloud.kms.v1.IRawDecryptRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IRawDecryptRequest
callback Callback<protos.google.cloud.kms.v1.IRawDecryptResponse, protos.google.cloud.kms.v1.IRawDecryptRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

rawEncrypt(request, options)

rawEncrypt(request?: protos.google.cloud.kms.v1.IRawEncryptRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.IRawEncryptResponse,
        protos.google.cloud.kms.v1.IRawEncryptRequest | undefined,
        {} | undefined
    ]>;

Encrypts data using portable cryptographic primitives. Most users should choose and rather than their raw counterparts. The must be .

Parameters
Name Description
request IRawEncryptRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.IRawEncryptResponse, protos.google.cloud.kms.v1.IRawEncryptRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing RawEncryptResponse. 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
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  to use for
   *  encryption.
   */
  // const name = 'abc123'
  /**
   *  Required. The data to encrypt. Must be no larger than 64KiB.
   *  The maximum size depends on the key version's
   *  protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level.
   *  For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE  keys, the
   *  plaintext must be no larger than 64KiB. For
   *  HSM google.cloud.kms.v1.ProtectionLevel.HSM  keys, the combined length of
   *  the plaintext and additional_authenticated_data fields must be no larger
   *  than 8KiB.
   */
  // const plaintext = Buffer.from('string')
  /**
   *  Optional. Optional data that, if specified, must also be provided during
   *  decryption through
   *  RawDecryptRequest.additional_authenticated_data google.cloud.kms.v1.RawDecryptRequest.additional_authenticated_data.
   *  This field may only be used in conjunction with an
   *  algorithm google.cloud.kms.v1.CryptoKeyVersion.algorithm  that accepts
   *  additional authenticated data (for example, AES-GCM).
   *  The maximum size depends on the key version's
   *  protection_level google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level.
   *  For SOFTWARE google.cloud.kms.v1.ProtectionLevel.SOFTWARE  keys, the
   *  plaintext must be no larger than 64KiB. For
   *  HSM google.cloud.kms.v1.ProtectionLevel.HSM  keys, the combined length of
   *  the plaintext and additional_authenticated_data fields must be no larger
   *  than 8KiB.
   */
  // const additionalAuthenticatedData = Buffer.from('string')
  /**
   *  Optional. An optional CRC32C checksum of the
   *  RawEncryptRequest.plaintext google.cloud.kms.v1.RawEncryptRequest.plaintext.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received plaintext using this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that CRC32C(plaintext) is equal
   *  to plaintext_crc32c, and if so, perform a limited number of retries. A
   *  persistent mismatch may indicate an issue in your computation of the CRC32C
   *  checksum. Note: This field is defined as int64 for reasons of compatibility
   *  across different languages. However, it is a non-negative integer, which
   *  will never exceed 2^32-1, and can be safely downconverted to uint32 in
   *  languages that support this type.
   */
  // const plaintextCrc32c = {}
  /**
   *  Optional. An optional CRC32C checksum of the
   *  RawEncryptRequest.additional_authenticated_data google.cloud.kms.v1.RawEncryptRequest.additional_authenticated_data.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received additional_authenticated_data using
   *  this checksum.
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(additional_authenticated_data) is equal to
   *  additional_authenticated_data_crc32c, and if so, perform
   *  a limited number of retries. A persistent mismatch may indicate an issue in
   *  your computation of the CRC32C checksum.
   *  Note: This field is defined as int64 for reasons of compatibility across
   *  different languages. However, it is a non-negative integer, which will
   *  never exceed 2^32-1, and can be safely downconverted to uint32 in languages
   *  that support this type.
   */
  // const additionalAuthenticatedDataCrc32c = {}
  /**
   *  Optional. A customer-supplied initialization vector that will be used for
   *  encryption. If it is not provided for AES-CBC and AES-CTR, one will be
   *  generated. It will be returned in
   *  RawEncryptResponse.initialization_vector google.cloud.kms.v1.RawEncryptResponse.initialization_vector.
   */
  // const initializationVector = Buffer.from('string')
  /**
   *  Optional. An optional CRC32C checksum of the
   *  RawEncryptRequest.initialization_vector google.cloud.kms.v1.RawEncryptRequest.initialization_vector.
   *  If specified,
   *  KeyManagementService google.cloud.kms.v1.KeyManagementService  will
   *  verify the integrity of the received initialization_vector using this
   *  checksum. KeyManagementService google.cloud.kms.v1.KeyManagementService 
   *  will report an error if the checksum verification fails. If you receive a
   *  checksum error, your client should verify that
   *  CRC32C(initialization_vector) is equal to
   *  initialization_vector_crc32c, and if so, perform
   *  a limited number of retries. A persistent mismatch may indicate an issue in
   *  your computation of the CRC32C checksum.
   *  Note: This field is defined as int64 for reasons of compatibility across
   *  different languages. However, it is a non-negative integer, which will
   *  never exceed 2^32-1, and can be safely downconverted to uint32 in languages
   *  that support this type.
   */
  // const initializationVectorCrc32c = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.rawEncrypt(request);
    console.log(response);
  }

  callRawEncrypt();

rawEncrypt(request, options, callback)

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

rawEncrypt(request, callback)

rawEncrypt(request: protos.google.cloud.kms.v1.IRawEncryptRequest, callback: Callback<protos.google.cloud.kms.v1.IRawEncryptResponse, protos.google.cloud.kms.v1.IRawEncryptRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IRawEncryptRequest
callback Callback<protos.google.cloud.kms.v1.IRawEncryptResponse, protos.google.cloud.kms.v1.IRawEncryptRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

restoreCryptoKeyVersion(request, options)

restoreCryptoKeyVersion(request?: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKeyVersion,
        protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest | undefined,
        {} | undefined
    ]>;

Restore a in the state.

Upon restoration of the CryptoKeyVersion, will be set to , and will be cleared.

Parameters
Name Description
request IRestoreCryptoKeyVersionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest | undefined, {} | undefined ]>

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

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.restoreCryptoKeyVersion(request);
    console.log(response);
  }

  callRestoreCryptoKeyVersion();

restoreCryptoKeyVersion(request, options, callback)

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

restoreCryptoKeyVersion(request, callback)

restoreCryptoKeyVersion(request: protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IRestoreCryptoKeyVersionRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IRestoreCryptoKeyVersionRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

setIamPolicy(request, options, callback)

setIamPolicy(request: IamProtos.google.iam.v1.SetIamPolicyRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.Policy, IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.Policy]>;

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request IamProtos.google.iam.v1.SetIamPolicyRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.Policy, google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.Policy, google.iam.v1.SetIamPolicyRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.Policy]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

testIamPermissions(request, options, callback)

testIamPermissions(request: IamProtos.google.iam.v1.TestIamPermissionsRequest, options?: gax.CallOptions | Callback<IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>, callback?: Callback<IamProtos.google.iam.v1.TestIamPermissionsResponse, IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>): Promise<[IamProtos.google.iam.v1.TestIamPermissionsResponse]>;

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Parameters
Name Description
request IamProtos.google.iam.v1.TestIamPermissionsRequest

The request object that will be sent.

options CallOptions | Callback<google.iam.v1.TestIamPermissionsResponse, google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback Callback<google.iam.v1.TestIamPermissionsResponse, google.iam.v1.TestIamPermissionsRequest | null | undefined, {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing .

Returns
Type Description
Promise<[google.iam.v1.TestIamPermissionsResponse]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

updateCryptoKey(request, options)

updateCryptoKey(request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKey,
        protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | undefined,
        {} | undefined
    ]>;

Update a .

Parameters
Name Description
request IUpdateCryptoKeyRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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. CryptoKey google.cloud.kms.v1.CryptoKey  with updated values.
   */
  // const cryptoKey = {}
  /**
   *  Required. List of fields to be updated in this request.
   */
  // const updateMask = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callUpdateCryptoKey() {
    // Construct request
    const request = {
      cryptoKey,
      updateMask,
    };

    // Run request
    const response = await kmsClient.updateCryptoKey(request);
    console.log(response);
  }

  callUpdateCryptoKey();

updateCryptoKey(request, options, callback)

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

updateCryptoKey(request, callback)

updateCryptoKey(request: protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateCryptoKeyRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.IUpdateCryptoKeyRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateCryptoKeyPrimaryVersion(request, options)

updateCryptoKeyPrimaryVersion(request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKey,
        (protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest | undefined),
        {} | undefined
    ]>;

Update the version of a that will be used in .

Returns an error if called on a key whose purpose is not .

Parameters
Name Description
request IUpdateCryptoKeyPrimaryVersionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

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

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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  to update.
   */
  // const name = 'abc123'
  /**
   *  Required. The id of the child
   *  CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  to use as primary.
   */
  // const cryptoKeyVersionId = 'abc123'

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

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

    // Run request
    const response = await kmsClient.updateCryptoKeyPrimaryVersion(request);
    console.log(response);
  }

  callUpdateCryptoKeyPrimaryVersion();

updateCryptoKeyPrimaryVersion(request, options, callback)

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

updateCryptoKeyPrimaryVersion(request, callback)

updateCryptoKeyPrimaryVersion(request: protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateCryptoKeyPrimaryVersionRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKey, protos.google.cloud.kms.v1.IUpdateCryptoKeyPrimaryVersionRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateCryptoKeyVersion(request, options)

updateCryptoKeyVersion(request?: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, options?: CallOptions): Promise<[
        protos.google.cloud.kms.v1.ICryptoKeyVersion,
        protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest | undefined,
        {} | undefined
    ]>;

Update a 's metadata.

may be changed between and using this method. See and to move between other states.

Parameters
Name Description
request IUpdateCryptoKeyVersionRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . 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. CryptoKeyVersion google.cloud.kms.v1.CryptoKeyVersion  with
   *  updated values.
   */
  // const cryptoKeyVersion = {}
  /**
   *  Required. List of fields to be updated in this request.
   */
  // const updateMask = {}

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

  // Instantiates a client
  const kmsClient = new KeyManagementServiceClient();

  async function callUpdateCryptoKeyVersion() {
    // Construct request
    const request = {
      cryptoKeyVersion,
      updateMask,
    };

    // Run request
    const response = await kmsClient.updateCryptoKeyVersion(request);
    console.log(response);
  }

  callUpdateCryptoKeyVersion();

updateCryptoKeyVersion(request, options, callback)

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

updateCryptoKeyVersion(request, callback)

updateCryptoKeyVersion(request: protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest, callback: Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateCryptoKeyVersionRequest
callback Callback<protos.google.cloud.kms.v1.ICryptoKeyVersion, protos.google.cloud.kms.v1.IUpdateCryptoKeyVersionRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void