API Keys v2 API - Class ApiKeysClient (1.1.0)

public abstract class ApiKeysClient

Reference documentation and code samples for the API Keys v2 API class ApiKeysClient.

ApiKeys client wrapper, for convenient use.

Inheritance

Object > ApiKeysClient

Derived Types

Namespace

Google.Cloud.ApiKeys.V2

Assembly

Google.Cloud.ApiKeys.V2.dll

Remarks

Manages the API keys associated with projects.

Properties

CreateKeyOperationsClient

public virtual OperationsClient CreateKeyOperationsClient { get; }

The long-running operations client for CreateKey.

Property Value
TypeDescription
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default ApiKeys scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

DeleteKeyOperationsClient

public virtual OperationsClient DeleteKeyOperationsClient { get; }

The long-running operations client for DeleteKey.

Property Value
TypeDescription
OperationsClient

GrpcClient

public virtual ApiKeys.ApiKeysClient GrpcClient { get; }

The underlying gRPC ApiKeys client

Property Value
TypeDescription
ApiKeys.ApiKeysClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

UndeleteKeyOperationsClient

public virtual OperationsClient UndeleteKeyOperationsClient { get; }

The long-running operations client for UndeleteKey.

Property Value
TypeDescription
OperationsClient

UpdateKeyOperationsClient

public virtual OperationsClient UpdateKeyOperationsClient { get; }

The long-running operations client for UpdateKey.

Property Value
TypeDescription
OperationsClient

Methods

Create()

public static ApiKeysClient Create()

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

Returns
TypeDescription
ApiKeysClient

The created ApiKeysClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<ApiKeysClient>

The task representing the created ApiKeysClient.

CreateKey(LocationName, Key, String, CallSettings)

public virtual Operation<Key, Empty> CreateKey(LocationName parent, Key key, string keyId, CallSettings callSettings = null)

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentLocationName

Required. The project in which the API key is created.

keyKey

Required. The API key fields to set at creation time. You can configure only the display_name, restrictions, and annotations fields.

keyIdString

User specified key id (optional). If specified, it will become the final component of the key resource name.

The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?.

