public abstract class ApiKeysClient
Reference documentation and code samples for the API Keys v2 API class ApiKeysClient.
ApiKeys client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.ApiKeys.V2Assembly
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
string |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default ApiKeys scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyListstring |
The default ApiKeys scopes are:
DeleteKeyOperationsClient
public virtual OperationsClient DeleteKeyOperationsClient { get; }
The long-running operations client for DeleteKey
.
Property Value | |
---|---|
Type | Description |
OperationsClient |
GrpcClient
public virtual ApiKeys.ApiKeysClient GrpcClient { get; }
The underlying gRPC ApiKeys client
Property Value | |
---|---|
Type | Description |
ApiKeysApiKeysClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
UndeleteKeyOperationsClient
public virtual OperationsClient UndeleteKeyOperationsClient { get; }
The long-running operations client for UndeleteKey
.
Property Value | |
---|---|
Type | Description |
OperationsClient |
UpdateKeyOperationsClient
public virtual OperationsClient UpdateKeyOperationsClient { get; }
The long-running operations client for UpdateKey
.
Property Value | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
ApiKeysClient | The created ApiKeysClient. |
CreateAsync(CancellationToken)
public static Task<ApiKeysClient> CreateAsync(CancellationToken cancellationToken = default)
Asynchronously creates a ApiKeysClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ApiKeysClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
TaskApiKeysClient | 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 | |
---|---|
Name | Description |
parent | LocationName Required. The project in which the API key is created. |
key | Key Required. The API key fields to set at creation time.
You can configure only the |
keyId | string 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: The id must NOT be a UUID-like string. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OperationKeyEmpty | The RPC response. |
// 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 | |
---|---|
Name | Description |
request | CreateKeyRequest 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 |
OperationKeyEmpty | The RPC response. |
// 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 | |
---|---|
Name | Description |
parent | string Required. The project in which the API key is created. |
key | Key Required. The API key fields to set at creation time.
You can configure only the |
keyId | string 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: The id must NOT be a UUID-like string. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OperationKeyEmpty | The RPC response. |
// 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 | |
---|---|
Name | Description |
parent | LocationName Required. The project in which the API key is created. |
key | Key Required. The API key fields to set at creation time.
You can configure only the |
keyId | string 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: The id must NOT be a UUID-like string. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
parent | LocationName Required. The project in which the API key is created. |
key | Key Required. The API key fields to set at creation time.
You can configure only the |
keyId | string 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: The id must NOT be a UUID-like string. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | CreateKeyRequest 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 |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | CreateKeyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
parent | string Required. The project in which the API key is created. |
key | Key Required. The API key fields to set at creation time.
You can configure only the |
keyId | string 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: The id must NOT be a UUID-like string. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
parent | string Required. The project in which the API key is created. |
key | Key Required. The API key fields to set at creation time.
You can configure only the |
keyId | string 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: The id must NOT be a UUID-like string. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | DeleteKeyRequest 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 |
OperationKeyEmpty | The RPC response. |
// 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 | |
---|---|
Name | Description |
name | KeyName Required. The resource name of the API key to be deleted. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OperationKeyEmpty | The RPC response. |
// 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 | |
---|---|
Name | Description |
name | string Required. The resource name of the API key to be deleted. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OperationKeyEmpty | The RPC response. |
// 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 | |
---|---|
Name | Description |
request | DeleteKeyRequest 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 |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | DeleteKeyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | KeyName Required. The resource name of the API key to be deleted. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | KeyName Required. The resource name of the API key to be deleted. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | string Required. The resource name of the API key to be deleted. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | string Required. The resource name of the API key to be deleted. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | GetKeyRequest 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 |
Key | The RPC response. |
// 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 | |
---|---|
Name | Description |
name | KeyName Required. The resource name of the API key to get. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Key | The RPC response. |
// 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 | |
---|---|
Name | Description |
name | string Required. The resource name of the API key to get. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Key | The RPC response. |
// 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 | |
---|---|
Name | Description |
request | GetKeyRequest 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 |
TaskKey | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | GetKeyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskKey | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | KeyName Required. The resource name of the API key to get. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskKey | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | KeyName Required. The resource name of the API key to get. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskKey | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | string Required. The resource name of the API key to get. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskKey | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | string Required. The resource name of the API key to get. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskKey | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | GetKeyStringRequest 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 |
GetKeyStringResponse | The RPC response. |
// 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 | |
---|---|
Name | Description |
name | KeyName Required. The resource name of the API key to be retrieved. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
GetKeyStringResponse | The RPC response. |
// 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 | |
---|---|
Name | Description |
name | string Required. The resource name of the API key to be retrieved. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
GetKeyStringResponse | The RPC response. |
// 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 | |
---|---|
Name | Description |
request | GetKeyStringRequest 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 |
TaskGetKeyStringResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | GetKeyStringRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskGetKeyStringResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | KeyName Required. The resource name of the API key to be retrieved. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskGetKeyStringResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | KeyName Required. The resource name of the API key to be retrieved. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskGetKeyStringResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | string Required. The resource name of the API key to be retrieved. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskGetKeyStringResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
name | string Required. The resource name of the API key to be retrieved. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskGetKeyStringResponse | A Task containing the RPC response. |
// 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, int?, 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 | |
---|---|
Name | Description |
parent | LocationName Required. Lists all API keys associated with this project. |
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 |
PagedEnumerableListKeysResponseKey | A pageable sequence of Key resources. |
// 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 | |
---|---|
Name | Description |
request | ListKeysRequest 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 |
PagedEnumerableListKeysResponseKey | A pageable sequence of Key resources. |
// 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, int?, 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 | |
---|---|
Name | Description |
parent | string Required. Lists all API keys associated with this project. |
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 |
PagedEnumerableListKeysResponseKey | A pageable sequence of Key resources. |
// 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, int?, 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 | |
---|---|
Name | Description |
parent | LocationName Required. Lists all API keys associated with this project. |
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 |
PagedAsyncEnumerableListKeysResponseKey | A pageable asynchronous sequence of Key resources. |
// 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 | |
---|---|
Name | Description |
request | ListKeysRequest 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 |
PagedAsyncEnumerableListKeysResponseKey | A pageable asynchronous sequence of Key resources. |
// 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, int?, 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 | |
---|---|
Name | Description |
parent | string Required. Lists all API keys associated with this project. |
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 |
PagedAsyncEnumerableListKeysResponseKey | A pageable asynchronous sequence of Key resources. |
// 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 | |
---|---|
Name | Description |
request | LookupKeyRequest 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 |
LookupKeyResponse | The RPC response. |
// 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 | |
---|---|
Name | Description |
request | LookupKeyRequest 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 |
TaskLookupKeyResponse | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | LookupKeyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskLookupKeyResponse | A Task containing the RPC response. |
// 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 | |
---|---|
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 |
OperationKeyEmpty | 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 | |
---|---|
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 |
TaskOperationKeyEmpty | 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 | |
---|---|
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 |
OperationKeyEmpty | 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 | |
---|---|
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 |
TaskOperationKeyEmpty | 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 | |
---|---|
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 |
OperationKeyEmpty | 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 | |
---|---|
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 |
TaskOperationKeyEmpty | 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 | |
---|---|
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 |
OperationKeyEmpty | 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 | |
---|---|
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 |
TaskOperationKeyEmpty | 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.
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 | |
---|---|
Name | Description |
request | UndeleteKeyRequest 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 |
OperationKeyEmpty | The RPC response. |
// 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 | |
---|---|
Name | Description |
request | UndeleteKeyRequest 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 |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | UndeleteKeyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
key | Key Required. Set the |
updateMask | FieldMask The field mask specifies which fields to be updated as part of this
request. All other fields are ignored.
Mutable fields are: |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
OperationKeyEmpty | The RPC response. |
// 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 | |
---|---|
Name | Description |
request | UpdateKeyRequest 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 |
OperationKeyEmpty | The RPC response. |
// 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 | |
---|---|
Name | Description |
key | Key Required. Set the |
updateMask | FieldMask The field mask specifies which fields to be updated as part of this
request. All other fields are ignored.
Mutable fields are: |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
key | Key Required. Set the |
updateMask | FieldMask The field mask specifies which fields to be updated as part of this
request. All other fields are ignored.
Mutable fields are: |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | UpdateKeyRequest 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 |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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 | |
---|---|
Name | Description |
request | UpdateKeyRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskOperationKeyEmpty | A Task containing the RPC response. |
// 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;
}