Compute Engine v1 API - Class RoutesClient (3.2.0)

public abstract class RoutesClient

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

Routes client wrapper, for convenient use.

Inheritance

object > RoutesClient

Derived Types

Namespace

Google.Cloud.Compute.V1

Assembly

Google.Cloud.Compute.V1.dll

Remarks

The Routes API.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
IReadOnlyListstring
Remarks

DeleteOperationsClient

public virtual OperationsClient DeleteOperationsClient { get; }

The long-running operations client for Delete.

Property Value
Type Description
OperationsClient

GrpcClient

public virtual Routes.RoutesClient GrpcClient { get; }

The underlying gRPC Routes client

Property Value
Type Description
RoutesRoutesClient

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

Methods

Create()

public static RoutesClient Create()

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

Returns
Type Description
RoutesClient

The created RoutesClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskRoutesClient

The task representing the created RoutesClient.

Delete(DeleteRouteRequest, CallSettings)

public virtual Operation<Operation, Operation> Delete(DeleteRouteRequest request, CallSettings callSettings = null)

Deletes the specified Route resource.

Parameters
Name Description
request DeleteRouteRequest

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
RoutesClient routesClient = RoutesClient.Create();
// Initialize request argument(s)
DeleteRouteRequest request = new DeleteRouteRequest
{
    RequestId = "",
    Route = "",
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = routesClient.Delete(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 = routesClient.PollOnceDelete(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;
}

Delete(string, string, CallSettings)

public virtual Operation<Operation, Operation> Delete(string project, string route, CallSettings callSettings = null)

Deletes the specified Route resource.

Parameters
Name Description
project string

Project ID for this request.

route string

Name of the Route resource to delete.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationOperationOperation

The RPC response.

Example
// Create client
RoutesClient routesClient = RoutesClient.Create();
// Initialize request argument(s)
string project = "";
string route = "";
// Make the request
lro::Operation<Operation, Operation> response = routesClient.Delete(project, route);

// 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 = routesClient.PollOnceDelete(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;
}

DeleteAsync(DeleteRouteRequest, CallSettings)

public virtual Task<Operation<Operation, Operation>> DeleteAsync(DeleteRouteRequest request, CallSettings callSettings = null)

Deletes the specified Route resource.

Parameters
Name Description
request DeleteRouteRequest

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
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
DeleteRouteRequest request = new DeleteRouteRequest
{
    RequestId = "",
    Route = "",
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await routesClient.DeleteAsync(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 routesClient.PollOnceDeleteAsync(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;
}

DeleteAsync(DeleteRouteRequest, CancellationToken)

public virtual Task<Operation<Operation, Operation>> DeleteAsync(DeleteRouteRequest request, CancellationToken cancellationToken)

Deletes the specified Route resource.

Parameters
Name Description
request DeleteRouteRequest

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
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
DeleteRouteRequest request = new DeleteRouteRequest
{
    RequestId = "",
    Route = "",
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await routesClient.DeleteAsync(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 routesClient.PollOnceDeleteAsync(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;
}

DeleteAsync(string, string, CallSettings)

public virtual Task<Operation<Operation, Operation>> DeleteAsync(string project, string route, CallSettings callSettings = null)

Deletes the specified Route resource.

Parameters
Name Description
project string

Project ID for this request.

route string

Name of the Route resource to delete.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationOperationOperation

A Task containing the RPC response.

Example
// Create client
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string route = "";
// Make the request
lro::Operation<Operation, Operation> response = await routesClient.DeleteAsync(project, route);

// 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 routesClient.PollOnceDeleteAsync(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;
}

DeleteAsync(string, string, CancellationToken)

public virtual Task<Operation<Operation, Operation>> DeleteAsync(string project, string route, CancellationToken cancellationToken)

Deletes the specified Route resource.

Parameters
Name Description
project string

Project ID for this request.

route string

Name of the Route resource to delete.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationOperationOperation

A Task containing the RPC response.

Example
// Create client
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string route = "";
// Make the request
lro::Operation<Operation, Operation> response = await routesClient.DeleteAsync(project, route);

// 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 routesClient.PollOnceDeleteAsync(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;
}

Get(GetRouteRequest, CallSettings)

public virtual Route Get(GetRouteRequest request, CallSettings callSettings = null)

Returns the specified Route resource.

Parameters
Name Description
request GetRouteRequest

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
Route

The RPC response.

Example
// Create client
RoutesClient routesClient = RoutesClient.Create();
// Initialize request argument(s)
GetRouteRequest request = new GetRouteRequest
{
    Route = "",
    Project = "",
};
// Make the request
Route response = routesClient.Get(request);

Get(string, string, CallSettings)

public virtual Route Get(string project, string route, CallSettings callSettings = null)

Returns the specified Route resource.

Parameters
Name Description
project string

Project ID for this request.

route string

Name of the Route resource to return.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Route

The RPC response.

Example
// Create client
RoutesClient routesClient = RoutesClient.Create();
// Initialize request argument(s)
string project = "";
string route = "";
// Make the request
Route response = routesClient.Get(project, route);

GetAsync(GetRouteRequest, CallSettings)

public virtual Task<Route> GetAsync(GetRouteRequest request, CallSettings callSettings = null)

Returns the specified Route resource.

Parameters
Name Description
request GetRouteRequest

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
TaskRoute

A Task containing the RPC response.

Example
// Create client
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
GetRouteRequest request = new GetRouteRequest
{
    Route = "",
    Project = "",
};
// Make the request
Route response = await routesClient.GetAsync(request);

GetAsync(GetRouteRequest, CancellationToken)

public virtual Task<Route> GetAsync(GetRouteRequest request, CancellationToken cancellationToken)

Returns the specified Route resource.

Parameters
Name Description
request GetRouteRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskRoute

A Task containing the RPC response.

Example
// Create client
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
GetRouteRequest request = new GetRouteRequest
{
    Route = "",
    Project = "",
};
// Make the request
Route response = await routesClient.GetAsync(request);

GetAsync(string, string, CallSettings)

public virtual Task<Route> GetAsync(string project, string route, CallSettings callSettings = null)

Returns the specified Route resource.

Parameters
Name Description
project string

Project ID for this request.

route string

Name of the Route resource to return.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskRoute

A Task containing the RPC response.

Example
// Create client
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string route = "";
// Make the request
Route response = await routesClient.GetAsync(project, route);

GetAsync(string, string, CancellationToken)

public virtual Task<Route> GetAsync(string project, string route, CancellationToken cancellationToken)

Returns the specified Route resource.

Parameters
Name Description
project string

Project ID for this request.

route string

Name of the Route resource to return.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskRoute

A Task containing the RPC response.

Example
// Create client
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
string route = "";
// Make the request
Route response = await routesClient.GetAsync(project, route);

Insert(InsertRouteRequest, CallSettings)

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

Creates a Route resource in the specified project using the data included in the request.

Parameters
Name Description
request InsertRouteRequest

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
RoutesClient routesClient = RoutesClient.Create();
// Initialize request argument(s)
InsertRouteRequest request = new InsertRouteRequest
{
    RequestId = "",
    RouteResource = new Route(),
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = routesClient.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 = routesClient.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, Route, CallSettings)

public virtual Operation<Operation, Operation> Insert(string project, Route routeResource, CallSettings callSettings = null)

Creates a Route resource in the specified project using the data included in the request.

Parameters
Name Description
project string

Project ID for this request.

routeResource Route

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
RoutesClient routesClient = RoutesClient.Create();
// Initialize request argument(s)
string project = "";
Route routeResource = new Route();
// Make the request
lro::Operation<Operation, Operation> response = routesClient.Insert(project, routeResource);

// 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 = routesClient.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(InsertRouteRequest, CallSettings)

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

Creates a Route resource in the specified project using the data included in the request.

Parameters
Name Description
request InsertRouteRequest

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
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
InsertRouteRequest request = new InsertRouteRequest
{
    RequestId = "",
    RouteResource = new Route(),
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await routesClient.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 routesClient.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(InsertRouteRequest, CancellationToken)

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

Creates a Route resource in the specified project using the data included in the request.

Parameters
Name Description
request InsertRouteRequest

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
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
InsertRouteRequest request = new InsertRouteRequest
{
    RequestId = "",
    RouteResource = new Route(),
    Project = "",
};
// Make the request
lro::Operation<Operation, Operation> response = await routesClient.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 routesClient.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, Route, CallSettings)

public virtual Task<Operation<Operation, Operation>> InsertAsync(string project, Route routeResource, CallSettings callSettings = null)

Creates a Route resource in the specified project using the data included in the request.

Parameters
Name Description
project string

Project ID for this request.

routeResource Route

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
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
Route routeResource = new Route();
// Make the request
lro::Operation<Operation, Operation> response = await routesClient.InsertAsync(project, routeResource);

// 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 routesClient.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, Route, CancellationToken)

public virtual Task<Operation<Operation, Operation>> InsertAsync(string project, Route routeResource, CancellationToken cancellationToken)

Creates a Route resource in the specified project using the data included in the request.

Parameters
Name Description
project string

Project ID for this request.

routeResource Route

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
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
Route routeResource = new Route();
// Make the request
lro::Operation<Operation, Operation> response = await routesClient.InsertAsync(project, routeResource);

// 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 routesClient.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(ListRoutesRequest, CallSettings)

public virtual PagedEnumerable<RouteList, Route> List(ListRoutesRequest request, CallSettings callSettings = null)

Retrieves the list of Route resources available to the specified project.

Parameters
Name Description
request ListRoutesRequest

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
PagedEnumerableRouteListRoute

A pageable sequence of Route resources.

Example
// Create client
RoutesClient routesClient = RoutesClient.Create();
// Initialize request argument(s)
ListRoutesRequest request = new ListRoutesRequest
{
    OrderBy = "",
    Project = "",
    Filter = "",
    ReturnPartialSuccess = false,
};
// Make the request
PagedEnumerable<RouteList, Route> response = routesClient.List(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Route 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 (RouteList page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Route 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<Route> 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 (Route 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<RouteList, Route> List(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieves the list of Route resources available to the specified project.

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
PagedEnumerableRouteListRoute

A pageable sequence of Route resources.

Example
// Create client
RoutesClient routesClient = RoutesClient.Create();
// Initialize request argument(s)
string project = "";
// Make the request
PagedEnumerable<RouteList, Route> response = routesClient.List(project);

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

public virtual PagedAsyncEnumerable<RouteList, Route> ListAsync(ListRoutesRequest request, CallSettings callSettings = null)

Retrieves the list of Route resources available to the specified project.

Parameters
Name Description
request ListRoutesRequest

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
PagedAsyncEnumerableRouteListRoute

A pageable asynchronous sequence of Route resources.

Example
// Create client
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
ListRoutesRequest request = new ListRoutesRequest
{
    OrderBy = "",
    Project = "",
    Filter = "",
    ReturnPartialSuccess = false,
};
// Make the request
PagedAsyncEnumerable<RouteList, Route> response = routesClient.ListAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Route 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((RouteList page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Route 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<Route> 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 (Route 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<RouteList, Route> ListAsync(string project, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Retrieves the list of Route resources available to the specified project.

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
PagedAsyncEnumerableRouteListRoute

A pageable asynchronous sequence of Route resources.

Example
// Create client
RoutesClient routesClient = await RoutesClient.CreateAsync();
// Initialize request argument(s)
string project = "";
// Make the request
PagedAsyncEnumerable<RouteList, Route> response = routesClient.ListAsync(project);

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

PollOnceDelete(string, CallSettings)

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

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

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.

PollOnceDeleteAsync(string, CallSettings)

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

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

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.

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.

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.