github.com/hashicorp/go-plugin@v1.6.0/examples/grpc/plugin-python/proto/kv_pb2_grpc.py (about) 1 # Copyright (c) HashiCorp, Inc. 2 # SPDX-License-Identifier: MPL-2.0 3 4 # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 5 """Client and server classes corresponding to protobuf-defined services.""" 6 import grpc 7 8 from proto import kv_pb2 as proto_dot_kv__pb2 9 10 11 class KVStub(object): 12 """Missing associated documentation comment in .proto file.""" 13 14 def __init__(self, channel): 15 """Constructor. 16 17 Args: 18 channel: A grpc.Channel. 19 """ 20 self.Get = channel.unary_unary( 21 '/proto.KV/Get', 22 request_serializer=proto_dot_kv__pb2.GetRequest.SerializeToString, 23 response_deserializer=proto_dot_kv__pb2.GetResponse.FromString, 24 ) 25 self.Put = channel.unary_unary( 26 '/proto.KV/Put', 27 request_serializer=proto_dot_kv__pb2.PutRequest.SerializeToString, 28 response_deserializer=proto_dot_kv__pb2.Empty.FromString, 29 ) 30 31 32 class KVServicer(object): 33 """Missing associated documentation comment in .proto file.""" 34 35 def Get(self, request, context): 36 """Missing associated documentation comment in .proto file.""" 37 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 38 context.set_details('Method not implemented!') 39 raise NotImplementedError('Method not implemented!') 40 41 def Put(self, request, context): 42 """Missing associated documentation comment in .proto file.""" 43 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 44 context.set_details('Method not implemented!') 45 raise NotImplementedError('Method not implemented!') 46 47 48 def add_KVServicer_to_server(servicer, server): 49 rpc_method_handlers = { 50 'Get': grpc.unary_unary_rpc_method_handler( 51 servicer.Get, 52 request_deserializer=proto_dot_kv__pb2.GetRequest.FromString, 53 response_serializer=proto_dot_kv__pb2.GetResponse.SerializeToString, 54 ), 55 'Put': grpc.unary_unary_rpc_method_handler( 56 servicer.Put, 57 request_deserializer=proto_dot_kv__pb2.PutRequest.FromString, 58 response_serializer=proto_dot_kv__pb2.Empty.SerializeToString, 59 ), 60 } 61 generic_handler = grpc.method_handlers_generic_handler( 62 'proto.KV', rpc_method_handlers) 63 server.add_generic_rpc_handlers((generic_handler,)) 64 65 66 # This class is part of an EXPERIMENTAL API. 67 class KV(object): 68 """Missing associated documentation comment in .proto file.""" 69 70 @staticmethod 71 def Get(request, 72 target, 73 options=(), 74 channel_credentials=None, 75 call_credentials=None, 76 insecure=False, 77 compression=None, 78 wait_for_ready=None, 79 timeout=None, 80 metadata=None): 81 return grpc.experimental.unary_unary(request, target, '/proto.KV/Get', 82 proto_dot_kv__pb2.GetRequest.SerializeToString, 83 proto_dot_kv__pb2.GetResponse.FromString, 84 options, channel_credentials, 85 insecure, call_credentials, compression, wait_for_ready, timeout, metadata) 86 87 @staticmethod 88 def Put(request, 89 target, 90 options=(), 91 channel_credentials=None, 92 call_credentials=None, 93 insecure=False, 94 compression=None, 95 wait_for_ready=None, 96 timeout=None, 97 metadata=None): 98 return grpc.experimental.unary_unary(request, target, '/proto.KV/Put', 99 proto_dot_kv__pb2.PutRequest.SerializeToString, 100 proto_dot_kv__pb2.Empty.FromString, 101 options, channel_credentials, 102 insecure, call_credentials, compression, wait_for_ready, timeout, metadata)