# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from ..common import Common_pb2 as common_dot_Common__pb2
from ..language_agent import ConfigurationDiscoveryService_pb2 as language__agent_dot_ConfigurationDiscoveryService__pb2


class ConfigurationDiscoveryServiceStub(object):
    """Fetch the latest dynamic configurations of the service.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.fetchConfigurations = channel.unary_unary(
                '/skywalking.v3.ConfigurationDiscoveryService/fetchConfigurations',
                request_serializer=language__agent_dot_ConfigurationDiscoveryService__pb2.ConfigurationSyncRequest.SerializeToString,
                response_deserializer=common_dot_Common__pb2.Commands.FromString,
                )


class ConfigurationDiscoveryServiceServicer(object):
    """Fetch the latest dynamic configurations of the service.
    """

    def fetchConfigurations(self, request, context):
        """fetchConfigurations service requests the latest configuration.
        Expect command of Commands is:
        command: CDS # meaning ConfigurationDiscoveryService's response
        args: Include string key and string value pair.
        The key depends on the agent implementation.
        The value is the latest value in String value. The watcher of key owner takes the responsibility to convert it to the correct type or format.
        One reserved key is `UUID`. The value would help reducing the traffic load between agent and OAP if there is no change.
        Commands could be empty if no change detected based on ConfigurationSyncRequest.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ConfigurationDiscoveryServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'fetchConfigurations': grpc.unary_unary_rpc_method_handler(
                    servicer.fetchConfigurations,
                    request_deserializer=language__agent_dot_ConfigurationDiscoveryService__pb2.ConfigurationSyncRequest.FromString,
                    response_serializer=common_dot_Common__pb2.Commands.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'skywalking.v3.ConfigurationDiscoveryService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class ConfigurationDiscoveryService(object):
    """Fetch the latest dynamic configurations of the service.
    """

    @staticmethod
    def fetchConfigurations(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, '/skywalking.v3.ConfigurationDiscoveryService/fetchConfigurations',
            language__agent_dot_ConfigurationDiscoveryService__pb2.ConfigurationSyncRequest.SerializeToString,
            common_dot_Common__pb2.Commands.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
