Skip to content

Commit fde1df7

Browse files
authored
refactor(ec2): split 5014-line rest.rs into per-resource submodules (#2273)
2 parents 97340e3 + 297adcf commit fde1df7

12 files changed

Lines changed: 5086 additions & 5014 deletions

File tree

crates/fakecloud-ec2/src/service/rest.rs

Lines changed: 0 additions & 5014 deletions
This file was deleted.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
//! EC2 byoip operations (extracted from the rest long-tail module).
2+
3+
#![allow(clippy::too_many_lines)]
4+
5+
use super::*;
6+
7+
pub(crate) fn advertise_byoip_cidr(
8+
_svc: &Ec2Service,
9+
req: &AwsRequest,
10+
) -> Result<AwsResponse, AwsServiceError> {
11+
require(&req.query_params, "Cidr")?;
12+
Ok(Ec2Service::respond(
13+
"AdvertiseByoipCidr",
14+
&req.request_id,
15+
"",
16+
))
17+
}
18+
19+
pub(crate) fn deprovision_byoip_cidr(
20+
_svc: &Ec2Service,
21+
req: &AwsRequest,
22+
) -> Result<AwsResponse, AwsServiceError> {
23+
require(&req.query_params, "Cidr")?;
24+
Ok(Ec2Service::respond(
25+
"DeprovisionByoipCidr",
26+
&req.request_id,
27+
"",
28+
))
29+
}
30+
31+
pub(crate) fn describe_byoip_cidrs(
32+
_svc: &Ec2Service,
33+
req: &AwsRequest,
34+
) -> Result<AwsResponse, AwsServiceError> {
35+
require(&req.query_params, "MaxResults")?;
36+
validate_max_results(&req.query_params, 1, 100)?;
37+
Ok(Ec2Service::respond(
38+
"DescribeByoipCidrs",
39+
&req.request_id,
40+
"",
41+
))
42+
}
43+
44+
pub(crate) fn provision_byoip_cidr(
45+
_svc: &Ec2Service,
46+
req: &AwsRequest,
47+
) -> Result<AwsResponse, AwsServiceError> {
48+
require(&req.query_params, "Cidr")?;
49+
Ok(Ec2Service::respond(
50+
"ProvisionByoipCidr",
51+
&req.request_id,
52+
"",
53+
))
54+
}
55+
56+
pub(crate) fn withdraw_byoip_cidr(
57+
_svc: &Ec2Service,
58+
req: &AwsRequest,
59+
) -> Result<AwsResponse, AwsServiceError> {
60+
require(&req.query_params, "Cidr")?;
61+
Ok(Ec2Service::respond(
62+
"WithdrawByoipCidr",
63+
&req.request_id,
64+
"",
65+
))
66+
}
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
//! EC2 capacity manager operations (extracted from the rest long-tail module).
2+
3+
#![allow(clippy::too_many_lines)]
4+
5+
use super::*;
6+
7+
pub(crate) fn create_capacity_manager_data_export(
8+
_svc: &Ec2Service,
9+
req: &AwsRequest,
10+
) -> Result<AwsResponse, AwsServiceError> {
11+
require(&req.query_params, "S3BucketName")?;
12+
require(&req.query_params, "Schedule")?;
13+
require(&req.query_params, "OutputFormat")?;
14+
validate_enum(&req.query_params, "Schedule", &["hourly"])?;
15+
validate_enum(&req.query_params, "OutputFormat", &["csv", "parquet"])?;
16+
Ok(Ec2Service::respond(
17+
"CreateCapacityManagerDataExport",
18+
&req.request_id,
19+
"",
20+
))
21+
}
22+
23+
pub(crate) fn delete_capacity_manager_data_export(
24+
_svc: &Ec2Service,
25+
req: &AwsRequest,
26+
) -> Result<AwsResponse, AwsServiceError> {
27+
require(&req.query_params, "CapacityManagerDataExportId")?;
28+
Ok(Ec2Service::respond(
29+
"DeleteCapacityManagerDataExport",
30+
&req.request_id,
31+
"",
32+
))
33+
}
34+
35+
pub(crate) fn describe_capacity_manager_data_exports(
36+
_svc: &Ec2Service,
37+
req: &AwsRequest,
38+
) -> Result<AwsResponse, AwsServiceError> {
39+
validate_max_results(&req.query_params, 1, 1000)?;
40+
Ok(Ec2Service::respond(
41+
"DescribeCapacityManagerDataExports",
42+
&req.request_id,
43+
"",
44+
))
45+
}
46+
47+
pub(crate) fn disable_capacity_manager(
48+
_svc: &Ec2Service,
49+
req: &AwsRequest,
50+
) -> Result<AwsResponse, AwsServiceError> {
51+
Ok(Ec2Service::respond(
52+
"DisableCapacityManager",
53+
&req.request_id,
54+
"",
55+
))
56+
}
57+
58+
pub(crate) fn enable_capacity_manager(
59+
_svc: &Ec2Service,
60+
req: &AwsRequest,
61+
) -> Result<AwsResponse, AwsServiceError> {
62+
Ok(Ec2Service::respond(
63+
"EnableCapacityManager",
64+
&req.request_id,
65+
"",
66+
))
67+
}
68+
69+
pub(crate) fn get_capacity_manager_attributes(
70+
_svc: &Ec2Service,
71+
req: &AwsRequest,
72+
) -> Result<AwsResponse, AwsServiceError> {
73+
Ok(Ec2Service::respond(
74+
"GetCapacityManagerAttributes",
75+
&req.request_id,
76+
"",
77+
))
78+
}
79+
80+
pub(crate) fn get_capacity_manager_metric_data(
81+
_svc: &Ec2Service,
82+
req: &AwsRequest,
83+
) -> Result<AwsResponse, AwsServiceError> {
84+
validate_int_range(&req.query_params, "Period", 3600, i64::MAX)?;
85+
require(&req.query_params, "StartTime")?;
86+
require(&req.query_params, "EndTime")?;
87+
require(&req.query_params, "Period")?;
88+
Ok(Ec2Service::respond(
89+
"GetCapacityManagerMetricData",
90+
&req.request_id,
91+
"",
92+
))
93+
}
94+
95+
pub(crate) fn get_capacity_manager_metric_dimensions(
96+
_svc: &Ec2Service,
97+
req: &AwsRequest,
98+
) -> Result<AwsResponse, AwsServiceError> {
99+
require(&req.query_params, "StartTime")?;
100+
require(&req.query_params, "EndTime")?;
101+
Ok(Ec2Service::respond(
102+
"GetCapacityManagerMetricDimensions",
103+
&req.request_id,
104+
"",
105+
))
106+
}
107+
108+
pub(crate) fn get_capacity_manager_monitored_tag_keys(
109+
_svc: &Ec2Service,
110+
req: &AwsRequest,
111+
) -> Result<AwsResponse, AwsServiceError> {
112+
validate_max_results(&req.query_params, 1, 1000)?;
113+
Ok(Ec2Service::respond(
114+
"GetCapacityManagerMonitoredTagKeys",
115+
&req.request_id,
116+
"",
117+
))
118+
}
119+
120+
pub(crate) fn update_capacity_manager_monitored_tag_keys(
121+
_svc: &Ec2Service,
122+
req: &AwsRequest,
123+
) -> Result<AwsResponse, AwsServiceError> {
124+
Ok(Ec2Service::respond(
125+
"UpdateCapacityManagerMonitoredTagKeys",
126+
&req.request_id,
127+
"",
128+
))
129+
}
130+
131+
pub(crate) fn update_capacity_manager_organizations_access(
132+
_svc: &Ec2Service,
133+
req: &AwsRequest,
134+
) -> Result<AwsResponse, AwsServiceError> {
135+
require(&req.query_params, "OrganizationsAccess")?;
136+
Ok(Ec2Service::respond(
137+
"UpdateCapacityManagerOrganizationsAccess",
138+
&req.request_id,
139+
"",
140+
))
141+
}

0 commit comments

Comments
 (0)