Class LocationsClient (1.0.0)

public abstract class LocationsClient : object

Locations client wrapper, for convenient use.

Inheritance

Object > LocationsClient

Derived Types

Namespace

Google.Cloud.Location

Assembly

Google.Cloud.Location.dll

Remarks

An abstract interface that provides location-related information for a service. Service-specific metadata is provided through the [Location.metadata][google.cloud.location.Location.metadata] field.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
String

DefaultScopes

public static System.Collections.Generic.IReadOnlyList<string> DefaultScopes { get; }

The default Locations scopes.

Property Value
TypeDescription
System.Collections.Generic.IReadOnlyList<String>
Remarks

The default Locations scopes are:

GrpcClient

public virtual Locations.LocationsClient GrpcClient { get; }

The underlying gRPC Locations client

Property Value
TypeDescription
Locations.LocationsClient

Methods

Create()

public static LocationsClient Create()

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

Returns
TypeDescription
LocationsClient

The created LocationsClient.

CreateAsync(System.Threading.CancellationToken)

public static System.Threading.Tasks.Task<LocationsClient> CreateAsync(System.Threading.CancellationToken cancellationToken = null)

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

Parameter
NameDescription
cancellationTokenSystem.Threading.CancellationToken

The to use while creating the client.

Returns
TypeDescription
System.Threading.Tasks.Task<LocationsClient>

The task representing the created LocationsClient.

GetLocation(GetLocationRequest, Api.Gax.Grpc.CallSettings)

public virtual Location GetLocation(GetLocationRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

Gets information about a location.

Parameters
NameDescription
requestGetLocationRequest

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

callSettingsApi.Gax.Grpc.CallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Location

The RPC response.

Example
// Create client
LocationsClient locationsClient = LocationsClient.Create();
// Initialize request argument(s)
GetLocationRequest request = new GetLocationRequest { Name = "", };
// Make the request
Location response = locationsClient.GetLocation(request);

GetLocationAsync(GetLocationRequest, Api.Gax.Grpc.CallSettings)

public virtual System.Threading.Tasks.Task<Location> GetLocationAsync(GetLocationRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

Gets information about a location.

Parameters
NameDescription
requestGetLocationRequest

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

callSettingsApi.Gax.Grpc.CallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
System.Threading.Tasks.Task<Location>

A Task containing the RPC response.

Example
// Create client
LocationsClient locationsClient = await LocationsClient.CreateAsync();
// Initialize request argument(s)
GetLocationRequest request = new GetLocationRequest { Name = "", };
// Make the request
Location response = await locationsClient.GetLocationAsync(request);

GetLocationAsync(GetLocationRequest, System.Threading.CancellationToken)

public virtual System.Threading.Tasks.Task<Location> GetLocationAsync(GetLocationRequest request, System.Threading.CancellationToken cancellationToken)

Gets information about a location.

Parameters
NameDescription
requestGetLocationRequest

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

cancellationTokenSystem.Threading.CancellationToken

A to use for this RPC.

Returns
TypeDescription
System.Threading.Tasks.Task<Location>

A Task containing the RPC response.

Example
// Create client
LocationsClient locationsClient = await LocationsClient.CreateAsync();
// Initialize request argument(s)
GetLocationRequest request = new GetLocationRequest { Name = "", };
// Make the request
Location response = await locationsClient.GetLocationAsync(request);

ListLocations(ListLocationsRequest, Api.Gax.Grpc.CallSettings)

public virtual Api.Gax.PagedEnumerable<ListLocationsResponse, Location> ListLocations(ListLocationsRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

Lists information about the supported locations for this service.

Parameters
NameDescription
requestListLocationsRequest

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

callSettingsApi.Gax.Grpc.CallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Api.Gax.PagedEnumerable<ListLocationsResponse, Location>

A pageable sequence of Location resources.

Example
// Create client
LocationsClient locationsClient = LocationsClient.Create();
// Initialize request argument(s)
ListLocationsRequest request = new ListLocationsRequest { Name = "", Filter = "", };
// Make the request
PagedEnumerable<ListLocationsResponse, Location> response = locationsClient.ListLocations(request);

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

ListLocationsAsync(ListLocationsRequest, Api.Gax.Grpc.CallSettings)

public virtual Api.Gax.PagedAsyncEnumerable<ListLocationsResponse, Location> ListLocationsAsync(ListLocationsRequest request, Api.Gax.Grpc.CallSettings callSettings = null)

Lists information about the supported locations for this service.

Parameters
NameDescription
requestListLocationsRequest

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

callSettingsApi.Gax.Grpc.CallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Api.Gax.PagedAsyncEnumerable<ListLocationsResponse, Location>

A pageable asynchronous sequence of Location resources.

Example
// Create client
LocationsClient locationsClient = await LocationsClient.CreateAsync();
// Initialize request argument(s)
ListLocationsRequest request = new ListLocationsRequest { Name = "", Filter = "", };
// Make the request
PagedAsyncEnumerable<ListLocationsResponse, Location> response = locationsClient.ListLocationsAsync(request);

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

Shuts down any channels automatically created by Create() and CreateAsync(System.Threading.CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
System.Threading.Tasks.Task

A task representing the asynchronous shutdown operation.

Remarks

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