Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SM-807: BWS CLI & SDK Updates #77

Merged
merged 18 commits into from
Jul 21, 2023
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
93f2ca6
SM-807: Fix edit secret, allow updating the project a secret is in, a…
coltonhurst Jun 26, 2023
b117e20
SM-807: Update schemas
coltonhurst Jun 26, 2023
cae2129
SM-807: Add proper error messaging when secrets or projects are deleted.
coltonhurst Jun 26, 2023
10e985d
SM-807: Make project_id a parameter rather than an argument on secret…
coltonhurst Jun 26, 2023
25b90fe
SM-807: Merge master into branch
coltonhurst Jun 27, 2023
45fe743
SM-807: Add back project_ids that were lost in the merge conflict res…
coltonhurst Jun 27, 2023
30bb03c
SM-807: Add additional secrets / projects deletion error message when…
coltonhurst Jun 27, 2023
28242ec
SM-807: Make failed messaging on projects or secrets delete optional,…
coltonhurst Jun 27, 2023
032f4e0
SM-807: Add back the project_id help text on secret create
coltonhurst Jun 27, 2023
b8074ff
SM-807: Update secret/project delete to use a filter_map and not prin…
coltonhurst Jun 28, 2023
8c6543e
Merge branch 'master' into sm/SM-807
coltonhurst Jun 28, 2023
daf7921
SM-807: Remove mut refactor
coltonhurst Jun 29, 2023
30f4da1
SM-807: Merge branch 'master' into sm/SM-807 and fix merge conflict i…
coltonhurst Jul 10, 2023
348ef19
Merge branch 'master' into sm/SM-807
coltonhurst Jul 11, 2023
ef38c8a
Merge branch 'master' into sm/SM-807
coltonhurst Jul 12, 2023
ecf34e0
Merge branch 'master' into sm/SM-807
coltonhurst Jul 14, 2023
d174d22
Merge branch 'master' into sm/SM-807
coltonhurst Jul 20, 2023
1077d74
Merge branch 'master' into sm/SM-807
coltonhurst Jul 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 20 additions & 26 deletions crates/bws/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,26 +388,23 @@ async fn process_commands() -> Result<()> {
| Commands::Delete {
cmd: DeleteCommand::Project { project_ids },
} => {
let mut projects_success = project_ids.len();
Hinton marked this conversation as resolved.
Show resolved Hide resolved

let result = client
.projects()
.delete(ProjectsDeleteRequest { ids: project_ids })
.await?;

let mut projects_success = 0;
let mut projects_failed: Vec<(Uuid, String)> = Vec::new();

for project in result.data.iter() {
match &project.error {
Some(error_message) => {
projects_failed.push((project.id, error_message.to_owned()))
}
None => projects_success += 1,
}
}
let projects_failed: Vec<(Uuid, String)> = result
.data
.into_iter()
.filter_map(|r| r.error.map(|e| (r.id, e)))
.collect();
projects_success -= projects_failed.len();

if projects_success == 0 || projects_success > 1 {
if projects_success > 1 {
println!("{} projects deleted successfully.", projects_success);
} else {
} else if projects_success == 1 {
println!("{} project deleted successfully.", projects_success);
}

Expand Down Expand Up @@ -550,26 +547,23 @@ async fn process_commands() -> Result<()> {
| Commands::Delete {
cmd: DeleteCommand::Secret { secret_ids },
} => {
let mut secrets_success = secret_ids.len();

let result = client
.secrets()
.delete(SecretsDeleteRequest { ids: secret_ids })
.await?;

let mut secrets_success = 0;
let mut secrets_failed: Vec<(Uuid, String)> = Vec::new();

for secret in result.data.iter() {
match &secret.error {
Some(error_message) => {
secrets_failed.push((secret.id, error_message.to_owned()))
}
None => secrets_success += 1,
}
}
let secrets_failed: Vec<(Uuid, String)> = result
.data
.into_iter()
.filter_map(|r| r.error.map(|e| (r.id, e)))
.collect();
secrets_success -= secrets_failed.len();

if secrets_success == 0 || secrets_success > 1 {
if secrets_success > 1 {
println!("{} secrets deleted successfully.", secrets_success);
} else {
} else if secrets_success == 1 {
println!("{} secret deleted successfully.", secrets_success);
}

Expand Down