Class KeyManagementServiceClient (2.3.0)

public abstract class KeyManagementServiceClient

KeyManagementService client wrapper, for convenient use.

Inheritance

Object > KeyManagementServiceClient

Namespace

Google.Cloud.Kms.V1

Assembly

Google.Cloud.Kms.V1.dll

Remarks

Google Cloud Key Management Service

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

  • [KeyRing][google.cloud.kms.v1.KeyRing]
  • [CryptoKey][google.cloud.kms.v1.CryptoKey]
  • [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]
  • [ImportJob][google.cloud.kms.v1.ImportJob]

If you are using manual gRPC libraries, see Using gRPC with Cloud KMS.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the KeyManagementService service, which is a host of "cloudkms.googleapis.com" and a port of 443.

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default KeyManagementService scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual KeyManagementService.KeyManagementServiceClient GrpcClient { get; }

The underlying gRPC KeyManagementService client

Property Value
TypeDescription
KeyManagementService.KeyManagementServiceClient

Methods

AsymmetricDecrypt(AsymmetricDecryptRequest, CallSettings)

public virtual AsymmetricDecryptResponse AsymmetricDecrypt(AsymmetricDecryptRequest request, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
NameDescription
requestAsymmetricDecryptRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AsymmetricDecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
AsymmetricDecryptRequest request = new AsymmetricDecryptRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Ciphertext = ByteString.Empty,
    CiphertextCrc32C = 0L,
};
// Make the request
AsymmetricDecryptResponse response = keyManagementServiceClient.AsymmetricDecrypt(request);

AsymmetricDecrypt(CryptoKeyVersionName, ByteString, CallSettings)

public virtual AsymmetricDecryptResponse AsymmetricDecrypt(CryptoKeyVersionName name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertextByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AsymmetricDecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = keyManagementServiceClient.AsymmetricDecrypt(name, ciphertext);

AsymmetricDecrypt(String, ByteString, CallSettings)

public virtual AsymmetricDecryptResponse AsymmetricDecrypt(string name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertextByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AsymmetricDecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = keyManagementServiceClient.AsymmetricDecrypt(name, ciphertext);

AsymmetricDecryptAsync(AsymmetricDecryptRequest, CallSettings)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(AsymmetricDecryptRequest request, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
NameDescription
requestAsymmetricDecryptRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<AsymmetricDecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
AsymmetricDecryptRequest request = new AsymmetricDecryptRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Ciphertext = ByteString.Empty,
    CiphertextCrc32C = 0L,
};
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(request);

AsymmetricDecryptAsync(AsymmetricDecryptRequest, CancellationToken)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(AsymmetricDecryptRequest request, CancellationToken cancellationToken)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
NameDescription
requestAsymmetricDecryptRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<AsymmetricDecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
AsymmetricDecryptRequest request = new AsymmetricDecryptRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Ciphertext = ByteString.Empty,
    CiphertextCrc32C = 0L,
};
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(request);

AsymmetricDecryptAsync(CryptoKeyVersionName, ByteString, CallSettings)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(CryptoKeyVersionName name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertextByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<AsymmetricDecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(name, ciphertext);

AsymmetricDecryptAsync(CryptoKeyVersionName, ByteString, CancellationToken)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(CryptoKeyVersionName name, ByteString ciphertext, CancellationToken cancellationToken)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertextByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<AsymmetricDecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(name, ciphertext);

AsymmetricDecryptAsync(String, ByteString, CallSettings)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(string name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertextByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<AsymmetricDecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(name, ciphertext);

AsymmetricDecryptAsync(String, ByteString, CancellationToken)

public virtual Task<AsymmetricDecryptResponse> AsymmetricDecryptAsync(string name, ByteString ciphertext, CancellationToken cancellationToken)

Decrypts data that was encrypted with a public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey] corresponding to a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_DECRYPT.

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for decryption.

ciphertextByteString

Required. The data encrypted with the named [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s public key using OAEP.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<AsymmetricDecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
ByteString ciphertext = ByteString.Empty;
// Make the request
AsymmetricDecryptResponse response = await keyManagementServiceClient.AsymmetricDecryptAsync(name, ciphertext);

AsymmetricSign(AsymmetricSignRequest, CallSettings)

public virtual AsymmetricSignResponse AsymmetricSign(AsymmetricSignRequest request, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
NameDescription
requestAsymmetricSignRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AsymmetricSignResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
AsymmetricSignRequest request = new AsymmetricSignRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Digest = new Digest(),
    DigestCrc32C = 0L,
};
// Make the request
AsymmetricSignResponse response = keyManagementServiceClient.AsymmetricSign(request);

AsymmetricSign(CryptoKeyVersionName, Digest, CallSettings)

public virtual AsymmetricSignResponse AsymmetricSign(CryptoKeyVersionName name, Digest digest, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digestDigest

Required. 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].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AsymmetricSignResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = keyManagementServiceClient.AsymmetricSign(name, digest);

AsymmetricSign(String, Digest, CallSettings)

public virtual AsymmetricSignResponse AsymmetricSign(string name, Digest digest, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digestDigest

Required. 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].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AsymmetricSignResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = keyManagementServiceClient.AsymmetricSign(name, digest);

AsymmetricSignAsync(AsymmetricSignRequest, CallSettings)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(AsymmetricSignRequest request, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
NameDescription
requestAsymmetricSignRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<AsymmetricSignResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
AsymmetricSignRequest request = new AsymmetricSignRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Digest = new Digest(),
    DigestCrc32C = 0L,
};
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(request);

AsymmetricSignAsync(AsymmetricSignRequest, CancellationToken)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(AsymmetricSignRequest request, CancellationToken cancellationToken)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
NameDescription
requestAsymmetricSignRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<AsymmetricSignResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
AsymmetricSignRequest request = new AsymmetricSignRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
    Digest = new Digest(),
    DigestCrc32C = 0L,
};
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(request);

AsymmetricSignAsync(CryptoKeyVersionName, Digest, CallSettings)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(CryptoKeyVersionName name, Digest digest, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digestDigest

Required. 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].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<AsymmetricSignResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(name, digest);

AsymmetricSignAsync(CryptoKeyVersionName, Digest, CancellationToken)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(CryptoKeyVersionName name, Digest digest, CancellationToken cancellationToken)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digestDigest

Required. 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].

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<AsymmetricSignResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(name, digest);

AsymmetricSignAsync(String, Digest, CallSettings)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(string name, Digest digest, CallSettings callSettings = null)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digestDigest

Required. 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].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<AsymmetricSignResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(name, digest);

AsymmetricSignAsync(String, Digest, CancellationToken)

public virtual Task<AsymmetricSignResponse> AsymmetricSignAsync(string name, Digest digest, CancellationToken cancellationToken)

Signs data using a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] ASYMMETRIC_SIGN, producing a signature that can be verified with the public key retrieved from [GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey].

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use for signing.

digestDigest

Required. 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].

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<AsymmetricSignResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
Digest digest = new Digest();
// Make the request
AsymmetricSignResponse response = await keyManagementServiceClient.AsymmetricSignAsync(name, digest);

Create()

public static KeyManagementServiceClient Create()

Synchronously creates a KeyManagementServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use KeyManagementServiceClientBuilder.

Returns
TypeDescription
KeyManagementServiceClient

The created KeyManagementServiceClient.

CreateAsync(CancellationToken)

public static Task<KeyManagementServiceClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))

Asynchronously creates a KeyManagementServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use KeyManagementServiceClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<KeyManagementServiceClient>

The task representing the created KeyManagementServiceClient.

CreateCryptoKey(CreateCryptoKeyRequest, CallSettings)

public virtual CryptoKey CreateCryptoKey(CreateCryptoKeyRequest request, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
NameDescription
requestCreateCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CreateCryptoKeyRequest request = new CreateCryptoKeyRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    CryptoKeyId = "",
    CryptoKey = new CryptoKey(),
    SkipInitialVersionCreation = false,
};
// Make the request
CryptoKey response = keyManagementServiceClient.CreateCryptoKey(request);

