Module pachyderm_sdk.api.enterprise

Expand source code
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# sources: api/enterprise/enterprise.proto
# plugin: python-betterproto
# This file has been @generated
from dataclasses import dataclass
from datetime import datetime
from typing import (
    TYPE_CHECKING,
    Dict,
    Optional,
)

import betterproto
import betterproto.lib.google.protobuf as betterproto_lib_google_protobuf
import grpc


if TYPE_CHECKING:
    import grpc


class State(betterproto.Enum):
    NONE = 0
    ACTIVE = 1
    EXPIRED = 2
    HEARTBEAT_FAILED = 3


class PauseStatusResponsePauseStatus(betterproto.Enum):
    UNPAUSED = 0
    PARTIALLY_PAUSED = 1
    PAUSED = 2


@dataclass(eq=False, repr=False)
class LicenseRecord(betterproto.Message):
    """
    LicenseRecord is the record we store in etcd for a Pachyderm enterprise
    token that has been provided to a Pachyderm license server
    """

    activation_code: str = betterproto.string_field(1)
    expires: datetime = betterproto.message_field(2)


@dataclass(eq=False, repr=False)
class EnterpriseConfig(betterproto.Message):
    """
    EnterpriseConfig is the configuration we store for heartbeating to the
    license server.
    """

    license_server: str = betterproto.string_field(1)
    """license_server is the address of the grpc license service"""

    id: str = betterproto.string_field(2)
    """
    id is the unique identifier for this pachd, which is registered with the
    license service
    """

    secret: str = betterproto.string_field(3)
    """secret is a shared secret between this pachd and the license service"""


@dataclass(eq=False, repr=False)
class EnterpriseRecord(betterproto.Message):
    """
    EnterpriseRecord is a protobuf we cache in etcd to store the enterprise
    status.
    """

    license: "LicenseRecord" = betterproto.message_field(1)
    """
    license is the cached LicenseRecord retrieved from the most recent
    heartbeat to the license server.
    """

    last_heartbeat: datetime = betterproto.message_field(2)
    """
    last_heartbeat is the timestamp of the last successful heartbeat to the
    license server
    """

    heartbeat_failed: bool = betterproto.bool_field(3)
    """
    heartbeat_failed is set if the license is still valid, but the pachd is no
    longer registered with an enterprise server. This is the same as the
    expired state, where auth is locked but not disabled.
    """


@dataclass(eq=False, repr=False)
class TokenInfo(betterproto.Message):
    """
    TokenInfo contains information about the currently active enterprise token
    """

    expires: datetime = betterproto.message_field(1)
    """
    expires indicates when the current token expires (unset if there is no
    current token)
    """


