Skip to main content

aws_lite_rs/
lib.rs

1//! Lightweight HTTP client for Amazon Web Services APIs.
2//!
3//! Provides REST API access with automatic SigV4 signing,
4//! retry, and rate limiting.
5
6pub mod api;
7pub mod auth;
8pub mod client;
9pub mod error;
10pub mod iam_policy;
11#[cfg(any(test, feature = "test-support"))]
12pub mod mock_client;
13pub mod ops;
14pub mod query;
15pub(crate) mod serde_base64;
16#[cfg(any(test, feature = "test-support"))]
17pub mod test_support;
18pub mod types;
19pub mod xml;
20
21pub use auth::AwsCredentials;
22pub use client::{AwsHttpClient, AwsHttpClientBuilder, AwsResponse};
23pub use error::{AwsError, Result};
24#[cfg(any(test, feature = "test-support"))]
25pub use mock_client::MockClient;
26
27/// Build a URL query string from key-value pairs, omitting any with empty values.
28pub(crate) fn append_query_params(url: String, params: &[(&str, &str)]) -> String {
29    let qs: Vec<String> = params
30        .iter()
31        .filter(|(_, v)| !v.is_empty())
32        .map(|(k, v)| format!("{}={}", k, urlencoding::encode(v)))
33        .collect();
34    if qs.is_empty() {
35        url
36    } else {
37        format!("{}?{}", url, qs.join("&"))
38    }
39}