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

from sdk.gen.storage.v2 import storage_pb2 as storage_dot_v2_dot_storage__pb2

GRPC_GENERATED_VERSION = '1.73.1'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in storage/v2/storage_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class StorageStub(object):
    """Services for storage and retrieval of blobs in the form of byte arrays, such as text and binary blobs.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Read = channel.unary_unary(
                '/nitric.proto.storage.v2.Storage/Read',
                request_serializer=storage_dot_v2_dot_storage__pb2.StorageReadRequest.SerializeToString,
                response_deserializer=storage_dot_v2_dot_storage__pb2.StorageReadResponse.FromString,
                _registered_method=True)
        self.Write = channel.unary_unary(
                '/nitric.proto.storage.v2.Storage/Write',
                request_serializer=storage_dot_v2_dot_storage__pb2.StorageWriteRequest.SerializeToString,
                response_deserializer=storage_dot_v2_dot_storage__pb2.StorageWriteResponse.FromString,
                _registered_method=True)
        self.Delete = channel.unary_unary(
                '/nitric.proto.storage.v2.Storage/Delete',
                request_serializer=storage_dot_v2_dot_storage__pb2.StorageDeleteRequest.SerializeToString,
                response_deserializer=storage_dot_v2_dot_storage__pb2.StorageDeleteResponse.FromString,
                _registered_method=True)
        self.PreSignUrl = channel.unary_unary(
                '/nitric.proto.storage.v2.Storage/PreSignUrl',
                request_serializer=storage_dot_v2_dot_storage__pb2.StoragePreSignUrlRequest.SerializeToString,
                response_deserializer=storage_dot_v2_dot_storage__pb2.StoragePreSignUrlResponse.FromString,
                _registered_method=True)
        self.ListBlobs = channel.unary_unary(
                '/nitric.proto.storage.v2.Storage/ListBlobs',
                request_serializer=storage_dot_v2_dot_storage__pb2.StorageListBlobsRequest.SerializeToString,
                response_deserializer=storage_dot_v2_dot_storage__pb2.StorageListBlobsResponse.FromString,
                _registered_method=True)
        self.Exists = channel.unary_unary(
                '/nitric.proto.storage.v2.Storage/Exists',
                request_serializer=storage_dot_v2_dot_storage__pb2.StorageExistsRequest.SerializeToString,
                response_deserializer=storage_dot_v2_dot_storage__pb2.StorageExistsResponse.FromString,
                _registered_method=True)


class StorageServicer(object):
    """Services for storage and retrieval of blobs in the form of byte arrays, such as text and binary blobs.
    """

    def Read(self, request, context):
        """Retrieve an item from a bucket
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Write(self, request, context):
        """Store an item to a bucket
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Delete(self, request, context):
        """Delete an item from a bucket
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def PreSignUrl(self, request, context):
        """Generate a pre-signed URL for direct operations on an item
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ListBlobs(self, request, context):
        """List blobs currently in the bucket
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Exists(self, request, context):
        """Determine is an object exists in a bucket
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_StorageServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Read': grpc.unary_unary_rpc_method_handler(
                    servicer.Read,
                    request_deserializer=storage_dot_v2_dot_storage__pb2.StorageReadRequest.FromString,
                    response_serializer=storage_dot_v2_dot_storage__pb2.StorageReadResponse.SerializeToString,
            ),
            'Write': grpc.unary_unary_rpc_method_handler(
                    servicer.Write,
                    request_deserializer=storage_dot_v2_dot_storage__pb2.StorageWriteRequest.FromString,
                    response_serializer=storage_dot_v2_dot_storage__pb2.StorageWriteResponse.SerializeToString,
            ),
            'Delete': grpc.unary_unary_rpc_method_handler(
                    servicer.Delete,
                    request_deserializer=storage_dot_v2_dot_storage__pb2.StorageDeleteRequest.FromString,
                    response_serializer=storage_dot_v2_dot_storage__pb2.StorageDeleteResponse.SerializeToString,
            ),
            'PreSignUrl': grpc.unary_unary_rpc_method_handler(
                    servicer.PreSignUrl,
                    request_deserializer=storage_dot_v2_dot_storage__pb2.StoragePreSignUrlRequest.FromString,
                    response_serializer=storage_dot_v2_dot_storage__pb2.StoragePreSignUrlResponse.SerializeToString,
            ),
            'ListBlobs': grpc.unary_unary_rpc_method_handler(
                    servicer.ListBlobs,
                    request_deserializer=storage_dot_v2_dot_storage__pb2.StorageListBlobsRequest.FromString,
                    response_serializer=storage_dot_v2_dot_storage__pb2.StorageListBlobsResponse.SerializeToString,
            ),
            'Exists': grpc.unary_unary_rpc_method_handler(
                    servicer.Exists,
                    request_deserializer=storage_dot_v2_dot_storage__pb2.StorageExistsRequest.FromString,
                    response_serializer=storage_dot_v2_dot_storage__pb2.StorageExistsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'nitric.proto.storage.v2.Storage', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('nitric.proto.storage.v2.Storage', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class Storage(object):
    """Services for storage and retrieval of blobs in the form of byte arrays, such as text and binary blobs.
    """

    @staticmethod
    def Read(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,
            '/nitric.proto.storage.v2.Storage/Read',
            storage_dot_v2_dot_storage__pb2.StorageReadRequest.SerializeToString,
            storage_dot_v2_dot_storage__pb2.StorageReadResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Write(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,
            '/nitric.proto.storage.v2.Storage/Write',
            storage_dot_v2_dot_storage__pb2.StorageWriteRequest.SerializeToString,
            storage_dot_v2_dot_storage__pb2.StorageWriteResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Delete(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,
            '/nitric.proto.storage.v2.Storage/Delete',
            storage_dot_v2_dot_storage__pb2.StorageDeleteRequest.SerializeToString,
            storage_dot_v2_dot_storage__pb2.StorageDeleteResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def PreSignUrl(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,
            '/nitric.proto.storage.v2.Storage/PreSignUrl',
            storage_dot_v2_dot_storage__pb2.StoragePreSignUrlRequest.SerializeToString,
            storage_dot_v2_dot_storage__pb2.StoragePreSignUrlResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListBlobs(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,
            '/nitric.proto.storage.v2.Storage/ListBlobs',
            storage_dot_v2_dot_storage__pb2.StorageListBlobsRequest.SerializeToString,
            storage_dot_v2_dot_storage__pb2.StorageListBlobsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Exists(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,
            '/nitric.proto.storage.v2.Storage/Exists',
            storage_dot_v2_dot_storage__pb2.StorageExistsRequest.SerializeToString,
            storage_dot_v2_dot_storage__pb2.StorageExistsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
