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

from kaskada.api.v1alpha import credential_pb2 as kaskada_dot_api_dot_v1alpha_dot_credential__pb2


class CredentialServiceStub(object):
    """A service for managing Kaskada API credentials.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.Get = channel.unary_unary(
                '/kaskada.api.v1alpha.CredentialService/Get',
                request_serializer=kaskada_dot_api_dot_v1alpha_dot_credential__pb2.GetCredentialRequest.SerializeToString,
                response_deserializer=kaskada_dot_api_dot_v1alpha_dot_credential__pb2.GetCredentialResponse.FromString,
                )


class CredentialServiceServicer(object):
    """A service for managing Kaskada API credentials.
    """

    def Get(self, request, context):
        """Gets API credentials.

        Credentials can be used to access the Kaskada API using a client
        library or directly using the REST endpoint.

        The returned credentials may be used by providing them to any of the
        Kaskada-maintained client libraries when asked for client-id and
        client-secret.

        The client-id and client-secret may be used independent of a client
        library. To do so you must generate a short-lived JWT bearer token by
        making a POST request as follows:

        curl --request POST \
        --url https://kaskada.us.auth0.com/oauth/token \
        --header 'content-type: application/json' \
        --data
        '{"client_id":"<client-id>","client_secret":"<client-secret>","audience":"https://api.prod.kaskada.com","grant_type":"client_credentials"}'

        If successful, the response body will include a JWT access token:

        {
        "access_token": "<token>",
        "token_type": "Bearer"
        }

        The token grants access to the Kaskada API to any gRPC or HTTP
        request that provides the token in the "Authorization" header /
        metadata:

        curl --request GET \
        --url http://api.kaskada.com/v1alpha/tables/ \
        --header 'authorization: Bearer <token>'

        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_CredentialServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Get': grpc.unary_unary_rpc_method_handler(
                    servicer.Get,
                    request_deserializer=kaskada_dot_api_dot_v1alpha_dot_credential__pb2.GetCredentialRequest.FromString,
                    response_serializer=kaskada_dot_api_dot_v1alpha_dot_credential__pb2.GetCredentialResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'kaskada.api.v1alpha.CredentialService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class CredentialService(object):
    """A service for managing Kaskada API credentials.
    """

    @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, '/kaskada.api.v1alpha.CredentialService/Get',
            kaskada_dot_api_dot_v1alpha_dot_credential__pb2.GetCredentialRequest.SerializeToString,
            kaskada_dot_api_dot_v1alpha_dot_credential__pb2.GetCredentialResponse.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
