Locations API - Class Google::Cloud::Location::Locations::Client (v0.3.0)

Reference documentation and code samples for the Locations API class Google::Cloud::Location::Locations::Client.

Client for the Locations service.

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

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the Locations Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Locations clients
::Google::Cloud::Location::Locations::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the Locations Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#get_location

def get_location(request, options = nil) -> ::Google::Cloud::Location::Location
def get_location(name: nil) -> ::Google::Cloud::Location::Location

Gets information about a location.

Overloads
def get_location(request, options = nil) -> ::Google::Cloud::Location::Location
Pass arguments to get_location via a request object, either of type GetLocationRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Location::GetLocationRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_location(name: nil) -> ::Google::Cloud::Location::Location
Pass arguments to get_location via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Resource name for the location.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/location"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Location::Locations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Location::GetLocationRequest.new

# Call the get_location method.
result = client.get_location request

# The returned object is of type Google::Cloud::Location::Location.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new Locations client object.

Yields
  • (config) — Configure the Locations client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Location::Locations::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Location::Locations::Client.new do |config|
  config.timeout = 10.0
end

#list_locations

def list_locations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Location::Location>
def list_locations(name: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Location::Location>

Lists information about the supported locations for this service.

Overloads
def list_locations(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Location::Location>
Pass arguments to list_locations via a request object, either of type Google::Cloud::Location::ListLocationsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Location::ListLocationsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_locations(name: nil, filter: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Location::Location>
Pass arguments to list_locations via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — The resource that owns the locations collection, if applicable.
  • filter (::String) — The standard list filter.
  • page_size (::Integer) — The standard list page size.
  • page_token (::String) — The standard list page token.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/location"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Location::Locations::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Location::ListLocationsRequest.new

# Call the list_locations method.
result = client.list_locations request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::Location::Location.
  p response
end