The id must NOT be a UUID-like string.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Key key = new Key();
string keyId = "";
// Make the request
Operation<Key, Empty> response = apiKeysClient.CreateKey(parent, key, keyId);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = apiKeysClient.PollOnceCreateKey(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

CreateKey(CreateKeyRequest, CallSettings)

public virtual Operation<Key, Empty> CreateKey(CreateKeyRequest request, CallSettings callSettings = null)

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestCreateKeyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
CreateKeyRequest request = new CreateKeyRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Key = new Key(),
    KeyId = "",
};
// Make the request
Operation<Key, Empty> response = apiKeysClient.CreateKey(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = apiKeysClient.PollOnceCreateKey(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

CreateKey(String, Key, String, CallSettings)

public virtual Operation<Key, Empty> CreateKey(string parent, Key key, string keyId, CallSettings callSettings = null)

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentString

Required. The project in which the API key is created.

keyKey

Required. The API key fields to set at creation time. You can configure only the display_name, restrictions, and annotations fields.

keyIdString

User specified key id (optional). If specified, it will become the final component of the key resource name.

The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?.

The id must NOT be a UUID-like string.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Key key = new Key();
string keyId = "";
// Make the request
Operation<Key, Empty> response = apiKeysClient.CreateKey(parent, key, keyId);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = apiKeysClient.PollOnceCreateKey(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

CreateKeyAsync(LocationName, Key, String, CallSettings)

public virtual Task<Operation<Key, Empty>> CreateKeyAsync(LocationName parent, Key key, string keyId, CallSettings callSettings = null)

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentLocationName

Required. The project in which the API key is created.

keyKey

Required. The API key fields to set at creation time. You can configure only the display_name, restrictions, and annotations fields.

keyIdString

User specified key id (optional). If specified, it will become the final component of the key resource name.

The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?.

The id must NOT be a UUID-like string.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Key key = new Key();
string keyId = "";
// Make the request
Operation<Key, Empty> response = await apiKeysClient.CreateKeyAsync(parent, key, keyId);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceCreateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

CreateKeyAsync(LocationName, Key, String, CancellationToken)

public virtual Task<Operation<Key, Empty>> CreateKeyAsync(LocationName parent, Key key, string keyId, CancellationToken cancellationToken)

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentLocationName

Required. The project in which the API key is created.

keyKey

Required. The API key fields to set at creation time. You can configure only the display_name, restrictions, and annotations fields.

keyIdString

User specified key id (optional). If specified, it will become the final component of the key resource name.

The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?.

The id must NOT be a UUID-like string.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Key key = new Key();
string keyId = "";
// Make the request
Operation<Key, Empty> response = await apiKeysClient.CreateKeyAsync(parent, key, keyId);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceCreateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

CreateKeyAsync(CreateKeyRequest, CallSettings)

public virtual Task<Operation<Key, Empty>> CreateKeyAsync(CreateKeyRequest request, CallSettings callSettings = null)

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestCreateKeyRequest

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<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
CreateKeyRequest request = new CreateKeyRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Key = new Key(),
    KeyId = "",
};
// Make the request
Operation<Key, Empty> response = await apiKeysClient.CreateKeyAsync(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceCreateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

CreateKeyAsync(CreateKeyRequest, CancellationToken)

public virtual Task<Operation<Key, Empty>> CreateKeyAsync(CreateKeyRequest request, CancellationToken cancellationToken)

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestCreateKeyRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
CreateKeyRequest request = new CreateKeyRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Key = new Key(),
    KeyId = "",
};
// Make the request
Operation<Key, Empty> response = await apiKeysClient.CreateKeyAsync(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceCreateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

CreateKeyAsync(String, Key, String, CallSettings)

public virtual Task<Operation<Key, Empty>> CreateKeyAsync(string parent, Key key, string keyId, CallSettings callSettings = null)

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentString

Required. The project in which the API key is created.

keyKey

Required. The API key fields to set at creation time. You can configure only the display_name, restrictions, and annotations fields.

keyIdString

User specified key id (optional). If specified, it will become the final component of the key resource name.

The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?.

The id must NOT be a UUID-like string.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Key key = new Key();
string keyId = "";
// Make the request
Operation<Key, Empty> response = await apiKeysClient.CreateKeyAsync(parent, key, keyId);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceCreateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

CreateKeyAsync(String, Key, String, CancellationToken)

public virtual Task<Operation<Key, Empty>> CreateKeyAsync(string parent, Key key, string keyId, CancellationToken cancellationToken)

Creates a new API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentString

Required. The project in which the API key is created.

keyKey

Required. The API key fields to set at creation time. You can configure only the display_name, restrictions, and annotations fields.

keyIdString

User specified key id (optional). If specified, it will become the final component of the key resource name.

The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?.

The id must NOT be a UUID-like string.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Key key = new Key();
string keyId = "";
// Make the request
Operation<Key, Empty> response = await apiKeysClient.CreateKeyAsync(parent, key, keyId);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceCreateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

DeleteKey(DeleteKeyRequest, CallSettings)

public virtual Operation<Key, Empty> DeleteKey(DeleteKeyRequest request, CallSettings callSettings = null)

Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestDeleteKeyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
DeleteKeyRequest request = new DeleteKeyRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
    Etag = "",
};
// Make the request
Operation<Key, Empty> response = apiKeysClient.DeleteKey(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = apiKeysClient.PollOnceDeleteKey(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

DeleteKey(KeyName, CallSettings)

public virtual Operation<Key, Empty> DeleteKey(KeyName name, CallSettings callSettings = null)

Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameKeyName

Required. The resource name of the API key to be deleted.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
KeyName name = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]");
// Make the request
Operation<Key, Empty> response = apiKeysClient.DeleteKey(name);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = apiKeysClient.PollOnceDeleteKey(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

DeleteKey(String, CallSettings)

public virtual Operation<Key, Empty> DeleteKey(string name, CallSettings callSettings = null)

Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameString

Required. The resource name of the API key to be deleted.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keys/[KEY]";
// Make the request
Operation<Key, Empty> response = apiKeysClient.DeleteKey(name);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = apiKeysClient.PollOnceDeleteKey(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

DeleteKeyAsync(DeleteKeyRequest, CallSettings)

public virtual Task<Operation<Key, Empty>> DeleteKeyAsync(DeleteKeyRequest request, CallSettings callSettings = null)

Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestDeleteKeyRequest

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<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
DeleteKeyRequest request = new DeleteKeyRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
    Etag = "",
};
// Make the request
Operation<Key, Empty> response = await apiKeysClient.DeleteKeyAsync(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceDeleteKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

DeleteKeyAsync(DeleteKeyRequest, CancellationToken)

public virtual Task<Operation<Key, Empty>> DeleteKeyAsync(DeleteKeyRequest request, CancellationToken cancellationToken)

Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestDeleteKeyRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
DeleteKeyRequest request = new DeleteKeyRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
    Etag = "",
};
// Make the request
Operation<Key, Empty> response = await apiKeysClient.DeleteKeyAsync(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceDeleteKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

DeleteKeyAsync(KeyName, CallSettings)

public virtual Task<Operation<Key, Empty>> DeleteKeyAsync(KeyName name, CallSettings callSettings = null)

Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameKeyName

Required. The resource name of the API key to be deleted.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
KeyName name = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]");
// Make the request
Operation<Key, Empty> response = await apiKeysClient.DeleteKeyAsync(name);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceDeleteKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

DeleteKeyAsync(KeyName, CancellationToken)

public virtual Task<Operation<Key, Empty>> DeleteKeyAsync(KeyName name, CancellationToken cancellationToken)

Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameKeyName

Required. The resource name of the API key to be deleted.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
KeyName name = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]");
// Make the request
Operation<Key, Empty> response = await apiKeysClient.DeleteKeyAsync(name);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceDeleteKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

DeleteKeyAsync(String, CallSettings)

public virtual Task<Operation<Key, Empty>> DeleteKeyAsync(string name, CallSettings callSettings = null)

Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameString

Required. The resource name of the API key to be deleted.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keys/[KEY]";
// Make the request
Operation<Key, Empty> response = await apiKeysClient.DeleteKeyAsync(name);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceDeleteKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

DeleteKeyAsync(String, CancellationToken)

public virtual Task<Operation<Key, Empty>> DeleteKeyAsync(string name, CancellationToken cancellationToken)

Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameString

Required. The resource name of the API key to be deleted.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keys/[KEY]";
// Make the request
Operation<Key, Empty> response = await apiKeysClient.DeleteKeyAsync(name);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceDeleteKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

GetKey(GetKeyRequest, CallSettings)

public virtual Key GetKey(GetKeyRequest request, CallSettings callSettings = null)

Gets the metadata for an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestGetKeyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Key

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
GetKeyRequest request = new GetKeyRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
};
// Make the request
Key response = apiKeysClient.GetKey(request);

GetKey(KeyName, CallSettings)

public virtual Key GetKey(KeyName name, CallSettings callSettings = null)

Gets the metadata for an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameKeyName

Required. The resource name of the API key to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Key

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
KeyName name = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]");
// Make the request
Key response = apiKeysClient.GetKey(name);

GetKey(String, CallSettings)

public virtual Key GetKey(string name, CallSettings callSettings = null)

Gets the metadata for an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameString

Required. The resource name of the API key to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Key

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keys/[KEY]";
// Make the request
Key response = apiKeysClient.GetKey(name);

GetKeyAsync(GetKeyRequest, CallSettings)

public virtual Task<Key> GetKeyAsync(GetKeyRequest request, CallSettings callSettings = null)

Gets the metadata for an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestGetKeyRequest

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<Key>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
GetKeyRequest request = new GetKeyRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
};
// Make the request
Key response = await apiKeysClient.GetKeyAsync(request);

