Google Cloud Key Management Service v1 API - Class AutokeyClient (3.13.0)

public abstract class AutokeyClient

Reference documentation and code samples for the Google Cloud Key Management Service v1 API class AutokeyClient.

Autokey client wrapper, for convenient use.

Inheritance

object > AutokeyClient

Derived Types

Namespace

Google.Cloud.Kms.V1

Assembly

Google.Cloud.Kms.V1.dll

Remarks

Provides interfaces for using Cloud KMS Autokey to provision new [CryptoKeys][google.cloud.kms.v1.CryptoKey], ready for Customer Managed Encryption Key (CMEK) use, on-demand. To support certain client tooling, this feature is modeled around a [KeyHandle][google.cloud.kms.v1.KeyHandle] resource: creating a [KeyHandle][google.cloud.kms.v1.KeyHandle] in a resource project and given location triggers Cloud KMS Autokey to provision a [CryptoKey][google.cloud.kms.v1.CryptoKey] in the configured key project and the same location.

Prior to use in a given resource project, [UpdateAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.UpdateAutokeyConfig] should have been called on an ancestor folder, setting the key project where Cloud KMS Autokey should create new [CryptoKeys][google.cloud.kms.v1.CryptoKey]. See documentation for additional prerequisites. To check what key project, if any, is currently configured on a resource project's ancestor folder, see [ShowEffectiveAutokeyConfig][google.cloud.kms.v1.AutokeyAdmin.ShowEffectiveAutokeyConfig].

Properties

CreateKeyHandleOperationsClient

public virtual OperationsClient CreateKeyHandleOperationsClient { get; }

The long-running operations client for CreateKeyHandle.

Property Value
Type Description
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Autokey scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual Autokey.AutokeyClient GrpcClient { get; }

The underlying gRPC Autokey client

Property Value
Type Description
AutokeyAutokeyClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
Type Description
IAMPolicyClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static AutokeyClient Create()

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

Returns
Type Description
AutokeyClient

The created AutokeyClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskAutokeyClient

The task representing the created AutokeyClient.

CreateKeyHandle(LocationName, KeyHandle, string, CallSettings)

public virtual Operation<KeyHandle, CreateKeyHandleMetadata> CreateKeyHandle(LocationName parent, KeyHandle keyHandle, string keyHandleId, CallSettings callSettings = null)