CreateCryptoKey(KeyRingName, String, CryptoKey, CallSettings)

public virtual CryptoKey CreateCryptoKey(KeyRingName parent, string cryptoKeyId, CryptoKey cryptoKey, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
NameDescription
parentKeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKeyCryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = keyManagementServiceClient.CreateCryptoKey(parent, cryptoKeyId, cryptoKey);

CreateCryptoKey(String, String, CryptoKey, CallSettings)

public virtual CryptoKey CreateCryptoKey(string parent, string cryptoKeyId, CryptoKey cryptoKey, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
NameDescription
parentString

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKeyCryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = keyManagementServiceClient.CreateCryptoKey(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyAsync(CreateCryptoKeyRequest, CallSettings)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(CreateCryptoKeyRequest request, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
NameDescription
requestCreateCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCryptoKeyRequest request = new CreateCryptoKeyRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    CryptoKeyId = "",
    CryptoKey = new CryptoKey(),
    SkipInitialVersionCreation = false,
};
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(request);

CreateCryptoKeyAsync(CreateCryptoKeyRequest, CancellationToken)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(CreateCryptoKeyRequest request, CancellationToken cancellationToken)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
NameDescription
requestCreateCryptoKeyRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCryptoKeyRequest request = new CreateCryptoKeyRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    CryptoKeyId = "",
    CryptoKey = new CryptoKey(),
    SkipInitialVersionCreation = false,
};
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(request);

CreateCryptoKeyAsync(KeyRingName, String, CryptoKey, CallSettings)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(KeyRingName parent, string cryptoKeyId, CryptoKey cryptoKey, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
NameDescription
parentKeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKeyCryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyAsync(KeyRingName, String, CryptoKey, CancellationToken)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(KeyRingName parent, string cryptoKeyId, CryptoKey cryptoKey, CancellationToken cancellationToken)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
NameDescription
parentKeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKeyCryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyAsync(String, String, CryptoKey, CallSettings)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(string parent, string cryptoKeyId, CryptoKey cryptoKey, CallSettings callSettings = null)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
NameDescription
parentString

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKeyCryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyAsync(String, String, CryptoKey, CancellationToken)

public virtual Task<CryptoKey> CreateCryptoKeyAsync(string parent, string cryptoKeyId, CryptoKey cryptoKey, CancellationToken cancellationToken)

Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] and [CryptoKey.version_template.algorithm][google.cloud.kms.v1.CryptoKeyVersionTemplate.algorithm] are required.

Parameters
NameDescription
parentString

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the KeyRing associated with the [CryptoKeys][google.cloud.kms.v1.CryptoKey].

cryptoKeyIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

cryptoKeyCryptoKey

Required. A [CryptoKey][google.cloud.kms.v1.CryptoKey] with initial field values.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string cryptoKeyId = "";
CryptoKey cryptoKey = new CryptoKey();
// Make the request
CryptoKey response = await keyManagementServiceClient.CreateCryptoKeyAsync(parent, cryptoKeyId, cryptoKey);

CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion CreateCryptoKeyVersion(CreateCryptoKeyVersionRequest request, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
NameDescription
requestCreateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CreateCryptoKeyVersionRequest request = new CreateCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersion = new CryptoKeyVersion(),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.CreateCryptoKeyVersion(request);

CreateCryptoKeyVersion(CryptoKeyName, CryptoKeyVersion, CallSettings)

public virtual CryptoKeyVersion CreateCryptoKeyVersion(CryptoKeyName parent, CryptoKeyVersion cryptoKeyVersion, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
NameDescription
parentCryptoKeyName

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].

cryptoKeyVersionCryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.CreateCryptoKeyVersion(parent, cryptoKeyVersion);

CreateCryptoKeyVersion(String, CryptoKeyVersion, CallSettings)

public virtual CryptoKeyVersion CreateCryptoKeyVersion(string parent, CryptoKeyVersion cryptoKeyVersion, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
NameDescription
parentString

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].

cryptoKeyVersionCryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.CreateCryptoKeyVersion(parent, cryptoKeyVersion);

CreateCryptoKeyVersionAsync(CreateCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(CreateCryptoKeyVersionRequest request, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
NameDescription
requestCreateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCryptoKeyVersionRequest request = new CreateCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersion = new CryptoKeyVersion(),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(request);

CreateCryptoKeyVersionAsync(CreateCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(CreateCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
NameDescription
requestCreateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCryptoKeyVersionRequest request = new CreateCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersion = new CryptoKeyVersion(),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(request);

CreateCryptoKeyVersionAsync(CryptoKeyName, CryptoKeyVersion, CallSettings)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(CryptoKeyName parent, CryptoKeyVersion cryptoKeyVersion, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
NameDescription
parentCryptoKeyName

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].

cryptoKeyVersionCryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(parent, cryptoKeyVersion);

CreateCryptoKeyVersionAsync(CryptoKeyName, CryptoKeyVersion, CancellationToken)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(CryptoKeyName parent, CryptoKeyVersion cryptoKeyVersion, CancellationToken cancellationToken)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
NameDescription
parentCryptoKeyName

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].

cryptoKeyVersionCryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(parent, cryptoKeyVersion);

CreateCryptoKeyVersionAsync(String, CryptoKeyVersion, CallSettings)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(string parent, CryptoKeyVersion cryptoKeyVersion, CallSettings callSettings = null)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
NameDescription
parentString

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].

cryptoKeyVersionCryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(parent, cryptoKeyVersion);

CreateCryptoKeyVersionAsync(String, CryptoKeyVersion, CancellationToken)

public virtual Task<CryptoKeyVersion> CreateCryptoKeyVersionAsync(string parent, CryptoKeyVersion cryptoKeyVersion, CancellationToken cancellationToken)

Create a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in a [CryptoKey][google.cloud.kms.v1.CryptoKey].

The server will assign the next sequential id. If unset, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED].

Parameters
NameDescription
parentString

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].

cryptoKeyVersionCryptoKeyVersion

Required. A [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with initial field values.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.CreateCryptoKeyVersionAsync(parent, cryptoKeyVersion);

CreateImportJob(CreateImportJobRequest, CallSettings)

public virtual ImportJob CreateImportJob(CreateImportJobRequest request, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
NameDescription
requestCreateImportJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CreateImportJobRequest request = new CreateImportJobRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    ImportJobId = "",
    ImportJob = new ImportJob(),
};
// Make the request
ImportJob response = keyManagementServiceClient.CreateImportJob(request);

CreateImportJob(KeyRingName, String, ImportJob, CallSettings)

public virtual ImportJob CreateImportJob(KeyRingName parent, string importJobId, ImportJob importJob, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
NameDescription
parentKeyRingName

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].

importJobIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJobImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = keyManagementServiceClient.CreateImportJob(parent, importJobId, importJob);

CreateImportJob(String, String, ImportJob, CallSettings)

public virtual ImportJob CreateImportJob(string parent, string importJobId, ImportJob importJob, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
NameDescription
parentString

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].

importJobIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJobImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = keyManagementServiceClient.CreateImportJob(parent, importJobId, importJob);

CreateImportJobAsync(CreateImportJobRequest, CallSettings)

public virtual Task<ImportJob> CreateImportJobAsync(CreateImportJobRequest request, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
NameDescription
requestCreateImportJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateImportJobRequest request = new CreateImportJobRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    ImportJobId = "",
    ImportJob = new ImportJob(),
};
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(request);

CreateImportJobAsync(CreateImportJobRequest, CancellationToken)

public virtual Task<ImportJob> CreateImportJobAsync(CreateImportJobRequest request, CancellationToken cancellationToken)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
NameDescription
requestCreateImportJobRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateImportJobRequest request = new CreateImportJobRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    ImportJobId = "",
    ImportJob = new ImportJob(),
};
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(request);

CreateImportJobAsync(KeyRingName, String, ImportJob, CallSettings)

public virtual Task<ImportJob> CreateImportJobAsync(KeyRingName parent, string importJobId, ImportJob importJob, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
NameDescription
parentKeyRingName

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].

importJobIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJobImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(parent, importJobId, importJob);

CreateImportJobAsync(KeyRingName, String, ImportJob, CancellationToken)

public virtual Task<ImportJob> CreateImportJobAsync(KeyRingName parent, string importJobId, ImportJob importJob, CancellationToken cancellationToken)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
NameDescription
parentKeyRingName

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].

importJobIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJobImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(parent, importJobId, importJob);

CreateImportJobAsync(String, String, ImportJob, CallSettings)

public virtual Task<ImportJob> CreateImportJobAsync(string parent, string importJobId, ImportJob importJob, CallSettings callSettings = null)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
NameDescription
parentString

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].

importJobIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJobImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(parent, importJobId, importJob);

CreateImportJobAsync(String, String, ImportJob, CancellationToken)

public virtual Task<ImportJob> CreateImportJobAsync(string parent, string importJobId, ImportJob importJob, CancellationToken cancellationToken)

Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a [KeyRing][google.cloud.kms.v1.KeyRing].

[ImportJob.import_method][google.cloud.kms.v1.ImportJob.import_method] is required.

Parameters
NameDescription
parentString

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].