GetKeyAsync(GetKeyRequest, CancellationToken)

public virtual Task<Key> GetKeyAsync(GetKeyRequest request, CancellationToken cancellationToken)

Gets the metadata for an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestGetKeyRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Key>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
GetKeyRequest request = new GetKeyRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
};
// Make the request
Key response = await apiKeysClient.GetKeyAsync(request);

GetKeyAsync(KeyName, CallSettings)

public virtual Task<Key> GetKeyAsync(KeyName name, CallSettings callSettings = null)

Gets the metadata for an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameKeyName

Required. The resource name of the API key to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Key>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
KeyName name = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]");
// Make the request
Key response = await apiKeysClient.GetKeyAsync(name);

GetKeyAsync(KeyName, CancellationToken)

public virtual Task<Key> GetKeyAsync(KeyName name, CancellationToken cancellationToken)

Gets the metadata for an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameKeyName

Required. The resource name of the API key to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Key>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
KeyName name = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]");
// Make the request
Key response = await apiKeysClient.GetKeyAsync(name);

GetKeyAsync(String, CallSettings)

public virtual Task<Key> GetKeyAsync(string name, CallSettings callSettings = null)

Gets the metadata for an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameString

Required. The resource name of the API key to get.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Key>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keys/[KEY]";
// Make the request
Key response = await apiKeysClient.GetKeyAsync(name);

