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

from . import management_pb2 as management__pb2


class ManagementAPIsServiceStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.DescribeModel = channel.unary_unary(
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/DescribeModel",
            request_serializer=management__pb2.DescribeModelRequest.SerializeToString,
            response_deserializer=management__pb2.ManagementResponse.FromString,
        )
        self.ListModels = channel.unary_unary(
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/ListModels",
            request_serializer=management__pb2.ListModelsRequest.SerializeToString,
            response_deserializer=management__pb2.ManagementResponse.FromString,
        )
        self.RegisterModel = channel.unary_unary(
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/RegisterModel",
            request_serializer=management__pb2.RegisterModelRequest.SerializeToString,
            response_deserializer=management__pb2.ManagementResponse.FromString,
        )
        self.ScaleWorker = channel.unary_unary(
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/ScaleWorker",
            request_serializer=management__pb2.ScaleWorkerRequest.SerializeToString,
            response_deserializer=management__pb2.ManagementResponse.FromString,
        )
        self.SetDefault = channel.unary_unary(
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/SetDefault",
            request_serializer=management__pb2.SetDefaultRequest.SerializeToString,
            response_deserializer=management__pb2.ManagementResponse.FromString,
        )
        self.UnregisterModel = channel.unary_unary(
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/UnregisterModel",
            request_serializer=management__pb2.UnregisterModelRequest.SerializeToString,
            response_deserializer=management__pb2.ManagementResponse.FromString,
        )


class ManagementAPIsServiceServicer(object):
    """Missing associated documentation comment in .proto file."""

    def DescribeModel(self, request, context):
        """Provides detailed information about the default version of a model."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def ListModels(self, request, context):
        """List registered models in TorchServe."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def RegisterModel(self, request, context):
        """Register a new model in TorchServe."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def ScaleWorker(self, request, context):
        """Configure number of workers for a default version of a model.This is a asynchronous call by default. Caller need to call describeModel to check if the model workers has been changed."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def SetDefault(self, request, context):
        """Set default version of a model"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def UnregisterModel(self, request, context):
        """Unregister the default version of a model from TorchServe if it is the only version available.This is a asynchronous call by default. Caller can call listModels to confirm model is unregistered"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_ManagementAPIsServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "DescribeModel": grpc.unary_unary_rpc_method_handler(
            servicer.DescribeModel,
            request_deserializer=management__pb2.DescribeModelRequest.FromString,
            response_serializer=management__pb2.ManagementResponse.SerializeToString,
        ),
        "ListModels": grpc.unary_unary_rpc_method_handler(
            servicer.ListModels,
            request_deserializer=management__pb2.ListModelsRequest.FromString,
            response_serializer=management__pb2.ManagementResponse.SerializeToString,
        ),
        "RegisterModel": grpc.unary_unary_rpc_method_handler(
            servicer.RegisterModel,
            request_deserializer=management__pb2.RegisterModelRequest.FromString,
            response_serializer=management__pb2.ManagementResponse.SerializeToString,
        ),
        "ScaleWorker": grpc.unary_unary_rpc_method_handler(
            servicer.ScaleWorker,
            request_deserializer=management__pb2.ScaleWorkerRequest.FromString,
            response_serializer=management__pb2.ManagementResponse.SerializeToString,
        ),
        "SetDefault": grpc.unary_unary_rpc_method_handler(
            servicer.SetDefault,
            request_deserializer=management__pb2.SetDefaultRequest.FromString,
            response_serializer=management__pb2.ManagementResponse.SerializeToString,
        ),
        "UnregisterModel": grpc.unary_unary_rpc_method_handler(
            servicer.UnregisterModel,
            request_deserializer=management__pb2.UnregisterModelRequest.FromString,
            response_serializer=management__pb2.ManagementResponse.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        "org.pytorch.serve.grpc.management.ManagementAPIsService", rpc_method_handlers
    )
    server.add_generic_rpc_handlers((generic_handler,))


# This class is part of an EXPERIMENTAL API.
class ManagementAPIsService(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def DescribeModel(
        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,
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/DescribeModel",
            management__pb2.DescribeModelRequest.SerializeToString,
            management__pb2.ManagementResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def ListModels(
        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,
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/ListModels",
            management__pb2.ListModelsRequest.SerializeToString,
            management__pb2.ManagementResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def RegisterModel(
        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,
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/RegisterModel",
            management__pb2.RegisterModelRequest.SerializeToString,
            management__pb2.ManagementResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def ScaleWorker(
        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,
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/ScaleWorker",
            management__pb2.ScaleWorkerRequest.SerializeToString,
            management__pb2.ManagementResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def SetDefault(
        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,
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/SetDefault",
            management__pb2.SetDefaultRequest.SerializeToString,
            management__pb2.ManagementResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )

    @staticmethod
    def UnregisterModel(
        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,
            "/org.pytorch.serve.grpc.management.ManagementAPIsService/UnregisterModel",
            management__pb2.UnregisterModelRequest.SerializeToString,
            management__pb2.ManagementResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )
