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

from yandex.cloud.cdn.v1 import cache_service_pb2 as yandex_dot_cloud_dot_cdn_dot_v1_dot_cache__service__pb2
from yandex.cloud.operation import operation_pb2 as yandex_dot_cloud_dot_operation_dot_operation__pb2


class CacheServiceStub(object):
    """A set of methods for managing Cache Service resources.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Purge = channel.unary_unary(
                '/yandex.cloud.cdn.v1.CacheService/Purge',
                request_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_cache__service__pb2.PurgeCacheRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
                )
        self.Prefetch = channel.unary_unary(
                '/yandex.cloud.cdn.v1.CacheService/Prefetch',
                request_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_cache__service__pb2.PrefetchCacheRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
                )


class CacheServiceServicer(object):
    """A set of methods for managing Cache Service resources.
    """

    def Purge(self, request, context):
        """Removes specified files from the cache of the specified resource. For details about purging, see [documentation](/docs/cdn/concepts/caching#purge).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Prefetch(self, request, context):
        """Uploads specified files from origins to cache of the specified resource. For defails about prefetching, see [documentation](/docs/cdn/concepts/caching#prefetch).
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_CacheServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Purge': grpc.unary_unary_rpc_method_handler(
                    servicer.Purge,
                    request_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_cache__service__pb2.PurgeCacheRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
            ),
            'Prefetch': grpc.unary_unary_rpc_method_handler(
                    servicer.Prefetch,
                    request_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_cache__service__pb2.PrefetchCacheRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'yandex.cloud.cdn.v1.CacheService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class CacheService(object):
    """A set of methods for managing Cache Service resources.
    """

    @staticmethod
    def Purge(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, '/yandex.cloud.cdn.v1.CacheService/Purge',
            yandex_dot_cloud_dot_cdn_dot_v1_dot_cache__service__pb2.PurgeCacheRequest.SerializeToString,
            yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Prefetch(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, '/yandex.cloud.cdn.v1.CacheService/Prefetch',
            yandex_dot_cloud_dot_cdn_dot_v1_dot_cache__service__pb2.PrefetchCacheRequest.SerializeToString,
            yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
