Compute Engine v1 API - Class RegionInstancesClient (2.17.0)

public abstract class RegionInstancesClient

Reference documentation and code samples for the Compute Engine v1 API class RegionInstancesClient.

RegionInstances client wrapper, for convenient use.

Inheritance

object > RegionInstancesClient

Namespace

Google.Cloud.Compute.V1

Assembly

Google.Cloud.Compute.V1.dll

Remarks

The RegionInstances API.

Properties

BulkInsertOperationsClient

public virtual OperationsClient BulkInsertOperationsClient { get; }

The long-running operations client for BulkInsert.

Property Value
Type Description
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default RegionInstances scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual RegionInstances.RegionInstancesClient GrpcClient { get; }

The underlying gRPC RegionInstances client

Property Value
Type Description
RegionInstancesRegionInstancesClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

BulkInsert(BulkInsertRegionInstanceRequest, CallSettings)

public virtual Operation<Operation, Operation> BulkInsert(BulkInsertRegionInstanceRequest request, CallSettings callSettings = null)

Creates multiple instances in a given region. Count specifies the number of instances to create.

Parameters
Name Description
request BulkInsertRegionInstanceRequest

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
OperationOperationOperation

The RPC response.

Example
// Create client
RegionInstancesClient regionInstancesClient = RegionInstancesClient.Create();
// Initialize request argument(s)
BulkInsertRegionInstanceRequest request = new BulkInsertRegionInstanceRequest
{
    RequestId = "",
    BulkInsertInstanceResourceResource = new BulkInsertInstanceResource(),
    Region = "",
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = regionInstancesClient.BulkInsert(request);

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

BulkInsert(string, string, BulkInsertInstanceResource, CallSettings)

public virtual Operation<Operation, Operation> BulkInsert(string project, string region, BulkInsertInstanceResource bulkInsertInstanceResourceResource, CallSettings callSettings = null)

Creates multiple instances in a given region. Count specifies the number of instances to create.

Parameters
Name Description
project string

Project ID for this request.

region string

The name of the region for this request.

bulkInsertInstanceResourceResource BulkInsertInstanceResource

The body resource for this request

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationOperationOperation

The RPC response.

Example
// Create client
RegionInstancesClient regionInstancesClient = RegionInstancesClient.Create();
// Initialize request argument(s)
string project = "";
string region = "";
BulkInsertInstanceResource bulkInsertInstanceResourceResource = new BulkInsertInstanceResource();
// Make the request
lro::Operation<Operation, Operation> response = regionInstancesClient.BulkInsert(project, region, bulkInsertInstanceResourceResource);

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

BulkInsertAsync(BulkInsertRegionInstanceRequest, CallSettings)

public virtual Task<Operation<Operation, Operation>> BulkInsertAsync(BulkInsertRegionInstanceRequest request, CallSettings callSettings = null)

Creates multiple instances in a given region. Count specifies the number of instances to create.

Parameters
Name Description
request BulkInsertRegionInstanceRequest

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
TaskOperationOperationOperation

A Task containing the RPC response.

Example
// Create client
RegionInstancesClient regionInstancesClient = await RegionInstancesClient.CreateAsync();
// Initialize request argument(s)
BulkInsertRegionInstanceRequest request = new BulkInsertRegionInstanceRequest
{
    RequestId = "",
    BulkInsertInstanceResourceResource = new BulkInsertInstanceResource(),
    Region = "",
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await regionInstancesClient.BulkInsertAsync(request);

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

BulkInsertAsync(BulkInsertRegionInstanceRequest, CancellationToken)

public virtual Task<Operation<Operation, Operation>> BulkInsertAsync(BulkInsertRegionInstanceRequest request, CancellationToken cancellationToken)

Creates multiple instances in a given region. Count specifies the number of instances to create.

Parameters
Name Description
request BulkInsertRegionInstanceRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationOperationOperation

A Task containing the RPC response.

Example
// Create client
RegionInstancesClient regionInstancesClient = await RegionInstancesClient.CreateAsync();
// Initialize request argument(s)
BulkInsertRegionInstanceRequest request = new BulkInsertRegionInstanceRequest
{
    RequestId = "",
    BulkInsertInstanceResourceResource = new BulkInsertInstanceResource(),
    Region = "",
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await regionInstancesClient.BulkInsertAsync(request);

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

BulkInsertAsync(string, string, BulkInsertInstanceResource, CallSettings)

public virtual Task<Operation<Operation, Operation>> BulkInsertAsync(string project, string region, BulkInsertInstanceResource bulkInsertInstanceResourceResource, CallSettings callSettings = null)

Creates multiple instances in a given region. Count specifies the number of instances to create.

Parameters
Name Description
project string

Project ID for this request.

region string

The name of the region for this request.

bulkInsertInstanceResourceResource BulkInsertInstanceResource

The body resource for this request

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationOperationOperation

A Task containing the RPC response.

Example
// Create client
RegionInstancesClient regionInstancesClient = await RegionInstancesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
BulkInsertInstanceResource bulkInsertInstanceResourceResource = new BulkInsertInstanceResource();
// Make the request
lro::Operation<Operation, Operation> response = await regionInstancesClient.BulkInsertAsync(project, region, bulkInsertInstanceResourceResource);

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

BulkInsertAsync(string, string, BulkInsertInstanceResource, CancellationToken)

public virtual Task<Operation<Operation, Operation>> BulkInsertAsync(string project, string region, BulkInsertInstanceResource bulkInsertInstanceResourceResource, CancellationToken cancellationToken)

Creates multiple instances in a given region. Count specifies the number of instances to create.

Parameters
Name Description
project string

Project ID for this request.

region string

The name of the region for this request.

bulkInsertInstanceResourceResource BulkInsertInstanceResource

The body resource for this request

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationOperationOperation

A Task containing the RPC response.

Example
// Create client
RegionInstancesClient regionInstancesClient = await RegionInstancesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
BulkInsertInstanceResource bulkInsertInstanceResourceResource = new BulkInsertInstanceResource();
// Make the request
lro::Operation<Operation, Operation> response = await regionInstancesClient.BulkInsertAsync(project, region, bulkInsertInstanceResourceResource);

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

Create()

public static RegionInstancesClient Create()

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

Returns
Type Description
RegionInstancesClient

The created RegionInstancesClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskRegionInstancesClient

The task representing the created RegionInstancesClient.

PollOnceBulkInsert(string, CallSettings)

public virtual Operation<Operation, Operation> PollOnceBulkInsert(string operationName, CallSettings callSettings = null)

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationOperationOperation

The result of polling the operation.

PollOnceBulkInsertAsync(string, CallSettings)

public virtual Task<Operation<Operation, Operation>> PollOnceBulkInsertAsync(string operationName, CallSettings callSettings = null)

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

Parameters
Name Description
operationName string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationOperationOperation

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.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.