Service Directory API for looking up service data at runtime. v1
Package
@google-cloud/service-directoryConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);Construct an instance of LookupServiceClient.
| Parameters | |
|---|---|
| Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;descriptors
descriptors: Descriptors;innerApiCalls
innerApiCalls: {
[name: string]: Function;
};locationsClient
locationsClient: LocationsClient;lookupServiceStub
lookupServiceStub?: Promise<{
[name: string]: Function;
}>;pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};port
static get port(): number;The port for this API service.
scopes
static get scopes(): string[];The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;The DNS address for this API service.
universeDomain
get universeDomain(): string;warn
warn: (code: string, message: string, warnType?: string) => void;Methods
close()
close(): Promise<void>;Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
| Returns | |
|---|---|
| Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
endpointPath(project, location, namespace, service, endpoint)
endpointPath(project: string, location: string, namespace: string, service: string, endpoint: string): string;Return a fully-qualified endpoint resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
namespace |
string
|
service |
string
|
endpoint |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
getLocation(request, options, callback)
getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;Gets information about a location.
| Parameters | |
|---|---|
| Name | Description |
request |
LocationProtos.google.cloud.location.IGetLocationRequest
The request object that will be sent. |
options |
CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Call options. See CallOptions for more details. |
callback |
Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
Promise<google.cloud.location.ILocation> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
const [response] = await client.getLocation(request);
getProjectId()
getProjectId(): Promise<string>;| Returns | |
|---|---|
| Type | Description |
Promise<string> |
|
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;| Parameter | |
|---|---|
| Name | Description |
callback |
Callback<string, undefined, undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
| Returns | |
|---|---|
| Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
listLocationsAsync(request, options)
listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;Lists information about the supported locations for this service. Returns an iterable object.
for-await-of syntax is used with the iterable to get response elements on-demand.
| Parameters | |
|---|---|
| Name | Description |
request |
LocationProtos.google.cloud.location.IListLocationsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
AsyncIterable<google.cloud.location.ILocation> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
// process response
}
matchEndpointFromEndpointName(endpointName)
matchEndpointFromEndpointName(endpointName: string): string | number;Parse the endpoint from Endpoint resource.
| Parameter | |
|---|---|
| Name | Description |
endpointName |
string
A fully-qualified path representing Endpoint resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the endpoint. |
matchLocationFromEndpointName(endpointName)
matchLocationFromEndpointName(endpointName: string): string | number;Parse the location from Endpoint resource.
| Parameter | |
|---|---|
| Name | Description |
endpointName |
string
A fully-qualified path representing Endpoint resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromNamespaceName(namespaceName)
matchLocationFromNamespaceName(namespaceName: string): string | number;Parse the location from Namespace resource.
| Parameter | |
|---|---|
| Name | Description |
namespaceName |
string
A fully-qualified path representing Namespace resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromServiceName(serviceName)
matchLocationFromServiceName(serviceName: string): string | number;Parse the location from Service resource.
| Parameter | |
|---|---|
| Name | Description |
serviceName |
string
A fully-qualified path representing Service resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the location. |
matchNamespaceFromEndpointName(endpointName)
matchNamespaceFromEndpointName(endpointName: string): string | number;Parse the namespace from Endpoint resource.
| Parameter | |
|---|---|
| Name | Description |
endpointName |
string
A fully-qualified path representing Endpoint resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the namespace. |
matchNamespaceFromNamespaceName(namespaceName)
matchNamespaceFromNamespaceName(namespaceName: string): string | number;Parse the namespace from Namespace resource.
| Parameter | |
|---|---|
| Name | Description |
namespaceName |
string
A fully-qualified path representing Namespace resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the namespace. |
matchNamespaceFromServiceName(serviceName)
matchNamespaceFromServiceName(serviceName: string): string | number;Parse the namespace from Service resource.
| Parameter | |
|---|---|
| Name | Description |
serviceName |
string
A fully-qualified path representing Service resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the namespace. |
matchProjectFromEndpointName(endpointName)
matchProjectFromEndpointName(endpointName: string): string | number;Parse the project from Endpoint resource.
| Parameter | |
|---|---|
| Name | Description |
endpointName |
string
A fully-qualified path representing Endpoint resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromNamespaceName(namespaceName)
matchProjectFromNamespaceName(namespaceName: string): string | number;Parse the project from Namespace resource.
| Parameter | |
|---|---|
| Name | Description |
namespaceName |
string
A fully-qualified path representing Namespace resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromServiceName(serviceName)
matchProjectFromServiceName(serviceName: string): string | number;Parse the project from Service resource.
| Parameter | |
|---|---|
| Name | Description |
serviceName |
string
A fully-qualified path representing Service resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the project. |
matchServiceFromEndpointName(endpointName)
matchServiceFromEndpointName(endpointName: string): string | number;Parse the service from Endpoint resource.
| Parameter | |
|---|---|
| Name | Description |
endpointName |
string
A fully-qualified path representing Endpoint resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the service. |
matchServiceFromServiceName(serviceName)
matchServiceFromServiceName(serviceName: string): string | number;Parse the service from Service resource.
| Parameter | |
|---|---|
| Name | Description |
serviceName |
string
A fully-qualified path representing Service resource. |
| Returns | |
|---|---|
| Type | Description |
string | number |
{string} A string representing the service. |
namespacePath(project, location, namespace)
namespacePath(project: string, location: string, namespace: string): string;Return a fully-qualified namespace resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
namespace |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |
resolveService(request, options)
resolveService(request?: protos.google.cloud.servicedirectory.v1.IResolveServiceRequest, options?: CallOptions): Promise<[
protos.google.cloud.servicedirectory.v1.IResolveServiceResponse,
(protos.google.cloud.servicedirectory.v1.IResolveServiceRequest | undefined),
{} | undefined
]>;Returns a service and its associated endpoints. Resolving a service is not considered an active developer method.
| Parameters | |
|---|---|
| Name | Description |
request |
IResolveServiceRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
| Returns | |
|---|---|
| Type | Description |
Promise<[
protos.google.cloud.servicedirectory.v1.IResolveServiceResponse,
(protos.google.cloud.servicedirectory.v1.IResolveServiceRequest | undefined),
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ResolveServiceResponse. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The name of the service to resolve.
*/
// const name = 'abc123'
/**
* 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.
*/
// const maxEndpoints = 1234
/**
* Optional. The filter applied to the endpoints of the resolved service.
* General `filter` string syntax:
* `resolveService(request, options, callback)
resolveService(request: protos.google.cloud.servicedirectory.v1.IResolveServiceRequest, options: CallOptions, callback: Callback<protos.google.cloud.servicedirectory.v1.IResolveServiceResponse, protos.google.cloud.servicedirectory.v1.IResolveServiceRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IResolveServiceRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.servicedirectory.v1.IResolveServiceResponse, protos.google.cloud.servicedirectory.v1.IResolveServiceRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
resolveService(request, callback)
resolveService(request: protos.google.cloud.servicedirectory.v1.IResolveServiceRequest, callback: Callback<protos.google.cloud.servicedirectory.v1.IResolveServiceResponse, protos.google.cloud.servicedirectory.v1.IResolveServiceRequest | null | undefined, {} | null | undefined>): void;| Parameters | |
|---|---|
| Name | Description |
request |
IResolveServiceRequest
|
callback |
Callback<protos.google.cloud.servicedirectory.v1.IResolveServiceResponse, protos.google.cloud.servicedirectory.v1.IResolveServiceRequest | null | undefined, {} | null | undefined>
|
| Returns | |
|---|---|
| Type | Description |
void |
|
servicePath(project, location, namespace, service)
servicePath(project: string, location: string, namespace: string, service: string): string;Return a fully-qualified service resource name string.
| Parameters | |
|---|---|
| Name | Description |
project |
string
|
location |
string
|
namespace |
string
|
service |
string
|
| Returns | |
|---|---|
| Type | Description |
string |
{string} Resource name string. |