public abstract class HostsClientReference documentation and code samples for the Compute Engine v1 API class HostsClient.
Hosts client wrapper, for convenient use.
Derived Types
Namespace
Google.Cloud.Compute.V1Assembly
Google.Cloud.Compute.V1.dll
Remarks
The Hosts API.
Properties
DefaultEndpoint
public static string DefaultEndpoint { get; }The default endpoint for the Hosts 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 Hosts scopes.
| Property Value | |
|---|---|
| Type | Description |
IReadOnlyListstring |
|
The default Hosts scopes are:
GetVersionOperationsClient
public virtual OperationsClient GetVersionOperationsClient { get; }The long-running operations client for GetVersion.
| Property Value | |
|---|---|
| Type | Description |
OperationsClient |
|
GrpcClient
public virtual Hosts.HostsClient GrpcClient { get; }The underlying gRPC Hosts client
| Property Value | |
|---|---|
| Type | Description |
HostsHostsClient |
|
ServiceMetadata
public static ServiceMetadata ServiceMetadata { get; }The service metadata associated with this client type.
| Property Value | |
|---|---|
| Type | Description |
ServiceMetadata |
|
Methods
Create()
public static HostsClient Create()Synchronously creates a HostsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use HostsClientBuilder.
| Returns | |
|---|---|
| Type | Description |
HostsClient |
The created HostsClient. |
CreateAsync(CancellationToken)
public static Task<HostsClient> CreateAsync(CancellationToken cancellationToken = default)Asynchronously creates a HostsClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use HostsClientBuilder.
| Parameter | |
|---|---|
| Name | Description |
cancellationToken |
CancellationTokenThe CancellationToken to use while creating the client. |
| Returns | |
|---|---|
| Type | Description |
TaskHostsClient |
The task representing the created HostsClient. |
Get(GetHostRequest, CallSettings)
public virtual Host Get(GetHostRequest request, CallSettings callSettings = null)Retrieves information about the specified host.
| Parameters | |
|---|---|
| Name | Description |
request |
GetHostRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
Host |
The RPC response. |
// Create client
HostsClient hostsClient = HostsClient.Create();
// Initialize request argument(s)
GetHostRequest request = new GetHostRequest
{
Host = "",
Zone = "",
Project = "",
Association = "",
};
// Make the request
Host response = hostsClient.Get(request);
Get(string, string, string, string, CallSettings)
public virtual Host Get(string project, string zone, string association, string host, CallSettings callSettings = null)Retrieves information about the specified host.
| Parameters | |
|---|---|
| Name | Description |
project |
stringThe project ID for this request. |
zone |
stringThe name of the zone for this request, formatted as RFC1035. |
association |
stringThe parent resource association for the Host. This field specifies the hierarchical context (e.g., reservation, block, sub-block) when accessing the host. For example, reservations/reservation_name, reservations/reservation_name/reservationBlocks/reservation_block_name or reservations/reservation_name/reservationBlocks/reservation_block_name/reservationSubBlocks/reservation_sub_block_name. |
host |
stringThe name of the host, formatted as RFC1035 or a resource ID number. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
Host |
The RPC response. |
// Create client
HostsClient hostsClient = HostsClient.Create();
// Initialize request argument(s)
string project = "";
string zone = "";
string association = "";
string host = "";
// Make the request
Host response = hostsClient.Get(project, zone, association, host);
GetAsync(GetHostRequest, CallSettings)
public virtual Task<Host> GetAsync(GetHostRequest request, CallSettings callSettings = null)Retrieves information about the specified host.
| Parameters | |
|---|---|
| Name | Description |
request |
GetHostRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskHost |
A Task containing the RPC response. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
GetHostRequest request = new GetHostRequest
{
Host = "",
Zone = "",
Project = "",
Association = "",
};
// Make the request
Host response = await hostsClient.GetAsync(request);
GetAsync(GetHostRequest, CancellationToken)
public virtual Task<Host> GetAsync(GetHostRequest request, CancellationToken cancellationToken)Retrieves information about the specified host.
| Parameters | |
|---|---|
| Name | Description |
request |
GetHostRequestThe request object containing all of the parameters for the API call. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskHost |
A Task containing the RPC response. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
GetHostRequest request = new GetHostRequest
{
Host = "",
Zone = "",
Project = "",
Association = "",
};
// Make the request
Host response = await hostsClient.GetAsync(request);
GetAsync(string, string, string, string, CallSettings)
public virtual Task<Host> GetAsync(string project, string zone, string association, string host, CallSettings callSettings = null)Retrieves information about the specified host.
| Parameters | |
|---|---|
| Name | Description |
project |
stringThe project ID for this request. |
zone |
stringThe name of the zone for this request, formatted as RFC1035. |
association |
stringThe parent resource association for the Host. This field specifies the hierarchical context (e.g., reservation, block, sub-block) when accessing the host. For example, reservations/reservation_name, reservations/reservation_name/reservationBlocks/reservation_block_name or reservations/reservation_name/reservationBlocks/reservation_block_name/reservationSubBlocks/reservation_sub_block_name. |
host |
stringThe name of the host, formatted as RFC1035 or a resource ID number. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskHost |
A Task containing the RPC response. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string zone = "";
string association = "";
string host = "";
// Make the request
Host response = await hostsClient.GetAsync(project, zone, association, host);
GetAsync(string, string, string, string, CancellationToken)
public virtual Task<Host> GetAsync(string project, string zone, string association, string host, CancellationToken cancellationToken)Retrieves information about the specified host.
| Parameters | |
|---|---|
| Name | Description |
project |
stringThe project ID for this request. |
zone |
stringThe name of the zone for this request, formatted as RFC1035. |
association |
stringThe parent resource association for the Host. This field specifies the hierarchical context (e.g., reservation, block, sub-block) when accessing the host. For example, reservations/reservation_name, reservations/reservation_name/reservationBlocks/reservation_block_name or reservations/reservation_name/reservationBlocks/reservation_block_name/reservationSubBlocks/reservation_sub_block_name. |
host |
stringThe name of the host, formatted as RFC1035 or a resource ID number. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskHost |
A Task containing the RPC response. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string zone = "";
string association = "";
string host = "";
// Make the request
Host response = await hostsClient.GetAsync(project, zone, association, host);
GetVersion(GetVersionHostRequest, CallSettings)
public virtual Operation<Operation, Operation> GetVersion(GetVersionHostRequest request, CallSettings callSettings = null)Allows customers to get SBOM versions of a host.
| Parameters | |
|---|---|
| Name | Description |
request |
GetVersionHostRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationOperationOperation |
The RPC response. |
// Create client
HostsClient hostsClient = HostsClient.Create();
// Initialize request argument(s)
GetVersionHostRequest request = new GetVersionHostRequest
{
Host = "",
Zone = "",
RequestId = "",
Project = "",
HostsGetVersionRequestResource = new HostsGetVersionRequest(),
Association = "",
};
// Make the request
lro::Operation<Operation, Operation> response = hostsClient.GetVersion(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 = hostsClient.PollOnceGetVersion(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;
}
GetVersion(string, string, string, string, HostsGetVersionRequest, CallSettings)
public virtual Operation<Operation, Operation> GetVersion(string project, string zone, string association, string host, HostsGetVersionRequest hostsGetVersionRequestResource, CallSettings callSettings = null)Allows customers to get SBOM versions of a host.
| Parameters | |
|---|---|
| Name | Description |
project |
stringProject ID for this request. |
zone |
stringName of the zone for this request. Zone name should conform to RFC1035. |
association |
stringThe parent resource association for the Host. This field specifies the hierarchical context (e.g., reservation, block, sub-block) when accessing the host. |
host |
stringThe name of the host, formatted as RFC1035 or a resource ID number. |
hostsGetVersionRequestResource |
HostsGetVersionRequestThe body resource for this request |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationOperationOperation |
The RPC response. |
// Create client
HostsClient hostsClient = HostsClient.Create();
// Initialize request argument(s)
string project = "";
string zone = "";
string association = "";
string host = "";
HostsGetVersionRequest hostsGetVersionRequestResource = new HostsGetVersionRequest();
// Make the request
lro::Operation<Operation, Operation> response = hostsClient.GetVersion(project, zone, association, host, hostsGetVersionRequestResource);
// 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 = hostsClient.PollOnceGetVersion(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;
}
GetVersionAsync(GetVersionHostRequest, CallSettings)
public virtual Task<Operation<Operation, Operation>> GetVersionAsync(GetVersionHostRequest request, CallSettings callSettings = null)Allows customers to get SBOM versions of a host.
| Parameters | |
|---|---|
| Name | Description |
request |
GetVersionHostRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOperationOperation |
A Task containing the RPC response. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
GetVersionHostRequest request = new GetVersionHostRequest
{
Host = "",
Zone = "",
RequestId = "",
Project = "",
HostsGetVersionRequestResource = new HostsGetVersionRequest(),
Association = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await hostsClient.GetVersionAsync(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 hostsClient.PollOnceGetVersionAsync(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;
}
GetVersionAsync(GetVersionHostRequest, CancellationToken)
public virtual Task<Operation<Operation, Operation>> GetVersionAsync(GetVersionHostRequest request, CancellationToken cancellationToken)Allows customers to get SBOM versions of a host.
| Parameters | |
|---|---|
| Name | Description |
request |
GetVersionHostRequestThe request object containing all of the parameters for the API call. |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOperationOperation |
A Task containing the RPC response. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
GetVersionHostRequest request = new GetVersionHostRequest
{
Host = "",
Zone = "",
RequestId = "",
Project = "",
HostsGetVersionRequestResource = new HostsGetVersionRequest(),
Association = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await hostsClient.GetVersionAsync(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 hostsClient.PollOnceGetVersionAsync(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;
}
GetVersionAsync(string, string, string, string, HostsGetVersionRequest, CallSettings)
public virtual Task<Operation<Operation, Operation>> GetVersionAsync(string project, string zone, string association, string host, HostsGetVersionRequest hostsGetVersionRequestResource, CallSettings callSettings = null)Allows customers to get SBOM versions of a host.
| Parameters | |
|---|---|
| Name | Description |
project |
stringProject ID for this request. |
zone |
stringName of the zone for this request. Zone name should conform to RFC1035. |
association |
stringThe parent resource association for the Host. This field specifies the hierarchical context (e.g., reservation, block, sub-block) when accessing the host. |
host |
stringThe name of the host, formatted as RFC1035 or a resource ID number. |
hostsGetVersionRequestResource |
HostsGetVersionRequestThe body resource for this request |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOperationOperation |
A Task containing the RPC response. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string zone = "";
string association = "";
string host = "";
HostsGetVersionRequest hostsGetVersionRequestResource = new HostsGetVersionRequest();
// Make the request
lro::Operation<Operation, Operation> response = await hostsClient.GetVersionAsync(project, zone, association, host, hostsGetVersionRequestResource);
// 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 hostsClient.PollOnceGetVersionAsync(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;
}
GetVersionAsync(string, string, string, string, HostsGetVersionRequest, CancellationToken)
public virtual Task<Operation<Operation, Operation>> GetVersionAsync(string project, string zone, string association, string host, HostsGetVersionRequest hostsGetVersionRequestResource, CancellationToken cancellationToken)Allows customers to get SBOM versions of a host.
| Parameters | |
|---|---|
| Name | Description |
project |
stringProject ID for this request. |
zone |
stringName of the zone for this request. Zone name should conform to RFC1035. |
association |
stringThe parent resource association for the Host. This field specifies the hierarchical context (e.g., reservation, block, sub-block) when accessing the host. |
host |
stringThe name of the host, formatted as RFC1035 or a resource ID number. |
hostsGetVersionRequestResource |
HostsGetVersionRequestThe body resource for this request |
cancellationToken |
CancellationTokenA CancellationToken to use for this RPC. |
| Returns | |
|---|---|
| Type | Description |
TaskOperationOperationOperation |
A Task containing the RPC response. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string zone = "";
string association = "";
string host = "";
HostsGetVersionRequest hostsGetVersionRequestResource = new HostsGetVersionRequest();
// Make the request
lro::Operation<Operation, Operation> response = await hostsClient.GetVersionAsync(project, zone, association, host, hostsGetVersionRequestResource);
// 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 hostsClient.PollOnceGetVersionAsync(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(ListHostsRequest, CallSettings)
public virtual PagedEnumerable<HostsListResponse, Host> List(ListHostsRequest request, CallSettings callSettings = null)Retrieves a list of hosts.
| Parameters | |
|---|---|
| Name | Description |
request |
ListHostsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedEnumerableHostsListResponseHost |
A pageable sequence of Host resources. |
// Create client
HostsClient hostsClient = HostsClient.Create();
// Initialize request argument(s)
ListHostsRequest request = new ListHostsRequest
{
Zone = "",
OrderBy = "",
Project = "",
Filter = "",
Association = "",
ReturnPartialSuccess = false,
};
// Make the request
PagedEnumerable<HostsListResponse, Host> response = hostsClient.List(request);
// Iterate over all response items, lazily performing RPCs as required
foreach (Host 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 (HostsListResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Host 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<Host> 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 (Host 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, string, int?, CallSettings)
public virtual PagedEnumerable<HostsListResponse, Host> List(string project, string zone, string association, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)Retrieves a list of hosts.
| Parameters | |
|---|---|
| Name | Description |
project |
stringThe project ID for this request. |
zone |
stringThe name of the zone for this request, formatted as RFC1035. |
association |
stringThe parent resource association for the Host. This field specifies the hierarchical context (e.g., reservation, block, sub-block) when accessing the host. For example, reservations/reservation_name, reservations/reservation_name/reservationBlocks/reservation_block_name or reservations/reservation_name/reservationBlocks/reservation_block_name/reservationSubBlocks/reservation_sub_block_name. |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedEnumerableHostsListResponseHost |
A pageable sequence of Host resources. |
// Create client
HostsClient hostsClient = HostsClient.Create();
// Initialize request argument(s)
string project = "";
string zone = "";
string association = "";
// Make the request
PagedEnumerable<HostsListResponse, Host> response = hostsClient.List(project, zone, association);
// Iterate over all response items, lazily performing RPCs as required
foreach (Host 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 (HostsListResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Host 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<Host> 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 (Host 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(ListHostsRequest, CallSettings)
public virtual PagedAsyncEnumerable<HostsListResponse, Host> ListAsync(ListHostsRequest request, CallSettings callSettings = null)Retrieves a list of hosts.
| Parameters | |
|---|---|
| Name | Description |
request |
ListHostsRequestThe request object containing all of the parameters for the API call. |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedAsyncEnumerableHostsListResponseHost |
A pageable asynchronous sequence of Host resources. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
ListHostsRequest request = new ListHostsRequest
{
Zone = "",
OrderBy = "",
Project = "",
Filter = "",
Association = "",
ReturnPartialSuccess = false,
};
// Make the request
PagedAsyncEnumerable<HostsListResponse, Host> response = hostsClient.ListAsync(request);
// Iterate over all response items, lazily performing RPCs as required
await foreach (Host item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
await foreach (HostsListResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Host 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<Host> 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 (Host 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, string, int?, CallSettings)
public virtual PagedAsyncEnumerable<HostsListResponse, Host> ListAsync(string project, string zone, string association, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)Retrieves a list of hosts.
| Parameters | |
|---|---|
| Name | Description |
project |
stringThe project ID for this request. |
zone |
stringThe name of the zone for this request, formatted as RFC1035. |
association |
stringThe parent resource association for the Host. This field specifies the hierarchical context (e.g., reservation, block, sub-block) when accessing the host. For example, reservations/reservation_name, reservations/reservation_name/reservationBlocks/reservation_block_name or reservations/reservation_name/reservationBlocks/reservation_block_name/reservationSubBlocks/reservation_sub_block_name. |
pageToken |
stringThe token returned from the previous request. A value of |
pageSize |
intThe size of page to request. The response will not be larger than this, but may be smaller. A value of
|
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
PagedAsyncEnumerableHostsListResponseHost |
A pageable asynchronous sequence of Host resources. |
// Create client
HostsClient hostsClient = await HostsClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string zone = "";
string association = "";
// Make the request
PagedAsyncEnumerable<HostsListResponse, Host> response = hostsClient.ListAsync(project, zone, association);
// Iterate over all response items, lazily performing RPCs as required
await foreach (Host item in response)
{
// Do something with each item
Console.WriteLine(item);
}
// Or iterate over pages (of server-defined size), performing one RPC per page
await foreach (HostsListResponse page in response.AsRawResponses())
{
// Do something with each page of items
Console.WriteLine("A page of results:");
foreach (Host 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<Host> 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 (Host 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;
PollOnceGetVersion(string, CallSettings)
public virtual Operation<Operation, Operation> PollOnceGetVersion(string operationName, CallSettings callSettings = null)Poll an operation once, using an operationName from a previous invocation of GetVersion.
| Parameters | |
|---|---|
| Name | Description |
operationName |
stringThe name of a previously invoked operation. Must not be |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
OperationOperationOperation |
The result of polling the operation. |
PollOnceGetVersionAsync(string, CallSettings)
public virtual Task<Operation<Operation, Operation>> PollOnceGetVersionAsync(string operationName, CallSettings callSettings = null)Asynchronously poll an operation once, using an operationName from a previous invocation of
GetVersion.
| Parameters | |
|---|---|
| Name | Description |
operationName |
stringThe name of a previously invoked operation. Must not be |
callSettings |
CallSettingsIf not null, applies overrides to this RPC call. |
| Returns | |
|---|---|
| Type | Description |
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. |
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.