-
Notifications
You must be signed in to change notification settings - Fork 1
/
region.rs
32 lines (28 loc) · 1.02 KB
/
region.rs
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
use outscale_api::apis::configuration::{AWSv4Key, Configuration};
use outscale_api::apis::volume_api::read_volumes;
use outscale_api::models::ReadVolumesRequest;
use secrecy::SecretString;
use std::env;
/* Show how to configure SDK for a specific region */
fn main() {
let region = "eu-west-2";
let mut config = Configuration::new();
config.base_path = format!("https://api.{}.outscale.com/api/v1", region);
config.aws_v4_key = Some(AWSv4Key {
access_key: env::var("OSC_ACCESS_KEY").unwrap(),
secret_key: SecretString::new(env::var("OSC_SECRET_KEY").unwrap()),
region: region.to_string(),
service: "oapi".to_string(),
});
match env::var("OSC_ENDPOINT_API") {
Ok(enpoint) => config.base_path = enpoint,
_ => (),
};
print!("Action on specific region ({})... ", region);
let request = ReadVolumesRequest::new();
if let Err(error) = read_volumes(&config, Some(request)) {
println!("Error: {:?}", error);
return;
}
println!("OK");
}