# Service Directory V1 API - Class Google::Cloud::ServiceDirectory::V1::LookupService::Client (v1.7.0)

1.7.0 (latest) 1.6.1 1.5.0 1.4.1 1.3.0 1.2.1 1.1.0 1.0.1 0.11.0 0.10.2 0.9.0 0.8.1 0.7.1 0.6.0 0.5.0 0.4.0 0.3.6 Reference documentation and code samples for the Service Directory V1 API class Google::Cloud::ServiceDirectory::V1::LookupService::Client.

Client for the LookupService service.


<br />

Service Directory API for looking up service data at runtime.

## Inherits

- Object

## Includes

- [Google::Cloud::ServiceDirectory::V1::LookupService::Paths](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Paths)

## Methods

### .configure

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

Configure the LookupService Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Client-Configuration "Google::Cloud::ServiceDirectory::V1::LookupService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Client-Configuration))
**Example**

```ruby
# 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Client#Google__Cloud__ServiceDirectory__V1__LookupService__Client_configure_class_ "Google::Cloud::ServiceDirectory::V1::LookupService::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Client-Configuration "Google::Cloud::ServiceDirectory::V1::LookupService::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Client-Configuration))

### #initialize

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

Create a new LookupService client object.
**Yields**

- (config) --- Configure the LookupService client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-LookupService-Client)) --- a new instance of Client
**Example**

```ruby
# 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
```

### #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)

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-Service "Google::Cloud::ServiceDirectory::V1::Service (class)") 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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-ResolveServiceRequest "Google::Cloud::ServiceDirectory::V1::ResolveServiceRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::ServiceDirectory::V1::ResolveServiceRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/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:
  `<field> <operator> <value> (<logical connector>)`
  - `<field>` can be `name`, `address`, `port`, or `annotations.<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:
  - `annotations.owner` returns endpoints that have a annotation with the key `owner`, this is the same as `annotations:owner`
  - `annotations.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`
  - `annotations.owner!=sd AND annotations.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](https://aip.dev/160).
**Yields**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-ResolveServiceResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_directory-v1/latest/Google-Cloud-ServiceDirectory-V1-ResolveServiceResponse))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
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
```

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)