GetKeyAsync(String, CancellationToken)

public virtual Task<Key> GetKeyAsync(string name, CancellationToken cancellationToken)

Gets the metadata for an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameString

Required. The resource name of the API key to get.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Key>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keys/[KEY]";
// Make the request
Key response = await apiKeysClient.GetKeyAsync(name);

GetKeyString(GetKeyStringRequest, CallSettings)

public virtual GetKeyStringResponse GetKeyString(GetKeyStringRequest request, CallSettings callSettings = null)

Get the key string for an API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestGetKeyStringRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
GetKeyStringResponse

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
GetKeyStringRequest request = new GetKeyStringRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
};
// Make the request
GetKeyStringResponse response = apiKeysClient.GetKeyString(request);

GetKeyString(KeyName, CallSettings)

public virtual GetKeyStringResponse GetKeyString(KeyName name, CallSettings callSettings = null)

Get the key string for an API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameKeyName

Required. The resource name of the API key to be retrieved.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
GetKeyStringResponse

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
KeyName name = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]");
// Make the request
GetKeyStringResponse response = apiKeysClient.GetKeyString(name);

GetKeyString(String, CallSettings)

public virtual GetKeyStringResponse GetKeyString(string name, CallSettings callSettings = null)

Get the key string for an API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameString

Required. The resource name of the API key to be retrieved.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
GetKeyStringResponse

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keys/[KEY]";
// Make the request
GetKeyStringResponse response = apiKeysClient.GetKeyString(name);

GetKeyStringAsync(GetKeyStringRequest, CallSettings)

public virtual Task<GetKeyStringResponse> GetKeyStringAsync(GetKeyStringRequest request, CallSettings callSettings = null)

Get the key string for an API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestGetKeyStringRequest

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<GetKeyStringResponse>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
GetKeyStringRequest request = new GetKeyStringRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
};
// Make the request
GetKeyStringResponse response = await apiKeysClient.GetKeyStringAsync(request);

GetKeyStringAsync(GetKeyStringRequest, CancellationToken)

public virtual Task<GetKeyStringResponse> GetKeyStringAsync(GetKeyStringRequest request, CancellationToken cancellationToken)

Get the key string for an API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestGetKeyStringRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<GetKeyStringResponse>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
GetKeyStringRequest request = new GetKeyStringRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
};
// Make the request
GetKeyStringResponse response = await apiKeysClient.GetKeyStringAsync(request);

GetKeyStringAsync(KeyName, CallSettings)

public virtual Task<GetKeyStringResponse> GetKeyStringAsync(KeyName name, CallSettings callSettings = null)

Get the key string for an API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameKeyName

Required. The resource name of the API key to be retrieved.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<GetKeyStringResponse>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
KeyName name = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]");
// Make the request
GetKeyStringResponse response = await apiKeysClient.GetKeyStringAsync(name);

GetKeyStringAsync(KeyName, CancellationToken)

public virtual Task<GetKeyStringResponse> GetKeyStringAsync(KeyName name, CancellationToken cancellationToken)

Get the key string for an API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameKeyName

Required. The resource name of the API key to be retrieved.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<GetKeyStringResponse>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
KeyName name = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]");
// Make the request
GetKeyStringResponse response = await apiKeysClient.GetKeyStringAsync(name);

GetKeyStringAsync(String, CallSettings)

public virtual Task<GetKeyStringResponse> GetKeyStringAsync(string name, CallSettings callSettings = null)

Get the key string for an API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameString

Required. The resource name of the API key to be retrieved.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<GetKeyStringResponse>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keys/[KEY]";
// Make the request
GetKeyStringResponse response = await apiKeysClient.GetKeyStringAsync(name);

