ni_measurementlink_service._internal.discovery_client
Contains API to register and un-register measurement service with discovery service.
Module Contents
Classes
Represents the location of a service. |
|
Class that contains APIs need to interact with discovery service. |
- class ni_measurementlink_service._internal.discovery_client.ServiceLocation[source]
Bases:
NamedTupleRepresents the location of a service.
- location :str
- insecure_port :str
- ssl_authenticated_port :str
- property insecure_address
Get the service’s insecure address in the format host:port.
- property ssl_authenticated_address
Get the service’s SSL-authenticated address in the format host:port.
- class ni_measurementlink_service._internal.discovery_client.DiscoveryClient(stub=None)[source]
Class that contains APIs need to interact with discovery service.
Attributes
stub (DiscoveryServiceStub): The gRPC stub used to interact with the discovery service.
registration_id(string): The ID from discovery service upon successful registration.
- property stub
Get the gRPC stub used to interact with the discovery service.
- register_measurement_service(service_port, service_info, measurement_info)[source]
Register the measurement service with the discovery service.
Args:
service_port (str): Port Number of the measurement service.
service_info (ServiceInfo): Service Info.
display_name (str): Display name of the service.
Returns
bool: Boolean to represent if the registration is successful.
- unregister_service()[source]
Un-registers the measurement service from the discovery service.
Should be called before the service is closed.
Returns
bool: Boolean to represent if the un-registration is successful.
- resolve_service(provided_interface, service_class='')[source]
Resolve the location of a service.
Given a description of a service, returns information that can be used to establish communication with that service. If necessary, the service will be started by the discovery service if it has not already been started.
Args:
provided_interface: The gRPC Full Name of the service. service_class: The service “class” that should be matched. If the value is not
specified and there is more than one matching service registered, an error is returned.
Returns
A ServiceLocation location object that represents the location of a service.