Class LookupServiceClient (1.3.0)

public abstract 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
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default LookupService scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

The default LookupService scopes are:

GrpcClient

public virtual LookupService.LookupServiceClient GrpcClient { get; }

The underlying gRPC LookupService client

Property Value
TypeDescription
LookupService.LookupServiceClient

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

The created LookupServiceClient.

CreateAsync(CancellationToken)

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

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

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<LookupServiceClient>

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
NameDescription
requestResolveServiceRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
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
NameDescription
requestResolveServiceRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<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
NameDescription
requestResolveServiceRequest

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

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

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

Returns
TypeDescription
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.