Adding grpc library
[osm/LCM.git] / osm_lcm / frontend_grpc.py
1 #!/usr/bin/python3
2 # -*- coding: utf-8 -*-
3
4 ##
5 # Copyright 2018 Telefonica S.A.
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License"); you may
8 # not use this file except in compliance with the License. You may obtain
9 # a copy of the License at
10 #
11 # http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16 # License for the specific language governing permissions and limitations
17 # under the License.
18 ##
19 # Generated by the Protocol Buffers compiler. DO NOT EDIT!
20 # source: osm_lcm/frontend.proto
21 # plugin: grpclib.plugin.main
22 import abc
23 import typing
24
25 import grpclib.const
26 import grpclib.client
27 if typing.TYPE_CHECKING:
28 import grpclib.server
29
30 import osm_lcm.frontend_pb2
31
32
33 class FrontendExecutorBase(abc.ABC):
34
35 @abc.abstractmethod
36 async def RunPrimitive(self, stream: 'grpclib.server.Stream[osm_lcm.frontend_pb2.PrimitiveRequest, osm_lcm.frontend_pb2.PrimitiveReply]') -> None:
37 pass
38
39 @abc.abstractmethod
40 async def GetSshKey(self, stream: 'grpclib.server.Stream[osm_lcm.frontend_pb2.SshKeyRequest, osm_lcm.frontend_pb2.SshKeyReply]') -> None:
41 pass
42
43 def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
44 return {
45 '/osm_lcm.FrontendExecutor/RunPrimitive': grpclib.const.Handler(
46 self.RunPrimitive,
47 grpclib.const.Cardinality.UNARY_STREAM,
48 osm_lcm.frontend_pb2.PrimitiveRequest,
49 osm_lcm.frontend_pb2.PrimitiveReply,
50 ),
51 '/osm_lcm.FrontendExecutor/GetSshKey': grpclib.const.Handler(
52 self.GetSshKey,
53 grpclib.const.Cardinality.UNARY_UNARY,
54 osm_lcm.frontend_pb2.SshKeyRequest,
55 osm_lcm.frontend_pb2.SshKeyReply,
56 ),
57 }
58
59
60 class FrontendExecutorStub:
61
62 def __init__(self, channel: grpclib.client.Channel) -> None:
63 self.RunPrimitive = grpclib.client.UnaryStreamMethod(
64 channel,
65 '/osm_lcm.FrontendExecutor/RunPrimitive',
66 osm_lcm.frontend_pb2.PrimitiveRequest,
67 osm_lcm.frontend_pb2.PrimitiveReply,
68 )
69 self.GetSshKey = grpclib.client.UnaryUnaryMethod(
70 channel,
71 '/osm_lcm.FrontendExecutor/GetSshKey',
72 osm_lcm.frontend_pb2.SshKeyRequest,
73 osm_lcm.frontend_pb2.SshKeyReply,
74 )