Skip to main content

vantage_aws/
lib.rs

1//! AWS API wrapper for Vantage — incubating.
2//!
3//! Treat AWS API endpoints as Vantage `TableSource`s. Build an
4//! [`AwsAccount`], hand it to a `Table`, and encode the operation in
5//! the table name as `{protocol}/{array_key}:{service}/{target}`:
6//!
7//! ```text
8//! json1/logGroups:logs/Logs_20140328.DescribeLogGroups
9//!   │       │      │    └── X-Amz-Target header value
10//!   │       │      └─────── service code (also URL hostname segment)
11//!   │       └────────────── response field that holds the row array
12//!   └────────────────────── wire protocol
13//!
14//! query/Users:iam/2010-05-08.ListUsers
15//!   │     │    │     │
16//!   │     │    │     └── "VERSION.Action" — both go in the form body
17//!   │     │    └──────── service code (also URL hostname segment)
18//!   │     └───────────── response element name (Query lists wrap in <member>)
19//!   └─────────────────── wire protocol
20//! ```
21//!
22//! Two protocols ship today: **JSON-1.1** for CloudWatch, ECS, KMS,
23//! DynamoDB control-plane, etc.; and **Query** (form-encoded request,
24//! XML response) for IAM, STS, EC2, ELBv1, SES, etc. Both are routed
25//! through the same `AwsAccount` `TableSource`, so relations span
26//! services and protocols freely.
27//!
28//! Conditions on the table fold into the request body. v0 is
29//! read-only; writes arrive later. The CloudWatch Logs and ECS list
30//! endpoints auto-paginate through `nextToken` until exhausted; cap
31//! the walk via [`AwsAccount::with_max_pages`] if you need to. Other
32//! protocols (Query/IAM, REST-XML/S3, REST-JSON/Lambda) are still
33//! single-page — they'll need their own walk implementations.
34//!
35//! Ready-made models live under [`models`] if you want to skip the
36//! table-name dance and start querying.
37//!
38//! ```no_run
39//! # use vantage_aws::{AwsAccount, eq};
40//! # use vantage_table::table::Table;
41//! # use vantage_types::EmptyEntity;
42//! # async fn run() -> vantage_core::Result<()> {
43//! // env vars first, falling back to ~/.aws/credentials [default]
44//! let aws = AwsAccount::from_default()?;
45//!
46//! let mut groups: Table<AwsAccount, EmptyEntity> = Table::new(
47//!     "json1/logGroups:logs/Logs_20140328.DescribeLogGroups",
48//!     aws,
49//! );
50//! groups.add_condition(eq("logGroupNamePrefix", "/aws/lambda/"));
51//! # Ok(()) }
52//! ```
53
54mod account;
55mod condition;
56mod dispatch;
57mod impls;
58mod json1;
59mod json10;
60mod operation;
61mod query;
62mod restjson;
63mod restxml;
64mod sign;
65
66pub mod dynamodb;
67pub mod models;
68pub mod types;
69
70pub use account::AwsAccount;
71pub use condition::{AwsCondition, eq, in_};
72pub use operation::AwsOperation;
73pub use types::{AnyAwsType, Arn, AwsDateTime, typed_records, untyped_records};
74
75#[doc(hidden)]
76pub mod __test_support {
77    //! Internal hooks for integration tests under `tests/`. Not part of
78    //! the public API.
79    pub use crate::sign::{SignedHeader, sign_v4};
80}