1pub mod cfn_provision;
11pub mod defaults;
12pub mod runtime;
13pub mod service;
14pub mod service_helpers;
15pub mod state;
16
17pub use runtime::Ec2Runtime;
18pub use service::Ec2Service;
19pub use state::{Ec2Snapshot, Ec2State, SharedEc2State, EC2_SNAPSHOT_SCHEMA_VERSION};
20
21#[cfg(test)]
23pub(crate) mod test_support {
24 use fakecloud_core::service::{AwsRequest, AwsResponse, AwsServiceError};
25
26 pub(crate) fn err_of(r: Result<AwsResponse, AwsServiceError>) -> AwsServiceError {
29 match r {
30 Ok(_) => panic!("expected an error, got Ok"),
31 Err(e) => e,
32 }
33 }
34
35 pub(crate) fn ec2_request(action: &str, query: &[(&str, &str)]) -> AwsRequest {
37 AwsRequest {
38 service: "ec2".into(),
39 action: action.into(),
40 region: "us-east-1".into(),
41 account_id: "000000000000".into(),
42 request_id: "rid".into(),
43 headers: http::HeaderMap::new(),
44 query_params: query
45 .iter()
46 .map(|(k, v)| (k.to_string(), v.to_string()))
47 .collect(),
48 body: bytes::Bytes::new(),
49 body_stream: parking_lot::Mutex::new(None),
50 path_segments: Vec::new(),
51 raw_path: "/".into(),
52 raw_query: String::new(),
53 method: http::Method::POST,
54 is_query_protocol: true,
55 access_key_id: None,
56 principal: None,
57 }
58 }
59}