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

from union.internal.hooks import payload_pb2 as hooks_dot_payload__pb2


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

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

        Args:
            channel: A grpc.Channel.
        """
        self.StreamEvents = channel.unary_stream(
                '/cloudidl.hooks.HooksService/StreamEvents',
                request_serializer=hooks_dot_payload__pb2.StreamEventsRequest.SerializeToString,
                response_deserializer=hooks_dot_payload__pb2.StreamEventsResponse.FromString,
                )
        self.AcknowledgeEvent = channel.unary_unary(
                '/cloudidl.hooks.HooksService/AcknowledgeEvent',
                request_serializer=hooks_dot_payload__pb2.AcknowledgeEventRequest.SerializeToString,
                response_deserializer=hooks_dot_payload__pb2.AcknowledgeEventResponse.FromString,
                )


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

    def StreamEvents(self, request, context):
        """StreamEvents streams execution events for the given tenant. Events use the CloudEvents
        format outlined in https://docs.flyte.org/en/latest/deployment/configuration/cloud_event.html.
        See `StreamEventsResponse` for supported events.

        Events are delivered at least once (or until the internal TTL is reached). Events may be
        spread over parallel streams, and the client(s) should be prepared to handle out-of-order events.
        Events will be resent until acknowledged.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def AcknowledgeEvent(self, request, context):
        """AcknowledgeEvent acknowledges the receipt of an event. Until called, events will be resent.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_HooksServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'StreamEvents': grpc.unary_stream_rpc_method_handler(
                    servicer.StreamEvents,
                    request_deserializer=hooks_dot_payload__pb2.StreamEventsRequest.FromString,
                    response_serializer=hooks_dot_payload__pb2.StreamEventsResponse.SerializeToString,
            ),
            'AcknowledgeEvent': grpc.unary_unary_rpc_method_handler(
                    servicer.AcknowledgeEvent,
                    request_deserializer=hooks_dot_payload__pb2.AcknowledgeEventRequest.FromString,
                    response_serializer=hooks_dot_payload__pb2.AcknowledgeEventResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'cloudidl.hooks.HooksService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


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

    @staticmethod
    def StreamEvents(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_stream(request, target, '/cloudidl.hooks.HooksService/StreamEvents',
            hooks_dot_payload__pb2.StreamEventsRequest.SerializeToString,
            hooks_dot_payload__pb2.StreamEventsResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def AcknowledgeEvent(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, '/cloudidl.hooks.HooksService/AcknowledgeEvent',
            hooks_dot_payload__pb2.AcknowledgeEventRequest.SerializeToString,
            hooks_dot_payload__pb2.AcknowledgeEventResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
