Service Directory V1beta1 API - Class Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client (v0.15.2)

Reference documentation and code samples for the Service Directory V1beta1 API class Google::Cloud::ServiceDirectory::V1beta1::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::V1beta1::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::V1beta1::LookupService::Client.new

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

#location_client

def location_client() -> Google::Cloud::Location::Locations::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Client)

#resolve_service

def resolve_service(request, options = nil) -> ::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse
def resolve_service(name: nil, max_endpoints: nil, endpoint_filter: nil) -> ::Google::Cloud::ServiceDirectory::V1beta1::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::V1beta1::ResolveServiceResponse
Pass arguments to resolve_service via a request object, either of type ResolveServiceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceDirectory::V1beta1::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::V1beta1::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: <field> <operator> <value> (<logical connector>)

    • <field> can be name, address, port, or metadata.<key> for map field
    • <operator> can be <, >, <=, >=, !=, =, :. Of which : means HAS, and is roughly the same as =
    • <value> must be the same data type as field
    • <logical connector> can be AND, OR, NOT

    Examples of valid filters:

    • metadata.owner returns endpoints that have a annotation with the key owner, this is the same as metadata:owner
    • metadata.protocol=gRPC returns endpoints that have key/value protocol=gRPC
    • address=192.108.1.105 returns endpoints that have this address
    • port>8080 returns endpoints that have port number larger than 8080 * name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c returns endpoints that have name that is alphabetically later than the string, so "endpoint-e" is returned but "endpoint-a" is not * name=projects/my-project/locations/us-central1/namespaces/my-namespace/services/my-service/endpoints/ep-1 returns the endpoint that has an endpoint_id equal to ep-1
    • metadata.owner!=sd AND metadata.foo=bar returns endpoints that have owner in annotation key but value is not sd AND have key/value foo=bar
    • doesnotexist.foo=bar returns an empty list. Note that endpoint doesn't have a field called "doesnotexist". Since the filter does not match any endpoint, it returns no results

    For more information about filtering, see API Filtering.

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/v1beta1"

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

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

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

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

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)