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

import hipcheck_pb2 as hipcheck__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 hipcheck_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 PluginServiceStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.GetQuerySchemas = channel.unary_stream(
                '/hipcheck.v1.PluginService/GetQuerySchemas',
                request_serializer=hipcheck__pb2.GetQuerySchemasRequest.SerializeToString,
                response_deserializer=hipcheck__pb2.GetQuerySchemasResponse.FromString,
                _registered_method=True)
        self.SetConfiguration = channel.unary_unary(
                '/hipcheck.v1.PluginService/SetConfiguration',
                request_serializer=hipcheck__pb2.SetConfigurationRequest.SerializeToString,
                response_deserializer=hipcheck__pb2.SetConfigurationResponse.FromString,
                _registered_method=True)
        self.GetDefaultPolicyExpression = channel.unary_unary(
                '/hipcheck.v1.PluginService/GetDefaultPolicyExpression',
                request_serializer=hipcheck__pb2.GetDefaultPolicyExpressionRequest.SerializeToString,
                response_deserializer=hipcheck__pb2.GetDefaultPolicyExpressionResponse.FromString,
                _registered_method=True)
        self.ExplainDefaultQuery = channel.unary_unary(
                '/hipcheck.v1.PluginService/ExplainDefaultQuery',
                request_serializer=hipcheck__pb2.ExplainDefaultQueryRequest.SerializeToString,
                response_deserializer=hipcheck__pb2.ExplainDefaultQueryResponse.FromString,
                _registered_method=True)
        self.InitiateQueryProtocol = channel.stream_stream(
                '/hipcheck.v1.PluginService/InitiateQueryProtocol',
                request_serializer=hipcheck__pb2.InitiateQueryProtocolRequest.SerializeToString,
                response_deserializer=hipcheck__pb2.InitiateQueryProtocolResponse.FromString,
                _registered_method=True)


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

    def GetQuerySchemas(self, request, context):
        """*
        Get schemas for all supported queries by the plugin.

        This is used by Hipcheck to validate that:

        - The plugin supports a default query taking a `target` type if used
        as a top-level plugin in the user's policy file.
        - That requests sent to the plugin and data returned by the plugin
        match the schema during execution.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SetConfiguration(self, request, context):
        """*
        Hipcheck sends all child nodes for the plugin from the user's policy
        file to configure the plugin.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetDefaultPolicyExpression(self, request, context):
        """*
        Get the default policy for a plugin, which may additionally depend on
        the plugin's configuration.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ExplainDefaultQuery(self, request, context):
        """*
        Get an explanation of what the default query returns, to use when
        reporting analysis results to users.

        Note that, because users can specify their own policy expression, this
        explanation *should not* assume the user has used the default policy
        expression, if one is provided by the plugin.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def InitiateQueryProtocol(self, request_iterator, context):
        """*
        Open a bidirectional streaming RPC to enable a request/response
        protocol between Hipcheck and a plugin, where Hipcheck can issue
        queries to the plugin, and the plugin may issue queries to _other_
        plugins through Hipcheck.

        Queries are cached by the publisher name, plugin name, query name,
        and key, and if a match is found for those four values, then
        Hipcheck will respond with the cached result of that prior matching
        query rather than running the query again.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_PluginServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'GetQuerySchemas': grpc.unary_stream_rpc_method_handler(
                    servicer.GetQuerySchemas,
                    request_deserializer=hipcheck__pb2.GetQuerySchemasRequest.FromString,
                    response_serializer=hipcheck__pb2.GetQuerySchemasResponse.SerializeToString,
            ),
            'SetConfiguration': grpc.unary_unary_rpc_method_handler(
                    servicer.SetConfiguration,
                    request_deserializer=hipcheck__pb2.SetConfigurationRequest.FromString,
                    response_serializer=hipcheck__pb2.SetConfigurationResponse.SerializeToString,
            ),
            'GetDefaultPolicyExpression': grpc.unary_unary_rpc_method_handler(
                    servicer.GetDefaultPolicyExpression,
                    request_deserializer=hipcheck__pb2.GetDefaultPolicyExpressionRequest.FromString,
                    response_serializer=hipcheck__pb2.GetDefaultPolicyExpressionResponse.SerializeToString,
            ),
            'ExplainDefaultQuery': grpc.unary_unary_rpc_method_handler(
                    servicer.ExplainDefaultQuery,
                    request_deserializer=hipcheck__pb2.ExplainDefaultQueryRequest.FromString,
                    response_serializer=hipcheck__pb2.ExplainDefaultQueryResponse.SerializeToString,
            ),
            'InitiateQueryProtocol': grpc.stream_stream_rpc_method_handler(
                    servicer.InitiateQueryProtocol,
                    request_deserializer=hipcheck__pb2.InitiateQueryProtocolRequest.FromString,
                    response_serializer=hipcheck__pb2.InitiateQueryProtocolResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'hipcheck.v1.PluginService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('hipcheck.v1.PluginService', rpc_method_handlers)


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

    @staticmethod
    def GetQuerySchemas(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,
            '/hipcheck.v1.PluginService/GetQuerySchemas',
            hipcheck__pb2.GetQuerySchemasRequest.SerializeToString,
            hipcheck__pb2.GetQuerySchemasResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SetConfiguration(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,
            '/hipcheck.v1.PluginService/SetConfiguration',
            hipcheck__pb2.SetConfigurationRequest.SerializeToString,
            hipcheck__pb2.SetConfigurationResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetDefaultPolicyExpression(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,
            '/hipcheck.v1.PluginService/GetDefaultPolicyExpression',
            hipcheck__pb2.GetDefaultPolicyExpressionRequest.SerializeToString,
            hipcheck__pb2.GetDefaultPolicyExpressionResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ExplainDefaultQuery(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,
            '/hipcheck.v1.PluginService/ExplainDefaultQuery',
            hipcheck__pb2.ExplainDefaultQueryRequest.SerializeToString,
            hipcheck__pb2.ExplainDefaultQueryResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def InitiateQueryProtocol(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(
            request_iterator,
            target,
            '/hipcheck.v1.PluginService/InitiateQueryProtocol',
            hipcheck__pb2.InitiateQueryProtocolRequest.SerializeToString,
            hipcheck__pb2.InitiateQueryProtocolResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
