Compute Engine v1 API - Class RegionCommitmentsClient (3.2.0)

public abstract class RegionCommitmentsClient

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

RegionCommitments client wrapper, for convenient use.

Inheritance

object > RegionCommitmentsClient

Namespace

Google.Cloud.Compute.V1

Assembly

Google.Cloud.Compute.V1.dll

Remarks

The RegionCommitments API.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the RegionCommitments 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 RegionCommitments scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual RegionCommitments.RegionCommitmentsClient GrpcClient { get; }

The underlying gRPC RegionCommitments client

Property Value
Type Description
RegionCommitmentsRegionCommitmentsClient

InsertOperationsClient

public virtual OperationsClient InsertOperationsClient { get; }

The long-running operations client for Insert.

Property Value
Type Description
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

UpdateOperationsClient

public virtual OperationsClient UpdateOperationsClient { get; }

The long-running operations client for Update.

Property Value
Type Description
OperationsClient

Methods

AggregatedList(AggregatedListRegionCommitmentsRequest, CallSettings)

public virtual PagedEnumerable<CommitmentAggregatedList, KeyValuePair<string, CommitmentsScopedList>> AggregatedList(AggregatedListRegionCommitmentsRequest request, CallSettings callSettings = null)

Retrieves an aggregated list of commitments by region. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Parameters
Name Description
request AggregatedListRegionCommitmentsRequest

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
PagedEnumerableCommitmentAggregatedListKeyValuePairstringCommitmentsScopedList

A pageable sequence of KeyValuePair<TKey, TValue> resources.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
AggregatedListRegionCommitmentsRequest request = new AggregatedListRegionCommitmentsRequest
{
    OrderBy = "",
    Project = "",
    ServiceProjectNumber = 0L,
    Filter = "",
    IncludeAllScopes = false,
    ReturnPartialSuccess = false,
};
// Make the request
PagedEnumerable<CommitmentAggregatedList, KeyValuePair<string, CommitmentsScopedList>> response = regionCommitmentsClient.AggregatedList(request);

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

AggregatedList(string, string, int?, CallSettings)

