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
//!
//! Library for interacting with an Avassa system.
//!
//! ## Avassa Client
//! The first interaction is to login into the system
//! ```no_run
//! #[tokio::main]
//! async fn main() -> Result<(), avassa_client::Error> {
//! use avassa_client::Client;
//!
//! // API CA certificate loaded
//! let ca_cert = Vec::new();
//!
//! // Use login using platform provided application token
//! let approle_id = "secret approle id";
//! let client = Client::builder()
//! .add_root_certificate(&ca_cert)?
//! .approle_login("https://api.customer.net",
//! &std::env::var("APPROLE_SECRET_ID").unwrap(),
//! Some(approle_id)).await?;
//!
//! // Username and password authentication, good during the development phase
//! let client = Client::builder()
//! .add_root_certificate(&ca_cert)?
//! .login("https://1.2.3.4", "joe", "secret").await?;
//!
//! Ok(())
//! }
//! ```
//!
//! ## Volga
//! ### Create a Volga producer and consumer
//! ```no_run
//! #[tokio::main]
//! async fn main() -> Result<(), avassa_client::Error> {
//! use avassa_client::Client;
//!
//! // API CA certificate loaded
//! let ca_cert = Vec::new();
//!
//! // Use login using platform provided application token
//! let approle_id = "secret approle id";
//! let client = Client::builder()
//! .add_root_certificate(&ca_cert)?
//! .application_login("https://api.customer.net", Some(approle_id)).await?;
//!
//! // Clone to move into async closure
//! let producer_client = client.clone();
//!
//! tokio::spawn(async move {
//! let mut producer = producer_client.volga_open_producer(
//! "test-producer",
//! "my-topic",
//! avassa_client::volga::OnNoExists::Create(Default::default())
//! )
//! .await?;
//!
//! producer.produce(&serde_json::json!({
//! "msg": "The Message",
//! })).await?;
//! Ok::<_, avassa_client::Error>(())
//! });
//!
//! let mut consumer = client.volga_open_consumer(
//! "test-consumer",
//! "my-topic",
//! Default::default())
//! .await?;
//!
//! let message = consumer.consume::<String>().await?;
//!
//! assert_eq!(message.payload, "test message");
//! Ok(())
//! }
//! ```
pub use *;
pub use *;