# Service Directory v1 API - Class LookupServiceClient (2.7.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.7.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [2.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/2.6.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [2.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/2.5.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [2.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/2.4.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [2.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/2.3.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [2.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/2.2.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/2.1.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [2.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/2.0.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [1.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/1.4.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [1.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/1.3.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [1.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/1.2.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [1.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/1.1.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)
- [1.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/1.0.0/Google.Cloud.ServiceDirectory.V1.LookupServiceClient)

    public abstract class LookupServiceClient

Reference documentation and code samples for the Service Directory v1 API class LookupServiceClient.

LookupService client wrapper, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> LookupServiceClient

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Derived Types

[LookupServiceClientImpl](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClientImpl)

## Namespace

[Google.Cloud.ServiceDirectory.V1](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1)

## Assembly

Google.Cloud.ServiceDirectory.V1.dll

## Remarks

Service Directory API for looking up service data at runtime.

## Properties

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

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

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default LookupService scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** The default LookupService scopes are:

- <https://www.googleapis.com/auth/cloud-platform>

<br />

### GrpcClient

    public virtual LookupService.LookupServiceClient GrpcClient { get; }

The underlying gRPC LookupService client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServicehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupService.LookupServiceClient` |   |

### LocationsClient

    public virtual LocationsClient LocationsClient { get; }

The [LocationsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Location/latest/Google.Cloud.Location.LocationsClient.html) associated with this client.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Location/latest/Google.Cloud.Location.LocationsClient.html` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceMetadata.html` |   |

## Methods

### Create()

    public static LookupServiceClient Create()

Synchronously creates a [LookupServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [LookupServiceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClientBuilder).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient` | The created [LookupServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient). |

### CreateAsync(CancellationToken)

    public static Task<LookupServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a [LookupServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient) using the default credentials, endpoint and
settings. To specify custom credentials or other settings, use [LookupServiceClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClientBuilder).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient` | The task representing the created [LookupServiceClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient). |

### ResolveService(ResolveServiceRequest, CallSettings)

    public virtual ResolveServiceResponse ResolveService(ResolveServiceRequest request, CallSettings callSettings = null)

Returns a \[service\]\[google.cloud.servicedirectory.v1.Service\] and its
associated endpoints.
Resolving a service is not considered an active developer method.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.ResolveServiceRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.ResolveServiceResponse` | The RPC response. |

**Example**

    // Create client
    LookupServiceClient lookupServiceClient = LookupServiceClient.Create();
    // Initialize request argument(s)
    ResolveServiceRequest request = new ResolveServiceRequest
    {
        ServiceName = ServiceName.FromProjectLocationNamespaceService("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"),
        MaxEndpoints = 0,
        EndpointFilter = "",
    };
    // Make the request
    ResolveServiceResponse response = lookupServiceClient.ResolveService(request);

### ResolveServiceAsync(ResolveServiceRequest, CallSettings)

    public virtual Task<ResolveServiceResponse> ResolveServiceAsync(ResolveServiceRequest request, CallSettings callSettings = null)

Returns a \[service\]\[google.cloud.servicedirectory.v1.Service\] and its
associated endpoints.
Resolving a service is not considered an active developer method.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.ResolveServiceRequest` The request object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.ResolveServiceResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    LookupServiceClient lookupServiceClient = await LookupServiceClient.CreateAsync();
    // Initialize request argument(s)
    ResolveServiceRequest request = new ResolveServiceRequest
    {
        ServiceName = ServiceName.FromProjectLocationNamespaceService("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"),
        MaxEndpoints = 0,
        EndpointFilter = "",
    };
    // Make the request
    ResolveServiceResponse response = await lookupServiceClient.ResolveServiceAsync(request);

### ResolveServiceAsync(ResolveServiceRequest, CancellationToken)

    public virtual Task<ResolveServiceResponse> ResolveServiceAsync(ResolveServiceRequest request, CancellationToken cancellationToken)

Returns a \[service\]\[google.cloud.servicedirectory.v1.Service\] and its
associated endpoints.
Resolving a service is not considered an active developer method.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.ResolveServiceRequest` The request object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.ResolveServiceResponse` | A Task containing the RPC response. |

**Example**

    // Create client
    LookupServiceClient lookupServiceClient = await LookupServiceClient.CreateAsync();
    // Initialize request argument(s)
    ResolveServiceRequest request = new ResolveServiceRequest
    {
        ServiceName = ServiceName.FromProjectLocationNamespaceService("[PROJECT]", "[LOCATION]", "[NAMESPACE]", "[SERVICE]"),
        MaxEndpoints = 0,
        EndpointFilter = "",
    };
    // Make the request
    ResolveServiceResponse response = await lookupServiceClient.ResolveServiceAsync(request);

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient#Google_Cloud_ServiceDirectory_V1_LookupServiceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient#Google_Cloud_ServiceDirectory_V1_LookupServiceClient_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not
affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient#Google_Cloud_ServiceDirectory_V1_LookupServiceClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceDirectory.V1/latest/Google.Cloud.ServiceDirectory.V1.LookupServiceClient#Google_Cloud_ServiceDirectory_V1_LookupServiceClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.