public abstract class InstancesClient
Instances client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.AppEngine.V1Assembly
Google.Cloud.AppEngine.V1.dll
Remarks
Manages instances of a version.
Properties
DebugInstanceOperationsClient
public virtual OperationsClient DebugInstanceOperationsClient { get; }
The long-running operations client for DebugInstance
.
Property Value | |
---|---|
Type | Description |
OperationsClient |
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the Instances service, which is a host of "appengine.googleapis.com" and a port of 443.
Property Value | |
---|---|
Type | Description |
String |
DefaultScopes
public static IReadOnlyList<string> DefaultScopes { get; }
The default Instances scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyList<String> |
The default Instances scopes are:
DeleteInstanceOperationsClient
public virtual OperationsClient DeleteInstanceOperationsClient { get; }
The long-running operations client for DeleteInstance
.
Property Value | |
---|---|
Type | Description |
OperationsClient |
GrpcClient
public virtual Instances.InstancesClient GrpcClient { get; }
The underlying gRPC Instances client
Property Value | |
---|---|
Type | Description |
Instances.InstancesClient |
Methods
Create()
public static InstancesClient Create()
Synchronously creates a InstancesClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use InstancesClientBuilder.
Returns | |
---|---|
Type | Description |
InstancesClient | The created InstancesClient. |
CreateAsync(CancellationToken)
public static Task<InstancesClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))
Asynchronously creates a InstancesClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use InstancesClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
Task<InstancesClient> | The task representing the created InstancesClient. |
DebugInstance(DebugInstanceRequest, CallSettings)
public virtual Operation<Instance, OperationMetadataV1> DebugInstance(DebugInstanceRequest request, CallSettings callSettings = null)
Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.
Only applicable for instances in App Engine flexible environment.
Parameters | |
---|---|
Name | Description |
request | DebugInstanceRequest 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 |
Operation<Instance, OperationMetadataV1> | The RPC response. |
// Create client
InstancesClient instancesClient = InstancesClient.Create();
// Initialize request argument(s)
DebugInstanceRequest request = new DebugInstanceRequest { Name = "", SshKey = "", };
// Make the request
Operation<Instance, OperationMetadataV1> response = instancesClient.DebugInstance(request);
// Poll until the returned long-running operation is complete
Operation<Instance, OperationMetadataV1> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Instance 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<Instance, OperationMetadataV1> retrievedResponse = instancesClient.PollOnceDebugInstance(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Instance retrievedResult = retrievedResponse.Result;
}
DebugInstanceAsync(DebugInstanceRequest, CallSettings)
public virtual Task<Operation<Instance, OperationMetadataV1>> DebugInstanceAsync(DebugInstanceRequest request, CallSettings callSettings = null)
Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.
Only applicable for instances in App Engine flexible environment.
Parameters | |
---|---|
Name | Description |
request | DebugInstanceRequest 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 |
Task<Operation<Instance, OperationMetadataV1>> | A Task containing the RPC response. |
// Create client
InstancesClient instancesClient = await InstancesClient.CreateAsync();
// Initialize request argument(s)
DebugInstanceRequest request = new DebugInstanceRequest { Name = "", SshKey = "", };
// Make the request
Operation<Instance, OperationMetadataV1> response = await instancesClient.DebugInstanceAsync(request);
// Poll until the returned long-running operation is complete
Operation<Instance, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Instance 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<Instance, OperationMetadataV1> retrievedResponse = await instancesClient.PollOnceDebugInstanceAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Instance retrievedResult = retrievedResponse.Result;
}
DebugInstanceAsync(DebugInstanceRequest, CancellationToken)
public virtual Task<Operation<Instance, OperationMetadataV1>> DebugInstanceAsync(DebugInstanceRequest request, CancellationToken cancellationToken)
Enables debugging on a VM instance. This allows you to use the SSH command to connect to the virtual machine where the instance lives. While in "debug mode", the instance continues to serve live traffic. You should delete the instance when you are done debugging and then allow the system to take over and determine if another instance should be started.
Only applicable for instances in App Engine flexible environment.
Parameters | |
---|---|
Name | Description |
request | DebugInstanceRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Operation<Instance, OperationMetadataV1>> | A Task containing the RPC response. |
// Create client
InstancesClient instancesClient = await InstancesClient.CreateAsync();
// Initialize request argument(s)
DebugInstanceRequest request = new DebugInstanceRequest { Name = "", SshKey = "", };
// Make the request
Operation<Instance, OperationMetadataV1> response = await instancesClient.DebugInstanceAsync(request);
// Poll until the returned long-running operation is complete
Operation<Instance, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Instance 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<Instance, OperationMetadataV1> retrievedResponse = await instancesClient.PollOnceDebugInstanceAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Instance retrievedResult = retrievedResponse.Result;
}
DeleteInstance(DeleteInstanceRequest, CallSettings)
public virtual Operation<Empty, OperationMetadataV1> DeleteInstance(DeleteInstanceRequest request, CallSettings callSettings = null)
Stops a running instance.
The instance might be automatically recreated based on the scaling settings of the version. For more information, see "How Instances are Managed" (standard environment | flexible environment).
To ensure that instances are not re-created and avoid getting billed, you
can stop all instances within the target version by changing the serving
status of the version to STOPPED
with the
apps.services.versions.patch
method.
Parameters | |
---|---|
Name | Description |
request | DeleteInstanceRequest 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 |
Operation<Empty, OperationMetadataV1> | The RPC response. |
// Create client
InstancesClient instancesClient = InstancesClient.Create();
// Initialize request argument(s)
DeleteInstanceRequest request = new DeleteInstanceRequest { Name = "", };
// Make the request
Operation<Empty, OperationMetadataV1> response = instancesClient.DeleteInstance(request);
// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadataV1> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Empty 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<Empty, OperationMetadataV1> retrievedResponse = instancesClient.PollOnceDeleteInstance(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
DeleteInstanceAsync(DeleteInstanceRequest, CallSettings)
public virtual Task<Operation<Empty, OperationMetadataV1>> DeleteInstanceAsync(DeleteInstanceRequest request, CallSettings callSettings = null)
Stops a running instance.
The instance might be automatically recreated based on the scaling settings of the version. For more information, see "How Instances are Managed" (standard environment | flexible environment).
To ensure that instances are not re-created and avoid getting billed, you
can stop all instances within the target version by changing the serving
status of the version to STOPPED
with the
apps.services.versions.patch
method.
Parameters | |
---|---|
Name | Description |
request | DeleteInstanceRequest 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 |
Task<Operation<Empty, OperationMetadataV1>> | A Task containing the RPC response. |
// Create client
InstancesClient instancesClient = await InstancesClient.CreateAsync();
// Initialize request argument(s)
DeleteInstanceRequest request = new DeleteInstanceRequest { Name = "", };
// Make the request
Operation<Empty, OperationMetadataV1> response = await instancesClient.DeleteInstanceAsync(request);
// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty 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<Empty, OperationMetadataV1> retrievedResponse = await instancesClient.PollOnceDeleteInstanceAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
DeleteInstanceAsync(DeleteInstanceRequest, CancellationToken)
public virtual Task<Operation<Empty, OperationMetadataV1>> DeleteInstanceAsync(DeleteInstanceRequest request, CancellationToken cancellationToken)
Stops a running instance.
The instance might be automatically recreated based on the scaling settings of the version. For more information, see "How Instances are Managed" (standard environment | flexible environment).
To ensure that instances are not re-created and avoid getting billed, you
can stop all instances within the target version by changing the serving
status of the version to STOPPED
with the
apps.services.versions.patch
method.
Parameters | |
---|---|
Name | Description |
request | DeleteInstanceRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Operation<Empty, OperationMetadataV1>> | A Task containing the RPC response. |
// Create client
InstancesClient instancesClient = await InstancesClient.CreateAsync();
// Initialize request argument(s)
DeleteInstanceRequest request = new DeleteInstanceRequest { Name = "", };
// Make the request
Operation<Empty, OperationMetadataV1> response = await instancesClient.DeleteInstanceAsync(request);
// Poll until the returned long-running operation is complete
Operation<Empty, OperationMetadataV1> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Empty 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<Empty, OperationMetadataV1> retrievedResponse = await instancesClient.PollOnceDeleteInstanceAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
Empty retrievedResult = retrievedResponse.Result;
}
GetInstance(GetInstanceRequest, CallSettings)
public virtual Instance GetInstance(GetInstanceRequest request, CallSettings callSettings = null)
Gets instance information.
Parameters | |
---|---|
Name | Description |
request | GetInstanceRequest 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 |
Instance | The RPC response. |
// Create client
InstancesClient instancesClient = InstancesClient.Create();
// Initialize request argument(s)
GetInstanceRequest request = new GetInstanceRequest { Name = "", };
// Make the request
Instance response = instancesClient.GetInstance(request);
GetInstanceAsync(GetInstanceRequest, CallSettings)
public virtual Task<Instance> GetInstanceAsync(GetInstanceRequest request, CallSettings callSettings = null)
Gets instance information.
Parameters | |
---|---|
Name | Description |
request | GetInstanceRequest 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 |
Task<Instance> | A Task containing the RPC response. |
// Create client
InstancesClient instancesClient = await InstancesClient.CreateAsync();
// Initialize request argument(s)
GetInstanceRequest request = new GetInstanceRequest { Name = "", };
// Make the request
Instance response = await instancesClient.GetInstanceAsync(request);
GetInstanceAsync(GetInstanceRequest, CancellationToken)
public virtual Task<Instance> GetInstanceAsync(GetInstanceRequest request, CancellationToken cancellationToken)
Gets instance information.
Parameters | |
---|---|
Name | Description |
request | GetInstanceRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
Task<Instance> | A Task containing the RPC response. |
// Create client
InstancesClient instancesClient = await InstancesClient.CreateAsync();
// Initialize request argument(s)
GetInstanceRequest request = new GetInstanceRequest { Name = "", };
// Make the request
Instance response = await instancesClient.GetInstanceAsync(request);
ListInstances(ListInstancesRequest, CallSettings)
public virtual PagedEnumerable<ListInstancesResponse, Instance> ListInstances(ListInstancesRequest request, CallSettings callSettings = null)
Lists the instances of a version.
Tip: To aggregate details about instances over time, see the Stackdriver Monitoring API.
Parameters | |
---|---|
Name | Description |
request | ListInstancesRequest 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 |
PagedEnumerable<ListInstancesResponse, Instance> | A pageable sequence of Instance resources. |
// Create client
InstancesClient instancesClient = InstancesClient.Create();
// Initialize request argument(s)
ListInstancesRequest request = new ListInstancesRequest { Parent = "", };
// Make the request
PagedEnumerable<ListInstancesResponse, Instance> response = instancesClient.ListInstances(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Instance 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 (ListInstancesResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Instance 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<Instance> 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 (Instance 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;
ListInstancesAsync(ListInstancesRequest, CallSettings)
public virtual PagedAsyncEnumerable<ListInstancesResponse, Instance> ListInstancesAsync(ListInstancesRequest request, CallSettings callSettings = null)
Lists the instances of a version.
Tip: To aggregate details about instances over time, see the Stackdriver Monitoring API.
Parameters | |
---|---|
Name | Description |
request | ListInstancesRequest 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 |
PagedAsyncEnumerable<ListInstancesResponse, Instance> | A pageable asynchronous sequence of Instance resources. |
// Create client
InstancesClient instancesClient = await InstancesClient.CreateAsync();
// Initialize request argument(s)
ListInstancesRequest request = new ListInstancesRequest { Parent = "", };
// Make the request
PagedAsyncEnumerable<ListInstancesResponse, Instance> response = instancesClient.ListInstancesAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Instance 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((ListInstancesResponse page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Instance 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<Instance> 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 (Instance 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;
PollOnceDebugInstance(String, CallSettings)
public virtual Operation<Instance, OperationMetadataV1> PollOnceDebugInstance(string operationName, CallSettings callSettings = null)
Poll an operation once, using an operationName
from a previous invocation of DebugInstance
.
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 |
Operation<Instance, OperationMetadataV1> | The result of polling the operation. |
PollOnceDebugInstanceAsync(String, CallSettings)
public virtual Task<Operation<Instance, OperationMetadataV1>> PollOnceDebugInstanceAsync(string operationName, CallSettings callSettings = null)
Asynchronously poll an operation once, using an operationName
from a previous invocation of
DebugInstance
.
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 |
Task<Operation<Instance, OperationMetadataV1>> | A task representing the result of polling the operation. |
PollOnceDeleteInstance(String, CallSettings)
public virtual Operation<Empty, OperationMetadataV1> PollOnceDeleteInstance(string operationName, CallSettings callSettings = null)
Poll an operation once, using an operationName
from a previous invocation of DeleteInstance
.
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 |
Operation<Empty, OperationMetadataV1> | The result of polling the operation. |
PollOnceDeleteInstanceAsync(String, CallSettings)
public virtual Task<Operation<Empty, OperationMetadataV1>> PollOnceDeleteInstanceAsync(string operationName, CallSettings callSettings = null)
Asynchronously poll an operation once, using an operationName
from a previous invocation of
DeleteInstance
.
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 |
Task<Operation<Empty, OperationMetadataV1>> | 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.