# 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 yandex.cloud.cdn.v1 import resource_pb2 as yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__pb2
from yandex.cloud.cdn.v1 import resource_service_pb2 as yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2
from yandex.cloud.operation import operation_pb2 as yandex_dot_cloud_dot_operation_dot_operation__pb2

GRPC_GENERATED_VERSION = '1.70.0'
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 yandex/cloud/cdn/v1/resource_service_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 ResourceServiceStub(object):
    """Provider's resources management service.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Get = channel.unary_unary(
                '/yandex.cloud.cdn.v1.ResourceService/Get',
                request_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.GetResourceRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__pb2.Resource.FromString,
                _registered_method=True)
        self.List = channel.unary_unary(
                '/yandex.cloud.cdn.v1.ResourceService/List',
                request_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.ListResourcesRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.ListResourcesResponse.FromString,
                _registered_method=True)
        self.Create = channel.unary_unary(
                '/yandex.cloud.cdn.v1.ResourceService/Create',
                request_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.CreateResourceRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
                _registered_method=True)
        self.Update = channel.unary_unary(
                '/yandex.cloud.cdn.v1.ResourceService/Update',
                request_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.UpdateResourceRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
                _registered_method=True)
        self.Delete = channel.unary_unary(
                '/yandex.cloud.cdn.v1.ResourceService/Delete',
                request_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.DeleteResourceRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
                _registered_method=True)
        self.GetProviderCName = channel.unary_unary(
                '/yandex.cloud.cdn.v1.ResourceService/GetProviderCName',
                request_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.GetProviderCNameRequest.SerializeToString,
                response_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.GetProviderCNameResponse.FromString,
                _registered_method=True)


class ResourceServiceServicer(object):
    """Provider's resources management service.
    """

    def Get(self, request, context):
        """Get client's CDN resource by resource id.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def List(self, request, context):
        """Lists CDN resources.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Create(self, request, context):
        """Creates a CDN resource in the specified folder.

        Creation may take up to 15 minutes.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Update(self, request, context):
        """Updates the specified CDN resource.

        The method implements patch behaviour, i.e. only the fields specified in the request are updated in the resource.

        Changes may take up to 15 minutes to apply. Afterwards, it is recommended to purge the resource's cache via a
        [CacheService.Purge] request.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Delete(self, request, context):
        """Deletes client's CDN resource.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetProviderCName(self, request, context):
        """Get Provider's CNAME (edge endpoint) bind to specified folder id.
        Returns UNIMPLEMENTED error, if provider doesn't support CNAME request.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ResourceServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Get': grpc.unary_unary_rpc_method_handler(
                    servicer.Get,
                    request_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.GetResourceRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__pb2.Resource.SerializeToString,
            ),
            'List': grpc.unary_unary_rpc_method_handler(
                    servicer.List,
                    request_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.ListResourcesRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.ListResourcesResponse.SerializeToString,
            ),
            'Create': grpc.unary_unary_rpc_method_handler(
                    servicer.Create,
                    request_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.CreateResourceRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
            ),
            'Update': grpc.unary_unary_rpc_method_handler(
                    servicer.Update,
                    request_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.UpdateResourceRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
            ),
            'Delete': grpc.unary_unary_rpc_method_handler(
                    servicer.Delete,
                    request_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.DeleteResourceRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.SerializeToString,
            ),
            'GetProviderCName': grpc.unary_unary_rpc_method_handler(
                    servicer.GetProviderCName,
                    request_deserializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.GetProviderCNameRequest.FromString,
                    response_serializer=yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.GetProviderCNameResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'yandex.cloud.cdn.v1.ResourceService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('yandex.cloud.cdn.v1.ResourceService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class ResourceService(object):
    """Provider's resources management service.
    """

    @staticmethod
    def Get(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.ResourceService/Get',
            yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.GetResourceRequest.SerializeToString,
            yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__pb2.Resource.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def List(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.ResourceService/List',
            yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.ListResourcesRequest.SerializeToString,
            yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.ListResourcesResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Create(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.ResourceService/Create',
            yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.CreateResourceRequest.SerializeToString,
            yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Update(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.ResourceService/Update',
            yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.UpdateResourceRequest.SerializeToString,
            yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.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,
            '/yandex.cloud.cdn.v1.ResourceService/Delete',
            yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.DeleteResourceRequest.SerializeToString,
            yandex_dot_cloud_dot_operation_dot_operation__pb2.Operation.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetProviderCName(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.ResourceService/GetProviderCName',
            yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.GetProviderCNameRequest.SerializeToString,
            yandex_dot_cloud_dot_cdn_dot_v1_dot_resource__service__pb2.GetProviderCNameResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
