Service Directory v1 API - Class LookupServiceClient (2.4.0)

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 > LookupServiceClient

Derived Types

Namespace

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
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default LookupService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default LookupService scopes are:

GrpcClient

public virtual LookupService.LookupServiceClient GrpcClient { get; }

The underlying gRPC LookupService client

Property Value
Type Description
LookupServiceLookupServiceClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static LookupServiceClient Create()

Synchronously creates a LookupServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use LookupServiceClientBuilder.

Returns
Type Description
LookupServiceClient

The created LookupServiceClient.

CreateAsync(CancellationToken)

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

Asynchronously creates a LookupServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use LookupServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskLookupServiceClient

The task representing the created 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 ResolveServiceRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
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 ResolveServiceRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskResolveServiceResponse

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 ResolveServiceRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskResolveServiceResponse

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() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.