public abstract class RegionsClient
Reference documentation and code samples for the Compute Engine v1 API class RegionsClient.
Regions client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Compute.V1Assembly
Google.Cloud.Compute.V1.dll
Remarks
The Regions API.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }
The default endpoint for the Regions 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 Regions scopes.
Property Value | |
---|---|
Type | Description |
IReadOnlyListstring |
The default Regions scopes are:
GrpcClient
public virtual Regions.RegionsClient GrpcClient { get; }
The underlying gRPC Regions client
Property Value | |
---|---|
Type | Description |
RegionsRegionsClient |
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }
The service metadata associated with this client type.
Property Value | |
---|---|
Type | Description |
ServiceMetadata |
Methods
Create()
public static RegionsClient Create()
Synchronously creates a RegionsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use RegionsClientBuilder.
Returns | |
---|---|
Type | Description |
RegionsClient | The created RegionsClient. |
CreateAsync(CancellationToken)
public static Task<RegionsClient> CreateAsync(CancellationToken cancellationToken = default)
Asynchronously creates a RegionsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use RegionsClientBuilder.
Parameter | |
---|---|
Name | Description |
cancellationToken | CancellationToken The CancellationToken to use while creating the client. |
Returns | |
---|---|
Type | Description |
TaskRegionsClient | The task representing the created RegionsClient. |
Get(GetRegionRequest, CallSettings)
public virtual Region Get(GetRegionRequest request, CallSettings callSettings = null)
Returns the specified Region resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
request | GetRegionRequest 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 |
Region | The RPC response. |
// Create client
RegionsClient regionsClient = RegionsClient.Create();
// Initialize request argument(s)
GetRegionRequest request = new GetRegionRequest
{
Region = "",
Project = "",
};
// Make the request
Region response = regionsClient.Get(request);
Get(string, string, CallSettings)
public virtual Region Get(string project, string region, CallSettings callSettings = null)
Returns the specified Region resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
project | string Project ID for this request. |
region | string Name of the region resource to return. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
Region | The RPC response. |
// Create client
RegionsClient regionsClient = RegionsClient.Create();
// Initialize request argument(s)
string project = "";
string region = "";
// Make the request
Region response = regionsClient.Get(project, region);
GetAsync(GetRegionRequest, CallSettings)
public virtual Task<Region> GetAsync(GetRegionRequest request, CallSettings callSettings = null)
Returns the specified Region resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
request | GetRegionRequest 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 |
TaskRegion | A Task containing the RPC response. |
// Create client
RegionsClient regionsClient = await RegionsClient.CreateAsync();
// Initialize request argument(s)
GetRegionRequest request = new GetRegionRequest
{
Region = "",
Project = "",
};
// Make the request
Region response = await regionsClient.GetAsync(request);
GetAsync(GetRegionRequest, CancellationToken)
public virtual Task<Region> GetAsync(GetRegionRequest request, CancellationToken cancellationToken)
Returns the specified Region resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
request | GetRegionRequest The request object containing all of the parameters for the API call. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskRegion | A Task containing the RPC response. |
// Create client
RegionsClient regionsClient = await RegionsClient.CreateAsync();
// Initialize request argument(s)
GetRegionRequest request = new GetRegionRequest
{
Region = "",
Project = "",
};
// Make the request
Region response = await regionsClient.GetAsync(request);
GetAsync(string, string, CallSettings)
public virtual Task<Region> GetAsync(string project, string region, CallSettings callSettings = null)
Returns the specified Region resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
project | string Project ID for this request. |
region | string Name of the region resource to return. |
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
TaskRegion | A Task containing the RPC response. |
// Create client
RegionsClient regionsClient = await RegionsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
// Make the request
Region response = await regionsClient.GetAsync(project, region);
GetAsync(string, string, CancellationToken)
public virtual Task<Region> GetAsync(string project, string region, CancellationToken cancellationToken)
Returns the specified Region resource. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
project | string Project ID for this request. |
region | string Name of the region resource to return. |
cancellationToken | CancellationToken A CancellationToken to use for this RPC. |
Returns | |
---|---|
Type | Description |
TaskRegion | A Task containing the RPC response. |
// Create client
RegionsClient regionsClient = await RegionsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string region = "";
// Make the request
Region response = await regionsClient.GetAsync(project, region);
List(ListRegionsRequest, CallSettings)
public virtual PagedEnumerable<RegionList, Region> List(ListRegionsRequest request, CallSettings callSettings = null)
Retrieves the list of region resources available to the specified project. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the items.quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
request | ListRegionsRequest 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 |
PagedEnumerableRegionListRegion | A pageable sequence of Region resources. |
// Create client
RegionsClient regionsClient = RegionsClient.Create();
// Initialize request argument(s)
ListRegionsRequest request = new ListRegionsRequest
{
OrderBy = "",
Project = "",
Filter = "",
ReturnPartialSuccess = false,
};
// Make the request
PagedEnumerable<RegionList, Region> response = regionsClient.List(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Region 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 (RegionList page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Region 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<Region> 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 (Region 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, int?, CallSettings)
public virtual PagedEnumerable<RegionList, Region> List(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves the list of region resources available to the specified project. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the items.quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
project | string Project ID for this request. |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedEnumerableRegionListRegion | A pageable sequence of Region resources. |
// Create client
RegionsClient regionsClient = RegionsClient.Create();
// Initialize request argument(s)
string project = "";
// Make the request
PagedEnumerable<RegionList, Region> response = regionsClient.List(project);
// Iterate over all response items, lazily performing RPCs as required
foreach (Region 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 (RegionList page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Region 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<Region> 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 (Region 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(ListRegionsRequest, CallSettings)
public virtual PagedAsyncEnumerable<RegionList, Region> ListAsync(ListRegionsRequest request, CallSettings callSettings = null)
Retrieves the list of region resources available to the specified project. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the items.quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
request | ListRegionsRequest 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 |
PagedAsyncEnumerableRegionListRegion | A pageable asynchronous sequence of Region resources. |
// Create client
RegionsClient regionsClient = await RegionsClient.CreateAsync();
// Initialize request argument(s)
ListRegionsRequest request = new ListRegionsRequest
{
OrderBy = "",
Project = "",
Filter = "",
ReturnPartialSuccess = false,
};
// Make the request
PagedAsyncEnumerable<RegionList, Region> response = regionsClient.ListAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Region 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((RegionList page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Region 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<Region> 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 (Region 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, int?, CallSettings)
public virtual PagedAsyncEnumerable<RegionList, Region> ListAsync(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)
Retrieves the list of region resources available to the specified project. To decrease latency for this method, you can optionally omit any unneeded information from the response by using a field mask. This practice is especially recommended for unused quota information (the items.quotas
field). To exclude one or more fields, set your request's fields
query parameter to only include the fields you need. For example, to only include the id
and selfLink
fields, add the query parameter ?fields=id,selfLink
to your request.
Parameters | |
---|---|
Name | Description |
project | string Project ID for this request. |
pageToken | string The token returned from the previous request. A value of |
pageSize | int The size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings | CallSettings If not null, applies overrides to this RPC call. |
Returns | |
---|---|
Type | Description |
PagedAsyncEnumerableRegionListRegion | A pageable asynchronous sequence of Region resources. |
// Create client
RegionsClient regionsClient = await RegionsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
// Make the request
PagedAsyncEnumerable<RegionList, Region> response = regionsClient.ListAsync(project);
// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Region 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((RegionList page) =>
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Region 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<Region> 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 (Region 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;
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.