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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#![allow(missing_docs, trivial_casts, unused_variables, unused_mut, unused_imports, unused_extern_crates, non_camel_case_types)]
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate futures;
extern crate chrono;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
#[cfg(any(feature = "client", feature = "server"))]
#[macro_use]
extern crate hyper;
extern crate swagger;
use futures::Stream;
use std::io::Error;
#[allow(unused_imports)]
use std::collections::HashMap;
pub use futures::Future;
#[cfg(any(feature = "client", feature = "server"))]
mod mimetypes;
pub use swagger::{ApiError, Context, ContextWrapper};
#[derive(Debug, PartialEq)]
pub enum SysLeasesRevokePutResponse {
Success ,
}
#[derive(Debug, PartialEq)]
pub enum GenerateCertResponse {
Success ( models::GenerateCertificateResponse ) ,
}
#[derive(Debug, PartialEq)]
pub enum ReadCertResponse {
Success ( models::CertificateResponse ) ,
}
#[derive(Debug, PartialEq)]
pub enum CreateOrphanTokenResponse {
Success ( models::AuthResponse ) ,
}
#[derive(Debug, PartialEq)]
pub enum CreateTokenResponse {
Success ( models::AuthResponse ) ,
}
#[derive(Debug, PartialEq)]
pub enum LogInWithTLSCertificateResponse {
Success ( models::AuthResponse ) ,
}
#[derive(Debug, PartialEq)]
pub enum RenewOwnTokenResponse {
Success ( models::AuthResponse ) ,
}
pub trait Api {
fn sys_leases_revoke_put(&self, x_vault_token: String, body: models::RevokeLeaseParameters, context: &Context) -> Box<Future<Item=SysLeasesRevokePutResponse, Error=ApiError> + Send>;
fn generate_cert(&self, x_vault_token: String, mount: String, name: String, body: models::GenerateCertificateParameters, context: &Context) -> Box<Future<Item=GenerateCertResponse, Error=ApiError> + Send>;
fn read_cert(&self, mount: String, serial: String, context: &Context) -> Box<Future<Item=ReadCertResponse, Error=ApiError> + Send>;
fn create_orphan_token(&self, x_vault_token: String, body: models::CreateTokenParameters, context: &Context) -> Box<Future<Item=CreateOrphanTokenResponse, Error=ApiError> + Send>;
fn create_token(&self, x_vault_token: String, body: models::CreateTokenParameters, context: &Context) -> Box<Future<Item=CreateTokenResponse, Error=ApiError> + Send>;
fn log_in_with_tls_certificate(&self, body: Option<models::AuthCertLoginParameters>, context: &Context) -> Box<Future<Item=LogInWithTLSCertificateResponse, Error=ApiError> + Send>;
fn renew_own_token(&self, x_vault_token: String, body: models::RenewSelfParameters, context: &Context) -> Box<Future<Item=RenewOwnTokenResponse, Error=ApiError> + Send>;
}
pub trait ApiNoContext {
fn sys_leases_revoke_put(&self, x_vault_token: String, body: models::RevokeLeaseParameters) -> Box<Future<Item=SysLeasesRevokePutResponse, Error=ApiError> + Send>;
fn generate_cert(&self, x_vault_token: String, mount: String, name: String, body: models::GenerateCertificateParameters) -> Box<Future<Item=GenerateCertResponse, Error=ApiError> + Send>;
fn read_cert(&self, mount: String, serial: String) -> Box<Future<Item=ReadCertResponse, Error=ApiError> + Send>;
fn create_orphan_token(&self, x_vault_token: String, body: models::CreateTokenParameters) -> Box<Future<Item=CreateOrphanTokenResponse, Error=ApiError> + Send>;
fn create_token(&self, x_vault_token: String, body: models::CreateTokenParameters) -> Box<Future<Item=CreateTokenResponse, Error=ApiError> + Send>;
fn log_in_with_tls_certificate(&self, body: Option<models::AuthCertLoginParameters>) -> Box<Future<Item=LogInWithTLSCertificateResponse, Error=ApiError> + Send>;
fn renew_own_token(&self, x_vault_token: String, body: models::RenewSelfParameters) -> Box<Future<Item=RenewOwnTokenResponse, Error=ApiError> + Send>;
}
pub trait ContextWrapperExt<'a> where Self: Sized {
fn with_context(self: &'a Self, context: Context) -> ContextWrapper<'a, Self>;
}
impl<'a, T: Api + Sized> ContextWrapperExt<'a> for T {
fn with_context(self: &'a T, context: Context) -> ContextWrapper<'a, T> {
ContextWrapper::<T>::new(self, context)
}
}
impl<'a, T: Api> ApiNoContext for ContextWrapper<'a, T> {
fn sys_leases_revoke_put(&self, x_vault_token: String, body: models::RevokeLeaseParameters) -> Box<Future<Item=SysLeasesRevokePutResponse, Error=ApiError> + Send> {
self.api().sys_leases_revoke_put(x_vault_token, body, &self.context())
}
fn generate_cert(&self, x_vault_token: String, mount: String, name: String, body: models::GenerateCertificateParameters) -> Box<Future<Item=GenerateCertResponse, Error=ApiError> + Send> {
self.api().generate_cert(x_vault_token, mount, name, body, &self.context())
}
fn read_cert(&self, mount: String, serial: String) -> Box<Future<Item=ReadCertResponse, Error=ApiError> + Send> {
self.api().read_cert(mount, serial, &self.context())
}
fn create_orphan_token(&self, x_vault_token: String, body: models::CreateTokenParameters) -> Box<Future<Item=CreateOrphanTokenResponse, Error=ApiError> + Send> {
self.api().create_orphan_token(x_vault_token, body, &self.context())
}
fn create_token(&self, x_vault_token: String, body: models::CreateTokenParameters) -> Box<Future<Item=CreateTokenResponse, Error=ApiError> + Send> {
self.api().create_token(x_vault_token, body, &self.context())
}
fn log_in_with_tls_certificate(&self, body: Option<models::AuthCertLoginParameters>) -> Box<Future<Item=LogInWithTLSCertificateResponse, Error=ApiError> + Send> {
self.api().log_in_with_tls_certificate(body, &self.context())
}
fn renew_own_token(&self, x_vault_token: String, body: models::RenewSelfParameters) -> Box<Future<Item=RenewOwnTokenResponse, Error=ApiError> + Send> {
self.api().renew_own_token(x_vault_token, body, &self.context())
}
}
#[cfg(feature = "client")]
pub mod client;
#[cfg(feature = "client")]
pub use self::client::Client;
#[cfg(feature = "server")]
pub mod server;
#[cfg(feature = "server")]
pub use self::server::router;
pub mod models;