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
//! `PCSTrait` (power control) impl for `StaticBackendDispatcher`.
//!
//! `POST /power` returns immediately with a transition id (via
//! `pcs_transitions_post`); the CLI then polls `pcs_transitions_get`
//! until the transition is `completed`. The older blocking
//! `power_*_sync` trait methods (server-side polling loop) have been
//! removed.
use manta_backend_dispatcher::types::pcs::power_status::types::PowerStatusAll;
use super::*;
impl PCSTrait for StaticBackendDispatcher {
async fn power_status(
&self,
auth_token: &str,
nodes: &[String],
power_status_filter: Option<&str>,
management_state_filter: Option<&str>,
) -> Result<PowerStatusAll, Error> {
dispatch!(
self,
power_status,
auth_token,
nodes,
power_status_filter,
management_state_filter
)
}
async fn pcs_transitions_post(
&self,
auth_token: &str,
operation: &str,
nodes: &[String],
) -> Result<TransitionStartOutput, Error> {
// Same trait-vs-inherent name clash as `pcs_transitions_get`:
// disambiguate explicitly.
match self {
Self::CSM(b) => {
PCSTrait::pcs_transitions_post(b, auth_token, operation, nodes).await
}
Self::OCHAMI(b) => {
PCSTrait::pcs_transitions_post(b, auth_token, operation, nodes).await
}
}
}
async fn pcs_transitions_get(
&self,
auth_token: &str,
transition_id: &str,
) -> Result<TransitionResponse, Error> {
// ShastaClient has an inherent `pcs_transitions_get` that takes
// only the token and returns a Vec. Disambiguate via the trait so
// the resolver picks the trait method (single transition by id),
// not the inherent one.
match self {
Self::CSM(b) => {
PCSTrait::pcs_transitions_get(b, auth_token, transition_id).await
}
Self::OCHAMI(b) => {
PCSTrait::pcs_transitions_get(b, auth_token, transition_id).await
}
}
}
}