1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Enterprise data structures

/// EnterpriseRecord is the record we store in etcd for a Pachyderm enterprise
/// token that has been provided to a Pachyderm cluster
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnterpriseRecord {
    #[prost(string, tag="1")]
    pub activation_code: std::string::String,
    /// expires is a timestamp indicating when this activation code will expire.
    #[prost(message, optional, tag="2")]
    pub expires: ::std::option::Option<::prost_types::Timestamp>,
}
//// Enterprise Activation API

/// TokenInfo contains information about the currently active enterprise token
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TokenInfo {
    /// expires indicates when the current token expires (unset if there is no
    /// current token)
    #[prost(message, optional, tag="1")]
    pub expires: ::std::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ActivateRequest {
    /// activation_code is a Pachyderm enterprise activation code. New users can
    /// obtain trial activation codes
    #[prost(string, tag="1")]
    pub activation_code: std::string::String,
    /// expires is a timestamp indicating when this activation code will expire.
    /// This should not generally be set (it's primarily used for testing), and is
    /// only applied if it's earlier than the signed expiration time in
    /// 'activation_code'.
    #[prost(message, optional, tag="2")]
    pub expires: ::std::option::Option<::prost_types::Timestamp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ActivateResponse {
    #[prost(message, optional, tag="1")]
    pub info: ::std::option::Option<TokenInfo>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetStateRequest {
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetStateResponse {
    #[prost(enumeration="State", tag="1")]
    pub state: i32,
    #[prost(message, optional, tag="2")]
    pub info: ::std::option::Option<TokenInfo>,
    #[prost(string, tag="3")]
    pub activation_code: std::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeactivateRequest {
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeactivateResponse {
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum State {
    None = 0,
    Active = 1,
    Expired = 2,
}
# [ doc = r" Generated client implementations." ] pub mod api_client { # ! [ allow ( unused_variables , dead_code , missing_docs ) ] use tonic :: codegen :: * ; pub struct ApiClient < T > { inner : tonic :: client :: Grpc < T > , } impl ApiClient < tonic :: transport :: Channel > { # [ doc = r" Attempt to create a new client by connecting to a given endpoint." ] pub async fn connect < D > ( dst : D ) -> Result < Self , tonic :: transport :: Error > where D : std :: convert :: TryInto < tonic :: transport :: Endpoint > , D :: Error : Into < StdError > , { let conn = tonic :: transport :: Endpoint :: new ( dst ) ? . connect ( ) . await ? ; Ok ( Self :: new ( conn ) ) } } impl < T > ApiClient < T > where T : tonic :: client :: GrpcService < tonic :: body :: BoxBody > , T :: ResponseBody : Body + HttpBody + Send + 'static , T :: Error : Into < StdError > , < T :: ResponseBody as HttpBody > :: Error : Into < StdError > + Send , { pub fn new ( inner : T ) -> Self { let inner = tonic :: client :: Grpc :: new ( inner ) ; Self { inner } } pub fn with_interceptor ( inner : T , interceptor : impl Into < tonic :: Interceptor > ) -> Self { let inner = tonic :: client :: Grpc :: with_interceptor ( inner , interceptor ) ; Self { inner } } # [ doc = " Provide a Pachyderm enterprise token, enabling Pachyderm enterprise" ] # [ doc = " features, such as the Pachyderm Dashboard and Auth system" ] pub async fn activate ( & mut self , request : impl tonic :: IntoRequest < super :: ActivateRequest > , ) -> Result < tonic :: Response < super :: ActivateResponse > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/enterprise.API/Activate" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } pub async fn get_state ( & mut self , request : impl tonic :: IntoRequest < super :: GetStateRequest > , ) -> Result < tonic :: Response < super :: GetStateResponse > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/enterprise.API/GetState" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } # [ doc = " Deactivate is a testing API. It removes a cluster's enterprise activation" ] # [ doc = " token and sets its enterprise state to NONE (normally, once a cluster has" ] # [ doc = " been activated, the only reachable state is EXPIRED)." ] # [ doc = "" ] # [ doc = " NOTE: This endpoint also calls DeleteAll (and deletes all Pachyderm data in" ] # [ doc = " its cluster). This is to avoid dealing with invalid, intermediate states" ] # [ doc = " (e.g. auth is activated but enterprise state is NONE)" ] pub async fn deactivate ( & mut self , request : impl tonic :: IntoRequest < super :: DeactivateRequest > , ) -> Result < tonic :: Response < super :: DeactivateResponse > , tonic :: Status > { self . inner . ready ( ) . await . map_err ( | e | { tonic :: Status :: new ( tonic :: Code :: Unknown , format ! ( "Service was not ready: {}" , e . into ( ) ) ) } ) ? ; let codec = tonic :: codec :: ProstCodec :: default ( ) ; let path = http :: uri :: PathAndQuery :: from_static ( "/enterprise.API/Deactivate" ) ; self . inner . unary ( request . into_request ( ) , path , codec ) . await } } impl < T : Clone > Clone for ApiClient < T > { fn clone ( & self ) -> Self { Self { inner : self . inner . clone ( ) , } } } impl < T > std :: fmt :: Debug for ApiClient < T > { fn fmt ( & self , f : & mut std :: fmt :: Formatter < '_ > ) -> std :: fmt :: Result { write ! ( f , "ApiClient {{ ... }}" ) } } }