Creates a new [KeyHandle][google.cloud.kms.v1.KeyHandle], triggering the provisioning of a new [CryptoKey][google.cloud.kms.v1.CryptoKey] for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting [KeyHandle][google.cloud.kms.v1.KeyHandle] and [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent LocationName

Required. Name of the resource project and location to create the [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

keyHandle KeyHandle

Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.

keyHandleId string

Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be unique to the resource project and location. If not provided by the caller, a new UUID is used.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationKeyHandleCreateKeyHandleMetadata

The RPC response.

Example
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
KeyHandle keyHandle = new KeyHandle();
string keyHandleId = "";
// Make the request
Operation<KeyHandle, CreateKeyHandleMetadata> response = autokeyClient.CreateKeyHandle(parent, keyHandle, keyHandleId);

// Poll until the returned long-running operation is complete
Operation<KeyHandle, CreateKeyHandleMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
KeyHandle result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<KeyHandle, CreateKeyHandleMetadata> retrievedResponse = autokeyClient.PollOnceCreateKeyHandle(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    KeyHandle retrievedResult = retrievedResponse.Result;
}

CreateKeyHandle(CreateKeyHandleRequest, CallSettings)

public virtual Operation<KeyHandle, CreateKeyHandleMetadata> CreateKeyHandle(CreateKeyHandleRequest request, CallSettings callSettings = null)

Creates a new [KeyHandle][google.cloud.kms.v1.KeyHandle], triggering the provisioning of a new [CryptoKey][google.cloud.kms.v1.CryptoKey] for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting [KeyHandle][google.cloud.kms.v1.KeyHandle] and [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request CreateKeyHandleRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationKeyHandleCreateKeyHandleMetadata

The RPC response.

Example
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
CreateKeyHandleRequest request = new CreateKeyHandleRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KeyHandleId = "",
    KeyHandle = new KeyHandle(),
};
// Make the request
Operation<KeyHandle, CreateKeyHandleMetadata> response = autokeyClient.CreateKeyHandle(request);

// Poll until the returned long-running operation is complete
Operation<KeyHandle, CreateKeyHandleMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
KeyHandle result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<KeyHandle, CreateKeyHandleMetadata> retrievedResponse = autokeyClient.PollOnceCreateKeyHandle(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    KeyHandle retrievedResult = retrievedResponse.Result;
}

CreateKeyHandle(string, KeyHandle, string, CallSettings)

public virtual Operation<KeyHandle, CreateKeyHandleMetadata> CreateKeyHandle(string parent, KeyHandle keyHandle, string keyHandleId, CallSettings callSettings = null)

Creates a new [KeyHandle][google.cloud.kms.v1.KeyHandle], triggering the provisioning of a new [CryptoKey][google.cloud.kms.v1.CryptoKey] for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting [KeyHandle][google.cloud.kms.v1.KeyHandle] and [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent string

Required. Name of the resource project and location to create the [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

keyHandle KeyHandle

Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.

keyHandleId string

Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be unique to the resource project and location. If not provided by the caller, a new UUID is used.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationKeyHandleCreateKeyHandleMetadata

The RPC response.

Example
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
KeyHandle keyHandle = new KeyHandle();
string keyHandleId = "";
// Make the request
Operation<KeyHandle, CreateKeyHandleMetadata> response = autokeyClient.CreateKeyHandle(parent, keyHandle, keyHandleId);

// Poll until the returned long-running operation is complete
Operation<KeyHandle, CreateKeyHandleMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
KeyHandle result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<KeyHandle, CreateKeyHandleMetadata> retrievedResponse = autokeyClient.PollOnceCreateKeyHandle(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    KeyHandle retrievedResult = retrievedResponse.Result;
}

CreateKeyHandleAsync(LocationName, KeyHandle, string, CallSettings)

public virtual Task<Operation<KeyHandle, CreateKeyHandleMetadata>> CreateKeyHandleAsync(LocationName parent, KeyHandle keyHandle, string keyHandleId, CallSettings callSettings = null)

Creates a new [KeyHandle][google.cloud.kms.v1.KeyHandle], triggering the provisioning of a new [CryptoKey][google.cloud.kms.v1.CryptoKey] for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting [KeyHandle][google.cloud.kms.v1.KeyHandle] and [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent LocationName

Required. Name of the resource project and location to create the [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

keyHandle KeyHandle

Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.

keyHandleId string

Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be unique to the resource project and location. If not provided by the caller, a new UUID is used.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationKeyHandleCreateKeyHandleMetadata

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
KeyHandle keyHandle = new KeyHandle();
string keyHandleId = "";
// Make the request
Operation<KeyHandle, CreateKeyHandleMetadata> response = await autokeyClient.CreateKeyHandleAsync(parent, keyHandle, keyHandleId);

// Poll until the returned long-running operation is complete
Operation<KeyHandle, CreateKeyHandleMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
KeyHandle result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<KeyHandle, CreateKeyHandleMetadata> retrievedResponse = await autokeyClient.PollOnceCreateKeyHandleAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    KeyHandle retrievedResult = retrievedResponse.Result;
}

CreateKeyHandleAsync(LocationName, KeyHandle, string, CancellationToken)

public virtual Task<Operation<KeyHandle, CreateKeyHandleMetadata>> CreateKeyHandleAsync(LocationName parent, KeyHandle keyHandle, string keyHandleId, CancellationToken cancellationToken)

Creates a new [KeyHandle][google.cloud.kms.v1.KeyHandle], triggering the provisioning of a new [CryptoKey][google.cloud.kms.v1.CryptoKey] for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting [KeyHandle][google.cloud.kms.v1.KeyHandle] and [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent LocationName

Required. Name of the resource project and location to create the [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

keyHandle KeyHandle

Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.

keyHandleId string

Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be unique to the resource project and location. If not provided by the caller, a new UUID is used.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationKeyHandleCreateKeyHandleMetadata

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
KeyHandle keyHandle = new KeyHandle();
string keyHandleId = "";
// Make the request
Operation<KeyHandle, CreateKeyHandleMetadata> response = await autokeyClient.CreateKeyHandleAsync(parent, keyHandle, keyHandleId);

// Poll until the returned long-running operation is complete
Operation<KeyHandle, CreateKeyHandleMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
KeyHandle result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<KeyHandle, CreateKeyHandleMetadata> retrievedResponse = await autokeyClient.PollOnceCreateKeyHandleAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    KeyHandle retrievedResult = retrievedResponse.Result;
}

CreateKeyHandleAsync(CreateKeyHandleRequest, CallSettings)

public virtual Task<Operation<KeyHandle, CreateKeyHandleMetadata>> CreateKeyHandleAsync(CreateKeyHandleRequest request, CallSettings callSettings = null)

Creates a new [KeyHandle][google.cloud.kms.v1.KeyHandle], triggering the provisioning of a new [CryptoKey][google.cloud.kms.v1.CryptoKey] for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting [KeyHandle][google.cloud.kms.v1.KeyHandle] and [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request CreateKeyHandleRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationKeyHandleCreateKeyHandleMetadata

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
CreateKeyHandleRequest request = new CreateKeyHandleRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KeyHandleId = "",
    KeyHandle = new KeyHandle(),
};
// Make the request
Operation<KeyHandle, CreateKeyHandleMetadata> response = await autokeyClient.CreateKeyHandleAsync(request);

// Poll until the returned long-running operation is complete
Operation<KeyHandle, CreateKeyHandleMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
KeyHandle result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<KeyHandle, CreateKeyHandleMetadata> retrievedResponse = await autokeyClient.PollOnceCreateKeyHandleAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    KeyHandle retrievedResult = retrievedResponse.Result;
}

CreateKeyHandleAsync(CreateKeyHandleRequest, CancellationToken)

public virtual Task<Operation<KeyHandle, CreateKeyHandleMetadata>> CreateKeyHandleAsync(CreateKeyHandleRequest request, CancellationToken cancellationToken)

Creates a new [KeyHandle][google.cloud.kms.v1.KeyHandle], triggering the provisioning of a new [CryptoKey][google.cloud.kms.v1.CryptoKey] for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting [KeyHandle][google.cloud.kms.v1.KeyHandle] and [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
request CreateKeyHandleRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationKeyHandleCreateKeyHandleMetadata

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
CreateKeyHandleRequest request = new CreateKeyHandleRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    KeyHandleId = "",
    KeyHandle = new KeyHandle(),
};
// Make the request
Operation<KeyHandle, CreateKeyHandleMetadata> response = await autokeyClient.CreateKeyHandleAsync(request);

// Poll until the returned long-running operation is complete
Operation<KeyHandle, CreateKeyHandleMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
KeyHandle result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<KeyHandle, CreateKeyHandleMetadata> retrievedResponse = await autokeyClient.PollOnceCreateKeyHandleAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    KeyHandle retrievedResult = retrievedResponse.Result;
}

CreateKeyHandleAsync(string, KeyHandle, string, CallSettings)

public virtual Task<Operation<KeyHandle, CreateKeyHandleMetadata>> CreateKeyHandleAsync(string parent, KeyHandle keyHandle, string keyHandleId, CallSettings callSettings = null)

Creates a new [KeyHandle][google.cloud.kms.v1.KeyHandle], triggering the provisioning of a new [CryptoKey][google.cloud.kms.v1.CryptoKey] for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting [KeyHandle][google.cloud.kms.v1.KeyHandle] and [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent string

Required. Name of the resource project and location to create the [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

keyHandle KeyHandle

Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.

keyHandleId string

Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be unique to the resource project and location. If not provided by the caller, a new UUID is used.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationKeyHandleCreateKeyHandleMetadata

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
KeyHandle keyHandle = new KeyHandle();
string keyHandleId = "";
// Make the request
Operation<KeyHandle, CreateKeyHandleMetadata> response = await autokeyClient.CreateKeyHandleAsync(parent, keyHandle, keyHandleId);

// Poll until the returned long-running operation is complete
Operation<KeyHandle, CreateKeyHandleMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
KeyHandle result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<KeyHandle, CreateKeyHandleMetadata> retrievedResponse = await autokeyClient.PollOnceCreateKeyHandleAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    KeyHandle retrievedResult = retrievedResponse.Result;
}

CreateKeyHandleAsync(string, KeyHandle, string, CancellationToken)

public virtual Task<Operation<KeyHandle, CreateKeyHandleMetadata>> CreateKeyHandleAsync(string parent, KeyHandle keyHandle, string keyHandleId, CancellationToken cancellationToken)

Creates a new [KeyHandle][google.cloud.kms.v1.KeyHandle], triggering the provisioning of a new [CryptoKey][google.cloud.kms.v1.CryptoKey] for CMEK use with the given resource type in the configured key project and the same location. [GetOperation][Operations.GetOperation] should be used to resolve the resulting long-running operation and get the resulting [KeyHandle][google.cloud.kms.v1.KeyHandle] and [CryptoKey][google.cloud.kms.v1.CryptoKey].

Parameters
Name Description
parent string

Required. Name of the resource project and location to create the [KeyHandle][google.cloud.kms.v1.KeyHandle] in, e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

keyHandle KeyHandle

Required. [KeyHandle][google.cloud.kms.v1.KeyHandle] to create.

keyHandleId string

Optional. Id of the [KeyHandle][google.cloud.kms.v1.KeyHandle]. Must be unique to the resource project and location. If not provided by the caller, a new UUID is used.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationKeyHandleCreateKeyHandleMetadata

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
KeyHandle keyHandle = new KeyHandle();
string keyHandleId = "";
// Make the request
Operation<KeyHandle, CreateKeyHandleMetadata> response = await autokeyClient.CreateKeyHandleAsync(parent, keyHandle, keyHandleId);

// Poll until the returned long-running operation is complete
Operation<KeyHandle, CreateKeyHandleMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
KeyHandle result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<KeyHandle, CreateKeyHandleMetadata> retrievedResponse = await autokeyClient.PollOnceCreateKeyHandleAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    KeyHandle retrievedResult = retrievedResponse.Result;
}

GetKeyHandle(GetKeyHandleRequest, CallSettings)

public virtual KeyHandle GetKeyHandle(GetKeyHandleRequest request, CallSettings callSettings = null)

Returns the [KeyHandle][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
request GetKeyHandleRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
KeyHandle

The RPC response.

Example
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
GetKeyHandleRequest request = new GetKeyHandleRequest
{
    KeyHandleName = KeyHandleName.FromProjectLocationKeyHandle("[PROJECT]", "[LOCATION]", "[KEY_HANDLE]"),
};
// Make the request
KeyHandle response = autokeyClient.GetKeyHandle(request);

GetKeyHandle(KeyHandleName, CallSettings)

public virtual KeyHandle GetKeyHandle(KeyHandleName name, CallSettings callSettings = null)

Returns the [KeyHandle][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
name KeyHandleName

Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource, e.g. projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
KeyHandle

The RPC response.

Example
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
KeyHandleName name = KeyHandleName.FromProjectLocationKeyHandle("[PROJECT]", "[LOCATION]", "[KEY_HANDLE]");
// Make the request
KeyHandle response = autokeyClient.GetKeyHandle(name);

GetKeyHandle(string, CallSettings)

public virtual KeyHandle GetKeyHandle(string name, CallSettings callSettings = null)

Returns the [KeyHandle][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
name string

Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource, e.g. projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
KeyHandle

The RPC response.

Example
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyHandles/[KEY_HANDLE]";
// Make the request
KeyHandle response = autokeyClient.GetKeyHandle(name);

GetKeyHandleAsync(GetKeyHandleRequest, CallSettings)

public virtual Task<KeyHandle> GetKeyHandleAsync(GetKeyHandleRequest request, CallSettings callSettings = null)

Returns the [KeyHandle][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
request GetKeyHandleRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskKeyHandle

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
GetKeyHandleRequest request = new GetKeyHandleRequest
{
    KeyHandleName = KeyHandleName.FromProjectLocationKeyHandle("[PROJECT]", "[LOCATION]", "[KEY_HANDLE]"),
};
// Make the request
KeyHandle response = await autokeyClient.GetKeyHandleAsync(request);

GetKeyHandleAsync(GetKeyHandleRequest, CancellationToken)

public virtual Task<KeyHandle> GetKeyHandleAsync(GetKeyHandleRequest request, CancellationToken cancellationToken)

Returns the [KeyHandle][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
request GetKeyHandleRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskKeyHandle

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
GetKeyHandleRequest request = new GetKeyHandleRequest
{
    KeyHandleName = KeyHandleName.FromProjectLocationKeyHandle("[PROJECT]", "[LOCATION]", "[KEY_HANDLE]"),
};
// Make the request
KeyHandle response = await autokeyClient.GetKeyHandleAsync(request);

GetKeyHandleAsync(KeyHandleName, CallSettings)

public virtual Task<KeyHandle> GetKeyHandleAsync(KeyHandleName name, CallSettings callSettings = null)

Returns the [KeyHandle][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
name KeyHandleName

Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource, e.g. projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskKeyHandle

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
KeyHandleName name = KeyHandleName.FromProjectLocationKeyHandle("[PROJECT]", "[LOCATION]", "[KEY_HANDLE]");
// Make the request
KeyHandle response = await autokeyClient.GetKeyHandleAsync(name);

GetKeyHandleAsync(KeyHandleName, CancellationToken)

public virtual Task<KeyHandle> GetKeyHandleAsync(KeyHandleName name, CancellationToken cancellationToken)

Returns the [KeyHandle][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
name KeyHandleName

Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource, e.g. projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskKeyHandle

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
KeyHandleName name = KeyHandleName.FromProjectLocationKeyHandle("[PROJECT]", "[LOCATION]", "[KEY_HANDLE]");
// Make the request
KeyHandle response = await autokeyClient.GetKeyHandleAsync(name);

GetKeyHandleAsync(string, CallSettings)

public virtual Task<KeyHandle> GetKeyHandleAsync(string name, CallSettings callSettings = null)

Returns the [KeyHandle][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
name string

Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource, e.g. projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskKeyHandle

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyHandles/[KEY_HANDLE]";
// Make the request
KeyHandle response = await autokeyClient.GetKeyHandleAsync(name);

GetKeyHandleAsync(string, CancellationToken)

public virtual Task<KeyHandle> GetKeyHandleAsync(string name, CancellationToken cancellationToken)

Returns the [KeyHandle][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
name string

Required. Name of the [KeyHandle][google.cloud.kms.v1.KeyHandle] resource, e.g. projects/{PROJECT_ID}/locations/{LOCATION}/keyHandles/{KEY_HANDLE_ID}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskKeyHandle

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keyHandles/[KEY_HANDLE]";
// Make the request
KeyHandle response = await autokeyClient.GetKeyHandleAsync(name);

ListKeyHandles(LocationName, CallSettings)

public virtual ListKeyHandlesResponse ListKeyHandles(LocationName parent, CallSettings callSettings = null)

Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
parent LocationName

Required. Name of the resource project and location from which to list [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ListKeyHandlesResponse

The RPC response.

Example
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
ListKeyHandlesResponse response = autokeyClient.ListKeyHandles(parent);

ListKeyHandles(ListKeyHandlesRequest, CallSettings)

public virtual ListKeyHandlesResponse ListKeyHandles(ListKeyHandlesRequest request, CallSettings callSettings = null)

Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
request ListKeyHandlesRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ListKeyHandlesResponse

The RPC response.

Example
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
ListKeyHandlesRequest request = new ListKeyHandlesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
ListKeyHandlesResponse response = autokeyClient.ListKeyHandles(request);

ListKeyHandles(string, CallSettings)

public virtual ListKeyHandlesResponse ListKeyHandles(string parent, CallSettings callSettings = null)

Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
parent string

Required. Name of the resource project and location from which to list [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ListKeyHandlesResponse

The RPC response.

Example
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
ListKeyHandlesResponse response = autokeyClient.ListKeyHandles(parent);

ListKeyHandlesAsync(LocationName, CallSettings)

public virtual Task<ListKeyHandlesResponse> ListKeyHandlesAsync(LocationName parent, CallSettings callSettings = null)

Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
parent LocationName

Required. Name of the resource project and location from which to list [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskListKeyHandlesResponse

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
ListKeyHandlesResponse response = await autokeyClient.ListKeyHandlesAsync(parent);

ListKeyHandlesAsync(LocationName, CancellationToken)

public virtual Task<ListKeyHandlesResponse> ListKeyHandlesAsync(LocationName parent, CancellationToken cancellationToken)

Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
parent LocationName

Required. Name of the resource project and location from which to list [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskListKeyHandlesResponse

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
ListKeyHandlesResponse response = await autokeyClient.ListKeyHandlesAsync(parent);

ListKeyHandlesAsync(ListKeyHandlesRequest, CallSettings)

public virtual Task<ListKeyHandlesResponse> ListKeyHandlesAsync(ListKeyHandlesRequest request, CallSettings callSettings = null)

Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
request ListKeyHandlesRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskListKeyHandlesResponse

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
ListKeyHandlesRequest request = new ListKeyHandlesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
ListKeyHandlesResponse response = await autokeyClient.ListKeyHandlesAsync(request);

ListKeyHandlesAsync(ListKeyHandlesRequest, CancellationToken)

public virtual Task<ListKeyHandlesResponse> ListKeyHandlesAsync(ListKeyHandlesRequest request, CancellationToken cancellationToken)

Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
request ListKeyHandlesRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskListKeyHandlesResponse

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
ListKeyHandlesRequest request = new ListKeyHandlesRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
};
// Make the request
ListKeyHandlesResponse response = await autokeyClient.ListKeyHandlesAsync(request);

ListKeyHandlesAsync(string, CallSettings)

public virtual Task<ListKeyHandlesResponse> ListKeyHandlesAsync(string parent, CallSettings callSettings = null)

Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
parent string

Required. Name of the resource project and location from which to list [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskListKeyHandlesResponse

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
ListKeyHandlesResponse response = await autokeyClient.ListKeyHandlesAsync(parent);

ListKeyHandlesAsync(string, CancellationToken)

public virtual Task<ListKeyHandlesResponse> ListKeyHandlesAsync(string parent, CancellationToken cancellationToken)

Lists [KeyHandles][google.cloud.kms.v1.KeyHandle].

Parameters
Name Description
parent string

Required. Name of the resource project and location from which to list [KeyHandles][google.cloud.kms.v1.KeyHandle], e.g. projects/{PROJECT_ID}/locations/{LOCATION}.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskListKeyHandlesResponse

A Task containing the RPC response.

Example
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
ListKeyHandlesResponse response = await autokeyClient.ListKeyHandlesAsync(parent);

PollOnceCreateKeyHandle(string, CallSettings)

public virtual Operation<KeyHandle, CreateKeyHandleMetadata> PollOnceCreateKeyHandle(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of CreateKeyHandle.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationKeyHandleCreateKeyHandleMetadata

The result of polling the operation.

PollOnceCreateKeyHandleAsync(string, CallSettings)

public virtual Task<Operation<KeyHandle, CreateKeyHandleMetadata>> PollOnceCreateKeyHandleAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of CreateKeyHandle.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationKeyHandleCreateKeyHandleMetadata

A task representing the result of polling the operation.

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
Type Description
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.