Service Directory V1 API - Class Google::Cloud::ServiceDirectory::V1::LookupService::Client (v0.6.0)

Reference documentation and code samples for the Service Directory V1 API class Google::Cloud::ServiceDirectory::V1::LookupService::Client.

Client for the LookupService service.

Service Directory API for looking up service data at runtime.

Inherits

  • Object

Methods

.configure

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

Configure the LookupService 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 LookupService clients
::Google::Cloud::ServiceDirectory::V1::LookupService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the LookupService 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

#initialize

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

Create a new LookupService client object.

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

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

#resolve_service

def resolve_service(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse
def resolve_service(name: nil, max_endpoints: nil, endpoint_filter: nil) -> ::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse

Returns a service and its associated endpoints. Resolving a service is not considered an active developer method.

Overloads
def resolve_service(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse
Pass arguments to resolve_service via a request object, either of type ResolveServiceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1::ResolveServiceRequest, ::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 resolve_service(name: nil, max_endpoints: nil, endpoint_filter: nil) -> ::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse
Pass arguments to resolve_service 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) — Required. The name of the service to resolve.
  • max_endpoints (::Integer) — Optional. The maximum number of endpoints to return. Defaults to 25. Maximum is 100. If a value less than one is specified, the Default is used. If a value greater than the Maximum is specified, the Maximum is used.
  • endpoint_filter (::String) —

    Optional. The filter applied to the endpoints of the resolved service.

    General filter string syntax:

    Examples of valid filters:

    • "metadata.owner" returns Endpoints that have a label with the key "owner", this is the same as "metadata:owner"
    • "metadata.protocol=gRPC" returns Endpoints that have key/value "protocol=gRPC"
    • "metadata.owner!=sd AND metadata.foo=bar" returns Endpoints that have "owner" field in metadata with a value that is not "sd" AND have the key/value foo=bar.
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/service_directory/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceDirectory::V1::LookupService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceDirectory::V1::ResolveServiceRequest.new

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

# The returned object is of type Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse.
p result