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
190
191
192
193
194
195
196
197
//! Rust client for the [Armada](https://armadaproject.io) batch-job scheduler.
//!
//! This crate provides an async gRPC client for submitting and monitoring batch
//! jobs on an Armada cluster. It is built on top of [tonic] and exposes a
//! small, ergonomic API that can be shared across async tasks without locking.
//!
//! # Quick start
//!
//! ```no_run
//! use armada_client::k8s::io::api::core::v1::{Container, PodSpec};
//! use armada_client::{
//! ArmadaClient, JobRequestItemBuilder, JobSubmitRequest, StaticTokenProvider,
//! };
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // 1. Connect (plaintext). Use `connect_tls` for production clusters.
//! let client = ArmadaClient::connect(
//! "http://localhost:50051",
//! StaticTokenProvider::new("my-token"),
//! )
//! .await?;
//!
//! // 2. Build a job item — pod spec required before `.build()` compiles.
//! let pod_spec = PodSpec {
//! containers: vec![Container {
//! name: Some("main".into()),
//! image: Some("busybox:latest".into()),
//! command: vec!["echo".into()],
//! args: vec!["hello".into()],
//! ..Default::default()
//! }],
//! ..Default::default()
//! };
//!
//! let item = JobRequestItemBuilder::new()
//! .namespace("default")
//! .priority(1.0)
//! .pod_spec(pod_spec)
//! .build();
//!
//! // 3. Submit.
//! let response = client
//! .submit(JobSubmitRequest {
//! queue: "my-queue".into(),
//! job_set_id: "my-job-set".into(),
//! job_request_items: vec![item],
//! })
//! .await?;
//!
//! for r in &response.job_response_items {
//! println!("job_id={}", r.job_id);
//! }
//! Ok(())
//! }
//! ```
//!
//! # Features
//!
//! | Feature | How to use |
//! |---|---|
//! | Plaintext connection | [`ArmadaClient::connect`] |
//! | TLS connection (system roots) | [`ArmadaClient::connect_tls`] |
//! | TLS with custom CA / mTLS | [`ArmadaClient::connect_tls_with_config`] |
//! | Per-call timeout | [`ArmadaClient::with_timeout`] |
//! | Job submission | [`ArmadaClient::submit`] |
//! | Cancel jobs by ID | [`ArmadaClient::cancel_jobs`] |
//! | Cancel a job set | [`ArmadaClient::cancel_job_set`] |
//! | Event streaming | [`ArmadaClient::watch`] |
//! | Static bearer token | [`StaticTokenProvider`] |
//! | Custom auth (OIDC, OAuth2…) | Implement [`TokenProvider`] |
//! | Compile-time safe job builder | [`JobRequestItemBuilder`] |
//!
//! # Kubernetes proto types
//!
//! Armada job specs embed Kubernetes `PodSpec` and related types. These are
//! generated from the upstream k8s protobufs and re-exported under the
//! [`k8s`] module, mirroring the proto package hierarchy:
//!
//! ```ignore
//! use armada_client::k8s::io::api::core::v1::{Container, PodSpec, ResourceRequirements};
//! use armada_client::k8s::io::apimachinery::pkg::api::resource::Quantity;
//! ```
//!
//! # Cloning and concurrent use
//!
//! [`ArmadaClient`] is `Clone`. All clones share the same underlying
//! connection pool — cloning is cheap and the correct way to use the client
//! across multiple tasks:
//!
//! ```no_run
//! # use armada_client::{ArmadaClient, StaticTokenProvider};
//! # async fn example() -> Result<(), armada_client::Error> {
//! let client = ArmadaClient::connect("http://localhost:50051", StaticTokenProvider::new("tok"))
//! .await?;
//!
//! let c1 = client.clone();
//! let c2 = client.clone();
//! tokio::join!(
//! async move { /* use c1 */ },
//! async move { /* use c2 */ },
//! );
//! # Ok(())
//! # }
//! ```
// google.api types (HttpRule etc.) generated as a side-effect of compiling the
// Armada API protos. Not part of the public API — used internally by api.rs.
pub
// k8s types referenced by the api package — must mirror the proto package hierarchy
// so that generated api.rs cross-package refs (e.g., super::k8s::io::api::core::v1::PodSpec) resolve.
// Convenience re-exports for the public API surface
pub use ;
pub use ;
pub use JobRequestItemBuilder;
pub use ArmadaClient;
pub use Error;
pub use BoxStream;
pub use prost;
pub use tonic;