1 # Copyright 2020 The gRPC Authors
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 """AsyncIO version of Channelz servicer."""
16 from grpc.experimental import aio
18 import grpc_channelz.v1.channelz_pb2 as _channelz_pb2
19 import grpc_channelz.v1.channelz_pb2_grpc as _channelz_pb2_grpc
20 from grpc_channelz.v1._servicer import ChannelzServicer as _SyncChannelzServicer
23 class ChannelzServicer(_channelz_pb2_grpc.ChannelzServicer):
24 """AsyncIO servicer for handling RPCs for service statuses."""
27 async def GetTopChannels(
28 request: _channelz_pb2.GetTopChannelsRequest,
29 context: aio.ServicerContext
30 ) -> _channelz_pb2.GetTopChannelsResponse:
31 return _SyncChannelzServicer.GetTopChannels(request, context)
35 request: _channelz_pb2.GetServersRequest,
36 context: aio.ServicerContext) -> _channelz_pb2.GetServersResponse:
37 return _SyncChannelzServicer.GetServers(request, context)
41 request: _channelz_pb2.GetServerRequest,
42 context: aio.ServicerContext) -> _channelz_pb2.GetServerResponse:
43 return _SyncChannelzServicer.GetServer(request, context)
46 async def GetServerSockets(
47 request: _channelz_pb2.GetServerSocketsRequest,
48 context: aio.ServicerContext
49 ) -> _channelz_pb2.GetServerSocketsResponse:
50 return _SyncChannelzServicer.GetServerSockets(request, context)
54 request: _channelz_pb2.GetChannelRequest,
55 context: aio.ServicerContext) -> _channelz_pb2.GetChannelResponse:
56 return _SyncChannelzServicer.GetChannel(request, context)
59 async def GetSubchannel(
60 request: _channelz_pb2.GetSubchannelRequest,
61 context: aio.ServicerContext
62 ) -> _channelz_pb2.GetSubchannelResponse:
63 return _SyncChannelzServicer.GetSubchannel(request, context)
67 request: _channelz_pb2.GetSocketRequest,
68 context: aio.ServicerContext) -> _channelz_pb2.GetSocketResponse:
69 return _SyncChannelzServicer.GetSocket(request, context)