devops_armory/
lib.rs

1//! DevOps Armory
2//!
3//! Library created to improve DevOps work.
4//!
5//! ## Example
6//! 
7//! ```rust
8//!     #[actix_web::main]
9//!     async fn test_function() -> Result<()> {
10//!     
11//!         let ssh_user = "user".to_string();
12//!         let ssh_key_location = "path_to_your_private_ssh_key".to_string();
13//!         let toml_file = "path_to_your_config.toml".to_string();
14//!         let toml_data = toml_parser(toml_file);
15//!         let f = toml_data.unwrap_or_default();
16//!         let g = &f.rustible[0];
17//!         let slack_vm_address_list = &g.vm[0].slackware.ip_address_list;
18//!         let slack_vm_commands = &g.vm[0].slackware.commands;
19//!         exec_command_on_remote(ssh_user, ssh_key_location, slack_vm_address_list.to_vec(), slack_vm_commands.to_vec()).await?;
20//!         Ok(())
21//!     
22//!     }
23//! ```
24
25pub mod toml_parser;
26
27pub mod rustible;
28
29pub fn test_vm_ubuntu(ip: String, command: String) -> (String, String) {
30    (ip.to_string(), command.to_string())
31}
32
33#[cfg(test)]
34mod tests {
35
36    use super::*;
37
38    #[test]
39    fn check_vm_ubuntu_config() {
40        let test_data_vm_ubuntu = test_vm_ubuntu("1.1.1.1".to_string(), "command_ubuntu1".to_string());
41        assert_eq!(test_data_vm_ubuntu, ("1.1.1.1".to_string(), "command_ubuntu1".to_string()));
42    }
43
44}