Constructor
new RegistrationServiceClient(optionsopt, gaxInstanceopt)
Construct an instance of RegistrationServiceClient.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. The options accepted by the constructor are described in detail in this document. The common options are: Properties
|
||||||||||||||||||||||||||||||||||||||||||||||||
gaxInstance |
gax |
<optional> |
loaded instance of |
Members
apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
port
The port for this API service.
scopes
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
The DNS address for this API service.
Methods
close() → {Promise}
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 |
A promise that resolves when the client is closed. |
endpointPath(project, location, namespace, service, endpoint) → {string}
Return a fully-qualified endpoint resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
namespace |
string | |
service |
string | |
endpoint |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
getProjectId() → {Promise}
Return the project ID used by this class.
Returns:
Type | Description |
---|---|
Promise |
A promise that resolves to string containing the project ID. |
initialize() → {Promise}
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 |
A promise that resolves to an authenticated service stub. |
listEndpointsAsync(request, optionsopt) → {Object}
Equivalent to listEndpoints
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Endpoint. 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. |
Example
/**
* 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 resource name of the service whose endpoints you'd like to
* list.
*/
// const parent = 'abc123'
/**
* Optional. The maximum number of items to return.
*/
// const pageSize = 1234
/**
* Optional. The next_page_token value returned from a previous List request,
* if any.
*/
// const pageToken = 'abc123'
/**
* Optional. The filter to list results by.
* General `filter` string syntax:
* `<field> <operator> <value> (<logical connector>)`
* * `<field>` can be `name`, `address`, `port`, or `metadata.<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:
* * `metadata.owner` returns endpoints that have a metadata with the key
* `owner`, this is the same as `metadata:owner`
* * `metadata.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
* * `metadata.owner!=sd AND metadata.foo=bar` returns endpoints that have
* `owner` in metadata 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 endpoints, it returns no results
* For more information about filtering, see
* API Filtering (https://aip.dev/160).
*/
// const filter = 'abc123'
/**
* Optional. The order to list results by.
* General `order_by` string syntax: `<field> (<asc|desc>) (,)`
* * `<field>` allows values: `name`, `address`, `port`
* * `<asc|desc>` ascending or descending order by `<field>`. If this is
* left blank, `asc` is used
* Note that an empty `order_by` string results in default order, which is
* order by `name` in ascending order.
*/
// const orderBy = 'abc123'
// Imports the Servicedirectory library
const {RegistrationServiceClient} = require('@google-cloud/service-directory').v1beta1;
// Instantiates a client
const servicedirectoryClient = new RegistrationServiceClient();
async function callListEndpoints() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = await servicedirectoryClient.listEndpointsAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListEndpoints();
listEndpointsStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing Endpoint on 'data' event.
The client library will perform auto-pagination by default: it will call the API as many
times as needed. Note that it can affect your quota.
We recommend using |
listNamespacesAsync(request, optionsopt) → {Object}
Equivalent to listNamespaces
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Namespace. 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. |
Example
/**
* 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 resource name of the project and location whose namespaces you'd like
* to list.
*/
// const parent = 'abc123'
/**
* Optional. The maximum number of items to return.
*/
// const pageSize = 1234
/**
* Optional. The next_page_token value returned from a previous List request, if any.
*/
// const pageToken = 'abc123'
/**
* Optional. The filter to list results by.
* General `filter` string syntax:
* `<field> <operator> <value> (<logical connector>)`
* * `<field>` can be `name` or `labels.<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:
* * `labels.owner` returns namespaces that have a label with the key
* `owner`, this is the same as `labels:owner`
* * `labels.owner=sd` returns namespaces that have key/value `owner=sd`
* * `name>projects/my-project/locations/us-east1/namespaces/namespace-c`
* returns namespaces that have name that is alphabetically later than the
* string, so "namespace-e" is returned but "namespace-a" is not
* * `labels.owner!=sd AND labels.foo=bar` returns namespaces that have
* `owner` in label key but value is not `sd` AND have key/value `foo=bar`
* * `doesnotexist.foo=bar` returns an empty list. Note that namespace
* doesn't have a field called "doesnotexist". Since the filter does not
* match any namespaces, it returns no results
* For more information about filtering, see
* API Filtering (https://aip.dev/160).
*/
// const filter = 'abc123'
/**
* Optional. The order to list results by.
* General `order_by` string syntax: `<field> (<asc|desc>) (,)`
* * `<field>` allows value: `name`
* * `<asc|desc>` ascending or descending order by `<field>`. If this is
* left blank, `asc` is used
* Note that an empty `order_by` string results in default order, which is
* order by `name` in ascending order.
*/
// const orderBy = 'abc123'
// Imports the Servicedirectory library
const {RegistrationServiceClient} = require('@google-cloud/service-directory').v1beta1;
// Instantiates a client
const servicedirectoryClient = new RegistrationServiceClient();
async function callListNamespaces() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = await servicedirectoryClient.listNamespacesAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListNamespaces();
listNamespacesStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing Namespace on 'data' event.
The client library will perform auto-pagination by default: it will call the API as many
times as needed. Note that it can affect your quota.
We recommend using |
listServicesAsync(request, optionsopt) → {Object}
Equivalent to listServices
, but returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Object |
An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Service. 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. |
Example
/**
* 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 resource name of the namespace whose services you'd
* like to list.
*/
// const parent = 'abc123'
/**
* Optional. The maximum number of items to return.
*/
// const pageSize = 1234
/**
* Optional. The next_page_token value returned from a previous List request,
* if any.
*/
// const pageToken = 'abc123'
/**
* Optional. The filter to list results by.
* General `filter` string syntax:
* `<field> <operator> <value> (<logical connector>)`
* * `<field>` can be `name` or `metadata.<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:
* * `metadata.owner` returns services that have a metadata with the key
* `owner`, this is the same as `metadata:owner`
* * `metadata.protocol=gRPC` returns services that have key/value
* `protocol=gRPC`
* *
* `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/service-c`
* returns services that have name that is alphabetically later than the
* string, so "service-e" is returned but "service-a" is not
* * `metadata.owner!=sd AND metadata.foo=bar` returns services that have
* `owner` in metadata key but value is not `sd` AND have key/value
* `foo=bar`
* * `doesnotexist.foo=bar` returns an empty list. Note that service
* doesn't have a field called "doesnotexist". Since the filter does not
* match any services, it returns no results
* For more information about filtering, see
* API Filtering (https://aip.dev/160).
*/
// const filter = 'abc123'
/**
* Optional. The order to list results by.
* General `order_by` string syntax: `<field> (<asc|desc>) (,)`
* * `<field>` allows value: `name`
* * `<asc|desc>` ascending or descending order by `<field>`. If this is
* left blank, `asc` is used
* Note that an empty `order_by` string results in default order, which is
* order by `name` in ascending order.
*/
// const orderBy = 'abc123'
// Imports the Servicedirectory library
const {RegistrationServiceClient} = require('@google-cloud/service-directory').v1beta1;
// Instantiates a client
const servicedirectoryClient = new RegistrationServiceClient();
async function callListServices() {
// Construct request
const request = {
parent,
};
// Run request
const iterable = await servicedirectoryClient.listServicesAsync(request);
for await (const response of iterable) {
console.log(response);
}
}
callListServices();
listServicesStream(request, optionsopt) → {Stream}
Equivalent to method.name.toCamelCase()
, but returns a NodeJS Stream object.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
Returns:
Type | Description |
---|---|
Stream |
An object stream which emits an object representing Service on 'data' event.
The client library will perform auto-pagination by default: it will call the API as many
times as needed. Note that it can affect your quota.
We recommend using |
locationPath(project, location) → {string}
Return a fully-qualified location resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
matchEndpointFromEndpointName(endpointName) → {string}
Parse the endpoint from Endpoint resource.
Parameters:
Name | Type | Description |
---|---|---|
endpointName |
string |
A fully-qualified path representing Endpoint resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the endpoint. |
matchLocationFromEndpointName(endpointName) → {string}
Parse the location from Endpoint resource.
Parameters:
Name | Type | Description |
---|---|---|
endpointName |
string |
A fully-qualified path representing Endpoint resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromLocationName(locationName) → {string}
Parse the location from Location resource.
Parameters:
Name | Type | Description |
---|---|---|
locationName |
string |
A fully-qualified path representing Location resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromNamespaceName(namespaceName) → {string}
Parse the location from Namespace resource.
Parameters:
Name | Type | Description |
---|---|---|
namespaceName |
string |
A fully-qualified path representing Namespace resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchLocationFromServiceName(serviceName) → {string}
Parse the location from Service resource.
Parameters:
Name | Type | Description |
---|---|---|
serviceName |
string |
A fully-qualified path representing Service resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the location. |
matchNamespaceFromEndpointName(endpointName) → {string}
Parse the namespace from Endpoint resource.
Parameters:
Name | Type | Description |
---|---|---|
endpointName |
string |
A fully-qualified path representing Endpoint resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the namespace. |
matchNamespaceFromNamespaceName(namespaceName) → {string}
Parse the namespace from Namespace resource.
Parameters:
Name | Type | Description |
---|---|---|
namespaceName |
string |
A fully-qualified path representing Namespace resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the namespace. |
matchNamespaceFromServiceName(serviceName) → {string}
Parse the namespace from Service resource.
Parameters:
Name | Type | Description |
---|---|---|
serviceName |
string |
A fully-qualified path representing Service resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the namespace. |
matchProjectFromEndpointName(endpointName) → {string}
Parse the project from Endpoint resource.
Parameters:
Name | Type | Description |
---|---|---|
endpointName |
string |
A fully-qualified path representing Endpoint resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromLocationName(locationName) → {string}
Parse the project from Location resource.
Parameters:
Name | Type | Description |
---|---|---|
locationName |
string |
A fully-qualified path representing Location resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromNamespaceName(namespaceName) → {string}
Parse the project from Namespace resource.
Parameters:
Name | Type | Description |
---|---|---|
namespaceName |
string |
A fully-qualified path representing Namespace resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchProjectFromServiceName(serviceName) → {string}
Parse the project from Service resource.
Parameters:
Name | Type | Description |
---|---|---|
serviceName |
string |
A fully-qualified path representing Service resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the project. |
matchServiceFromEndpointName(endpointName) → {string}
Parse the service from Endpoint resource.
Parameters:
Name | Type | Description |
---|---|---|
endpointName |
string |
A fully-qualified path representing Endpoint resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the service. |
matchServiceFromServiceName(serviceName) → {string}
Parse the service from Service resource.
Parameters:
Name | Type | Description |
---|---|---|
serviceName |
string |
A fully-qualified path representing Service resource. |
Returns:
Type | Description |
---|---|
string |
A string representing the service. |
namespacePath(project, location, namespace) → {string}
Return a fully-qualified namespace resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
namespace |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |
servicePath(project, location, namespace, service) → {string}
Return a fully-qualified service resource name string.
Parameters:
Name | Type | Description |
---|---|---|
project |
string | |
location |
string | |
namespace |
string | |
service |
string |
Returns:
Type | Description |
---|---|
string |
Resource name string. |