GetKeyStringAsync(String, CancellationToken)

public virtual Task<GetKeyStringResponse> GetKeyStringAsync(string name, CancellationToken cancellationToken)

Get the key string for an API key.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
nameString

Required. The resource name of the API key to be retrieved.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<GetKeyStringResponse>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/keys/[KEY]";
// Make the request
GetKeyStringResponse response = await apiKeysClient.GetKeyStringAsync(name);

ListKeys(LocationName, String, Nullable<Int32>, CallSettings)

public virtual PagedEnumerable<ListKeysResponse, Key> ListKeys(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the API keys owned by a project. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentLocationName

Required. Lists all API keys associated with this project.

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<ListKeysResponse, Key>

A pageable sequence of Key resources.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListKeysResponse, Key> response = apiKeysClient.ListKeys(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Key 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 (ListKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Key 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<Key> 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 (Key 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;

ListKeys(ListKeysRequest, CallSettings)

public virtual PagedEnumerable<ListKeysResponse, Key> ListKeys(ListKeysRequest request, CallSettings callSettings = null)

Lists the API keys owned by a project. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestListKeysRequest

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<ListKeysResponse, Key>

A pageable sequence of Key resources.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
ListKeysRequest request = new ListKeysRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    ShowDeleted = false,
};
// Make the request
PagedEnumerable<ListKeysResponse, Key> response = apiKeysClient.ListKeys(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Key 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 (ListKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Key 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<Key> 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 (Key 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;

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

public virtual PagedEnumerable<ListKeysResponse, Key> ListKeys(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the API keys owned by a project. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentString

Required. Lists all API keys associated with this project.

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<ListKeysResponse, Key>

A pageable sequence of Key resources.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListKeysResponse, Key> response = apiKeysClient.ListKeys(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Key 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 (ListKeysResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Key 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<Key> 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 (Key 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;

ListKeysAsync(LocationName, String, Nullable<Int32>, CallSettings)

public virtual PagedAsyncEnumerable<ListKeysResponse, Key> ListKeysAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the API keys owned by a project. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentLocationName

Required. Lists all API keys associated with this project.

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<ListKeysResponse, Key>

A pageable asynchronous sequence of Key resources.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListKeysResponse, Key> response = apiKeysClient.ListKeysAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Key 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((ListKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Key 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<Key> 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 (Key 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;

ListKeysAsync(ListKeysRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListKeysResponse, Key> ListKeysAsync(ListKeysRequest request, CallSettings callSettings = null)

Lists the API keys owned by a project. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestListKeysRequest

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<ListKeysResponse, Key>

A pageable asynchronous sequence of Key resources.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
ListKeysRequest request = new ListKeysRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    ShowDeleted = false,
};
// Make the request
PagedAsyncEnumerable<ListKeysResponse, Key> response = apiKeysClient.ListKeysAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Key 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((ListKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Key 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<Key> 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 (Key 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;

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

public virtual PagedAsyncEnumerable<ListKeysResponse, Key> ListKeysAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the API keys owned by a project. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
parentString

Required. Lists all API keys associated with this project.

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<ListKeysResponse, Key>

A pageable asynchronous sequence of Key resources.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListKeysResponse, Key> response = apiKeysClient.ListKeysAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Key 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((ListKeysResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Key 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<Key> 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 (Key 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;

LookupKey(LookupKeyRequest, CallSettings)

public virtual LookupKeyResponse LookupKey(LookupKeyRequest request, CallSettings callSettings = null)

Find the parent project and resource name of the API key that matches the key string in the request. If the API key has been purged, resource name will not be set. The service account must have the apikeys.keys.lookup permission on the parent project.

Parameters
NameDescription
requestLookupKeyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
LookupKeyResponse

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
LookupKeyRequest request = new LookupKeyRequest { KeyString = "", };
// Make the request
LookupKeyResponse response = apiKeysClient.LookupKey(request);

LookupKeyAsync(LookupKeyRequest, CallSettings)

public virtual Task<LookupKeyResponse> LookupKeyAsync(LookupKeyRequest request, CallSettings callSettings = null)

Find the parent project and resource name of the API key that matches the key string in the request. If the API key has been purged, resource name will not be set. The service account must have the apikeys.keys.lookup permission on the parent project.

Parameters
NameDescription
requestLookupKeyRequest

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<LookupKeyResponse>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
LookupKeyRequest request = new LookupKeyRequest { KeyString = "", };
// Make the request
LookupKeyResponse response = await apiKeysClient.LookupKeyAsync(request);

LookupKeyAsync(LookupKeyRequest, CancellationToken)

public virtual Task<LookupKeyResponse> LookupKeyAsync(LookupKeyRequest request, CancellationToken cancellationToken)

Find the parent project and resource name of the API key that matches the key string in the request. If the API key has been purged, resource name will not be set. The service account must have the apikeys.keys.lookup permission on the parent project.

Parameters
NameDescription
requestLookupKeyRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<LookupKeyResponse>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
LookupKeyRequest request = new LookupKeyRequest { KeyString = "", };
// Make the request
LookupKeyResponse response = await apiKeysClient.LookupKeyAsync(request);

PollOnceCreateKey(String, CallSettings)

public virtual Operation<Key, Empty> PollOnceCreateKey(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The result of polling the operation.

PollOnceCreateKeyAsync(String, CallSettings)

public virtual Task<Operation<Key, Empty>> PollOnceCreateKeyAsync(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A task representing the result of polling the operation.

PollOnceDeleteKey(String, CallSettings)

public virtual Operation<Key, Empty> PollOnceDeleteKey(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The result of polling the operation.

PollOnceDeleteKeyAsync(String, CallSettings)

public virtual Task<Operation<Key, Empty>> PollOnceDeleteKeyAsync(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A task representing the result of polling the operation.

PollOnceUndeleteKey(String, CallSettings)

public virtual Operation<Key, Empty> PollOnceUndeleteKey(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The result of polling the operation.

PollOnceUndeleteKeyAsync(String, CallSettings)

public virtual Task<Operation<Key, Empty>> PollOnceUndeleteKeyAsync(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A task representing the result of polling the operation.

PollOnceUpdateKey(String, CallSettings)

public virtual Operation<Key, Empty> PollOnceUpdateKey(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The result of polling the operation.

PollOnceUpdateKeyAsync(String, CallSettings)

public virtual Task<Operation<Key, Empty>> PollOnceUpdateKeyAsync(string operationName, CallSettings callSettings = null)

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

Parameters
NameDescription
operationNameString

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Key, Empty>>

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

UndeleteKey(UndeleteKeyRequest, CallSettings)

public virtual Operation<Key, Empty> UndeleteKey(UndeleteKeyRequest request, CallSettings callSettings = null)

Undeletes an API key which was deleted within 30 days.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestUndeleteKeyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
UndeleteKeyRequest request = new UndeleteKeyRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
};
// Make the request
Operation<Key, Empty> response = apiKeysClient.UndeleteKey(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = apiKeysClient.PollOnceUndeleteKey(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

UndeleteKeyAsync(UndeleteKeyRequest, CallSettings)

public virtual Task<Operation<Key, Empty>> UndeleteKeyAsync(UndeleteKeyRequest request, CallSettings callSettings = null)

Undeletes an API key which was deleted within 30 days.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestUndeleteKeyRequest

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<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
UndeleteKeyRequest request = new UndeleteKeyRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
};
// Make the request
Operation<Key, Empty> response = await apiKeysClient.UndeleteKeyAsync(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceUndeleteKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

UndeleteKeyAsync(UndeleteKeyRequest, CancellationToken)

public virtual Task<Operation<Key, Empty>> UndeleteKeyAsync(UndeleteKeyRequest request, CancellationToken cancellationToken)

Undeletes an API key which was deleted within 30 days.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestUndeleteKeyRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
UndeleteKeyRequest request = new UndeleteKeyRequest
{
    KeyName = KeyName.FromProjectLocationKey("[PROJECT]", "[LOCATION]", "[KEY]"),
};
// Make the request
Operation<Key, Empty> response = await apiKeysClient.UndeleteKeyAsync(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceUndeleteKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

UpdateKey(Key, FieldMask, CallSettings)

public virtual Operation<Key, Empty> UpdateKey(Key key, FieldMask updateMask, CallSettings callSettings = null)

Patches the modifiable fields of an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
keyKey

Required. Set the name field to the resource name of the API key to be updated. You can update only the display_name, restrictions, and annotations fields.

updateMaskFieldMask

The field mask specifies which fields to be updated as part of this request. All other fields are ignored. Mutable fields are: display_name, restrictions, and annotations. If an update mask is not provided, the service treats it as an implied mask equivalent to all allowed fields that are set on the wire. If the field mask has a special value "*", the service treats it equivalent to replace all allowed mutable fields.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
Key key = new Key();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Key, Empty> response = apiKeysClient.UpdateKey(key, updateMask);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = apiKeysClient.PollOnceUpdateKey(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

UpdateKey(UpdateKeyRequest, CallSettings)

public virtual Operation<Key, Empty> UpdateKey(UpdateKeyRequest request, CallSettings callSettings = null)

Patches the modifiable fields of an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestUpdateKeyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Operation<Key, Empty>

The RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = ApiKeysClient.Create();
// Initialize request argument(s)
UpdateKeyRequest request = new UpdateKeyRequest
{
    Key = new Key(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Key, Empty> response = apiKeysClient.UpdateKey(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = apiKeysClient.PollOnceUpdateKey(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

UpdateKeyAsync(Key, FieldMask, CallSettings)

public virtual Task<Operation<Key, Empty>> UpdateKeyAsync(Key key, FieldMask updateMask, CallSettings callSettings = null)

Patches the modifiable fields of an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
keyKey

Required. Set the name field to the resource name of the API key to be updated. You can update only the display_name, restrictions, and annotations fields.

updateMaskFieldMask

The field mask specifies which fields to be updated as part of this request. All other fields are ignored. Mutable fields are: display_name, restrictions, and annotations. If an update mask is not provided, the service treats it as an implied mask equivalent to all allowed fields that are set on the wire. If the field mask has a special value "*", the service treats it equivalent to replace all allowed mutable fields.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
Key key = new Key();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Key, Empty> response = await apiKeysClient.UpdateKeyAsync(key, updateMask);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceUpdateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

UpdateKeyAsync(Key, FieldMask, CancellationToken)

public virtual Task<Operation<Key, Empty>> UpdateKeyAsync(Key key, FieldMask updateMask, CancellationToken cancellationToken)

Patches the modifiable fields of an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
keyKey

Required. Set the name field to the resource name of the API key to be updated. You can update only the display_name, restrictions, and annotations fields.

updateMaskFieldMask

The field mask specifies which fields to be updated as part of this request. All other fields are ignored. Mutable fields are: display_name, restrictions, and annotations. If an update mask is not provided, the service treats it as an implied mask equivalent to all allowed fields that are set on the wire. If the field mask has a special value "*", the service treats it equivalent to replace all allowed mutable fields.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
Key key = new Key();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Key, Empty> response = await apiKeysClient.UpdateKeyAsync(key, updateMask);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceUpdateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

UpdateKeyAsync(UpdateKeyRequest, CallSettings)

public virtual Task<Operation<Key, Empty>> UpdateKeyAsync(UpdateKeyRequest request, CallSettings callSettings = null)

Patches the modifiable fields of an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestUpdateKeyRequest

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<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
UpdateKeyRequest request = new UpdateKeyRequest
{
    Key = new Key(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Key, Empty> response = await apiKeysClient.UpdateKeyAsync(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceUpdateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}

UpdateKeyAsync(UpdateKeyRequest, CancellationToken)

public virtual Task<Operation<Key, Empty>> UpdateKeyAsync(UpdateKeyRequest request, CancellationToken cancellationToken)

Patches the modifiable fields of an API key. The key string of the API key isn't included in the response.

NOTE: Key is a global resource; hence the only supported value for location is global.

Parameters
NameDescription
requestUpdateKeyRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Operation<Key, Empty>>

A Task containing the RPC response.

Example
// Create client
ApiKeysClient apiKeysClient = await ApiKeysClient.CreateAsync();
// Initialize request argument(s)
UpdateKeyRequest request = new UpdateKeyRequest
{
    Key = new Key(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Key, Empty> response = await apiKeysClient.UpdateKeyAsync(request);

// Poll until the returned long-running operation is complete
Operation<Key, Empty> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Key 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<Key, Empty> retrievedResponse = await apiKeysClient.PollOnceUpdateKeyAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Key retrievedResult = retrievedResponse.Result;
}