rds_ssm_connect 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/src/lib.rs +81 -25
- package/src-tauri/tauri.conf.json +1 -1
package/package.json
CHANGED
package/src-tauri/Cargo.toml
CHANGED
package/src-tauri/src/lib.rs
CHANGED
|
@@ -710,18 +710,56 @@ pub struct PrerequisitesResult {
|
|
|
710
710
|
async fn check_prerequisites() -> Result<PrerequisitesResult, String> {
|
|
711
711
|
use std::process::Command;
|
|
712
712
|
|
|
713
|
+
// Common paths where tools might be installed
|
|
714
|
+
let search_paths = [
|
|
715
|
+
"/usr/local/bin",
|
|
716
|
+
"/opt/homebrew/bin",
|
|
717
|
+
"/usr/bin",
|
|
718
|
+
"/bin",
|
|
719
|
+
&format!("{}/.local/bin", std::env::var("HOME").unwrap_or_default()),
|
|
720
|
+
];
|
|
721
|
+
|
|
722
|
+
fn find_command(name: &str, search_paths: &[&str]) -> Option<std::path::PathBuf> {
|
|
723
|
+
// First try PATH
|
|
724
|
+
if let Ok(output) = std::process::Command::new("which").arg(name).output() {
|
|
725
|
+
if output.status.success() {
|
|
726
|
+
let path = String::from_utf8_lossy(&output.stdout).trim().to_string();
|
|
727
|
+
if !path.is_empty() {
|
|
728
|
+
return Some(std::path::PathBuf::from(path));
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
// Then search common paths
|
|
733
|
+
for dir in search_paths {
|
|
734
|
+
let path = std::path::Path::new(dir).join(name);
|
|
735
|
+
if path.exists() {
|
|
736
|
+
return Some(path);
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
None
|
|
740
|
+
}
|
|
741
|
+
|
|
713
742
|
let mut prerequisites = Vec::new();
|
|
714
743
|
|
|
715
744
|
// Check aws-vault
|
|
716
|
-
let aws_vault = match
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
745
|
+
let aws_vault = match find_command("aws-vault", &search_paths) {
|
|
746
|
+
Some(path) => match Command::new(&path).arg("--version").output() {
|
|
747
|
+
Ok(output) if output.status.success() => PrerequisiteStatus {
|
|
748
|
+
name: "aws-vault".to_string(),
|
|
749
|
+
installed: true,
|
|
750
|
+
version: Some(String::from_utf8_lossy(&output.stdout).trim().to_string()),
|
|
751
|
+
install_url: "https://github.com/99designs/aws-vault#installing".to_string(),
|
|
752
|
+
install_command: Some("brew install aws-vault".to_string()),
|
|
753
|
+
},
|
|
754
|
+
_ => PrerequisiteStatus {
|
|
755
|
+
name: "aws-vault".to_string(),
|
|
756
|
+
installed: false,
|
|
757
|
+
version: None,
|
|
758
|
+
install_url: "https://github.com/99designs/aws-vault#installing".to_string(),
|
|
759
|
+
install_command: Some("brew install aws-vault".to_string()),
|
|
760
|
+
},
|
|
723
761
|
},
|
|
724
|
-
|
|
762
|
+
None => PrerequisiteStatus {
|
|
725
763
|
name: "aws-vault".to_string(),
|
|
726
764
|
installed: false,
|
|
727
765
|
version: None,
|
|
@@ -732,18 +770,27 @@ async fn check_prerequisites() -> Result<PrerequisitesResult, String> {
|
|
|
732
770
|
prerequisites.push(aws_vault);
|
|
733
771
|
|
|
734
772
|
// Check AWS CLI
|
|
735
|
-
let aws_cli = match
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
773
|
+
let aws_cli = match find_command("aws", &search_paths) {
|
|
774
|
+
Some(path) => match Command::new(&path).arg("--version").output() {
|
|
775
|
+
Ok(output) if output.status.success() => {
|
|
776
|
+
let version_str = String::from_utf8_lossy(&output.stdout);
|
|
777
|
+
PrerequisiteStatus {
|
|
778
|
+
name: "AWS CLI".to_string(),
|
|
779
|
+
installed: true,
|
|
780
|
+
version: Some(version_str.split_whitespace().take(1).collect()),
|
|
781
|
+
install_url: "https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html".to_string(),
|
|
782
|
+
install_command: Some("brew install awscli".to_string()),
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
_ => PrerequisiteStatus {
|
|
739
786
|
name: "AWS CLI".to_string(),
|
|
740
|
-
installed:
|
|
741
|
-
version:
|
|
787
|
+
installed: false,
|
|
788
|
+
version: None,
|
|
742
789
|
install_url: "https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html".to_string(),
|
|
743
790
|
install_command: Some("brew install awscli".to_string()),
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
|
|
791
|
+
},
|
|
792
|
+
},
|
|
793
|
+
None => PrerequisiteStatus {
|
|
747
794
|
name: "AWS CLI".to_string(),
|
|
748
795
|
installed: false,
|
|
749
796
|
version: None,
|
|
@@ -754,15 +801,24 @@ async fn check_prerequisites() -> Result<PrerequisitesResult, String> {
|
|
|
754
801
|
prerequisites.push(aws_cli);
|
|
755
802
|
|
|
756
803
|
// Check Session Manager Plugin
|
|
757
|
-
let ssm_plugin = match
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
804
|
+
let ssm_plugin = match find_command("session-manager-plugin", &search_paths) {
|
|
805
|
+
Some(path) => match Command::new(&path).arg("--version").output() {
|
|
806
|
+
Ok(output) if output.status.success() => PrerequisiteStatus {
|
|
807
|
+
name: "Session Manager Plugin".to_string(),
|
|
808
|
+
installed: true,
|
|
809
|
+
version: Some(String::from_utf8_lossy(&output.stdout).trim().to_string()),
|
|
810
|
+
install_url: "https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html".to_string(),
|
|
811
|
+
install_command: None,
|
|
812
|
+
},
|
|
813
|
+
_ => PrerequisiteStatus {
|
|
814
|
+
name: "Session Manager Plugin".to_string(),
|
|
815
|
+
installed: false,
|
|
816
|
+
version: None,
|
|
817
|
+
install_url: "https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html".to_string(),
|
|
818
|
+
install_command: None,
|
|
819
|
+
},
|
|
764
820
|
},
|
|
765
|
-
|
|
821
|
+
None => PrerequisiteStatus {
|
|
766
822
|
name: "Session Manager Plugin".to_string(),
|
|
767
823
|
installed: false,
|
|
768
824
|
version: None,
|