@dataclass(eq=False, repr=False)
class ActivateRequest(betterproto.Message):
    license_server: str = betterproto.string_field(1)
    id: str = betterproto.string_field(2)
    secret: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class ActivateResponse(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class GetStateRequest(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class GetStateResponse(betterproto.Message):
    state: "State" = betterproto.enum_field(1)
    info: "TokenInfo" = betterproto.message_field(2)
    activation_code: str = betterproto.string_field(3)
    """
    activation_code will always be an empty string, call GetEnterpriseCode to
    get the activation code
    """


@dataclass(eq=False, repr=False)
class GetActivationCodeRequest(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class GetActivationCodeResponse(betterproto.Message):
    state: "State" = betterproto.enum_field(1)
    info: "TokenInfo" = betterproto.message_field(2)
    activation_code: str = betterproto.string_field(3)


@dataclass(eq=False, repr=False)
class HeartbeatRequest(betterproto.Message):
    """
    Heartbeat in the enterprise service just triggers a heartbeat for testing
    purposes. The RPC used to communicate with the license service is defined
    in the license service.
    """

    pass


@dataclass(eq=False, repr=False)
class HeartbeatResponse(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class DeactivateRequest(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class DeactivateResponse(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class PauseRequest(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class PauseResponse(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class UnpauseRequest(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class UnpauseResponse(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class PauseStatusRequest(betterproto.Message):
    pass


@dataclass(eq=False, repr=False)
class PauseStatusResponse(betterproto.Message):
    status: "PauseStatusResponsePauseStatus" = betterproto.enum_field(1)


class ApiStub:

    def __init__(self, channel: "grpc.Channel"):
        self.__rpc_activate = channel.unary_unary(
            "/enterprise_v2.API/Activate",
            request_serializer=ActivateRequest.SerializeToString,
            response_deserializer=ActivateResponse.FromString,
        )
        self.__rpc_get_state = channel.unary_unary(
            "/enterprise_v2.API/GetState",
            request_serializer=GetStateRequest.SerializeToString,
            response_deserializer=GetStateResponse.FromString,
        )
        self.__rpc_get_activation_code = channel.unary_unary(
            "/enterprise_v2.API/GetActivationCode",
            request_serializer=GetActivationCodeRequest.SerializeToString,
            response_deserializer=GetActivationCodeResponse.FromString,
        )
        self.__rpc_heartbeat = channel.unary_unary(
            "/enterprise_v2.API/Heartbeat",
            request_serializer=HeartbeatRequest.SerializeToString,
            response_deserializer=HeartbeatResponse.FromString,
        )
        self.__rpc_deactivate = channel.unary_unary(
            "/enterprise_v2.API/Deactivate",
            request_serializer=DeactivateRequest.SerializeToString,
            response_deserializer=DeactivateResponse.FromString,
        )
        self.__rpc_pause = channel.unary_unary(
            "/enterprise_v2.API/Pause",
            request_serializer=PauseRequest.SerializeToString,
            response_deserializer=PauseResponse.FromString,
        )
        self.__rpc_unpause = channel.unary_unary(
            "/enterprise_v2.API/Unpause",
            request_serializer=UnpauseRequest.SerializeToString,
            response_deserializer=UnpauseResponse.FromString,
        )
        self.__rpc_pause_status = channel.unary_unary(
            "/enterprise_v2.API/PauseStatus",
            request_serializer=PauseStatusRequest.SerializeToString,
            response_deserializer=PauseStatusResponse.FromString,
        )

    def activate(
        self, *, license_server: str = "", id: str = "", secret: str = ""
    ) -> "ActivateResponse":

        request = ActivateRequest()
        request.license_server = license_server
        request.id = id
        request.secret = secret

        return self.__rpc_activate(request)

    def get_state(self) -> "GetStateResponse":

        request = GetStateRequest()

        return self.__rpc_get_state(request)

    def get_activation_code(self) -> "GetActivationCodeResponse":

        request = GetActivationCodeRequest()

        return self.__rpc_get_activation_code(request)

    def heartbeat(self) -> "HeartbeatResponse":

        request = HeartbeatRequest()

        return self.__rpc_heartbeat(request)

    def deactivate(self) -> "DeactivateResponse":

        request = DeactivateRequest()

        return self.__rpc_deactivate(request)

    def pause(self) -> "PauseResponse":

        request = PauseRequest()

        return self.__rpc_pause(request)

    def unpause(self) -> "UnpauseResponse":

        request = UnpauseRequest()

        return self.__rpc_unpause(request)

    def pause_status(self) -> "PauseStatusResponse":

        request = PauseStatusRequest()

        return self.__rpc_pause_status(request)

Classes

class State (*args, **kwds)

The base class for protobuf enumerations, all generated enumerations will inherit from this. Bases :class:enum.IntEnum.

Expand source code
class State(betterproto.Enum):
    NONE = 0
    ACTIVE = 1
    EXPIRED = 2
    HEARTBEAT_FAILED = 3

Ancestors

  • betterproto.Enum
  • enum.IntEnum
  • builtins.int
  • enum.ReprEnum
  • enum.Enum

Class variables

var NONE
var ACTIVE
var EXPIRED
var HEARTBEAT_FAILED
class PauseStatusResponsePauseStatus (*args, **kwds)

The base class for protobuf enumerations, all generated enumerations will inherit from this. Bases :class:enum.IntEnum.

Expand source code
class PauseStatusResponsePauseStatus(betterproto.Enum):
    UNPAUSED = 0
    PARTIALLY_PAUSED = 1
    PAUSED = 2

Ancestors

  • betterproto.Enum
  • enum.IntEnum
  • builtins.int
  • enum.ReprEnum
  • enum.Enum

Class variables

var UNPAUSED
var PARTIALLY_PAUSED
var PAUSED
class LicenseRecord (activation_code: str = None, expires: datetime.datetime = None)

LicenseRecord is the record we store in etcd for a Pachyderm enterprise token that has been provided to a Pachyderm license server

Expand source code
@dataclass(eq=False, repr=False)
class LicenseRecord(betterproto.Message):
    """
    LicenseRecord is the record we store in etcd for a Pachyderm enterprise
    token that has been provided to a Pachyderm license server
    """

    activation_code: str = betterproto.string_field(1)
    expires: datetime = betterproto.message_field(2)

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var activation_code : str
var expires : datetime.datetime
class EnterpriseConfig (license_server: str = None, id: str = None, secret: str = None)

EnterpriseConfig is the configuration we store for heartbeating to the license server.

Expand source code
@dataclass(eq=False, repr=False)
class EnterpriseConfig(betterproto.Message):
    """
    EnterpriseConfig is the configuration we store for heartbeating to the
    license server.
    """

    license_server: str = betterproto.string_field(1)
    """license_server is the address of the grpc license service"""

    id: str = betterproto.string_field(2)
    """
    id is the unique identifier for this pachd, which is registered with the
    license service
    """

    secret: str = betterproto.string_field(3)
    """secret is a shared secret between this pachd and the license service"""

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var license_server : str

license_server is the address of the grpc license service

var id : str

id is the unique identifier for this pachd, which is registered with the license service

var secret : str

secret is a shared secret between this pachd and the license service

class EnterpriseRecord (license: LicenseRecord = None, last_heartbeat: datetime.datetime = None, heartbeat_failed: bool = None)

EnterpriseRecord is a protobuf we cache in etcd to store the enterprise status.

Expand source code
@dataclass(eq=False, repr=False)
class EnterpriseRecord(betterproto.Message):
    """
    EnterpriseRecord is a protobuf we cache in etcd to store the enterprise
    status.
    """

    license: "LicenseRecord" = betterproto.message_field(1)
    """
    license is the cached LicenseRecord retrieved from the most recent
    heartbeat to the license server.
    """

    last_heartbeat: datetime = betterproto.message_field(2)
    """
    last_heartbeat is the timestamp of the last successful heartbeat to the
    license server
    """

    heartbeat_failed: bool = betterproto.bool_field(3)
    """
    heartbeat_failed is set if the license is still valid, but the pachd is no
    longer registered with an enterprise server. This is the same as the
    expired state, where auth is locked but not disabled.
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var licenseLicenseRecord

license is the cached LicenseRecord retrieved from the most recent heartbeat to the license server.

var last_heartbeat : datetime.datetime

last_heartbeat is the timestamp of the last successful heartbeat to the license server

var heartbeat_failed : bool

heartbeat_failed is set if the license is still valid, but the pachd is no longer registered with an enterprise server. This is the same as the expired state, where auth is locked but not disabled.

class TokenInfo (expires: datetime.datetime = None)

TokenInfo contains information about the currently active enterprise token

Expand source code
@dataclass(eq=False, repr=False)
class TokenInfo(betterproto.Message):
    """
    TokenInfo contains information about the currently active enterprise token
    """

    expires: datetime = betterproto.message_field(1)
    """
    expires indicates when the current token expires (unset if there is no
    current token)
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var expires : datetime.datetime

expires indicates when the current token expires (unset if there is no current token)

class ActivateRequest (license_server: str = None, id: str = None, secret: str = None)

ActivateRequest(license_server: str = None, id: str = None, secret: str = None)

Expand source code
@dataclass(eq=False, repr=False)
class ActivateRequest(betterproto.Message):
    license_server: str = betterproto.string_field(1)
    id: str = betterproto.string_field(2)
    secret: str = betterproto.string_field(3)

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var license_server : str
var id : str
var secret : str
class ActivateResponse

ActivateResponse()

Expand source code
@dataclass(eq=False, repr=False)
class ActivateResponse(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class GetStateRequest

GetStateRequest()

Expand source code
@dataclass(eq=False, repr=False)
class GetStateRequest(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class GetStateResponse (state: State = None, info: TokenInfo = None, activation_code: str = None)

GetStateResponse(state: 'State' = None, info: 'TokenInfo' = None, activation_code: str = None)

Expand source code
@dataclass(eq=False, repr=False)
class GetStateResponse(betterproto.Message):
    state: "State" = betterproto.enum_field(1)
    info: "TokenInfo" = betterproto.message_field(2)
    activation_code: str = betterproto.string_field(3)
    """
    activation_code will always be an empty string, call GetEnterpriseCode to
    get the activation code
    """

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var stateState
var infoTokenInfo
var activation_code : str

activation_code will always be an empty string, call GetEnterpriseCode to get the activation code

class GetActivationCodeRequest

GetActivationCodeRequest()

Expand source code
@dataclass(eq=False, repr=False)
class GetActivationCodeRequest(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class GetActivationCodeResponse (state: State = None, info: TokenInfo = None, activation_code: str = None)

GetActivationCodeResponse(state: 'State' = None, info: 'TokenInfo' = None, activation_code: str = None)

Expand source code
@dataclass(eq=False, repr=False)
class GetActivationCodeResponse(betterproto.Message):
    state: "State" = betterproto.enum_field(1)
    info: "TokenInfo" = betterproto.message_field(2)
    activation_code: str = betterproto.string_field(3)

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var stateState
var infoTokenInfo
var activation_code : str
class HeartbeatRequest

Heartbeat in the enterprise service just triggers a heartbeat for testing purposes. The RPC used to communicate with the license service is defined in the license service.

Expand source code
@dataclass(eq=False, repr=False)
class HeartbeatRequest(betterproto.Message):
    """
    Heartbeat in the enterprise service just triggers a heartbeat for testing
    purposes. The RPC used to communicate with the license service is defined
    in the license service.
    """

    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class HeartbeatResponse

HeartbeatResponse()

Expand source code
@dataclass(eq=False, repr=False)
class HeartbeatResponse(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class DeactivateRequest

DeactivateRequest()

Expand source code
@dataclass(eq=False, repr=False)
class DeactivateRequest(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class DeactivateResponse

DeactivateResponse()

Expand source code
@dataclass(eq=False, repr=False)
class DeactivateResponse(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class PauseRequest

PauseRequest()

Expand source code
@dataclass(eq=False, repr=False)
class PauseRequest(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class PauseResponse

PauseResponse()

Expand source code
@dataclass(eq=False, repr=False)
class PauseResponse(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class UnpauseRequest

UnpauseRequest()

Expand source code
@dataclass(eq=False, repr=False)
class UnpauseRequest(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class UnpauseResponse

UnpauseResponse()

Expand source code
@dataclass(eq=False, repr=False)
class UnpauseResponse(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class PauseStatusRequest

PauseStatusRequest()

Expand source code
@dataclass(eq=False, repr=False)
class PauseStatusRequest(betterproto.Message):
    pass

Ancestors

  • betterproto.Message
  • abc.ABC
class PauseStatusResponse (status: PauseStatusResponsePauseStatus = None)

PauseStatusResponse(status: 'PauseStatusResponsePauseStatus' = None)

Expand source code
@dataclass(eq=False, repr=False)
class PauseStatusResponse(betterproto.Message):
    status: "PauseStatusResponsePauseStatus" = betterproto.enum_field(1)

Ancestors

  • betterproto.Message
  • abc.ABC

Class variables

var statusPauseStatusResponsePauseStatus
class ApiStub (channel: grpc.Channel)
Expand source code
class ApiStub:

    def __init__(self, channel: "grpc.Channel"):
        self.__rpc_activate = channel.unary_unary(
            "/enterprise_v2.API/Activate",
            request_serializer=ActivateRequest.SerializeToString,
            response_deserializer=ActivateResponse.FromString,
        )
        self.__rpc_get_state = channel.unary_unary(
            "/enterprise_v2.API/GetState",
            request_serializer=GetStateRequest.SerializeToString,
            response_deserializer=GetStateResponse.FromString,
        )
        self.__rpc_get_activation_code = channel.unary_unary(
            "/enterprise_v2.API/GetActivationCode",
            request_serializer=GetActivationCodeRequest.SerializeToString,
            response_deserializer=GetActivationCodeResponse.FromString,
        )
        self.__rpc_heartbeat = channel.unary_unary(
            "/enterprise_v2.API/Heartbeat",
            request_serializer=HeartbeatRequest.SerializeToString,
            response_deserializer=HeartbeatResponse.FromString,
        )
        self.__rpc_deactivate = channel.unary_unary(
            "/enterprise_v2.API/Deactivate",
            request_serializer=DeactivateRequest.SerializeToString,
            response_deserializer=DeactivateResponse.FromString,
        )
        self.__rpc_pause = channel.unary_unary(
            "/enterprise_v2.API/Pause",
            request_serializer=PauseRequest.SerializeToString,
            response_deserializer=PauseResponse.FromString,
        )
        self.__rpc_unpause = channel.unary_unary(
            "/enterprise_v2.API/Unpause",
            request_serializer=UnpauseRequest.SerializeToString,
            response_deserializer=UnpauseResponse.FromString,
        )
        self.__rpc_pause_status = channel.unary_unary(
            "/enterprise_v2.API/PauseStatus",
            request_serializer=PauseStatusRequest.SerializeToString,
            response_deserializer=PauseStatusResponse.FromString,
        )

    def activate(
        self, *, license_server: str = "", id: str = "", secret: str = ""
    ) -> "ActivateResponse":

        request = ActivateRequest()
        request.license_server = license_server
        request.id = id
        request.secret = secret

        return self.__rpc_activate(request)

    def get_state(self) -> "GetStateResponse":

        request = GetStateRequest()

        return self.__rpc_get_state(request)

    def get_activation_code(self) -> "GetActivationCodeResponse":

        request = GetActivationCodeRequest()

        return self.__rpc_get_activation_code(request)

    def heartbeat(self) -> "HeartbeatResponse":

        request = HeartbeatRequest()

        return self.__rpc_heartbeat(request)

    def deactivate(self) -> "DeactivateResponse":

        request = DeactivateRequest()

        return self.__rpc_deactivate(request)

    def pause(self) -> "PauseResponse":

        request = PauseRequest()

        return self.__rpc_pause(request)

    def unpause(self) -> "UnpauseResponse":

        request = UnpauseRequest()

        return self.__rpc_unpause(request)

    def pause_status(self) -> "PauseStatusResponse":

        request = PauseStatusRequest()

        return self.__rpc_pause_status(request)

Methods

def activate(self, *, license_server: str = '', id: str = '', secret: str = '') ‑> ActivateResponse
Expand source code
def activate(
    self, *, license_server: str = "", id: str = "", secret: str = ""
) -> "ActivateResponse":

    request = ActivateRequest()
    request.license_server = license_server
    request.id = id
    request.secret = secret

    return self.__rpc_activate(request)
def get_state(self) ‑> GetStateResponse
Expand source code
def get_state(self) -> "GetStateResponse":

    request = GetStateRequest()

    return self.__rpc_get_state(request)
def get_activation_code(self) ‑> GetActivationCodeResponse
Expand source code
def get_activation_code(self) -> "GetActivationCodeResponse":

    request = GetActivationCodeRequest()

    return self.__rpc_get_activation_code(request)
def heartbeat(self) ‑> HeartbeatResponse
Expand source code
def heartbeat(self) -> "HeartbeatResponse":

    request = HeartbeatRequest()

    return self.__rpc_heartbeat(request)
def deactivate(self) ‑> DeactivateResponse
Expand source code
def deactivate(self) -> "DeactivateResponse":

    request = DeactivateRequest()

    return self.__rpc_deactivate(request)
def pause(self) ‑> PauseResponse
Expand source code
def pause(self) -> "PauseResponse":

    request = PauseRequest()

    return self.__rpc_pause(request)
def unpause(self) ‑> UnpauseResponse
Expand source code
def unpause(self) -> "UnpauseResponse":

    request = UnpauseRequest()

    return self.__rpc_unpause(request)
def pause_status(self) ‑> PauseStatusResponse
Expand source code
def pause_status(self) -> "PauseStatusResponse":

    request = PauseStatusRequest()

    return self.__rpc_pause_status(request)