public abstract class WorkloadIdentityClientReference documentation and code samples for the Workload Identity v1 API class WorkloadIdentityClient.
WorkloadIdentity client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.WorkloadIdentity.V1Assembly
Google.Cloud.WorkloadIdentity.V1.dll
Remarks
Service describing handlers for resources
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }The default endpoint for the WorkloadIdentity service, which is a host of "workloadidentity.googleapis.com" and a port of 443.
| Property Value | |
|---|---|
| Type | Description |
string |
|
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }The default WorkloadIdentity scopes.
| Property Value | |
|---|---|
| Type | Description |
IReadOnlyListstring |
|
The default WorkloadIdentity scopes are:
GenerateServiceAgentsOperationsClient
public virtual OperationsClient GenerateServiceAgentsOperationsClient { get; }The long-running operations client for GenerateServiceAgents.
| Property Value | |
|---|---|
| Type | Description |
OperationsClient |
|
GrpcClient
public virtual WorkloadIdentity.WorkloadIdentityClient GrpcClient { get; }The underlying gRPC WorkloadIdentity client
| Property Value | |
|---|---|
| Type | Description |
WorkloadIdentityWorkloadIdentityClient |
|
LocationsClient
public virtual LocationsClient LocationsClient { get; }The LocationsClient associated with this client.
| Property Value | |
|---|---|
| Type | Description |
LocationsClient |
|
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }The service metadata associated with this client type.
| Property Value | |
|---|---|
| Type | Description |
ServiceMetadata |
|
Methods
Create()
public static WorkloadIdentityClient Create()Synchronously creates a WorkloadIdentityClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use WorkloadIdentityClientBuilder.
| Returns | |
|---|---|
| Type | Description |
WorkloadIdentityClient |
The created WorkloadIdentityClient. |
CreateAsync(CancellationToken)
public static Task<WorkloadIdentityClient> CreateAsync(CancellationToken cancellationToken = default)Asynchronously creates a WorkloadIdentityClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use WorkloadIdentityClientBuilder.
| Parameter | |
|---|---|
| Name | Description |
cancellationToken |
CancellationTokenThe CancellationToken to use while creating the client. |
| Returns | |
|---|---|
| Type | Description |
TaskWorkloadIdentityClient |
The task representing the created WorkloadIdentityClient. |
GenerateServiceAgents(GenerateServiceAgentsRequest, CallSettings)
public virtual Operation<GenerateServiceAgentsResponse, OperationMetadata> GenerateServiceAgents(GenerateServiceAgentsRequest request, CallSettings callSettings = null)Creates all service agents for a given resource, location and service producer.
| Parameters | |
|---|---|
| Name | Description |
request |
GenerateServiceAgentsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationGenerateServiceAgentsResponseOperationMetadata |
The RPC response. |
// Create client
WorkloadIdentityClient workloadIdentityClient = WorkloadIdentityClient.Create();
// Initialize request argument(s)
GenerateServiceAgentsRequest request = new GenerateServiceAgentsRequest
{
ParentAsServiceProducerName = ServiceProducerName.FromProjectLocationServiceProducer("[PROJECT]", "[LOCATION]", "[SERVICE_PRODUCER]"),
};
// Make the request
Operation<GenerateServiceAgentsResponse, OperationMetadata> response = workloadIdentityClient.GenerateServiceAgents(request);
// Poll until the returned long-running operation is complete
Operation<GenerateServiceAgentsResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
GenerateServiceAgentsResponse 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<GenerateServiceAgentsResponse, OperationMetadata> retrievedResponse = workloadIdentityClient.PollOnceGenerateServiceAgents(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
GenerateServiceAgentsResponse retrievedResult = retrievedResponse.Result;
}
GenerateServiceAgents(ServiceProducerName, CallSettings)
public virtual Operation<GenerateServiceAgentsResponse, OperationMetadata> GenerateServiceAgents(ServiceProducerName parent, CallSettings callSettings = null)Creates all service agents for a given resource, location and service producer.
| Parameters | |
|---|---|
| Name | Description |
parent |
ServiceProducerNameRequired. The parent resource. The Examples:
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationGenerateServiceAgentsResponseOperationMetadata |
The RPC response. |
// Create client
WorkloadIdentityClient workloadIdentityClient = WorkloadIdentityClient.Create();
// Initialize request argument(s)
ServiceProducerName parent = ServiceProducerName.FromProjectLocationServiceProducer("[PROJECT]", "[LOCATION]", "[SERVICE_PRODUCER]");
// Make the request
Operation<GenerateServiceAgentsResponse, OperationMetadata> response = workloadIdentityClient.GenerateServiceAgents(parent);
// Poll until the returned long-running operation is complete
Operation<GenerateServiceAgentsResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
GenerateServiceAgentsResponse 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<GenerateServiceAgentsResponse, OperationMetadata> retrievedResponse = workloadIdentityClient.PollOnceGenerateServiceAgents(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
GenerateServiceAgentsResponse retrievedResult = retrievedResponse.Result;
}
GenerateServiceAgents(string, CallSettings)
public virtual Operation<GenerateServiceAgentsResponse, OperationMetadata> GenerateServiceAgents(string parent, CallSettings callSettings = null)Creates all service agents for a given resource, location and service producer.
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The parent resource. The Examples:
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationGenerateServiceAgentsResponseOperationMetadata |
The RPC response. |
// Create client
WorkloadIdentityClient workloadIdentityClient = WorkloadIdentityClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/serviceProducers/[SERVICE_PRODUCER]";
// Make the request
Operation<GenerateServiceAgentsResponse, OperationMetadata> response = workloadIdentityClient.GenerateServiceAgents(parent);
// Poll until the returned long-running operation is complete
Operation<GenerateServiceAgentsResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
GenerateServiceAgentsResponse 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<GenerateServiceAgentsResponse, OperationMetadata> retrievedResponse = workloadIdentityClient.PollOnceGenerateServiceAgents(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
GenerateServiceAgentsResponse retrievedResult = retrievedResponse.Result;
}
GenerateServiceAgentsAsync(GenerateServiceAgentsRequest, CallSettings)
public virtual Task<Operation<GenerateServiceAgentsResponse, OperationMetadata>> GenerateServiceAgentsAsync(GenerateServiceAgentsRequest request, CallSettings callSettings = null)Creates all service agents for a given resource, location and service producer.
| Parameters | |
|---|---|
| Name | Description |
request |
GenerateServiceAgentsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationGenerateServiceAgentsResponseOperationMetadata |
A Task containing the RPC response. |
// Create client
WorkloadIdentityClient workloadIdentityClient = await WorkloadIdentityClient.CreateAsync();
// Initialize request argument(s)
GenerateServiceAgentsRequest request = new GenerateServiceAgentsRequest
{
ParentAsServiceProducerName = ServiceProducerName.FromProjectLocationServiceProducer("[PROJECT]", "[LOCATION]", "[SERVICE_PRODUCER]"),
};
// Make the request
Operation<GenerateServiceAgentsResponse, OperationMetadata> response = await workloadIdentityClient.GenerateServiceAgentsAsync(request);
// Poll until the returned long-running operation is complete
Operation<GenerateServiceAgentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
GenerateServiceAgentsResponse 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<GenerateServiceAgentsResponse, OperationMetadata> retrievedResponse = await workloadIdentityClient.PollOnceGenerateServiceAgentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
GenerateServiceAgentsResponse retrievedResult = retrievedResponse.Result;
}
GenerateServiceAgentsAsync(GenerateServiceAgentsRequest, CancellationToken)
public virtual Task<Operation<GenerateServiceAgentsResponse, OperationMetadata>> GenerateServiceAgentsAsync(GenerateServiceAgentsRequest request, CancellationToken cancellationToken)Creates all service agents for a given resource, location and service producer.
| Parameters | |
|---|---|
| Name | Description |
request |
GenerateServiceAgentsRequestThe request object containing all of the parameters for the API call. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationGenerateServiceAgentsResponseOperationMetadata |
A Task containing the RPC response. |
// Create client
WorkloadIdentityClient workloadIdentityClient = await WorkloadIdentityClient.CreateAsync();
// Initialize request argument(s)
GenerateServiceAgentsRequest request = new GenerateServiceAgentsRequest
{
ParentAsServiceProducerName = ServiceProducerName.FromProjectLocationServiceProducer("[PROJECT]", "[LOCATION]", "[SERVICE_PRODUCER]"),
};
// Make the request
Operation<GenerateServiceAgentsResponse, OperationMetadata> response = await workloadIdentityClient.GenerateServiceAgentsAsync(request);
// Poll until the returned long-running operation is complete
Operation<GenerateServiceAgentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
GenerateServiceAgentsResponse 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<GenerateServiceAgentsResponse, OperationMetadata> retrievedResponse = await workloadIdentityClient.PollOnceGenerateServiceAgentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
GenerateServiceAgentsResponse retrievedResult = retrievedResponse.Result;
}
GenerateServiceAgentsAsync(ServiceProducerName, CallSettings)
public virtual Task<Operation<GenerateServiceAgentsResponse, OperationMetadata>> GenerateServiceAgentsAsync(ServiceProducerName parent, CallSettings callSettings = null)Creates all service agents for a given resource, location and service producer.
| Parameters | |
|---|---|
| Name | Description |
parent |
ServiceProducerNameRequired. The parent resource. The Examples:
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationGenerateServiceAgentsResponseOperationMetadata |
A Task containing the RPC response. |
// Create client
WorkloadIdentityClient workloadIdentityClient = await WorkloadIdentityClient.CreateAsync();
// Initialize request argument(s)
ServiceProducerName parent = ServiceProducerName.FromProjectLocationServiceProducer("[PROJECT]", "[LOCATION]", "[SERVICE_PRODUCER]");
// Make the request
Operation<GenerateServiceAgentsResponse, OperationMetadata> response = await workloadIdentityClient.GenerateServiceAgentsAsync(parent);
// Poll until the returned long-running operation is complete
Operation<GenerateServiceAgentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
GenerateServiceAgentsResponse 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<GenerateServiceAgentsResponse, OperationMetadata> retrievedResponse = await workloadIdentityClient.PollOnceGenerateServiceAgentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
GenerateServiceAgentsResponse retrievedResult = retrievedResponse.Result;
}
GenerateServiceAgentsAsync(ServiceProducerName, CancellationToken)
public virtual Task<Operation<GenerateServiceAgentsResponse, OperationMetadata>> GenerateServiceAgentsAsync(ServiceProducerName parent, CancellationToken cancellationToken)Creates all service agents for a given resource, location and service producer.
| Parameters | |
|---|---|
| Name | Description |
parent |
ServiceProducerNameRequired. The parent resource. The Examples:
|
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationGenerateServiceAgentsResponseOperationMetadata |
A Task containing the RPC response. |
// Create client
WorkloadIdentityClient workloadIdentityClient = await WorkloadIdentityClient.CreateAsync();
// Initialize request argument(s)
ServiceProducerName parent = ServiceProducerName.FromProjectLocationServiceProducer("[PROJECT]", "[LOCATION]", "[SERVICE_PRODUCER]");
// Make the request
Operation<GenerateServiceAgentsResponse, OperationMetadata> response = await workloadIdentityClient.GenerateServiceAgentsAsync(parent);
// Poll until the returned long-running operation is complete
Operation<GenerateServiceAgentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
GenerateServiceAgentsResponse 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<GenerateServiceAgentsResponse, OperationMetadata> retrievedResponse = await workloadIdentityClient.PollOnceGenerateServiceAgentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
GenerateServiceAgentsResponse retrievedResult = retrievedResponse.Result;
}
GenerateServiceAgentsAsync(string, CallSettings)
public virtual Task<Operation<GenerateServiceAgentsResponse, OperationMetadata>> GenerateServiceAgentsAsync(string parent, CallSettings callSettings = null)Creates all service agents for a given resource, location and service producer.
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The parent resource. The Examples:
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationGenerateServiceAgentsResponseOperationMetadata |
A Task containing the RPC response. |
// Create client
WorkloadIdentityClient workloadIdentityClient = await WorkloadIdentityClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/serviceProducers/[SERVICE_PRODUCER]";
// Make the request
Operation<GenerateServiceAgentsResponse, OperationMetadata> response = await workloadIdentityClient.GenerateServiceAgentsAsync(parent);
// Poll until the returned long-running operation is complete
Operation<GenerateServiceAgentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
GenerateServiceAgentsResponse 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<GenerateServiceAgentsResponse, OperationMetadata> retrievedResponse = await workloadIdentityClient.PollOnceGenerateServiceAgentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
GenerateServiceAgentsResponse retrievedResult = retrievedResponse.Result;
}
GenerateServiceAgentsAsync(string, CancellationToken)
public virtual Task<Operation<GenerateServiceAgentsResponse, OperationMetadata>> GenerateServiceAgentsAsync(string parent, CancellationToken cancellationToken)Creates all service agents for a given resource, location and service producer.
| Parameters | |
|---|---|
| Name | Description |
parent |
stringRequired. The parent resource. The Examples:
|
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationGenerateServiceAgentsResponseOperationMetadata |
A Task containing the RPC response. |
// Create client
WorkloadIdentityClient workloadIdentityClient = await WorkloadIdentityClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/serviceProducers/[SERVICE_PRODUCER]";
// Make the request
Operation<GenerateServiceAgentsResponse, OperationMetadata> response = await workloadIdentityClient.GenerateServiceAgentsAsync(parent);
// Poll until the returned long-running operation is complete
Operation<GenerateServiceAgentsResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
GenerateServiceAgentsResponse 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<GenerateServiceAgentsResponse, OperationMetadata> retrievedResponse = await workloadIdentityClient.PollOnceGenerateServiceAgentsAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
GenerateServiceAgentsResponse retrievedResult = retrievedResponse.Result;
}
PollOnceGenerateServiceAgents(string, CallSettings)
public virtual Operation<GenerateServiceAgentsResponse, OperationMetadata> PollOnceGenerateServiceAgents(string operationName, CallSettings callSettings = null)Poll an operation once, using an operationName from a previous invocation of GenerateServiceAgents
.
| Parameters | |
|---|---|
| Name | Description |
operationName |
stringThe name of a previously invoked operation. Must not be |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationGenerateServiceAgentsResponseOperationMetadata |
The result of polling the operation. |
PollOnceGenerateServiceAgentsAsync(string, CallSettings)
public virtual Task<Operation<GenerateServiceAgentsResponse, OperationMetadata>> PollOnceGenerateServiceAgentsAsync(string operationName, CallSettings callSettings = null)Asynchronously poll an operation once, using an operationName from a previous invocation of
GenerateServiceAgents.
| Parameters | |
|---|---|
| Name | Description |
operationName |
stringThe name of a previously invoked operation. Must not be |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationGenerateServiceAgentsResponseOperationMetadata |
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.