# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! """Client and server classes corresponding to protobuf-defined services.""" import grpc import warnings from shared import metrics_pb2 as metrics__pb2 GRPC_GENERATED_VERSION = '1.76.0' GRPC_VERSION = grpc.__version__ _version_not_supported = False try: from grpc._utilities import first_version_is_lower _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) except ImportError: _version_not_supported = True if _version_not_supported: raise RuntimeError( f'The grpc package installed is at version {GRPC_VERSION},' + ' but the generated code in metrics_pb2_grpc.py depends on' + f' grpcio>={GRPC_GENERATED_VERSION}.' + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' ) class MetricsServiceStub(object): """MetricsService handles streaming metrics from collectors to aggregator """ def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.StreamMetrics = channel.stream_unary( '/monitoring.MetricsService/StreamMetrics', request_serializer=metrics__pb2.Metric.SerializeToString, response_deserializer=metrics__pb2.StreamAck.FromString, _registered_method=True) self.GetCurrentState = channel.unary_unary( '/monitoring.MetricsService/GetCurrentState', request_serializer=metrics__pb2.StateRequest.SerializeToString, response_deserializer=metrics__pb2.MachineState.FromString, _registered_method=True) self.GetAllStates = channel.unary_unary( '/monitoring.MetricsService/GetAllStates', request_serializer=metrics__pb2.Empty.SerializeToString, response_deserializer=metrics__pb2.AllMachinesState.FromString, _registered_method=True) class MetricsServiceServicer(object): """MetricsService handles streaming metrics from collectors to aggregator """ def StreamMetrics(self, request_iterator, context): """Client-side streaming: collector streams metrics to aggregator """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def GetCurrentState(self, request, context): """Get current state of a machine """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def GetAllStates(self, request, context): """Get current state of all machines """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def add_MetricsServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'StreamMetrics': grpc.stream_unary_rpc_method_handler( servicer.StreamMetrics, request_deserializer=metrics__pb2.Metric.FromString, response_serializer=metrics__pb2.StreamAck.SerializeToString, ), 'GetCurrentState': grpc.unary_unary_rpc_method_handler( servicer.GetCurrentState, request_deserializer=metrics__pb2.StateRequest.FromString, response_serializer=metrics__pb2.MachineState.SerializeToString, ), 'GetAllStates': grpc.unary_unary_rpc_method_handler( servicer.GetAllStates, request_deserializer=metrics__pb2.Empty.FromString, response_serializer=metrics__pb2.AllMachinesState.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'monitoring.MetricsService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) server.add_registered_method_handlers('monitoring.MetricsService', rpc_method_handlers) # This class is part of an EXPERIMENTAL API. class MetricsService(object): """MetricsService handles streaming metrics from collectors to aggregator """ @staticmethod def StreamMetrics(request_iterator, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.stream_unary( request_iterator, target, '/monitoring.MetricsService/StreamMetrics', metrics__pb2.Metric.SerializeToString, metrics__pb2.StreamAck.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata, _registered_method=True) @staticmethod def GetCurrentState(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary( request, target, '/monitoring.MetricsService/GetCurrentState', metrics__pb2.StateRequest.SerializeToString, metrics__pb2.MachineState.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata, _registered_method=True) @staticmethod def GetAllStates(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary( request, target, '/monitoring.MetricsService/GetAllStates', metrics__pb2.Empty.SerializeToString, metrics__pb2.AllMachinesState.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata, _registered_method=True) class ControlServiceStub(object): """ControlService handles bidirectional control commands """ def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.Control = channel.stream_stream( '/monitoring.ControlService/Control', request_serializer=metrics__pb2.ControlCommand.SerializeToString, response_deserializer=metrics__pb2.ControlResponse.FromString, _registered_method=True) class ControlServiceServicer(object): """ControlService handles bidirectional control commands """ def Control(self, request_iterator, context): """Bidirectional streaming for commands and responses """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def add_ControlServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'Control': grpc.stream_stream_rpc_method_handler( servicer.Control, request_deserializer=metrics__pb2.ControlCommand.FromString, response_serializer=metrics__pb2.ControlResponse.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'monitoring.ControlService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) server.add_registered_method_handlers('monitoring.ControlService', rpc_method_handlers) # This class is part of an EXPERIMENTAL API. class ControlService(object): """ControlService handles bidirectional control commands """ @staticmethod def Control(request_iterator, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.stream_stream( request_iterator, target, '/monitoring.ControlService/Control', metrics__pb2.ControlCommand.SerializeToString, metrics__pb2.ControlResponse.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata, _registered_method=True) class ConfigServiceStub(object): """ConfigService handles dynamic configuration """ def __init__(self, channel): """Constructor. Args: channel: A grpc.Channel. """ self.GetConfig = channel.unary_unary( '/monitoring.ConfigService/GetConfig', request_serializer=metrics__pb2.ConfigRequest.SerializeToString, response_deserializer=metrics__pb2.CollectorConfig.FromString, _registered_method=True) self.WatchConfig = channel.unary_stream( '/monitoring.ConfigService/WatchConfig', request_serializer=metrics__pb2.ConfigRequest.SerializeToString, response_deserializer=metrics__pb2.CollectorConfig.FromString, _registered_method=True) class ConfigServiceServicer(object): """ConfigService handles dynamic configuration """ def GetConfig(self, request, context): """Get current configuration for a collector """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def WatchConfig(self, request, context): """Stream configuration updates """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details('Method not implemented!') raise NotImplementedError('Method not implemented!') def add_ConfigServiceServicer_to_server(servicer, server): rpc_method_handlers = { 'GetConfig': grpc.unary_unary_rpc_method_handler( servicer.GetConfig, request_deserializer=metrics__pb2.ConfigRequest.FromString, response_serializer=metrics__pb2.CollectorConfig.SerializeToString, ), 'WatchConfig': grpc.unary_stream_rpc_method_handler( servicer.WatchConfig, request_deserializer=metrics__pb2.ConfigRequest.FromString, response_serializer=metrics__pb2.CollectorConfig.SerializeToString, ), } generic_handler = grpc.method_handlers_generic_handler( 'monitoring.ConfigService', rpc_method_handlers) server.add_generic_rpc_handlers((generic_handler,)) server.add_registered_method_handlers('monitoring.ConfigService', rpc_method_handlers) # This class is part of an EXPERIMENTAL API. class ConfigService(object): """ConfigService handles dynamic configuration """ @staticmethod def GetConfig(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_unary( request, target, '/monitoring.ConfigService/GetConfig', metrics__pb2.ConfigRequest.SerializeToString, metrics__pb2.CollectorConfig.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata, _registered_method=True) @staticmethod def WatchConfig(request, target, options=(), channel_credentials=None, call_credentials=None, insecure=False, compression=None, wait_for_ready=None, timeout=None, metadata=None): return grpc.experimental.unary_stream( request, target, '/monitoring.ConfigService/WatchConfig', metrics__pb2.ConfigRequest.SerializeToString, metrics__pb2.CollectorConfig.FromString, options, channel_credentials, insecure, call_credentials, compression, wait_for_ready, timeout, metadata, _registered_method=True)