diff --git a/python/grpcdemo_pb2.py b/python/grpcdemo_pb2.py new file mode 100644 index 0000000..f5ddce6 --- /dev/null +++ b/python/grpcdemo_pb2.py @@ -0,0 +1,225 @@ +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: grpcdemo.proto + +import sys +_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +from google.protobuf import descriptor_pb2 +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='grpcdemo.proto', + package='', + syntax='proto3', + serialized_pb=_b('\n\x0egrpcdemo.proto\"\x1a\n\x07\x43ommand\x12\x0f\n\x07\x63ommand\x18\x01 \x01(\t\"\x1a\n\x07Results\x12\x0f\n\x07results\x18\x01 \x01(\t21\n\x0bHostCommand\x12\"\n\nruncommand\x12\x08.Command\x1a\x08.Results\"\x00\x62\x06proto3') +) +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + + + + +_COMMAND = _descriptor.Descriptor( + name='Command', + full_name='Command', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='command', full_name='Command.command', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=18, + serialized_end=44, +) + + +_RESULTS = _descriptor.Descriptor( + name='Results', + full_name='Results', + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name='results', full_name='Results.results', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=_b("").decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=46, + serialized_end=72, +) + +DESCRIPTOR.message_types_by_name['Command'] = _COMMAND +DESCRIPTOR.message_types_by_name['Results'] = _RESULTS + +Command = _reflection.GeneratedProtocolMessageType('Command', (_message.Message,), dict( + DESCRIPTOR = _COMMAND, + __module__ = 'grpcdemo_pb2' + # @@protoc_insertion_point(class_scope:Command) + )) +_sym_db.RegisterMessage(Command) + +Results = _reflection.GeneratedProtocolMessageType('Results', (_message.Message,), dict( + DESCRIPTOR = _RESULTS, + __module__ = 'grpcdemo_pb2' + # @@protoc_insertion_point(class_scope:Results) + )) +_sym_db.RegisterMessage(Results) + + +try: + # THESE ELEMENTS WILL BE DEPRECATED. + # Please use the generated *_pb2_grpc.py files instead. + import grpc + from grpc.framework.common import cardinality + from grpc.framework.interfaces.face import utilities as face_utilities + from grpc.beta import implementations as beta_implementations + from grpc.beta import interfaces as beta_interfaces + + + class HostCommandStub(object): + """The date service + + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.runcommand = channel.unary_unary( + '/HostCommand/runcommand', + request_serializer=Command.SerializeToString, + response_deserializer=Results.FromString, + ) + + + class HostCommandServicer(object): + """The date service + + """ + + def runcommand(self, request, context): + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + + def add_HostCommandServicer_to_server(servicer, server): + rpc_method_handlers = { + 'runcommand': grpc.unary_unary_rpc_method_handler( + servicer.runcommand, + request_deserializer=Command.FromString, + response_serializer=Results.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'HostCommand', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + class BetaHostCommandServicer(object): + """The Beta API is deprecated for 0.15.0 and later. + + It is recommended to use the GA API (classes and functions in this + file not marked beta) for all further purposes. This class was generated + only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" + """The date service + + """ + def runcommand(self, request, context): + context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) + + + class BetaHostCommandStub(object): + """The Beta API is deprecated for 0.15.0 and later. + + It is recommended to use the GA API (classes and functions in this + file not marked beta) for all further purposes. This class was generated + only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0.""" + """The date service + + """ + def runcommand(self, request, timeout, metadata=None, with_call=False, protocol_options=None): + raise NotImplementedError() + runcommand.future = None + + + def beta_create_HostCommand_server(servicer, pool=None, pool_size=None, default_timeout=None, maximum_timeout=None): + """The Beta API is deprecated for 0.15.0 and later. + + It is recommended to use the GA API (classes and functions in this + file not marked beta) for all further purposes. This function was + generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" + request_deserializers = { + ('HostCommand', 'runcommand'): Command.FromString, + } + response_serializers = { + ('HostCommand', 'runcommand'): Results.SerializeToString, + } + method_implementations = { + ('HostCommand', 'runcommand'): face_utilities.unary_unary_inline(servicer.runcommand), + } + server_options = beta_implementations.server_options(request_deserializers=request_deserializers, response_serializers=response_serializers, thread_pool=pool, thread_pool_size=pool_size, default_timeout=default_timeout, maximum_timeout=maximum_timeout) + return beta_implementations.server(method_implementations, options=server_options) + + + def beta_create_HostCommand_stub(channel, host=None, metadata_transformer=None, pool=None, pool_size=None): + """The Beta API is deprecated for 0.15.0 and later. + + It is recommended to use the GA API (classes and functions in this + file not marked beta) for all further purposes. This function was + generated only to ease transition from grpcio<0.15.0 to grpcio>=0.15.0""" + request_serializers = { + ('HostCommand', 'runcommand'): Command.SerializeToString, + } + response_deserializers = { + ('HostCommand', 'runcommand'): Results.FromString, + } + cardinalities = { + 'runcommand': cardinality.Cardinality.UNARY_UNARY, + } + stub_options = beta_implementations.stub_options(host=host, metadata_transformer=metadata_transformer, request_serializers=request_serializers, response_deserializers=response_deserializers, thread_pool=pool, thread_pool_size=pool_size) + return beta_implementations.dynamic_stub(channel, 'HostCommand', cardinalities, options=stub_options) +except ImportError: + pass +# @@protoc_insertion_point(module_scope) diff --git a/python/grpcdemo_pb2_grpc.py b/python/grpcdemo_pb2_grpc.py new file mode 100644 index 0000000..1672834 --- /dev/null +++ b/python/grpcdemo_pb2_grpc.py @@ -0,0 +1,48 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc +from grpc.framework.common import cardinality +from grpc.framework.interfaces.face import utilities as face_utilities + +import grpcdemo_pb2 as grpcdemo__pb2 + + +class HostCommandStub(object): + """The date service + + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.runcommand = channel.unary_unary( + '/HostCommand/runcommand', + request_serializer=grpcdemo__pb2.Command.SerializeToString, + response_deserializer=grpcdemo__pb2.Results.FromString, + ) + + +class HostCommandServicer(object): + """The date service + + """ + + def runcommand(self, request, context): + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_HostCommandServicer_to_server(servicer, server): + rpc_method_handlers = { + 'runcommand': grpc.unary_unary_rpc_method_handler( + servicer.runcommand, + request_deserializer=grpcdemo__pb2.Command.FromString, + response_serializer=grpcdemo__pb2.Results.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'HostCommand', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,))