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

from chromiumos.longrunning import operations_pb2 as chromiumos_dot_longrunning_dot_operations__pb2
from chromiumos.test.api import publish_service_pb2 as chromiumos_dot_test_dot_api_dot_publish__service__pb2


class PublishServiceStub(object):
    """Provides the ability to upload files to GS and publish results.
    Publishing and upload require a more complex workflow than simple
    file copy, and as such we require a service to simplify.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.UploadToGS = channel.unary_unary(
                '/chromiumos.test.api.PublishService/UploadToGS',
                request_serializer=chromiumos_dot_test_dot_api_dot_publish__service__pb2.UploadToGSRequest.SerializeToString,
                response_deserializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString,
                )


class PublishServiceServicer(object):
    """Provides the ability to upload files to GS and publish results.
    Publishing and upload require a more complex workflow than simple
    file copy, and as such we require a service to simplify.
    """

    def UploadToGS(self, request, context):
        """UploadToGS uploads a folder to Google Cloud Storage

        Effectively this should function as a thin wrapper around the GCS API.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_PublishServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'UploadToGS': grpc.unary_unary_rpc_method_handler(
                    servicer.UploadToGS,
                    request_deserializer=chromiumos_dot_test_dot_api_dot_publish__service__pb2.UploadToGSRequest.FromString,
                    response_serializer=chromiumos_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'chromiumos.test.api.PublishService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class PublishService(object):
    """Provides the ability to upload files to GS and publish results.
    Publishing and upload require a more complex workflow than simple
    file copy, and as such we require a service to simplify.
    """

    @staticmethod
    def UploadToGS(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, '/chromiumos.test.api.PublishService/UploadToGS',
            chromiumos_dot_test_dot_api_dot_publish__service__pb2.UploadToGSRequest.SerializeToString,
            chromiumos_dot_longrunning_dot_operations__pb2.Operation.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
