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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! # aws_config_mod
//!
//! A missing piece of the Rust AWS SDK. A current missing feature of the SDK is the ability
//! to read and modify AWS config files programatically, such as what we can do with the set command:
//! <https://docs.aws.amazon.com/cli/latest/reference/configure/set.html>
//!
//! The goal of this library is allowing you to add, modify, and remove AWS CLI configuration settings for
//! existing configuration files to to generate new ones while any existing whitespace or comments
//! in the original file.
//!
//! This crate is still a work-in-progress, so if there are any features that you need right away, please
//! open an issue and they will be prioritized.
//!
//! ## Usage
//!
//! ```
//! // Assuming you already read the configuration file to a string
//! let config_content = r#"
//! [profile A]
//! credential_source = Ec2InstanceMetadata
//! endpoint_url = https://profile-a-endpoint.aws/
//!
//! [profile B]
//! source_profile = A
//! role_arn = arn:aws:iam::123456789012:role/roleB
//! services = profileB
//!
//! [services profileB]
//! ec2 =
//! endpoint_url = https://profile-b-ec2-endpoint.aws"#;
//!
//! let mut config = AwsConfigFile::parse(SAMPLE_FILE).expect("Sample file should be valid");
//!
//! let setting_path = SettingPath::try_from("profile.A.credential_source").expect("Should parse");
//! config.set(setting_path, Value::from("my-new-credential-source"));
//! let stringified = config.to_string();
//! // Write the content back to your file
//! ```
//!
//! ## TODOs
//!
//! - improved error messages
//! - automatic config file loading via standard aws config locations and environment variables
//! - detect and match formatting
//! - set formatting
//! - utilize aws types
//! - add more strongly typed structs for various aspects of the configuration
pub use Error;
pub use ;