public virtual PagedEnumerable<CommitmentAggregatedList, KeyValuePair<string, CommitmentsScopedList>> AggregatedList(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieves an aggregated list of commitments by region. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Parameters
Name Description
project string

Project ID for this request.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableCommitmentAggregatedListKeyValuePairstringCommitmentsScopedList

A pageable sequence of KeyValuePair<TKey, TValue> resources.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
string project = "";
// Make the request
PagedEnumerable<CommitmentAggregatedList, KeyValuePair<string, CommitmentsScopedList>> response = regionCommitmentsClient.AggregatedList(project);

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

AggregatedListAsync(AggregatedListRegionCommitmentsRequest, CallSettings)

public virtual PagedAsyncEnumerable<CommitmentAggregatedList, KeyValuePair<string, CommitmentsScopedList>> AggregatedListAsync(AggregatedListRegionCommitmentsRequest request, CallSettings callSettings = null)

Retrieves an aggregated list of commitments by region. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Parameters
Name Description
request AggregatedListRegionCommitmentsRequest

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
PagedAsyncEnumerableCommitmentAggregatedListKeyValuePairstringCommitmentsScopedList

A pageable asynchronous sequence of KeyValuePair<TKey, TValue> resources.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
AggregatedListRegionCommitmentsRequest request = new AggregatedListRegionCommitmentsRequest
{
    OrderBy = "",
    Project = "",
    ServiceProjectNumber = 0L,
    Filter = "",
    IncludeAllScopes = false,
    ReturnPartialSuccess = false,
};
// Make the request
PagedAsyncEnumerable<CommitmentAggregatedList, KeyValuePair<string, CommitmentsScopedList>> response = regionCommitmentsClient.AggregatedListAsync(request);

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

AggregatedListAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<CommitmentAggregatedList, KeyValuePair<string, CommitmentsScopedList>> AggregatedListAsync(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieves an aggregated list of commitments by region. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Parameters
Name Description
project string

Project ID for this request.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableCommitmentAggregatedListKeyValuePairstringCommitmentsScopedList

A pageable asynchronous sequence of KeyValuePair<TKey, TValue> resources.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
// Make the request
PagedAsyncEnumerable<CommitmentAggregatedList, KeyValuePair<string, CommitmentsScopedList>> response = regionCommitmentsClient.AggregatedListAsync(project);

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

Create()

public static RegionCommitmentsClient Create()

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

Returns
Type Description
RegionCommitmentsClient

The created RegionCommitmentsClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskRegionCommitmentsClient

The task representing the created RegionCommitmentsClient.

Get(GetRegionCommitmentRequest, CallSettings)

public virtual Commitment Get(GetRegionCommitmentRequest request, CallSettings callSettings = null)

Returns the specified commitment resource.

Parameters
Name Description
request GetRegionCommitmentRequest

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
Commitment

The RPC response.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
GetRegionCommitmentRequest request = new GetRegionCommitmentRequest
{
    Region = "",
    Project = "",
    Commitment = "",
};
// Make the request
Commitment response = regionCommitmentsClient.Get(request);

Get(string, string, string, CallSettings)

public virtual Commitment Get(string project, string region, string commitment, CallSettings callSettings = null)

Returns the specified commitment resource.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

commitment string

Name of the commitment to return.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Commitment

The RPC response.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
string project = "";
string region = "";
string commitment = "";
// Make the request
Commitment response = regionCommitmentsClient.Get(project, region, commitment);

GetAsync(GetRegionCommitmentRequest, CallSettings)

public virtual Task<Commitment> GetAsync(GetRegionCommitmentRequest request, CallSettings callSettings = null)

Returns the specified commitment resource.

Parameters
Name Description
request GetRegionCommitmentRequest

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
TaskCommitment

A Task containing the RPC response.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
GetRegionCommitmentRequest request = new GetRegionCommitmentRequest
{
    Region = "",
    Project = "",
    Commitment = "",
};
// Make the request
Commitment response = await regionCommitmentsClient.GetAsync(request);

GetAsync(GetRegionCommitmentRequest, CancellationToken)

public virtual Task<Commitment> GetAsync(GetRegionCommitmentRequest request, CancellationToken cancellationToken)

Returns the specified commitment resource.

Parameters
Name Description
request GetRegionCommitmentRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCommitment

A Task containing the RPC response.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
GetRegionCommitmentRequest request = new GetRegionCommitmentRequest
{
    Region = "",
    Project = "",
    Commitment = "",
};
// Make the request
Commitment response = await regionCommitmentsClient.GetAsync(request);

GetAsync(string, string, string, CallSettings)

public virtual Task<Commitment> GetAsync(string project, string region, string commitment, CallSettings callSettings = null)

Returns the specified commitment resource.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

commitment string

Name of the commitment to return.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCommitment

A Task containing the RPC response.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
string commitment = "";
// Make the request
Commitment response = await regionCommitmentsClient.GetAsync(project, region, commitment);

GetAsync(string, string, string, CancellationToken)

public virtual Task<Commitment> GetAsync(string project, string region, string commitment, CancellationToken cancellationToken)

Returns the specified commitment resource.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

commitment string

Name of the commitment to return.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCommitment

A Task containing the RPC response.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
string commitment = "";
// Make the request
Commitment response = await regionCommitmentsClient.GetAsync(project, region, commitment);

Insert(InsertRegionCommitmentRequest, CallSettings)

public virtual Operation<Operation, Operation> Insert(InsertRegionCommitmentRequest request, CallSettings callSettings = null)

Creates a commitment in the specified project using the data included in the request.

Parameters
Name Description
request InsertRegionCommitmentRequest

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
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
InsertRegionCommitmentRequest request = new InsertRegionCommitmentRequest
{
    RequestId = "",
    Region = "",
    Project = "",
    CommitmentResource = new Commitment(),
};
// Make the request
lro::Operation<Operation, Operation> response = regionCommitmentsClient.Insert(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 = regionCommitmentsClient.PollOnceInsert(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;
}

Insert(string, string, Commitment, CallSettings)

public virtual Operation<Operation, Operation> Insert(string project, string region, Commitment commitmentResource, CallSettings callSettings = null)

Creates a commitment in the specified project using the data included in the request.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

commitmentResource Commitment

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
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
string project = "";
string region = "";
Commitment commitmentResource = new Commitment();
// Make the request
lro::Operation<Operation, Operation> response = regionCommitmentsClient.Insert(project, region, commitmentResource);

// 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 = regionCommitmentsClient.PollOnceInsert(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;
}

InsertAsync(InsertRegionCommitmentRequest, CallSettings)

public virtual Task<Operation<Operation, Operation>> InsertAsync(InsertRegionCommitmentRequest request, CallSettings callSettings = null)

Creates a commitment in the specified project using the data included in the request.

Parameters
Name Description
request InsertRegionCommitmentRequest

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
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
InsertRegionCommitmentRequest request = new InsertRegionCommitmentRequest
{
    RequestId = "",
    Region = "",
    Project = "",
    CommitmentResource = new Commitment(),
};
// Make the request
lro::Operation<Operation, Operation> response = await regionCommitmentsClient.InsertAsync(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 regionCommitmentsClient.PollOnceInsertAsync(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;
}

InsertAsync(InsertRegionCommitmentRequest, CancellationToken)

public virtual Task<Operation<Operation, Operation>> InsertAsync(InsertRegionCommitmentRequest request, CancellationToken cancellationToken)

Creates a commitment in the specified project using the data included in the request.

Parameters
Name Description
request InsertRegionCommitmentRequest

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
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
InsertRegionCommitmentRequest request = new InsertRegionCommitmentRequest
{
    RequestId = "",
    Region = "",
    Project = "",
    CommitmentResource = new Commitment(),
};
// Make the request
lro::Operation<Operation, Operation> response = await regionCommitmentsClient.InsertAsync(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 regionCommitmentsClient.PollOnceInsertAsync(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;
}

InsertAsync(string, string, Commitment, CallSettings)

public virtual Task<Operation<Operation, Operation>> InsertAsync(string project, string region, Commitment commitmentResource, CallSettings callSettings = null)

Creates a commitment in the specified project using the data included in the request.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

commitmentResource Commitment

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
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
Commitment commitmentResource = new Commitment();
// Make the request
lro::Operation<Operation, Operation> response = await regionCommitmentsClient.InsertAsync(project, region, commitmentResource);

// 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 regionCommitmentsClient.PollOnceInsertAsync(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;
}

InsertAsync(string, string, Commitment, CancellationToken)

public virtual Task<Operation<Operation, Operation>> InsertAsync(string project, string region, Commitment commitmentResource, CancellationToken cancellationToken)

Creates a commitment in the specified project using the data included in the request.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

commitmentResource Commitment

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
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
Commitment commitmentResource = new Commitment();
// Make the request
lro::Operation<Operation, Operation> response = await regionCommitmentsClient.InsertAsync(project, region, commitmentResource);

// 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 regionCommitmentsClient.PollOnceInsertAsync(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;
}

List(ListRegionCommitmentsRequest, CallSettings)

public virtual PagedEnumerable<CommitmentList, Commitment> List(ListRegionCommitmentsRequest request, CallSettings callSettings = null)

Retrieves a list of commitments contained within the specified region.

Parameters
Name Description
request ListRegionCommitmentsRequest

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
PagedEnumerableCommitmentListCommitment

A pageable sequence of Commitment resources.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
ListRegionCommitmentsRequest request = new ListRegionCommitmentsRequest
{
    Region = "",
    OrderBy = "",
    Project = "",
    Filter = "",
    ReturnPartialSuccess = false,
};
// Make the request
PagedEnumerable<CommitmentList, Commitment> response = regionCommitmentsClient.List(request);

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

List(string, string, string, int?, CallSettings)

public virtual PagedEnumerable<CommitmentList, Commitment> List(string project, string region, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieves a list of commitments contained within the specified region.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableCommitmentListCommitment

A pageable sequence of Commitment resources.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
string project = "";
string region = "";
// Make the request
PagedEnumerable<CommitmentList, Commitment> response = regionCommitmentsClient.List(project, region);

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

ListAsync(ListRegionCommitmentsRequest, CallSettings)

public virtual PagedAsyncEnumerable<CommitmentList, Commitment> ListAsync(ListRegionCommitmentsRequest request, CallSettings callSettings = null)

Retrieves a list of commitments contained within the specified region.

Parameters
Name Description
request ListRegionCommitmentsRequest

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
PagedAsyncEnumerableCommitmentListCommitment

A pageable asynchronous sequence of Commitment resources.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
ListRegionCommitmentsRequest request = new ListRegionCommitmentsRequest
{
    Region = "",
    OrderBy = "",
    Project = "",
    Filter = "",
    ReturnPartialSuccess = false,
};
// Make the request
PagedAsyncEnumerable<CommitmentList, Commitment> response = regionCommitmentsClient.ListAsync(request);

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

ListAsync(string, string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<CommitmentList, Commitment> ListAsync(string project, string region, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieves a list of commitments contained within the specified region.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableCommitmentListCommitment

A pageable asynchronous sequence of Commitment resources.

Example
// Create client
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
// Make the request
PagedAsyncEnumerable<CommitmentList, Commitment> response = regionCommitmentsClient.ListAsync(project, region);

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

PollOnceInsert(string, CallSettings)

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

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

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.

PollOnceInsertAsync(string, CallSettings)

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

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

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.

PollOnceUpdate(string, CallSettings)

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

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

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.

PollOnceUpdateAsync(string, CallSettings)

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

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

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.

Update(UpdateRegionCommitmentRequest, CallSettings)

public virtual Operation<Operation, Operation> Update(UpdateRegionCommitmentRequest request, CallSettings callSettings = null)

Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: auto_renew.

Parameters
Name Description
request UpdateRegionCommitmentRequest

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
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
UpdateRegionCommitmentRequest request = new UpdateRegionCommitmentRequest
{
    RequestId = "",
    Paths = "",
    Region = "",
    Project = "",
    CommitmentResource = new Commitment(),
    Commitment = "",
    UpdateMask = "",
};
// Make the request
lro::Operation<Operation, Operation> response = regionCommitmentsClient.Update(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 = regionCommitmentsClient.PollOnceUpdate(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;
}

Update(string, string, string, Commitment, CallSettings)

public virtual Operation<Operation, Operation> Update(string project, string region, string commitment, Commitment commitmentResource, CallSettings callSettings = null)

Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: auto_renew.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

commitment string

Name of the commitment for which auto renew is being updated.

commitmentResource Commitment

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
RegionCommitmentsClient regionCommitmentsClient = RegionCommitmentsClient.Create();
// Initialize request argument(s)
string project = "";
string region = "";
string commitment = "";
Commitment commitmentResource = new Commitment();
// Make the request
lro::Operation<Operation, Operation> response = regionCommitmentsClient.Update(project, region, commitment, commitmentResource);

// 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 = regionCommitmentsClient.PollOnceUpdate(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;
}

UpdateAsync(UpdateRegionCommitmentRequest, CallSettings)

public virtual Task<Operation<Operation, Operation>> UpdateAsync(UpdateRegionCommitmentRequest request, CallSettings callSettings = null)

Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: auto_renew.

Parameters
Name Description
request UpdateRegionCommitmentRequest

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
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
UpdateRegionCommitmentRequest request = new UpdateRegionCommitmentRequest
{
    RequestId = "",
    Paths = "",
    Region = "",
    Project = "",
    CommitmentResource = new Commitment(),
    Commitment = "",
    UpdateMask = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await regionCommitmentsClient.UpdateAsync(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 regionCommitmentsClient.PollOnceUpdateAsync(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;
}

UpdateAsync(UpdateRegionCommitmentRequest, CancellationToken)

public virtual Task<Operation<Operation, Operation>> UpdateAsync(UpdateRegionCommitmentRequest request, CancellationToken cancellationToken)

Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: auto_renew.

Parameters
Name Description
request UpdateRegionCommitmentRequest

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
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
UpdateRegionCommitmentRequest request = new UpdateRegionCommitmentRequest
{
    RequestId = "",
    Paths = "",
    Region = "",
    Project = "",
    CommitmentResource = new Commitment(),
    Commitment = "",
    UpdateMask = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await regionCommitmentsClient.UpdateAsync(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 regionCommitmentsClient.PollOnceUpdateAsync(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;
}

UpdateAsync(string, string, string, Commitment, CallSettings)

public virtual Task<Operation<Operation, Operation>> UpdateAsync(string project, string region, string commitment, Commitment commitmentResource, CallSettings callSettings = null)

Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: auto_renew.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

commitment string

Name of the commitment for which auto renew is being updated.

commitmentResource Commitment

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
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
string commitment = "";
Commitment commitmentResource = new Commitment();
// Make the request
lro::Operation<Operation, Operation> response = await regionCommitmentsClient.UpdateAsync(project, region, commitment, commitmentResource);

// 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 regionCommitmentsClient.PollOnceUpdateAsync(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;
}

UpdateAsync(string, string, string, Commitment, CancellationToken)

public virtual Task<Operation<Operation, Operation>> UpdateAsync(string project, string region, string commitment, Commitment commitmentResource, CancellationToken cancellationToken)

Updates the specified commitment with the data included in the request. Update is performed only on selected fields included as part of update-mask. Only the following fields can be modified: auto_renew.

Parameters
Name Description
project string

Project ID for this request.

region string

Name of the region for this request.

commitment string

Name of the commitment for which auto renew is being updated.

commitmentResource Commitment

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
RegionCommitmentsClient regionCommitmentsClient = await RegionCommitmentsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
string commitment = "";
Commitment commitmentResource = new Commitment();
// Make the request
lro::Operation<Operation, Operation> response = await regionCommitmentsClient.UpdateAsync(project, region, commitment, commitmentResource);

// 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 regionCommitmentsClient.PollOnceUpdateAsync(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;
}