summaryrefslogtreecommitdiff
path: root/angelsharkd/src/routes/extensions/simple_deprov
diff options
context:
space:
mode:
authorAdam Carpenter <adam.carpenter@adp.com>2022-01-17 15:02:00 -0500
committerGitHub <noreply@github.com>2022-01-17 15:02:00 -0500
commit6e307700a5203f5b9fcc741f693fcacc7757414d (patch)
treefe7781e07a74e05a82ea3c1e19c389337fe8ac8c /angelsharkd/src/routes/extensions/simple_deprov
parentd3e1b697fec543e0197f1c549164c210504dde3b (diff)
parent579980ca75dfbc27639259c773dfc5fe1ec9e32a (diff)
downloadaltruistic-angelshark-6e307700a5203f5b9fcc741f693fcacc7757414d.tar.xz
altruistic-angelshark-6e307700a5203f5b9fcc741f693fcacc7757414d.zip
Merge pull request #7 from adpllc/devHEADmaster
feat: support station busyout/release toggling via extension
Diffstat (limited to 'angelsharkd/src/routes/extensions/simple_deprov')
-rw-r--r--angelsharkd/src/routes/extensions/simple_deprov/README.md2
-rw-r--r--angelsharkd/src/routes/extensions/simple_deprov/mod.rs15
2 files changed, 14 insertions, 3 deletions
diff --git a/angelsharkd/src/routes/extensions/simple_deprov/README.md b/angelsharkd/src/routes/extensions/simple_deprov/README.md
index 4900075..f7a3fe2 100644
--- a/angelsharkd/src/routes/extensions/simple_deprov/README.md
+++ b/angelsharkd/src/routes/extensions/simple_deprov/README.md
@@ -16,7 +16,7 @@ cargo build --bin angelsharkd --features simple_deprov ...
## `POST /extensions/deprov` Remove Objects
-The request type is TODO:
+The request type is as follows:
```json
POST /extensions/deprov
diff --git a/angelsharkd/src/routes/extensions/simple_deprov/mod.rs b/angelsharkd/src/routes/extensions/simple_deprov/mod.rs
index fc734f3..77bde55 100644
--- a/angelsharkd/src/routes/extensions/simple_deprov/mod.rs
+++ b/angelsharkd/src/routes/extensions/simple_deprov/mod.rs
@@ -1,5 +1,5 @@
use libangelshark::{AcmRunner, Message, ParallelIterator};
-use log::error;
+use log::{error, info};
use serde::Deserialize;
use std::convert::Infallible;
use warp::{
@@ -24,10 +24,12 @@ async fn remove_entries(entries: Entries, mut runner: AcmRunner) -> Result<impl
for entry in entries {
match entry {
Entry::StationUser { acm, ext } => {
+ runner.queue_input(&acm, &Message::new(&format!("list station {}", ext)));
runner.queue_input(&acm, &Message::new(&format!("clear amw all {}", ext)));
runner.queue_input(&acm, &Message::new(&format!("remove station {}", ext)));
}
Entry::AgentLoginId { acm, ext } => {
+ runner.queue_input(&acm, &Message::new(&format!("list agent-loginID {}", ext)));
runner.queue_input(
&acm,
&Message::new(&format!("remove agent-loginID {}", ext)),
@@ -42,7 +44,16 @@ async fn remove_entries(entries: Entries, mut runner: AcmRunner) -> Result<impl
.map(|(acm, output)| match output {
Ok(messages) => messages
.into_iter()
- .filter_map(|message| Some(format!("ACM {}: {}", acm.clone(), message.error?)))
+ .filter_map(|message| {
+ if let Some(data) = message
+ .datas
+ .and_then(|d| Some(format!("{acm}\t{}", d.get(0)?.join("\t"))))
+ {
+ // if there was data (such as in lists), print it out
+ info!("{data}");
+ }
+ Some(format!("ACM {}: {}", acm.clone(), message.error?))
+ })
.collect(),
Err(error) => vec![format!("ACM {}: {}", acm, error)],
})