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.
Derived Types
Namespace
Google.Cloud.Kms.V1Assembly
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 |
The default Autokey scopes are:
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.
|
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. |
// 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. |
// 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.
|
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. |
// 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.
|
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. |
// 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.
|
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. |
// 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. |
// 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. |
// 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.
|
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. |
// 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.
|
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. |
// 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. |
// 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.
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
KeyHandle |
The RPC response. |
// 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.
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
KeyHandle |
The RPC response. |
// 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. |
// 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. |
// 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.
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskKeyHandle |
A Task containing the RPC response. |
// 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.
|
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskKeyHandle |
A Task containing the RPC response. |
// 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.
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskKeyHandle |
A Task containing the RPC response. |
// 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.
|
cancellationToken |
CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskKeyHandle |
A Task containing the RPC response. |
// 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, string, int?, CallSettings)
public virtual PagedEnumerable<ListKeyHandlesResponse, KeyHandle> ListKeyHandles(LocationName parent, string pageToken = null, int? pageSize = null, 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.
|
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListKeyHandlesResponseKeyHandle |
A pageable sequence of KeyHandle resources. |
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListKeyHandlesResponse, KeyHandle> response = autokeyClient.ListKeyHandles(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (KeyHandle 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 (ListKeyHandlesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (KeyHandle 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<KeyHandle> 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 (KeyHandle 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;
ListKeyHandles(ListKeyHandlesRequest, CallSettings)
public virtual PagedEnumerable<ListKeyHandlesResponse, KeyHandle> 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 |
PagedEnumerableListKeyHandlesResponseKeyHandle |
A pageable sequence of KeyHandle resources. |
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
ListKeyHandlesRequest request = new ListKeyHandlesRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
Filter = "",
};
// Make the request
PagedEnumerable<ListKeyHandlesResponse, KeyHandle> response = autokeyClient.ListKeyHandles(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (KeyHandle 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 (ListKeyHandlesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (KeyHandle 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<KeyHandle> 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 (KeyHandle 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;
ListKeyHandles(string, string, int?, CallSettings)
public virtual PagedEnumerable<ListKeyHandlesResponse, KeyHandle> ListKeyHandles(string parent, string pageToken = null, int? pageSize = null, 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.
|
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableListKeyHandlesResponseKeyHandle |
A pageable sequence of KeyHandle resources. |
// Create client
AutokeyClient autokeyClient = AutokeyClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListKeyHandlesResponse, KeyHandle> response = autokeyClient.ListKeyHandles(parent);
// Iterate over all response items, lazily performing RPCs as required
foreach (KeyHandle 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 (ListKeyHandlesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (KeyHandle 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<KeyHandle> 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 (KeyHandle 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;
ListKeyHandlesAsync(LocationName, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListKeyHandlesResponse, KeyHandle> ListKeyHandlesAsync(LocationName parent, string pageToken = null, int? pageSize = null, 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.
|
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListKeyHandlesResponseKeyHandle |
A pageable asynchronous sequence of KeyHandle resources. |
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListKeyHandlesResponse, KeyHandle> response = autokeyClient.ListKeyHandlesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((KeyHandle 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((ListKeyHandlesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (KeyHandle 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<KeyHandle> 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 (KeyHandle 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;
ListKeyHandlesAsync(ListKeyHandlesRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListKeyHandlesResponse, KeyHandle> 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 |
PagedAsyncEnumerableListKeyHandlesResponseKeyHandle |
A pageable asynchronous sequence of KeyHandle resources. |
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
ListKeyHandlesRequest request = new ListKeyHandlesRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
Filter = "",
};
// Make the request
PagedAsyncEnumerable<ListKeyHandlesResponse, KeyHandle> response = autokeyClient.ListKeyHandlesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((KeyHandle 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((ListKeyHandlesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (KeyHandle 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<KeyHandle> 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 (KeyHandle 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;
ListKeyHandlesAsync(string, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<ListKeyHandlesResponse, KeyHandle> ListKeyHandlesAsync(string parent, string pageToken = null, int? pageSize = null, 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.
|
pageToken |
string The token returned from the previous request. A value of |
pageSize |
int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableListKeyHandlesResponseKeyHandle |
A pageable asynchronous sequence of KeyHandle resources. |
// Create client
AutokeyClient autokeyClient = await AutokeyClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListKeyHandlesResponse, KeyHandle> response = autokeyClient.ListKeyHandlesAsync(parent);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((KeyHandle 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((ListKeyHandlesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (KeyHandle 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<KeyHandle> 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 (KeyHandle 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;
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 |
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 |
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. |
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.