importJobIdString

Required. It must be unique within a KeyRing and match the regular expression [a-zA-Z0-9_-]{1,63}

importJobImportJob

Required. An [ImportJob][google.cloud.kms.v1.ImportJob] with initial field values.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
string importJobId = "";
ImportJob importJob = new ImportJob();
// Make the request
ImportJob response = await keyManagementServiceClient.CreateImportJobAsync(parent, importJobId, importJob);

CreateKeyRing(LocationName, String, KeyRing, CallSettings)

public virtual KeyRing CreateKeyRing(LocationName parent, string keyRingId, KeyRing keyRing, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
NameDescription
parentLocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingIdString

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRingKeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = keyManagementServiceClient.CreateKeyRing(parent, keyRingId, keyRing);

CreateKeyRing(CreateKeyRingRequest, CallSettings)

public virtual KeyRing CreateKeyRing(CreateKeyRingRequest request, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
NameDescription
requestCreateKeyRingRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CreateKeyRingRequest request = new CreateKeyRingRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KeyRingId = "",
    KeyRing = new KeyRing(),
};
// Make the request
KeyRing response = keyManagementServiceClient.CreateKeyRing(request);

CreateKeyRing(String, String, KeyRing, CallSettings)

public virtual KeyRing CreateKeyRing(string parent, string keyRingId, KeyRing keyRing, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
NameDescription
parentString

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingIdString

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRingKeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = keyManagementServiceClient.CreateKeyRing(parent, keyRingId, keyRing);

CreateKeyRingAsync(LocationName, String, KeyRing, CallSettings)

public virtual Task<KeyRing> CreateKeyRingAsync(LocationName parent, string keyRingId, KeyRing keyRing, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
NameDescription
parentLocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingIdString

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRingKeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(parent, keyRingId, keyRing);

CreateKeyRingAsync(LocationName, String, KeyRing, CancellationToken)

public virtual Task<KeyRing> CreateKeyRingAsync(LocationName parent, string keyRingId, KeyRing keyRing, CancellationToken cancellationToken)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
NameDescription
parentLocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingIdString

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRingKeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(parent, keyRingId, keyRing);

CreateKeyRingAsync(CreateKeyRingRequest, CallSettings)

public virtual Task<KeyRing> CreateKeyRingAsync(CreateKeyRingRequest request, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
NameDescription
requestCreateKeyRingRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateKeyRingRequest request = new CreateKeyRingRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KeyRingId = "",
    KeyRing = new KeyRing(),
};
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(request);

CreateKeyRingAsync(CreateKeyRingRequest, CancellationToken)

public virtual Task<KeyRing> CreateKeyRingAsync(CreateKeyRingRequest request, CancellationToken cancellationToken)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
NameDescription
requestCreateKeyRingRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CreateKeyRingRequest request = new CreateKeyRingRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KeyRingId = "",
    KeyRing = new KeyRing(),
};
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(request);

CreateKeyRingAsync(String, String, KeyRing, CallSettings)

public virtual Task<KeyRing> CreateKeyRingAsync(string parent, string keyRingId, KeyRing keyRing, CallSettings callSettings = null)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
NameDescription
parentString

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingIdString

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRingKeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(parent, keyRingId, keyRing);

CreateKeyRingAsync(String, String, KeyRing, CancellationToken)

public virtual Task<KeyRing> CreateKeyRingAsync(string parent, string keyRingId, KeyRing keyRing, CancellationToken cancellationToken)

Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location.

Parameters
NameDescription
parentString

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

keyRingIdString

Required. It must be unique within a location and match the regular expression [a-zA-Z0-9_-]{1,63}

keyRingKeyRing

Required. A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
string keyRingId = "";
KeyRing keyRing = new KeyRing();
// Make the request
KeyRing response = await keyManagementServiceClient.CreateKeyRingAsync(parent, keyRingId, keyRing);

Decrypt(CryptoKeyName, ByteString, CallSettings)

public virtual DecryptResponse Decrypt(CryptoKeyName name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameCryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertextByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
DecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = keyManagementServiceClient.Decrypt(name, ciphertext);

Decrypt(DecryptRequest, CallSettings)

public virtual DecryptResponse Decrypt(DecryptRequest request, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
requestDecryptRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
DecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
DecryptRequest request = new DecryptRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Ciphertext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    CiphertextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
DecryptResponse response = keyManagementServiceClient.Decrypt(request);

Decrypt(String, ByteString, CallSettings)

public virtual DecryptResponse Decrypt(string name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertextByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
DecryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = keyManagementServiceClient.Decrypt(name, ciphertext);

DecryptAsync(CryptoKeyName, ByteString, CallSettings)

public virtual Task<DecryptResponse> DecryptAsync(CryptoKeyName name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameCryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertextByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<DecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(name, ciphertext);

DecryptAsync(CryptoKeyName, ByteString, CancellationToken)

public virtual Task<DecryptResponse> DecryptAsync(CryptoKeyName name, ByteString ciphertext, CancellationToken cancellationToken)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameCryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertextByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<DecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(name, ciphertext);

DecryptAsync(DecryptRequest, CallSettings)

public virtual Task<DecryptResponse> DecryptAsync(DecryptRequest request, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
requestDecryptRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<DecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
DecryptRequest request = new DecryptRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Ciphertext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    CiphertextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(request);

DecryptAsync(DecryptRequest, CancellationToken)

public virtual Task<DecryptResponse> DecryptAsync(DecryptRequest request, CancellationToken cancellationToken)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
requestDecryptRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<DecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
DecryptRequest request = new DecryptRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Ciphertext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    CiphertextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(request);

DecryptAsync(String, ByteString, CallSettings)

public virtual Task<DecryptResponse> DecryptAsync(string name, ByteString ciphertext, CallSettings callSettings = null)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertextByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<DecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(name, ciphertext);

DecryptAsync(String, ByteString, CancellationToken)

public virtual Task<DecryptResponse> DecryptAsync(string name, ByteString ciphertext, CancellationToken cancellationToken)

Decrypts data that was protected by [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to use for decryption. The server will choose the appropriate version.

ciphertextByteString

Required. The encrypted data originally returned in [EncryptResponse.ciphertext][google.cloud.kms.v1.EncryptResponse.ciphertext].

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<DecryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
ByteString ciphertext = ByteString.Empty;
// Make the request
DecryptResponse response = await keyManagementServiceClient.DecryptAsync(name, ciphertext);

DestroyCryptoKeyVersion(CryptoKeyVersionName, CallSettings)

public virtual CryptoKeyVersion DestroyCryptoKeyVersion(CryptoKeyVersionName name, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.DestroyCryptoKeyVersion(name);

DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion DestroyCryptoKeyVersion(DestroyCryptoKeyVersionRequest request, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
NameDescription
requestDestroyCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
DestroyCryptoKeyVersionRequest request = new DestroyCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.DestroyCryptoKeyVersion(request);

DestroyCryptoKeyVersion(String, CallSettings)

public virtual CryptoKeyVersion DestroyCryptoKeyVersion(string name, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.DestroyCryptoKeyVersion(name);

DestroyCryptoKeyVersionAsync(CryptoKeyVersionName, CallSettings)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(CryptoKeyVersionName name, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(name);

DestroyCryptoKeyVersionAsync(CryptoKeyVersionName, CancellationToken)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(CryptoKeyVersionName name, CancellationToken cancellationToken)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(name);

DestroyCryptoKeyVersionAsync(DestroyCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(DestroyCryptoKeyVersionRequest request, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
NameDescription
requestDestroyCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
DestroyCryptoKeyVersionRequest request = new DestroyCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(request);

DestroyCryptoKeyVersionAsync(DestroyCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(DestroyCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
NameDescription
requestDestroyCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
DestroyCryptoKeyVersionRequest request = new DestroyCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(request);

DestroyCryptoKeyVersionAsync(String, CallSettings)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(string name, CallSettings callSettings = null)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(name);

DestroyCryptoKeyVersionAsync(String, CancellationToken)

public virtual Task<CryptoKeyVersion> DestroyCryptoKeyVersionAsync(string name, CancellationToken cancellationToken)

Schedule a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] for destruction.

Upon calling this method, [CryptoKeyVersion.state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be set to a time 24 hours in the future, at which point the [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be changed to [DESTROYED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROYED], and the key material will be irrevocably destroyed.

Before the [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] is reached, [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] may be called to reverse the process.

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to destroy.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.DestroyCryptoKeyVersionAsync(name);

Encrypt(IResourceName, ByteString, CallSettings)

public virtual EncryptResponse Encrypt(IResourceName name, ByteString plaintext, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameIResourceName

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].

plaintextByteString

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
EncryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = keyManagementServiceClient.Encrypt(name, plaintext);

Encrypt(EncryptRequest, CallSettings)

public virtual EncryptResponse Encrypt(EncryptRequest request, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
requestEncryptRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
EncryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
EncryptRequest request = new EncryptRequest
{
    ResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Plaintext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    PlaintextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
EncryptResponse response = keyManagementServiceClient.Encrypt(request);

Encrypt(String, ByteString, CallSettings)

public virtual EncryptResponse Encrypt(string name, ByteString plaintext, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameString

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].

plaintextByteString

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
EncryptResponse

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "a/wildcard/resource";
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = keyManagementServiceClient.Encrypt(name, plaintext);

EncryptAsync(IResourceName, ByteString, CallSettings)

public virtual Task<EncryptResponse> EncryptAsync(IResourceName name, ByteString plaintext, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameIResourceName

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].

plaintextByteString

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<EncryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(name, plaintext);

EncryptAsync(IResourceName, ByteString, CancellationToken)

public virtual Task<EncryptResponse> EncryptAsync(IResourceName name, ByteString plaintext, CancellationToken cancellationToken)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameIResourceName

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].

plaintextByteString

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.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<EncryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
IResourceName name = new UnparsedResourceName("a/wildcard/resource");
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(name, plaintext);

EncryptAsync(EncryptRequest, CallSettings)

public virtual Task<EncryptResponse> EncryptAsync(EncryptRequest request, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
requestEncryptRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<EncryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
EncryptRequest request = new EncryptRequest
{
    ResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Plaintext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    PlaintextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(request);

EncryptAsync(EncryptRequest, CancellationToken)

public virtual Task<EncryptResponse> EncryptAsync(EncryptRequest request, CancellationToken cancellationToken)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
requestEncryptRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<EncryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
EncryptRequest request = new EncryptRequest
{
    ResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Plaintext = ByteString.Empty,
    AdditionalAuthenticatedData = ByteString.Empty,
    PlaintextCrc32C = 0L,
    AdditionalAuthenticatedDataCrc32C = 0L,
};
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(request);

EncryptAsync(String, ByteString, CallSettings)

public virtual Task<EncryptResponse> EncryptAsync(string name, ByteString plaintext, CallSettings callSettings = null)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameString

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].

plaintextByteString

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.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<EncryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "a/wildcard/resource";
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(name, plaintext);

EncryptAsync(String, ByteString, CancellationToken)

public virtual Task<EncryptResponse> EncryptAsync(string name, ByteString plaintext, CancellationToken cancellationToken)

Encrypts data, so that it can only be recovered by a call to [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameString

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].

plaintextByteString

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.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<EncryptResponse>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "a/wildcard/resource";
ByteString plaintext = ByteString.Empty;
// Make the request
EncryptResponse response = await keyManagementServiceClient.EncryptAsync(name, plaintext);

GetCryptoKey(CryptoKeyName, CallSettings)

public virtual CryptoKey GetCryptoKey(CryptoKeyName name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameCryptoKeyName

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
CryptoKey response = keyManagementServiceClient.GetCryptoKey(name);

GetCryptoKey(GetCryptoKeyRequest, CallSettings)

public virtual CryptoKey GetCryptoKey(GetCryptoKeyRequest request, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
requestGetCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetCryptoKeyRequest request = new GetCryptoKeyRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
CryptoKey response = keyManagementServiceClient.GetCryptoKey(request);

GetCryptoKey(String, CallSettings)

public virtual CryptoKey GetCryptoKey(string name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
CryptoKey response = keyManagementServiceClient.GetCryptoKey(name);

GetCryptoKeyAsync(CryptoKeyName, CallSettings)

public virtual Task<CryptoKey> GetCryptoKeyAsync(CryptoKeyName name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameCryptoKeyName

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(name);

GetCryptoKeyAsync(CryptoKeyName, CancellationToken)

public virtual Task<CryptoKey> GetCryptoKeyAsync(CryptoKeyName name, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameCryptoKeyName

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(name);

GetCryptoKeyAsync(GetCryptoKeyRequest, CallSettings)

public virtual Task<CryptoKey> GetCryptoKeyAsync(GetCryptoKeyRequest request, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
requestGetCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetCryptoKeyRequest request = new GetCryptoKeyRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(request);

GetCryptoKeyAsync(GetCryptoKeyRequest, CancellationToken)

public virtual Task<CryptoKey> GetCryptoKeyAsync(GetCryptoKeyRequest request, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
requestGetCryptoKeyRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetCryptoKeyRequest request = new GetCryptoKeyRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
};
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(request);

GetCryptoKeyAsync(String, CallSettings)

public virtual Task<CryptoKey> GetCryptoKeyAsync(string name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(name);

GetCryptoKeyAsync(String, CancellationToken)

public virtual Task<CryptoKey> GetCryptoKeyAsync(string name, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKey][google.cloud.kms.v1.CryptoKey], as well as its [primary][google.cloud.kms.v1.CryptoKey.primary] [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.CryptoKey.name] of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
CryptoKey response = await keyManagementServiceClient.GetCryptoKeyAsync(name);

GetCryptoKeyVersion(CryptoKeyVersionName, CallSettings)

public virtual CryptoKeyVersion GetCryptoKeyVersion(CryptoKeyVersionName name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.GetCryptoKeyVersion(name);

GetCryptoKeyVersion(GetCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion GetCryptoKeyVersion(GetCryptoKeyVersionRequest request, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
requestGetCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetCryptoKeyVersionRequest request = new GetCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.GetCryptoKeyVersion(request);

GetCryptoKeyVersion(String, CallSettings)

public virtual CryptoKeyVersion GetCryptoKeyVersion(string name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.GetCryptoKeyVersion(name);

GetCryptoKeyVersionAsync(CryptoKeyVersionName, CallSettings)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(CryptoKeyVersionName name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(name);

GetCryptoKeyVersionAsync(CryptoKeyVersionName, CancellationToken)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(CryptoKeyVersionName name, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(name);

GetCryptoKeyVersionAsync(GetCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(GetCryptoKeyVersionRequest request, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
requestGetCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetCryptoKeyVersionRequest request = new GetCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(request);

GetCryptoKeyVersionAsync(GetCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(GetCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
requestGetCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetCryptoKeyVersionRequest request = new GetCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(request);

GetCryptoKeyVersionAsync(String, CallSettings)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(string name, CallSettings callSettings = null)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(name);

GetCryptoKeyVersionAsync(String, CancellationToken)

public virtual Task<CryptoKeyVersion> GetCryptoKeyVersionAsync(string name, CancellationToken cancellationToken)

Returns metadata for a given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.GetCryptoKeyVersionAsync(name);

GetIamPolicy(IResourceName, CallSettings)

public virtual Policy GetIamPolicy(IResourceName resource, CallSettings callSettings = null)

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

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

GetIamPolicy(GetIamPolicyRequest, CallSettings)

public virtual Policy GetIamPolicy(GetIamPolicyRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

GetIamPolicy(String, CallSettings)

public virtual Policy GetIamPolicy(string resource, CallSettings callSettings = null)

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

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

GetIamPolicyAsync(IResourceName, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CallSettings callSettings = null)

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

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(IResourceName, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CancellationToken cancellationToken)

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

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CallSettings callSettings = null)

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

Parameters
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(GetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CancellationToken cancellationToken)

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

Parameters
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(String, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(string resource, CallSettings callSettings = null)

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

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetIamPolicyAsync(String, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(string resource, CancellationToken cancellationToken)

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

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

GetImportJob(GetImportJobRequest, CallSettings)

public virtual ImportJob GetImportJob(GetImportJobRequest request, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
requestGetImportJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetImportJobRequest request = new GetImportJobRequest
{
    ImportJobName = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]"),
};
// Make the request
ImportJob response = keyManagementServiceClient.GetImportJob(request);

GetImportJob(ImportJobName, CallSettings)

public virtual ImportJob GetImportJob(ImportJobName name, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
nameImportJobName

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ImportJobName name = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]");
// Make the request
ImportJob response = keyManagementServiceClient.GetImportJob(name);

GetImportJob(String, CallSettings)

public virtual ImportJob GetImportJob(string name, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ImportJob

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/importJobs/[IMPORT_JOB]";
// Make the request
ImportJob response = keyManagementServiceClient.GetImportJob(name);

GetImportJobAsync(GetImportJobRequest, CallSettings)

public virtual Task<ImportJob> GetImportJobAsync(GetImportJobRequest request, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
requestGetImportJobRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetImportJobRequest request = new GetImportJobRequest
{
    ImportJobName = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]"),
};
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(request);

GetImportJobAsync(GetImportJobRequest, CancellationToken)

public virtual Task<ImportJob> GetImportJobAsync(GetImportJobRequest request, CancellationToken cancellationToken)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
requestGetImportJobRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetImportJobRequest request = new GetImportJobRequest
{
    ImportJobName = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]"),
};
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(request);

GetImportJobAsync(ImportJobName, CallSettings)

public virtual Task<ImportJob> GetImportJobAsync(ImportJobName name, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
nameImportJobName

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ImportJobName name = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]");
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(name);

GetImportJobAsync(ImportJobName, CancellationToken)

public virtual Task<ImportJob> GetImportJobAsync(ImportJobName name, CancellationToken cancellationToken)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
nameImportJobName

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ImportJobName name = ImportJobName.FromProjectLocationKeyRingImportJob("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[IMPORT_JOB]");
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(name);

GetImportJobAsync(String, CallSettings)

public virtual Task<ImportJob> GetImportJobAsync(string name, CallSettings callSettings = null)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/importJobs/[IMPORT_JOB]";
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(name);

GetImportJobAsync(String, CancellationToken)

public virtual Task<ImportJob> GetImportJobAsync(string name, CancellationToken cancellationToken)

Returns metadata for a given [ImportJob][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<ImportJob>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/importJobs/[IMPORT_JOB]";
// Make the request
ImportJob response = await keyManagementServiceClient.GetImportJobAsync(name);

GetKeyRing(GetKeyRingRequest, CallSettings)

public virtual KeyRing GetKeyRing(GetKeyRingRequest request, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
requestGetKeyRingRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetKeyRingRequest request = new GetKeyRingRequest
{
    KeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
};
// Make the request
KeyRing response = keyManagementServiceClient.GetKeyRing(request);

GetKeyRing(KeyRingName, CallSettings)

public virtual KeyRing GetKeyRing(KeyRingName name, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
nameKeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName name = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
KeyRing response = keyManagementServiceClient.GetKeyRing(name);

GetKeyRing(String, CallSettings)

public virtual KeyRing GetKeyRing(string name, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
KeyRing

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
KeyRing response = keyManagementServiceClient.GetKeyRing(name);

GetKeyRingAsync(GetKeyRingRequest, CallSettings)

public virtual Task<KeyRing> GetKeyRingAsync(GetKeyRingRequest request, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
requestGetKeyRingRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetKeyRingRequest request = new GetKeyRingRequest
{
    KeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
};
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(request);

GetKeyRingAsync(GetKeyRingRequest, CancellationToken)

public virtual Task<KeyRing> GetKeyRingAsync(GetKeyRingRequest request, CancellationToken cancellationToken)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
requestGetKeyRingRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetKeyRingRequest request = new GetKeyRingRequest
{
    KeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
};
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(request);

GetKeyRingAsync(KeyRingName, CallSettings)

public virtual Task<KeyRing> GetKeyRingAsync(KeyRingName name, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
nameKeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName name = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(name);

GetKeyRingAsync(KeyRingName, CancellationToken)

public virtual Task<KeyRing> GetKeyRingAsync(KeyRingName name, CancellationToken cancellationToken)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
nameKeyRingName

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName name = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(name);

GetKeyRingAsync(String, CallSettings)

public virtual Task<KeyRing> GetKeyRingAsync(string name, CallSettings callSettings = null)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(name);

GetKeyRingAsync(String, CancellationToken)

public virtual Task<KeyRing> GetKeyRingAsync(string name, CancellationToken cancellationToken)

Returns metadata for a given [KeyRing][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.KeyRing.name] of the [KeyRing][google.cloud.kms.v1.KeyRing] to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<KeyRing>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
KeyRing response = await keyManagementServiceClient.GetKeyRingAsync(name);

GetPublicKey(CryptoKeyVersionName, CallSettings)

public virtual PublicKey GetPublicKey(CryptoKeyVersionName name, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PublicKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
PublicKey response = keyManagementServiceClient.GetPublicKey(name);

GetPublicKey(GetPublicKeyRequest, CallSettings)

public virtual PublicKey GetPublicKey(GetPublicKeyRequest request, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
NameDescription
requestGetPublicKeyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PublicKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
GetPublicKeyRequest request = new GetPublicKeyRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
PublicKey response = keyManagementServiceClient.GetPublicKey(request);

GetPublicKey(String, CallSettings)

public virtual PublicKey GetPublicKey(string name, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PublicKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
PublicKey response = keyManagementServiceClient.GetPublicKey(name);

GetPublicKeyAsync(CryptoKeyVersionName, CallSettings)

public virtual Task<PublicKey> GetPublicKeyAsync(CryptoKeyVersionName name, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<PublicKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(name);

GetPublicKeyAsync(CryptoKeyVersionName, CancellationToken)

public virtual Task<PublicKey> GetPublicKeyAsync(CryptoKeyVersionName name, CancellationToken cancellationToken)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<PublicKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(name);

GetPublicKeyAsync(GetPublicKeyRequest, CallSettings)

public virtual Task<PublicKey> GetPublicKeyAsync(GetPublicKeyRequest request, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
NameDescription
requestGetPublicKeyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<PublicKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetPublicKeyRequest request = new GetPublicKeyRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(request);

GetPublicKeyAsync(GetPublicKeyRequest, CancellationToken)

public virtual Task<PublicKey> GetPublicKeyAsync(GetPublicKeyRequest request, CancellationToken cancellationToken)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
NameDescription
requestGetPublicKeyRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<PublicKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
GetPublicKeyRequest request = new GetPublicKeyRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(request);

GetPublicKeyAsync(String, CallSettings)

public virtual Task<PublicKey> GetPublicKeyAsync(string name, CallSettings callSettings = null)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<PublicKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(name);

GetPublicKeyAsync(String, CancellationToken)

public virtual Task<PublicKey> GetPublicKeyAsync(string name, CancellationToken cancellationToken)

Returns the public key for the given [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]. The [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must be [ASYMMETRIC_SIGN][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_SIGN] or [ASYMMETRIC_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ASYMMETRIC_DECRYPT].

Parameters
NameDescription
nameString

Required. The [name][google.cloud.kms.v1.CryptoKeyVersion.name] of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] public key to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<PublicKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
PublicKey response = await keyManagementServiceClient.GetPublicKeyAsync(name);

ImportCryptoKeyVersion(ImportCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion ImportCryptoKeyVersion(ImportCryptoKeyVersionRequest request, CallSettings callSettings = null)

Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the wrapped key material provided in the request.

The version ID will be assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
requestImportCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ImportCryptoKeyVersionRequest request = new ImportCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Algorithm = CryptoKeyVersion.Types.CryptoKeyVersionAlgorithm.Unspecified,
    ImportJob = "",
    RsaAesWrappedKey = ByteString.Empty,
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.ImportCryptoKeyVersion(request);

ImportCryptoKeyVersionAsync(ImportCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> ImportCryptoKeyVersionAsync(ImportCryptoKeyVersionRequest request, CallSettings callSettings = null)

Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the wrapped key material provided in the request.

The version ID will be assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
requestImportCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ImportCryptoKeyVersionRequest request = new ImportCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Algorithm = CryptoKeyVersion.Types.CryptoKeyVersionAlgorithm.Unspecified,
    ImportJob = "",
    RsaAesWrappedKey = ByteString.Empty,
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.ImportCryptoKeyVersionAsync(request);

ImportCryptoKeyVersionAsync(ImportCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> ImportCryptoKeyVersionAsync(ImportCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Imports a new [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] into an existing [CryptoKey][google.cloud.kms.v1.CryptoKey] using the wrapped key material provided in the request.

The version ID will be assigned the next sequential id within the [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
requestImportCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ImportCryptoKeyVersionRequest request = new ImportCryptoKeyVersionRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    Algorithm = CryptoKeyVersion.Types.CryptoKeyVersionAlgorithm.Unspecified,
    ImportJob = "",
    RsaAesWrappedKey = ByteString.Empty,
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.ImportCryptoKeyVersionAsync(request);

ListCryptoKeys(KeyRingName, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeys(KeyRingName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
parentKeyRingName

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListCryptoKeysResponse, CryptoKey>

A pageable sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
PagedEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeys(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKey item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeys(ListCryptoKeysRequest, CallSettings)

public virtual PagedEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeys(ListCryptoKeysRequest request, CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
requestListCryptoKeysRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListCryptoKeysResponse, CryptoKey>

A pageable sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ListCryptoKeysRequest request = new ListCryptoKeysRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    VersionView = CryptoKeyVersion.Types.CryptoKeyVersionView.Unspecified,
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeys(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKey item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeys(String, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeys(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
parentString

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListCryptoKeysResponse, CryptoKey>

A pageable sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
PagedEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeys(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKey item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeysAsync(KeyRingName, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeysAsync(KeyRingName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
parentKeyRingName

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey>

A pageable asynchronous sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeysAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKey item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeysAsync(ListCryptoKeysRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeysAsync(ListCryptoKeysRequest request, CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
requestListCryptoKeysRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey>

A pageable asynchronous sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ListCryptoKeysRequest request = new ListCryptoKeysRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    VersionView = CryptoKeyVersion.Types.CryptoKeyVersionView.Unspecified,
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeysAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKey item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeysAsync(String, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> ListCryptoKeysAsync(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
parentString

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey>

A pageable asynchronous sequence of CryptoKey resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
PagedAsyncEnumerable<ListCryptoKeysResponse, CryptoKey> response = keyManagementServiceClient.ListCryptoKeysAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKey item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKey item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKey> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKey item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersions(CryptoKeyName, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersions(CryptoKeyName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
parentCryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion>

A pageable sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersions(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKeyVersion item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeyVersionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersions(ListCryptoKeyVersionsRequest, CallSettings)

public virtual PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersions(ListCryptoKeyVersionsRequest request, CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
requestListCryptoKeyVersionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion>

A pageable sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ListCryptoKeyVersionsRequest request = new ListCryptoKeyVersionsRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    View = CryptoKeyVersion.Types.CryptoKeyVersionView.Unspecified,
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersions(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKeyVersion item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeyVersionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersions(String, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersions(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
parentString

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion>

A pageable sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
PagedEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersions(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CryptoKeyVersion item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCryptoKeyVersionsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersionsAsync(CryptoKeyName, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersionsAsync(CryptoKeyName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
parentCryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion>

A pageable asynchronous sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName parent = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
// Make the request
PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersionsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKeyVersion item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeyVersionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersionsAsync(ListCryptoKeyVersionsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersionsAsync(ListCryptoKeyVersionsRequest request, CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
requestListCryptoKeyVersionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion>

A pageable asynchronous sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ListCryptoKeyVersionsRequest request = new ListCryptoKeyVersionsRequest
{
    ParentAsCryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    View = CryptoKeyVersion.Types.CryptoKeyVersionView.Unspecified,
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersionsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKeyVersion item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeyVersionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCryptoKeyVersionsAsync(String, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> ListCryptoKeyVersionsAsync(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion].

Parameters
NameDescription
parentString

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to list, in the format projects/*/locations/*/keyRings/*/cryptoKeys/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion>

A pageable asynchronous sequence of CryptoKeyVersion resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
// Make the request
PagedAsyncEnumerable<ListCryptoKeyVersionsResponse, CryptoKeyVersion> response = keyManagementServiceClient.ListCryptoKeyVersionsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CryptoKeyVersion item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCryptoKeyVersionsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CryptoKeyVersion item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CryptoKeyVersion> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CryptoKeyVersion item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobs(KeyRingName, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListImportJobsResponse, ImportJob> ListImportJobs(KeyRingName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
parentKeyRingName

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListImportJobsResponse, ImportJob>

A pageable sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
PagedEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobs(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (ImportJob item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListImportJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobs(ListImportJobsRequest, CallSettings)

public virtual PagedEnumerable<ListImportJobsResponse, ImportJob> ListImportJobs(ListImportJobsRequest request, CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
requestListImportJobsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListImportJobsResponse, ImportJob>

A pageable sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ListImportJobsRequest request = new ListImportJobsRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobs(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (ImportJob item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListImportJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobs(String, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListImportJobsResponse, ImportJob> ListImportJobs(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
parentString

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListImportJobsResponse, ImportJob>

A pageable sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
PagedEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobs(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (ImportJob item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListImportJobsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobsAsync(KeyRingName, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> ListImportJobsAsync(KeyRingName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
parentKeyRingName

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListImportJobsResponse, ImportJob>

A pageable asynchronous sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
KeyRingName parent = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]");
// Make the request
PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ImportJob item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListImportJobsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobsAsync(ListImportJobsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> ListImportJobsAsync(ListImportJobsRequest request, CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
requestListImportJobsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListImportJobsResponse, ImportJob>

A pageable asynchronous sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ListImportJobsRequest request = new ListImportJobsRequest
{
    ParentAsKeyRingName = KeyRingName.FromProjectLocationKeyRing("[PROJECT]", "[LOCATION]", "[KEY_RING]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ImportJob item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListImportJobsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListImportJobsAsync(String, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> ListImportJobsAsync(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [ImportJobs][google.cloud.kms.v1.ImportJob].

Parameters
NameDescription
parentString

Required. The resource name of the [KeyRing][google.cloud.kms.v1.KeyRing] to list, in the format projects/*/locations/*/keyRings/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListImportJobsResponse, ImportJob>

A pageable asynchronous sequence of ImportJob resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]";
// Make the request
PagedAsyncEnumerable<ListImportJobsResponse, ImportJob> response = keyManagementServiceClient.ListImportJobsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((ImportJob item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListImportJobsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (ImportJob item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<ImportJob> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (ImportJob item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRings(LocationName, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRings(LocationName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
parentLocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListKeyRingsResponse, KeyRing>

A pageable sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRings(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (KeyRing item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListKeyRingsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRings(ListKeyRingsRequest, CallSettings)

public virtual PagedEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRings(ListKeyRingsRequest request, CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
requestListKeyRingsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListKeyRingsResponse, KeyRing>

A pageable sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
ListKeyRingsRequest request = new ListKeyRingsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRings(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (KeyRing item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListKeyRingsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRings(String, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRings(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
parentString

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerable<ListKeyRingsResponse, KeyRing>

A pageable sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRings(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (KeyRing item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListKeyRingsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRingsAsync(LocationName, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRingsAsync(LocationName parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
parentLocationName

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing>

A pageable asynchronous sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRingsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((KeyRing item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListKeyRingsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRingsAsync(ListKeyRingsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRingsAsync(ListKeyRingsRequest request, CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
requestListKeyRingsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing>

A pageable asynchronous sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
ListKeyRingsRequest request = new ListKeyRingsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRingsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((KeyRing item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListKeyRingsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListKeyRingsAsync(String, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> ListKeyRingsAsync(string parent, string pageToken = null, int? pageSize = default(int? ), CallSettings callSettings = null)

Lists [KeyRings][google.cloud.kms.v1.KeyRing].

Parameters
NameDescription
parentString

Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format projects/*/locations/*.

pageTokenString

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeNullable<Int32>

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing>

A pageable asynchronous sequence of KeyRing resources.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListKeyRingsResponse, KeyRing> response = keyManagementServiceClient.ListKeyRingsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((KeyRing item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListKeyRingsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (KeyRing item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<KeyRing> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (KeyRing item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

RestoreCryptoKeyVersion(CryptoKeyVersionName, CallSettings)

public virtual CryptoKeyVersion RestoreCryptoKeyVersion(CryptoKeyVersionName name, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.RestoreCryptoKeyVersion(name);

RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion RestoreCryptoKeyVersion(RestoreCryptoKeyVersionRequest request, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
NameDescription
requestRestoreCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
RestoreCryptoKeyVersionRequest request = new RestoreCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.RestoreCryptoKeyVersion(request);

RestoreCryptoKeyVersion(String, CallSettings)

public virtual CryptoKeyVersion RestoreCryptoKeyVersion(string name, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.RestoreCryptoKeyVersion(name);

RestoreCryptoKeyVersionAsync(CryptoKeyVersionName, CallSettings)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(CryptoKeyVersionName name, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(name);

RestoreCryptoKeyVersionAsync(CryptoKeyVersionName, CancellationToken)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(CryptoKeyVersionName name, CancellationToken cancellationToken)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
NameDescription
nameCryptoKeyVersionName

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersionName name = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]");
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(name);

RestoreCryptoKeyVersionAsync(RestoreCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(RestoreCryptoKeyVersionRequest request, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
NameDescription
requestRestoreCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
RestoreCryptoKeyVersionRequest request = new RestoreCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(request);

RestoreCryptoKeyVersionAsync(RestoreCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(RestoreCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
NameDescription
requestRestoreCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
RestoreCryptoKeyVersionRequest request = new RestoreCryptoKeyVersionRequest
{
    CryptoKeyVersionName = CryptoKeyVersionName.FromProjectLocationKeyRingCryptoKeyCryptoKeyVersion("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]", "[CRYPTO_KEY_VERSION]"),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(request);

RestoreCryptoKeyVersionAsync(String, CallSettings)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(string name, CallSettings callSettings = null)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(name);

RestoreCryptoKeyVersionAsync(String, CancellationToken)

public virtual Task<CryptoKeyVersion> RestoreCryptoKeyVersionAsync(string name, CancellationToken cancellationToken)

Restore a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] in the [DESTROY_SCHEDULED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DESTROY_SCHEDULED] state.

Upon restoration of the CryptoKeyVersion, [state][google.cloud.kms.v1.CryptoKeyVersion.state] will be set to [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED], and [destroy_time][google.cloud.kms.v1.CryptoKeyVersion.destroy_time] will be cleared.

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to restore.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]/cryptoKeyVersions/[CRYPTO_KEY_VERSION]";
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.RestoreCryptoKeyVersionAsync(name);

SetIamPolicy(IResourceName, Policy, CallSettings)

public virtual Policy SetIamPolicy(IResourceName resource, Policy policy, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

SetIamPolicy(SetIamPolicyRequest, CallSettings)

public virtual Policy SetIamPolicy(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
requestSetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

SetIamPolicy(String, Policy, CallSettings)

public virtual Policy SetIamPolicy(string resource, Policy policy, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

SetIamPolicyAsync(IResourceName, Policy, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(IResourceName resource, Policy policy, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(IResourceName, Policy, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(IResourceName resource, Policy policy, CancellationToken cancellationToken)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
requestSetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(SetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CancellationToken cancellationToken)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
requestSetIamPolicyRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(String, Policy, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(string resource, Policy policy, CallSettings callSettings = null)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

SetIamPolicyAsync(String, Policy, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(string resource, Policy policy, CancellationToken cancellationToken)

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return Public Errors: NOT_FOUND, INVALID_ARGUMENT and PERMISSION_DENIED

Parameters
NameDescription
resourceString

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

policyPolicy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Policy>

A Task containing the RPC response.

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

TestIamPermissions(IResourceName, IEnumerable<String>, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)

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
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

TestIamPermissions(TestIamPermissionsRequest, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, CallSettings callSettings = null)

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
NameDescription
requestTestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

TestIamPermissions(String, IEnumerable<String>, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)

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
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

TestIamPermissionsAsync(IResourceName, IEnumerable<String>, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)

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
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(IResourceName, IEnumerable<String>, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CancellationToken cancellationToken)

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
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CallSettings callSettings = null)

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
NameDescription
requestTestIamPermissionsRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(TestIamPermissionsRequest, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CancellationToken cancellationToken)

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
NameDescription
requestTestIamPermissionsRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(String, IEnumerable<String>, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)

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
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

TestIamPermissionsAsync(String, IEnumerable<String>, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CancellationToken cancellationToken)

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
NameDescription
resourceString

REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.

permissionsIEnumerable<String>

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<TestIamPermissionsResponse>

A Task containing the RPC response.

UpdateCryptoKey(CryptoKey, FieldMask, CallSettings)

public virtual CryptoKey UpdateCryptoKey(CryptoKey cryptoKey, FieldMask updateMask, CallSettings callSettings = null)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
cryptoKeyCryptoKey

Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.

updateMaskFieldMask

Required. List of fields to be updated in this request.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKey cryptoKey = new CryptoKey();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKey(cryptoKey, updateMask);

UpdateCryptoKey(UpdateCryptoKeyRequest, CallSettings)

public virtual CryptoKey UpdateCryptoKey(UpdateCryptoKeyRequest request, CallSettings callSettings = null)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
requestUpdateCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
UpdateCryptoKeyRequest request = new UpdateCryptoKeyRequest
{
    CryptoKey = new CryptoKey(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKey(request);

UpdateCryptoKeyAsync(CryptoKey, FieldMask, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyAsync(CryptoKey cryptoKey, FieldMask updateMask, CallSettings callSettings = null)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
cryptoKeyCryptoKey

Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.

updateMaskFieldMask

Required. List of fields to be updated in this request.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKey cryptoKey = new CryptoKey();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyAsync(cryptoKey, updateMask);

UpdateCryptoKeyAsync(CryptoKey, FieldMask, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyAsync(CryptoKey cryptoKey, FieldMask updateMask, CancellationToken cancellationToken)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
cryptoKeyCryptoKey

Required. [CryptoKey][google.cloud.kms.v1.CryptoKey] with updated values.

updateMaskFieldMask

Required. List of fields to be updated in this request.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKey cryptoKey = new CryptoKey();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyAsync(cryptoKey, updateMask);

UpdateCryptoKeyAsync(UpdateCryptoKeyRequest, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyAsync(UpdateCryptoKeyRequest request, CallSettings callSettings = null)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
requestUpdateCryptoKeyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyRequest request = new UpdateCryptoKeyRequest
{
    CryptoKey = new CryptoKey(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyAsync(request);

UpdateCryptoKeyAsync(UpdateCryptoKeyRequest, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyAsync(UpdateCryptoKeyRequest request, CancellationToken cancellationToken)

Update a [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
NameDescription
requestUpdateCryptoKeyRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyRequest request = new UpdateCryptoKeyRequest
{
    CryptoKey = new CryptoKey(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyAsync(request);

UpdateCryptoKeyPrimaryVersion(CryptoKeyName, String, CallSettings)

public virtual CryptoKey UpdateCryptoKeyPrimaryVersion(CryptoKeyName name, string cryptoKeyVersionId, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameCryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionIdString

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest, CallSettings)

public virtual CryptoKey UpdateCryptoKeyPrimaryVersion(UpdateCryptoKeyPrimaryVersionRequest request, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
requestUpdateCryptoKeyPrimaryVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
UpdateCryptoKeyPrimaryVersionRequest request = new UpdateCryptoKeyPrimaryVersionRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersionId = "",
};
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKeyPrimaryVersion(request);

UpdateCryptoKeyPrimaryVersion(String, String, CallSettings)

public virtual CryptoKey UpdateCryptoKeyPrimaryVersion(string name, string cryptoKeyVersionId, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionIdString

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKey

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = keyManagementServiceClient.UpdateCryptoKeyPrimaryVersion(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersionAsync(CryptoKeyName, String, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(CryptoKeyName name, string cryptoKeyVersionId, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameCryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionIdString

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersionAsync(CryptoKeyName, String, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(CryptoKeyName name, string cryptoKeyVersionId, CancellationToken cancellationToken)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameCryptoKeyName

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionIdString

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyName name = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]");
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersionAsync(UpdateCryptoKeyPrimaryVersionRequest, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(UpdateCryptoKeyPrimaryVersionRequest request, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
requestUpdateCryptoKeyPrimaryVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyPrimaryVersionRequest request = new UpdateCryptoKeyPrimaryVersionRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersionId = "",
};
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(request);

UpdateCryptoKeyPrimaryVersionAsync(UpdateCryptoKeyPrimaryVersionRequest, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(UpdateCryptoKeyPrimaryVersionRequest request, CancellationToken cancellationToken)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
requestUpdateCryptoKeyPrimaryVersionRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyPrimaryVersionRequest request = new UpdateCryptoKeyPrimaryVersionRequest
{
    CryptoKeyName = CryptoKeyName.FromProjectLocationKeyRingCryptoKey("[PROJECT]", "[LOCATION]", "[KEY_RING]", "[CRYPTO_KEY]"),
    CryptoKeyVersionId = "",
};
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(request);

UpdateCryptoKeyPrimaryVersionAsync(String, String, CallSettings)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(string name, string cryptoKeyVersionId, CallSettings callSettings = null)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionIdString

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(name, cryptoKeyVersionId);

UpdateCryptoKeyPrimaryVersionAsync(String, String, CancellationToken)

public virtual Task<CryptoKey> UpdateCryptoKeyPrimaryVersionAsync(string name, string cryptoKeyVersionId, CancellationToken cancellationToken)

Update the version of a [CryptoKey][google.cloud.kms.v1.CryptoKey] that will be used in [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt].

Returns an error if called on a key whose purpose is not [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT].

Parameters
NameDescription
nameString

Required. The resource name of the [CryptoKey][google.cloud.kms.v1.CryptoKey] to update.

cryptoKeyVersionIdString

Required. The id of the child [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] to use as primary.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKey>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyRings/[KEY_RING]/cryptoKeys/[CRYPTO_KEY]";
string cryptoKeyVersionId = "";
// Make the request
CryptoKey response = await keyManagementServiceClient.UpdateCryptoKeyPrimaryVersionAsync(name, cryptoKeyVersionId);

UpdateCryptoKeyVersion(CryptoKeyVersion, FieldMask, CallSettings)

public virtual CryptoKeyVersion UpdateCryptoKeyVersion(CryptoKeyVersion cryptoKeyVersion, FieldMask updateMask, CallSettings callSettings = null)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
NameDescription
cryptoKeyVersionCryptoKeyVersion

Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.

updateMaskFieldMask

Required. List of fields to be updated in this request.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.UpdateCryptoKeyVersion(cryptoKeyVersion, updateMask);

UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest, CallSettings)

public virtual CryptoKeyVersion UpdateCryptoKeyVersion(UpdateCryptoKeyVersionRequest request, CallSettings callSettings = null)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
NameDescription
requestUpdateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
CryptoKeyVersion

The RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.Create();
// Initialize request argument(s)
UpdateCryptoKeyVersionRequest request = new UpdateCryptoKeyVersionRequest
{
    CryptoKeyVersion = new CryptoKeyVersion(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKeyVersion response = keyManagementServiceClient.UpdateCryptoKeyVersion(request);

UpdateCryptoKeyVersionAsync(CryptoKeyVersion, FieldMask, CallSettings)

public virtual Task<CryptoKeyVersion> UpdateCryptoKeyVersionAsync(CryptoKeyVersion cryptoKeyVersion, FieldMask updateMask, CallSettings callSettings = null)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
NameDescription
cryptoKeyVersionCryptoKeyVersion

Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.

updateMaskFieldMask

Required. List of fields to be updated in this request.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.UpdateCryptoKeyVersionAsync(cryptoKeyVersion, updateMask);

UpdateCryptoKeyVersionAsync(CryptoKeyVersion, FieldMask, CancellationToken)

public virtual Task<CryptoKeyVersion> UpdateCryptoKeyVersionAsync(CryptoKeyVersion cryptoKeyVersion, FieldMask updateMask, CancellationToken cancellationToken)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
NameDescription
cryptoKeyVersionCryptoKeyVersion

Required. [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion] with updated values.

updateMaskFieldMask

Required. List of fields to be updated in this request.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
CryptoKeyVersion cryptoKeyVersion = new CryptoKeyVersion();
FieldMask updateMask = new FieldMask();
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.UpdateCryptoKeyVersionAsync(cryptoKeyVersion, updateMask);

UpdateCryptoKeyVersionAsync(UpdateCryptoKeyVersionRequest, CallSettings)

public virtual Task<CryptoKeyVersion> UpdateCryptoKeyVersionAsync(UpdateCryptoKeyVersionRequest request, CallSettings callSettings = null)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
NameDescription
requestUpdateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyVersionRequest request = new UpdateCryptoKeyVersionRequest
{
    CryptoKeyVersion = new CryptoKeyVersion(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.UpdateCryptoKeyVersionAsync(request);

UpdateCryptoKeyVersionAsync(UpdateCryptoKeyVersionRequest, CancellationToken)

public virtual Task<CryptoKeyVersion> UpdateCryptoKeyVersionAsync(UpdateCryptoKeyVersionRequest request, CancellationToken cancellationToken)

Update a [CryptoKeyVersion][google.cloud.kms.v1.CryptoKeyVersion]'s metadata.

[state][google.cloud.kms.v1.CryptoKeyVersion.state] may be changed between [ENABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.ENABLED] and [DISABLED][google.cloud.kms.v1.CryptoKeyVersion.CryptoKeyVersionState.DISABLED] using this method. See [DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion] and [RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion] to move between other states.

Parameters
NameDescription
requestUpdateCryptoKeyVersionRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<CryptoKeyVersion>

A Task containing the RPC response.

Example
// Create client
KeyManagementServiceClient keyManagementServiceClient = await KeyManagementServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCryptoKeyVersionRequest request = new UpdateCryptoKeyVersionRequest
{
    CryptoKeyVersion = new CryptoKeyVersion(),
    UpdateMask = new FieldMask(),
};
// Make the request
CryptoKeyVersion response = await keyManagementServiceClient.UpdateCryptoKeyVersionAsync(request);