@@ -5,15 +5,26 @@ isort:skip_file
55---------------------------------------------------------------------
66"""
77import abc
8+ import collections .abc
89import grpc
10+ import grpc .aio
911import ni_measurementlink_service ._internal .stubs .ni .measurementlink .discovery .v1 .discovery_service_pb2 as ni_measurementlink_discovery_v1_discovery_service_pb2
12+ import typing
13+
14+ _T = typing .TypeVar ('_T' )
15+
16+ class _MaybeAsyncIterator (collections .abc .AsyncIterator [_T ], collections .abc .Iterator [_T ], metaclass = abc .ABCMeta ):
17+ ...
18+
19+ class _ServicerContext (grpc .ServicerContext , grpc .aio .ServicerContext ): # type: ignore
20+ ...
1021
1122class DiscoveryServiceStub :
1223 """The service used as a registry for other services. This service can be used to discover
1324 and activate other services present in the system.
1425 """
1526
16- def __init__ (self , channel : grpc .Channel ) -> None : ...
27+ def __init__ (self , channel : typing . Union [ grpc .Channel , grpc . aio . Channel ] ) -> None : ...
1728 RegisterService : grpc .UnaryUnaryMultiCallable [
1829 ni_measurementlink_discovery_v1_discovery_service_pb2 .RegisterServiceRequest ,
1930 ni_measurementlink_discovery_v1_discovery_service_pb2 .RegisterServiceResponse ,
@@ -56,6 +67,53 @@ class DiscoveryServiceStub:
5667 - FAILED_PRECONDITION: More than one service matching the resolve request was found
5768 """
5869
70+ class DiscoveryServiceAsyncStub :
71+ """The service used as a registry for other services. This service can be used to discover
72+ and activate other services present in the system.
73+ """
74+
75+ RegisterService : grpc .aio .UnaryUnaryMultiCallable [
76+ ni_measurementlink_discovery_v1_discovery_service_pb2 .RegisterServiceRequest ,
77+ ni_measurementlink_discovery_v1_discovery_service_pb2 .RegisterServiceResponse ,
78+ ]
79+ """Registers a service instance with the discovery service.
80+ Status Codes for errors:
81+ - INVALID_ARGUMENT:
82+ - ServiceDescriptor.display_name is empty
83+ - ServiceDescriptor.provided_interfaces is empty
84+ - ServiceDescriptor.service_class is empty
85+ - ServiceLocation.location is empty
86+ - Both ServiceLocation.insecure_port and ServiceLocation.ssl_authenticated_port are empty
87+ - Either ServiceLocation.insecure_port or ServiceLocation.ssl_authenticated_port contain an invalid port number
88+ """
89+ UnregisterService : grpc .aio .UnaryUnaryMultiCallable [
90+ ni_measurementlink_discovery_v1_discovery_service_pb2 .UnregisterServiceRequest ,
91+ ni_measurementlink_discovery_v1_discovery_service_pb2 .UnregisterServiceResponse ,
92+ ]
93+ """Unregisters a service instance with the discovery service."""
94+ EnumerateServices : grpc .aio .UnaryUnaryMultiCallable [
95+ ni_measurementlink_discovery_v1_discovery_service_pb2 .EnumerateServicesRequest ,
96+ ni_measurementlink_discovery_v1_discovery_service_pb2 .EnumerateServicesResponse ,
97+ ]
98+ """Enumerate all services which implement a specific service interface.
99+ This is useful for plugin type systems where the possible services are not known ahead of time.
100+ """
101+ ResolveService : grpc .aio .UnaryUnaryMultiCallable [
102+ ni_measurementlink_discovery_v1_discovery_service_pb2 .ResolveServiceRequest ,
103+ ni_measurementlink_discovery_v1_discovery_service_pb2 .ServiceLocation ,
104+ ]
105+ """Given a description of a service, returns information that can be used to establish communication
106+ with that service. If necessary, the service will be started by the discovery service if it has not
107+ already been started. Activation of the service is accomplished through use of a .serviceconfig file
108+ which includes information describing the service. Services that register a .serviceconfig file must
109+ call RegisterService when their service is started or this call will never complete successfully when
110+ the discovery service attempts to start it.
111+ Status Codes for errors:
112+ - INVALID_ARGUMENT: provided_interfaces is empty
113+ - NOT_FOUND: No service matching the resolve request was found
114+ - FAILED_PRECONDITION: More than one service matching the resolve request was found
115+ """
116+
59117class DiscoveryServiceServicer (metaclass = abc .ABCMeta ):
60118 """The service used as a registry for other services. This service can be used to discover
61119 and activate other services present in the system.
@@ -65,8 +123,8 @@ class DiscoveryServiceServicer(metaclass=abc.ABCMeta):
65123 def RegisterService (
66124 self ,
67125 request : ni_measurementlink_discovery_v1_discovery_service_pb2 .RegisterServiceRequest ,
68- context : grpc . ServicerContext ,
69- ) -> ni_measurementlink_discovery_v1_discovery_service_pb2 .RegisterServiceResponse :
126+ context : _ServicerContext ,
127+ ) -> typing . Union [ ni_measurementlink_discovery_v1_discovery_service_pb2 .RegisterServiceResponse , collections . abc . Awaitable [ ni_measurementlink_discovery_v1_discovery_service_pb2 . RegisterServiceResponse ]] :
70128 """Registers a service instance with the discovery service.
71129 Status Codes for errors:
72130 - INVALID_ARGUMENT:
@@ -81,24 +139,24 @@ class DiscoveryServiceServicer(metaclass=abc.ABCMeta):
81139 def UnregisterService (
82140 self ,
83141 request : ni_measurementlink_discovery_v1_discovery_service_pb2 .UnregisterServiceRequest ,
84- context : grpc . ServicerContext ,
85- ) -> ni_measurementlink_discovery_v1_discovery_service_pb2 .UnregisterServiceResponse :
142+ context : _ServicerContext ,
143+ ) -> typing . Union [ ni_measurementlink_discovery_v1_discovery_service_pb2 .UnregisterServiceResponse , collections . abc . Awaitable [ ni_measurementlink_discovery_v1_discovery_service_pb2 . UnregisterServiceResponse ]] :
86144 """Unregisters a service instance with the discovery service."""
87145 @abc .abstractmethod
88146 def EnumerateServices (
89147 self ,
90148 request : ni_measurementlink_discovery_v1_discovery_service_pb2 .EnumerateServicesRequest ,
91- context : grpc . ServicerContext ,
92- ) -> ni_measurementlink_discovery_v1_discovery_service_pb2 .EnumerateServicesResponse :
149+ context : _ServicerContext ,
150+ ) -> typing . Union [ ni_measurementlink_discovery_v1_discovery_service_pb2 .EnumerateServicesResponse , collections . abc . Awaitable [ ni_measurementlink_discovery_v1_discovery_service_pb2 . EnumerateServicesResponse ]] :
93151 """Enumerate all services which implement a specific service interface.
94152 This is useful for plugin type systems where the possible services are not known ahead of time.
95153 """
96154 @abc .abstractmethod
97155 def ResolveService (
98156 self ,
99157 request : ni_measurementlink_discovery_v1_discovery_service_pb2 .ResolveServiceRequest ,
100- context : grpc . ServicerContext ,
101- ) -> ni_measurementlink_discovery_v1_discovery_service_pb2 .ServiceLocation :
158+ context : _ServicerContext ,
159+ ) -> typing . Union [ ni_measurementlink_discovery_v1_discovery_service_pb2 .ServiceLocation , collections . abc . Awaitable [ ni_measurementlink_discovery_v1_discovery_service_pb2 . ServiceLocation ]] :
102160 """Given a description of a service, returns information that can be used to establish communication
103161 with that service. If necessary, the service will be started by the discovery service if it has not
104162 already been started. Activation of the service is accomplished through use of a .serviceconfig file
@@ -111,4 +169,4 @@ class DiscoveryServiceServicer(metaclass=abc.ABCMeta):
111169 - FAILED_PRECONDITION: More than one service matching the resolve request was found
112170 """
113171
114- def add_DiscoveryServiceServicer_to_server (servicer : DiscoveryServiceServicer , server : grpc .Server ) -> None : ...
172+ def add_DiscoveryServiceServicer_to_server (servicer : DiscoveryServiceServicer , server : typing . Union [ grpc .Server , grpc . aio . Server ] ) -> None : ...
0 commit comments