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
use serde_json::value::Value;
use tokio::runtime::Runtime;
mod client;
mod parse;
pub fn list_keys() -> Value {
Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(client::get_keys())
}
pub fn describe_key(key_id: &str) -> Value {
Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(client::get_key(key_id))
}
pub fn create_key() -> Value {
Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(client::create_key_and_parse())
}
pub fn schedule_key_deletion(key_id: String, pending_window_in_days: i64) -> Value {
Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(client::schedule_key_deletion_and_parse(
key_id,
pending_window_in_days,
))
}
pub fn cancel_key_deletion(key_id: String) -> Value {
Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(client::cancel_key_deletion_and_parse(key_id))
}
pub fn disable_key(key_id: &str) -> Option<Value> {
Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(client::disable_key_and_respond(key_id))
}
pub fn enable_key(key_id: &str) -> Option<Value> {
Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(client::enable_key_and_respond(key_id))
}
pub fn generate_data_key(key_id: &str, key_spec: Option<String>, bytes: Option<i64>) -> Value {
Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(client::generate_data_key_and_parse(key_id, key_spec, bytes))
}
pub fn generate_data_key_without_plaintext(
key_id: &str,
key_spec: Option<String>,
bytes: Option<i64>,
) -> Value {
Runtime::new()
.expect("Failed to create Tokio runtime")
.block_on(client::generate_data_key_without_plaintext_and_parse(
key_id, key_spec, bytes,
))
}