1use std::error::Error;
14use std::fmt;
15
16use async_trait::async_trait;
17use rusoto_core::credential::ProvideAwsCredentials;
18use rusoto_core::region;
19use rusoto_core::request::{BufferedHttpResponse, DispatchSignedRequest};
20use rusoto_core::{Client, RusotoError};
21
22use rusoto_core::proto;
23use rusoto_core::request::HttpResponse;
24use rusoto_core::signature::SignedRequest;
25#[allow(unused_imports)]
26use serde::{Deserialize, Serialize};
27
28impl ComputeOptimizerClient {
29 fn new_signed_request(&self, http_method: &str, request_uri: &str) -> SignedRequest {
30 let mut request =
31 SignedRequest::new(http_method, "compute-optimizer", &self.region, request_uri);
32
33 request.set_content_type("application/x-amz-json-1.0".to_owned());
34
35 request
36 }
37
38 async fn sign_and_dispatch<E>(
39 &self,
40 request: SignedRequest,
41 from_response: fn(BufferedHttpResponse) -> RusotoError<E>,
42 ) -> Result<HttpResponse, RusotoError<E>> {
43 let mut response = self.client.sign_and_dispatch(request).await?;
44 if !response.status.is_success() {
45 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
46 return Err(from_response(response));
47 }
48
49 Ok(response)
50 }
51}
52
53use serde_json;
54#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
56#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
57pub struct AutoScalingGroupConfiguration {
58 #[serde(rename = "desiredCapacity")]
60 #[serde(skip_serializing_if = "Option::is_none")]
61 pub desired_capacity: Option<i64>,
62 #[serde(rename = "instanceType")]
64 #[serde(skip_serializing_if = "Option::is_none")]
65 pub instance_type: Option<String>,
66 #[serde(rename = "maxSize")]
68 #[serde(skip_serializing_if = "Option::is_none")]
69 pub max_size: Option<i64>,
70 #[serde(rename = "minSize")]
72 #[serde(skip_serializing_if = "Option::is_none")]
73 pub min_size: Option<i64>,
74}
75
76#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
78#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
79pub struct AutoScalingGroupRecommendation {
80 #[serde(rename = "accountId")]
82 #[serde(skip_serializing_if = "Option::is_none")]
83 pub account_id: Option<String>,
84 #[serde(rename = "autoScalingGroupArn")]
86 #[serde(skip_serializing_if = "Option::is_none")]
87 pub auto_scaling_group_arn: Option<String>,
88 #[serde(rename = "autoScalingGroupName")]
90 #[serde(skip_serializing_if = "Option::is_none")]
91 pub auto_scaling_group_name: Option<String>,
92 #[serde(rename = "currentConfiguration")]
94 #[serde(skip_serializing_if = "Option::is_none")]
95 pub current_configuration: Option<AutoScalingGroupConfiguration>,
96 #[serde(rename = "finding")]
98 #[serde(skip_serializing_if = "Option::is_none")]
99 pub finding: Option<String>,
100 #[serde(rename = "lastRefreshTimestamp")]
102 #[serde(skip_serializing_if = "Option::is_none")]
103 pub last_refresh_timestamp: Option<f64>,
104 #[serde(rename = "lookBackPeriodInDays")]
106 #[serde(skip_serializing_if = "Option::is_none")]
107 pub look_back_period_in_days: Option<f64>,
108 #[serde(rename = "recommendationOptions")]
110 #[serde(skip_serializing_if = "Option::is_none")]
111 pub recommendation_options: Option<Vec<AutoScalingGroupRecommendationOption>>,
112 #[serde(rename = "utilizationMetrics")]
114 #[serde(skip_serializing_if = "Option::is_none")]
115 pub utilization_metrics: Option<Vec<UtilizationMetric>>,
116}
117
118#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
120#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
121pub struct AutoScalingGroupRecommendationOption {
122 #[serde(rename = "configuration")]
124 #[serde(skip_serializing_if = "Option::is_none")]
125 pub configuration: Option<AutoScalingGroupConfiguration>,
126 #[serde(rename = "performanceRisk")]
128 #[serde(skip_serializing_if = "Option::is_none")]
129 pub performance_risk: Option<f64>,
130 #[serde(rename = "projectedUtilizationMetrics")]
132 #[serde(skip_serializing_if = "Option::is_none")]
133 pub projected_utilization_metrics: Option<Vec<UtilizationMetric>>,
134 #[serde(rename = "rank")]
136 #[serde(skip_serializing_if = "Option::is_none")]
137 pub rank: Option<i64>,
138}
139
140#[derive(Clone, Debug, Default, PartialEq, Serialize)]
141#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
142pub struct DescribeRecommendationExportJobsRequest {
143 #[serde(rename = "filters")]
145 #[serde(skip_serializing_if = "Option::is_none")]
146 pub filters: Option<Vec<JobFilter>>,
147 #[serde(rename = "jobIds")]
149 #[serde(skip_serializing_if = "Option::is_none")]
150 pub job_ids: Option<Vec<String>>,
151 #[serde(rename = "maxResults")]
153 #[serde(skip_serializing_if = "Option::is_none")]
154 pub max_results: Option<i64>,
155 #[serde(rename = "nextToken")]
157 #[serde(skip_serializing_if = "Option::is_none")]
158 pub next_token: Option<String>,
159}
160
161#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
162#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
163pub struct DescribeRecommendationExportJobsResponse {
164 #[serde(rename = "nextToken")]
166 #[serde(skip_serializing_if = "Option::is_none")]
167 pub next_token: Option<String>,
168 #[serde(rename = "recommendationExportJobs")]
170 #[serde(skip_serializing_if = "Option::is_none")]
171 pub recommendation_export_jobs: Option<Vec<RecommendationExportJob>>,
172}
173
174#[derive(Clone, Debug, Default, PartialEq, Serialize)]
175#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
176pub struct ExportAutoScalingGroupRecommendationsRequest {
177 #[serde(rename = "accountIds")]
179 #[serde(skip_serializing_if = "Option::is_none")]
180 pub account_ids: Option<Vec<String>>,
181 #[serde(rename = "fieldsToExport")]
183 #[serde(skip_serializing_if = "Option::is_none")]
184 pub fields_to_export: Option<Vec<String>>,
185 #[serde(rename = "fileFormat")]
187 #[serde(skip_serializing_if = "Option::is_none")]
188 pub file_format: Option<String>,
189 #[serde(rename = "filters")]
191 #[serde(skip_serializing_if = "Option::is_none")]
192 pub filters: Option<Vec<Filter>>,
193 #[serde(rename = "includeMemberAccounts")]
195 #[serde(skip_serializing_if = "Option::is_none")]
196 pub include_member_accounts: Option<bool>,
197 #[serde(rename = "s3DestinationConfig")]
199 pub s_3_destination_config: S3DestinationConfig,
200}
201
202#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
203#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
204pub struct ExportAutoScalingGroupRecommendationsResponse {
205 #[serde(rename = "jobId")]
207 #[serde(skip_serializing_if = "Option::is_none")]
208 pub job_id: Option<String>,
209 #[serde(rename = "s3Destination")]
211 #[serde(skip_serializing_if = "Option::is_none")]
212 pub s_3_destination: Option<S3Destination>,
213}
214
215#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
217#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
218pub struct ExportDestination {
219 #[serde(rename = "s3")]
221 #[serde(skip_serializing_if = "Option::is_none")]
222 pub s_3: Option<S3Destination>,
223}
224
225#[derive(Clone, Debug, Default, PartialEq, Serialize)]
226#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
227pub struct ExportEC2InstanceRecommendationsRequest {
228 #[serde(rename = "accountIds")]
230 #[serde(skip_serializing_if = "Option::is_none")]
231 pub account_ids: Option<Vec<String>>,
232 #[serde(rename = "fieldsToExport")]
234 #[serde(skip_serializing_if = "Option::is_none")]
235 pub fields_to_export: Option<Vec<String>>,
236 #[serde(rename = "fileFormat")]
238 #[serde(skip_serializing_if = "Option::is_none")]
239 pub file_format: Option<String>,
240 #[serde(rename = "filters")]
242 #[serde(skip_serializing_if = "Option::is_none")]
243 pub filters: Option<Vec<Filter>>,
244 #[serde(rename = "includeMemberAccounts")]
246 #[serde(skip_serializing_if = "Option::is_none")]
247 pub include_member_accounts: Option<bool>,
248 #[serde(rename = "s3DestinationConfig")]
250 pub s_3_destination_config: S3DestinationConfig,
251}
252
253#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
254#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
255pub struct ExportEC2InstanceRecommendationsResponse {
256 #[serde(rename = "jobId")]
258 #[serde(skip_serializing_if = "Option::is_none")]
259 pub job_id: Option<String>,
260 #[serde(rename = "s3Destination")]
262 #[serde(skip_serializing_if = "Option::is_none")]
263 pub s_3_destination: Option<S3Destination>,
264}
265
266#[derive(Clone, Debug, Default, PartialEq, Serialize)]
268#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
269pub struct Filter {
270 #[serde(rename = "name")]
272 #[serde(skip_serializing_if = "Option::is_none")]
273 pub name: Option<String>,
274 #[serde(rename = "values")]
276 #[serde(skip_serializing_if = "Option::is_none")]
277 pub values: Option<Vec<String>>,
278}
279
280#[derive(Clone, Debug, Default, PartialEq, Serialize)]
281#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
282pub struct GetAutoScalingGroupRecommendationsRequest {
283 #[serde(rename = "accountIds")]
285 #[serde(skip_serializing_if = "Option::is_none")]
286 pub account_ids: Option<Vec<String>>,
287 #[serde(rename = "autoScalingGroupArns")]
289 #[serde(skip_serializing_if = "Option::is_none")]
290 pub auto_scaling_group_arns: Option<Vec<String>>,
291 #[serde(rename = "filters")]
293 #[serde(skip_serializing_if = "Option::is_none")]
294 pub filters: Option<Vec<Filter>>,
295 #[serde(rename = "maxResults")]
297 #[serde(skip_serializing_if = "Option::is_none")]
298 pub max_results: Option<i64>,
299 #[serde(rename = "nextToken")]
301 #[serde(skip_serializing_if = "Option::is_none")]
302 pub next_token: Option<String>,
303}
304
305#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
306#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
307pub struct GetAutoScalingGroupRecommendationsResponse {
308 #[serde(rename = "autoScalingGroupRecommendations")]
310 #[serde(skip_serializing_if = "Option::is_none")]
311 pub auto_scaling_group_recommendations: Option<Vec<AutoScalingGroupRecommendation>>,
312 #[serde(rename = "errors")]
314 #[serde(skip_serializing_if = "Option::is_none")]
315 pub errors: Option<Vec<GetRecommendationError>>,
316 #[serde(rename = "nextToken")]
318 #[serde(skip_serializing_if = "Option::is_none")]
319 pub next_token: Option<String>,
320}
321
322#[derive(Clone, Debug, Default, PartialEq, Serialize)]
323#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
324pub struct GetEC2InstanceRecommendationsRequest {
325 #[serde(rename = "accountIds")]
327 #[serde(skip_serializing_if = "Option::is_none")]
328 pub account_ids: Option<Vec<String>>,
329 #[serde(rename = "filters")]
331 #[serde(skip_serializing_if = "Option::is_none")]
332 pub filters: Option<Vec<Filter>>,
333 #[serde(rename = "instanceArns")]
335 #[serde(skip_serializing_if = "Option::is_none")]
336 pub instance_arns: Option<Vec<String>>,
337 #[serde(rename = "maxResults")]
339 #[serde(skip_serializing_if = "Option::is_none")]
340 pub max_results: Option<i64>,
341 #[serde(rename = "nextToken")]
343 #[serde(skip_serializing_if = "Option::is_none")]
344 pub next_token: Option<String>,
345}
346
347#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
348#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
349pub struct GetEC2InstanceRecommendationsResponse {
350 #[serde(rename = "errors")]
352 #[serde(skip_serializing_if = "Option::is_none")]
353 pub errors: Option<Vec<GetRecommendationError>>,
354 #[serde(rename = "instanceRecommendations")]
356 #[serde(skip_serializing_if = "Option::is_none")]
357 pub instance_recommendations: Option<Vec<InstanceRecommendation>>,
358 #[serde(rename = "nextToken")]
360 #[serde(skip_serializing_if = "Option::is_none")]
361 pub next_token: Option<String>,
362}
363
364#[derive(Clone, Debug, Default, PartialEq, Serialize)]
365#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
366pub struct GetEC2RecommendationProjectedMetricsRequest {
367 #[serde(rename = "endTime")]
369 pub end_time: f64,
370 #[serde(rename = "instanceArn")]
372 pub instance_arn: String,
373 #[serde(rename = "period")]
375 pub period: i64,
376 #[serde(rename = "startTime")]
378 pub start_time: f64,
379 #[serde(rename = "stat")]
381 pub stat: String,
382}
383
384#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
385#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
386pub struct GetEC2RecommendationProjectedMetricsResponse {
387 #[serde(rename = "recommendedOptionProjectedMetrics")]
389 #[serde(skip_serializing_if = "Option::is_none")]
390 pub recommended_option_projected_metrics: Option<Vec<RecommendedOptionProjectedMetric>>,
391}
392
393#[derive(Clone, Debug, Default, PartialEq, Serialize)]
394#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
395pub struct GetEnrollmentStatusRequest {}
396
397#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
398#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
399pub struct GetEnrollmentStatusResponse {
400 #[serde(rename = "memberAccountsEnrolled")]
402 #[serde(skip_serializing_if = "Option::is_none")]
403 pub member_accounts_enrolled: Option<bool>,
404 #[serde(rename = "status")]
406 #[serde(skip_serializing_if = "Option::is_none")]
407 pub status: Option<String>,
408 #[serde(rename = "statusReason")]
410 #[serde(skip_serializing_if = "Option::is_none")]
411 pub status_reason: Option<String>,
412}
413
414#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
416#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
417pub struct GetRecommendationError {
418 #[serde(rename = "code")]
420 #[serde(skip_serializing_if = "Option::is_none")]
421 pub code: Option<String>,
422 #[serde(rename = "identifier")]
424 #[serde(skip_serializing_if = "Option::is_none")]
425 pub identifier: Option<String>,
426 #[serde(rename = "message")]
428 #[serde(skip_serializing_if = "Option::is_none")]
429 pub message: Option<String>,
430}
431
432#[derive(Clone, Debug, Default, PartialEq, Serialize)]
433#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
434pub struct GetRecommendationSummariesRequest {
435 #[serde(rename = "accountIds")]
437 #[serde(skip_serializing_if = "Option::is_none")]
438 pub account_ids: Option<Vec<String>>,
439 #[serde(rename = "maxResults")]
441 #[serde(skip_serializing_if = "Option::is_none")]
442 pub max_results: Option<i64>,
443 #[serde(rename = "nextToken")]
445 #[serde(skip_serializing_if = "Option::is_none")]
446 pub next_token: Option<String>,
447}
448
449#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
450#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
451pub struct GetRecommendationSummariesResponse {
452 #[serde(rename = "nextToken")]
454 #[serde(skip_serializing_if = "Option::is_none")]
455 pub next_token: Option<String>,
456 #[serde(rename = "recommendationSummaries")]
458 #[serde(skip_serializing_if = "Option::is_none")]
459 pub recommendation_summaries: Option<Vec<RecommendationSummary>>,
460}
461
462#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
464#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
465pub struct InstanceRecommendation {
466 #[serde(rename = "accountId")]
468 #[serde(skip_serializing_if = "Option::is_none")]
469 pub account_id: Option<String>,
470 #[serde(rename = "currentInstanceType")]
472 #[serde(skip_serializing_if = "Option::is_none")]
473 pub current_instance_type: Option<String>,
474 #[serde(rename = "finding")]
476 #[serde(skip_serializing_if = "Option::is_none")]
477 pub finding: Option<String>,
478 #[serde(rename = "instanceArn")]
480 #[serde(skip_serializing_if = "Option::is_none")]
481 pub instance_arn: Option<String>,
482 #[serde(rename = "instanceName")]
484 #[serde(skip_serializing_if = "Option::is_none")]
485 pub instance_name: Option<String>,
486 #[serde(rename = "lastRefreshTimestamp")]
488 #[serde(skip_serializing_if = "Option::is_none")]
489 pub last_refresh_timestamp: Option<f64>,
490 #[serde(rename = "lookBackPeriodInDays")]
492 #[serde(skip_serializing_if = "Option::is_none")]
493 pub look_back_period_in_days: Option<f64>,
494 #[serde(rename = "recommendationOptions")]
496 #[serde(skip_serializing_if = "Option::is_none")]
497 pub recommendation_options: Option<Vec<InstanceRecommendationOption>>,
498 #[serde(rename = "recommendationSources")]
500 #[serde(skip_serializing_if = "Option::is_none")]
501 pub recommendation_sources: Option<Vec<RecommendationSource>>,
502 #[serde(rename = "utilizationMetrics")]
504 #[serde(skip_serializing_if = "Option::is_none")]
505 pub utilization_metrics: Option<Vec<UtilizationMetric>>,
506}
507
508#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
510#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
511pub struct InstanceRecommendationOption {
512 #[serde(rename = "instanceType")]
514 #[serde(skip_serializing_if = "Option::is_none")]
515 pub instance_type: Option<String>,
516 #[serde(rename = "performanceRisk")]
518 #[serde(skip_serializing_if = "Option::is_none")]
519 pub performance_risk: Option<f64>,
520 #[serde(rename = "projectedUtilizationMetrics")]
522 #[serde(skip_serializing_if = "Option::is_none")]
523 pub projected_utilization_metrics: Option<Vec<UtilizationMetric>>,
524 #[serde(rename = "rank")]
526 #[serde(skip_serializing_if = "Option::is_none")]
527 pub rank: Option<i64>,
528}
529
530#[derive(Clone, Debug, Default, PartialEq, Serialize)]
532#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
533pub struct JobFilter {
534 #[serde(rename = "name")]
536 #[serde(skip_serializing_if = "Option::is_none")]
537 pub name: Option<String>,
538 #[serde(rename = "values")]
540 #[serde(skip_serializing_if = "Option::is_none")]
541 pub values: Option<Vec<String>>,
542}
543
544#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
546#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
547pub struct ProjectedMetric {
548 #[serde(rename = "name")]
550 #[serde(skip_serializing_if = "Option::is_none")]
551 pub name: Option<String>,
552 #[serde(rename = "timestamps")]
554 #[serde(skip_serializing_if = "Option::is_none")]
555 pub timestamps: Option<Vec<f64>>,
556 #[serde(rename = "values")]
558 #[serde(skip_serializing_if = "Option::is_none")]
559 pub values: Option<Vec<f64>>,
560}
561
562#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
564#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
565pub struct RecommendationExportJob {
566 #[serde(rename = "creationTimestamp")]
568 #[serde(skip_serializing_if = "Option::is_none")]
569 pub creation_timestamp: Option<f64>,
570 #[serde(rename = "destination")]
572 #[serde(skip_serializing_if = "Option::is_none")]
573 pub destination: Option<ExportDestination>,
574 #[serde(rename = "failureReason")]
576 #[serde(skip_serializing_if = "Option::is_none")]
577 pub failure_reason: Option<String>,
578 #[serde(rename = "jobId")]
580 #[serde(skip_serializing_if = "Option::is_none")]
581 pub job_id: Option<String>,
582 #[serde(rename = "lastUpdatedTimestamp")]
584 #[serde(skip_serializing_if = "Option::is_none")]
585 pub last_updated_timestamp: Option<f64>,
586 #[serde(rename = "resourceType")]
588 #[serde(skip_serializing_if = "Option::is_none")]
589 pub resource_type: Option<String>,
590 #[serde(rename = "status")]
592 #[serde(skip_serializing_if = "Option::is_none")]
593 pub status: Option<String>,
594}
595
596#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
598#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
599pub struct RecommendationSource {
600 #[serde(rename = "recommendationSourceArn")]
602 #[serde(skip_serializing_if = "Option::is_none")]
603 pub recommendation_source_arn: Option<String>,
604 #[serde(rename = "recommendationSourceType")]
606 #[serde(skip_serializing_if = "Option::is_none")]
607 pub recommendation_source_type: Option<String>,
608}
609
610#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
612#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
613pub struct RecommendationSummary {
614 #[serde(rename = "accountId")]
616 #[serde(skip_serializing_if = "Option::is_none")]
617 pub account_id: Option<String>,
618 #[serde(rename = "recommendationResourceType")]
620 #[serde(skip_serializing_if = "Option::is_none")]
621 pub recommendation_resource_type: Option<String>,
622 #[serde(rename = "summaries")]
624 #[serde(skip_serializing_if = "Option::is_none")]
625 pub summaries: Option<Vec<Summary>>,
626}
627
628#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
630#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
631pub struct RecommendedOptionProjectedMetric {
632 #[serde(rename = "projectedMetrics")]
634 #[serde(skip_serializing_if = "Option::is_none")]
635 pub projected_metrics: Option<Vec<ProjectedMetric>>,
636 #[serde(rename = "rank")]
638 #[serde(skip_serializing_if = "Option::is_none")]
639 pub rank: Option<i64>,
640 #[serde(rename = "recommendedInstanceType")]
642 #[serde(skip_serializing_if = "Option::is_none")]
643 pub recommended_instance_type: Option<String>,
644}
645
646#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
648#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
649pub struct S3Destination {
650 #[serde(rename = "bucket")]
652 #[serde(skip_serializing_if = "Option::is_none")]
653 pub bucket: Option<String>,
654 #[serde(rename = "key")]
656 #[serde(skip_serializing_if = "Option::is_none")]
657 pub key: Option<String>,
658 #[serde(rename = "metadataKey")]
660 #[serde(skip_serializing_if = "Option::is_none")]
661 pub metadata_key: Option<String>,
662}
663
664#[derive(Clone, Debug, Default, PartialEq, Serialize)]
666#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
667pub struct S3DestinationConfig {
668 #[serde(rename = "bucket")]
670 #[serde(skip_serializing_if = "Option::is_none")]
671 pub bucket: Option<String>,
672 #[serde(rename = "keyPrefix")]
674 #[serde(skip_serializing_if = "Option::is_none")]
675 pub key_prefix: Option<String>,
676}
677
678#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
680#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
681pub struct Summary {
682 #[serde(rename = "name")]
684 #[serde(skip_serializing_if = "Option::is_none")]
685 pub name: Option<String>,
686 #[serde(rename = "value")]
688 #[serde(skip_serializing_if = "Option::is_none")]
689 pub value: Option<f64>,
690}
691
692#[derive(Clone, Debug, Default, PartialEq, Serialize)]
693#[cfg_attr(feature = "deserialize_structs", derive(Deserialize))]
694pub struct UpdateEnrollmentStatusRequest {
695 #[serde(rename = "includeMemberAccounts")]
697 #[serde(skip_serializing_if = "Option::is_none")]
698 pub include_member_accounts: Option<bool>,
699 #[serde(rename = "status")]
701 pub status: String,
702}
703
704#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
705#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
706pub struct UpdateEnrollmentStatusResponse {
707 #[serde(rename = "status")]
709 #[serde(skip_serializing_if = "Option::is_none")]
710 pub status: Option<String>,
711 #[serde(rename = "statusReason")]
713 #[serde(skip_serializing_if = "Option::is_none")]
714 pub status_reason: Option<String>,
715}
716
717#[derive(Clone, Debug, Default, Deserialize, PartialEq)]
719#[cfg_attr(any(test, feature = "serialize_structs"), derive(Serialize))]
720pub struct UtilizationMetric {
721 #[serde(rename = "name")]
723 #[serde(skip_serializing_if = "Option::is_none")]
724 pub name: Option<String>,
725 #[serde(rename = "statistic")]
727 #[serde(skip_serializing_if = "Option::is_none")]
728 pub statistic: Option<String>,
729 #[serde(rename = "value")]
731 #[serde(skip_serializing_if = "Option::is_none")]
732 pub value: Option<f64>,
733}
734
735#[derive(Debug, PartialEq)]
737pub enum DescribeRecommendationExportJobsError {
738 AccessDenied(String),
740 InternalServer(String),
742 InvalidParameterValue(String),
744 MissingAuthenticationToken(String),
746 OptInRequired(String),
748 ResourceNotFound(String),
750 ServiceUnavailable(String),
752 Throttling(String),
754}
755
756impl DescribeRecommendationExportJobsError {
757 pub fn from_response(
758 res: BufferedHttpResponse,
759 ) -> RusotoError<DescribeRecommendationExportJobsError> {
760 if let Some(err) = proto::json::Error::parse(&res) {
761 match err.typ.as_str() {
762 "AccessDeniedException" => {
763 return RusotoError::Service(
764 DescribeRecommendationExportJobsError::AccessDenied(err.msg),
765 )
766 }
767 "InternalServerException" => {
768 return RusotoError::Service(
769 DescribeRecommendationExportJobsError::InternalServer(err.msg),
770 )
771 }
772 "InvalidParameterValueException" => {
773 return RusotoError::Service(
774 DescribeRecommendationExportJobsError::InvalidParameterValue(err.msg),
775 )
776 }
777 "MissingAuthenticationToken" => {
778 return RusotoError::Service(
779 DescribeRecommendationExportJobsError::MissingAuthenticationToken(err.msg),
780 )
781 }
782 "OptInRequiredException" => {
783 return RusotoError::Service(
784 DescribeRecommendationExportJobsError::OptInRequired(err.msg),
785 )
786 }
787 "ResourceNotFoundException" => {
788 return RusotoError::Service(
789 DescribeRecommendationExportJobsError::ResourceNotFound(err.msg),
790 )
791 }
792 "ServiceUnavailableException" => {
793 return RusotoError::Service(
794 DescribeRecommendationExportJobsError::ServiceUnavailable(err.msg),
795 )
796 }
797 "ThrottlingException" => {
798 return RusotoError::Service(DescribeRecommendationExportJobsError::Throttling(
799 err.msg,
800 ))
801 }
802 "ValidationException" => return RusotoError::Validation(err.msg),
803 _ => {}
804 }
805 }
806 RusotoError::Unknown(res)
807 }
808}
809impl fmt::Display for DescribeRecommendationExportJobsError {
810 #[allow(unused_variables)]
811 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
812 match *self {
813 DescribeRecommendationExportJobsError::AccessDenied(ref cause) => {
814 write!(f, "{}", cause)
815 }
816 DescribeRecommendationExportJobsError::InternalServer(ref cause) => {
817 write!(f, "{}", cause)
818 }
819 DescribeRecommendationExportJobsError::InvalidParameterValue(ref cause) => {
820 write!(f, "{}", cause)
821 }
822 DescribeRecommendationExportJobsError::MissingAuthenticationToken(ref cause) => {
823 write!(f, "{}", cause)
824 }
825 DescribeRecommendationExportJobsError::OptInRequired(ref cause) => {
826 write!(f, "{}", cause)
827 }
828 DescribeRecommendationExportJobsError::ResourceNotFound(ref cause) => {
829 write!(f, "{}", cause)
830 }
831 DescribeRecommendationExportJobsError::ServiceUnavailable(ref cause) => {
832 write!(f, "{}", cause)
833 }
834 DescribeRecommendationExportJobsError::Throttling(ref cause) => write!(f, "{}", cause),
835 }
836 }
837}
838impl Error for DescribeRecommendationExportJobsError {}
839#[derive(Debug, PartialEq)]
841pub enum ExportAutoScalingGroupRecommendationsError {
842 AccessDenied(String),
844 InternalServer(String),
846 InvalidParameterValue(String),
848 LimitExceeded(String),
850 MissingAuthenticationToken(String),
852 OptInRequired(String),
854 ServiceUnavailable(String),
856 Throttling(String),
858}
859
860impl ExportAutoScalingGroupRecommendationsError {
861 pub fn from_response(
862 res: BufferedHttpResponse,
863 ) -> RusotoError<ExportAutoScalingGroupRecommendationsError> {
864 if let Some(err) = proto::json::Error::parse(&res) {
865 match err.typ.as_str() {
866 "AccessDeniedException" => {
867 return RusotoError::Service(
868 ExportAutoScalingGroupRecommendationsError::AccessDenied(err.msg),
869 )
870 }
871 "InternalServerException" => {
872 return RusotoError::Service(
873 ExportAutoScalingGroupRecommendationsError::InternalServer(err.msg),
874 )
875 }
876 "InvalidParameterValueException" => {
877 return RusotoError::Service(
878 ExportAutoScalingGroupRecommendationsError::InvalidParameterValue(err.msg),
879 )
880 }
881 "LimitExceededException" => {
882 return RusotoError::Service(
883 ExportAutoScalingGroupRecommendationsError::LimitExceeded(err.msg),
884 )
885 }
886 "MissingAuthenticationToken" => {
887 return RusotoError::Service(
888 ExportAutoScalingGroupRecommendationsError::MissingAuthenticationToken(
889 err.msg,
890 ),
891 )
892 }
893 "OptInRequiredException" => {
894 return RusotoError::Service(
895 ExportAutoScalingGroupRecommendationsError::OptInRequired(err.msg),
896 )
897 }
898 "ServiceUnavailableException" => {
899 return RusotoError::Service(
900 ExportAutoScalingGroupRecommendationsError::ServiceUnavailable(err.msg),
901 )
902 }
903 "ThrottlingException" => {
904 return RusotoError::Service(
905 ExportAutoScalingGroupRecommendationsError::Throttling(err.msg),
906 )
907 }
908 "ValidationException" => return RusotoError::Validation(err.msg),
909 _ => {}
910 }
911 }
912 RusotoError::Unknown(res)
913 }
914}
915impl fmt::Display for ExportAutoScalingGroupRecommendationsError {
916 #[allow(unused_variables)]
917 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
918 match *self {
919 ExportAutoScalingGroupRecommendationsError::AccessDenied(ref cause) => {
920 write!(f, "{}", cause)
921 }
922 ExportAutoScalingGroupRecommendationsError::InternalServer(ref cause) => {
923 write!(f, "{}", cause)
924 }
925 ExportAutoScalingGroupRecommendationsError::InvalidParameterValue(ref cause) => {
926 write!(f, "{}", cause)
927 }
928 ExportAutoScalingGroupRecommendationsError::LimitExceeded(ref cause) => {
929 write!(f, "{}", cause)
930 }
931 ExportAutoScalingGroupRecommendationsError::MissingAuthenticationToken(ref cause) => {
932 write!(f, "{}", cause)
933 }
934 ExportAutoScalingGroupRecommendationsError::OptInRequired(ref cause) => {
935 write!(f, "{}", cause)
936 }
937 ExportAutoScalingGroupRecommendationsError::ServiceUnavailable(ref cause) => {
938 write!(f, "{}", cause)
939 }
940 ExportAutoScalingGroupRecommendationsError::Throttling(ref cause) => {
941 write!(f, "{}", cause)
942 }
943 }
944 }
945}
946impl Error for ExportAutoScalingGroupRecommendationsError {}
947#[derive(Debug, PartialEq)]
949pub enum ExportEC2InstanceRecommendationsError {
950 AccessDenied(String),
952 InternalServer(String),
954 InvalidParameterValue(String),
956 LimitExceeded(String),
958 MissingAuthenticationToken(String),
960 OptInRequired(String),
962 ServiceUnavailable(String),
964 Throttling(String),
966}
967
968impl ExportEC2InstanceRecommendationsError {
969 pub fn from_response(
970 res: BufferedHttpResponse,
971 ) -> RusotoError<ExportEC2InstanceRecommendationsError> {
972 if let Some(err) = proto::json::Error::parse(&res) {
973 match err.typ.as_str() {
974 "AccessDeniedException" => {
975 return RusotoError::Service(
976 ExportEC2InstanceRecommendationsError::AccessDenied(err.msg),
977 )
978 }
979 "InternalServerException" => {
980 return RusotoError::Service(
981 ExportEC2InstanceRecommendationsError::InternalServer(err.msg),
982 )
983 }
984 "InvalidParameterValueException" => {
985 return RusotoError::Service(
986 ExportEC2InstanceRecommendationsError::InvalidParameterValue(err.msg),
987 )
988 }
989 "LimitExceededException" => {
990 return RusotoError::Service(
991 ExportEC2InstanceRecommendationsError::LimitExceeded(err.msg),
992 )
993 }
994 "MissingAuthenticationToken" => {
995 return RusotoError::Service(
996 ExportEC2InstanceRecommendationsError::MissingAuthenticationToken(err.msg),
997 )
998 }
999 "OptInRequiredException" => {
1000 return RusotoError::Service(
1001 ExportEC2InstanceRecommendationsError::OptInRequired(err.msg),
1002 )
1003 }
1004 "ServiceUnavailableException" => {
1005 return RusotoError::Service(
1006 ExportEC2InstanceRecommendationsError::ServiceUnavailable(err.msg),
1007 )
1008 }
1009 "ThrottlingException" => {
1010 return RusotoError::Service(ExportEC2InstanceRecommendationsError::Throttling(
1011 err.msg,
1012 ))
1013 }
1014 "ValidationException" => return RusotoError::Validation(err.msg),
1015 _ => {}
1016 }
1017 }
1018 RusotoError::Unknown(res)
1019 }
1020}
1021impl fmt::Display for ExportEC2InstanceRecommendationsError {
1022 #[allow(unused_variables)]
1023 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1024 match *self {
1025 ExportEC2InstanceRecommendationsError::AccessDenied(ref cause) => {
1026 write!(f, "{}", cause)
1027 }
1028 ExportEC2InstanceRecommendationsError::InternalServer(ref cause) => {
1029 write!(f, "{}", cause)
1030 }
1031 ExportEC2InstanceRecommendationsError::InvalidParameterValue(ref cause) => {
1032 write!(f, "{}", cause)
1033 }
1034 ExportEC2InstanceRecommendationsError::LimitExceeded(ref cause) => {
1035 write!(f, "{}", cause)
1036 }
1037 ExportEC2InstanceRecommendationsError::MissingAuthenticationToken(ref cause) => {
1038 write!(f, "{}", cause)
1039 }
1040 ExportEC2InstanceRecommendationsError::OptInRequired(ref cause) => {
1041 write!(f, "{}", cause)
1042 }
1043 ExportEC2InstanceRecommendationsError::ServiceUnavailable(ref cause) => {
1044 write!(f, "{}", cause)
1045 }
1046 ExportEC2InstanceRecommendationsError::Throttling(ref cause) => write!(f, "{}", cause),
1047 }
1048 }
1049}
1050impl Error for ExportEC2InstanceRecommendationsError {}
1051#[derive(Debug, PartialEq)]
1053pub enum GetAutoScalingGroupRecommendationsError {
1054 AccessDenied(String),
1056 InternalServer(String),
1058 InvalidParameterValue(String),
1060 MissingAuthenticationToken(String),
1062 OptInRequired(String),
1064 ResourceNotFound(String),
1066 ServiceUnavailable(String),
1068 Throttling(String),
1070}
1071
1072impl GetAutoScalingGroupRecommendationsError {
1073 pub fn from_response(
1074 res: BufferedHttpResponse,
1075 ) -> RusotoError<GetAutoScalingGroupRecommendationsError> {
1076 if let Some(err) = proto::json::Error::parse(&res) {
1077 match err.typ.as_str() {
1078 "AccessDeniedException" => {
1079 return RusotoError::Service(
1080 GetAutoScalingGroupRecommendationsError::AccessDenied(err.msg),
1081 )
1082 }
1083 "InternalServerException" => {
1084 return RusotoError::Service(
1085 GetAutoScalingGroupRecommendationsError::InternalServer(err.msg),
1086 )
1087 }
1088 "InvalidParameterValueException" => {
1089 return RusotoError::Service(
1090 GetAutoScalingGroupRecommendationsError::InvalidParameterValue(err.msg),
1091 )
1092 }
1093 "MissingAuthenticationToken" => {
1094 return RusotoError::Service(
1095 GetAutoScalingGroupRecommendationsError::MissingAuthenticationToken(
1096 err.msg,
1097 ),
1098 )
1099 }
1100 "OptInRequiredException" => {
1101 return RusotoError::Service(
1102 GetAutoScalingGroupRecommendationsError::OptInRequired(err.msg),
1103 )
1104 }
1105 "ResourceNotFoundException" => {
1106 return RusotoError::Service(
1107 GetAutoScalingGroupRecommendationsError::ResourceNotFound(err.msg),
1108 )
1109 }
1110 "ServiceUnavailableException" => {
1111 return RusotoError::Service(
1112 GetAutoScalingGroupRecommendationsError::ServiceUnavailable(err.msg),
1113 )
1114 }
1115 "ThrottlingException" => {
1116 return RusotoError::Service(
1117 GetAutoScalingGroupRecommendationsError::Throttling(err.msg),
1118 )
1119 }
1120 "ValidationException" => return RusotoError::Validation(err.msg),
1121 _ => {}
1122 }
1123 }
1124 RusotoError::Unknown(res)
1125 }
1126}
1127impl fmt::Display for GetAutoScalingGroupRecommendationsError {
1128 #[allow(unused_variables)]
1129 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1130 match *self {
1131 GetAutoScalingGroupRecommendationsError::AccessDenied(ref cause) => {
1132 write!(f, "{}", cause)
1133 }
1134 GetAutoScalingGroupRecommendationsError::InternalServer(ref cause) => {
1135 write!(f, "{}", cause)
1136 }
1137 GetAutoScalingGroupRecommendationsError::InvalidParameterValue(ref cause) => {
1138 write!(f, "{}", cause)
1139 }
1140 GetAutoScalingGroupRecommendationsError::MissingAuthenticationToken(ref cause) => {
1141 write!(f, "{}", cause)
1142 }
1143 GetAutoScalingGroupRecommendationsError::OptInRequired(ref cause) => {
1144 write!(f, "{}", cause)
1145 }
1146 GetAutoScalingGroupRecommendationsError::ResourceNotFound(ref cause) => {
1147 write!(f, "{}", cause)
1148 }
1149 GetAutoScalingGroupRecommendationsError::ServiceUnavailable(ref cause) => {
1150 write!(f, "{}", cause)
1151 }
1152 GetAutoScalingGroupRecommendationsError::Throttling(ref cause) => {
1153 write!(f, "{}", cause)
1154 }
1155 }
1156 }
1157}
1158impl Error for GetAutoScalingGroupRecommendationsError {}
1159#[derive(Debug, PartialEq)]
1161pub enum GetEC2InstanceRecommendationsError {
1162 AccessDenied(String),
1164 InternalServer(String),
1166 InvalidParameterValue(String),
1168 MissingAuthenticationToken(String),
1170 OptInRequired(String),
1172 ResourceNotFound(String),
1174 ServiceUnavailable(String),
1176 Throttling(String),
1178}
1179
1180impl GetEC2InstanceRecommendationsError {
1181 pub fn from_response(
1182 res: BufferedHttpResponse,
1183 ) -> RusotoError<GetEC2InstanceRecommendationsError> {
1184 if let Some(err) = proto::json::Error::parse(&res) {
1185 match err.typ.as_str() {
1186 "AccessDeniedException" => {
1187 return RusotoError::Service(GetEC2InstanceRecommendationsError::AccessDenied(
1188 err.msg,
1189 ))
1190 }
1191 "InternalServerException" => {
1192 return RusotoError::Service(
1193 GetEC2InstanceRecommendationsError::InternalServer(err.msg),
1194 )
1195 }
1196 "InvalidParameterValueException" => {
1197 return RusotoError::Service(
1198 GetEC2InstanceRecommendationsError::InvalidParameterValue(err.msg),
1199 )
1200 }
1201 "MissingAuthenticationToken" => {
1202 return RusotoError::Service(
1203 GetEC2InstanceRecommendationsError::MissingAuthenticationToken(err.msg),
1204 )
1205 }
1206 "OptInRequiredException" => {
1207 return RusotoError::Service(GetEC2InstanceRecommendationsError::OptInRequired(
1208 err.msg,
1209 ))
1210 }
1211 "ResourceNotFoundException" => {
1212 return RusotoError::Service(
1213 GetEC2InstanceRecommendationsError::ResourceNotFound(err.msg),
1214 )
1215 }
1216 "ServiceUnavailableException" => {
1217 return RusotoError::Service(
1218 GetEC2InstanceRecommendationsError::ServiceUnavailable(err.msg),
1219 )
1220 }
1221 "ThrottlingException" => {
1222 return RusotoError::Service(GetEC2InstanceRecommendationsError::Throttling(
1223 err.msg,
1224 ))
1225 }
1226 "ValidationException" => return RusotoError::Validation(err.msg),
1227 _ => {}
1228 }
1229 }
1230 RusotoError::Unknown(res)
1231 }
1232}
1233impl fmt::Display for GetEC2InstanceRecommendationsError {
1234 #[allow(unused_variables)]
1235 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1236 match *self {
1237 GetEC2InstanceRecommendationsError::AccessDenied(ref cause) => write!(f, "{}", cause),
1238 GetEC2InstanceRecommendationsError::InternalServer(ref cause) => write!(f, "{}", cause),
1239 GetEC2InstanceRecommendationsError::InvalidParameterValue(ref cause) => {
1240 write!(f, "{}", cause)
1241 }
1242 GetEC2InstanceRecommendationsError::MissingAuthenticationToken(ref cause) => {
1243 write!(f, "{}", cause)
1244 }
1245 GetEC2InstanceRecommendationsError::OptInRequired(ref cause) => write!(f, "{}", cause),
1246 GetEC2InstanceRecommendationsError::ResourceNotFound(ref cause) => {
1247 write!(f, "{}", cause)
1248 }
1249 GetEC2InstanceRecommendationsError::ServiceUnavailable(ref cause) => {
1250 write!(f, "{}", cause)
1251 }
1252 GetEC2InstanceRecommendationsError::Throttling(ref cause) => write!(f, "{}", cause),
1253 }
1254 }
1255}
1256impl Error for GetEC2InstanceRecommendationsError {}
1257#[derive(Debug, PartialEq)]
1259pub enum GetEC2RecommendationProjectedMetricsError {
1260 AccessDenied(String),
1262 InternalServer(String),
1264 InvalidParameterValue(String),
1266 MissingAuthenticationToken(String),
1268 OptInRequired(String),
1270 ResourceNotFound(String),
1272 ServiceUnavailable(String),
1274 Throttling(String),
1276}
1277
1278impl GetEC2RecommendationProjectedMetricsError {
1279 pub fn from_response(
1280 res: BufferedHttpResponse,
1281 ) -> RusotoError<GetEC2RecommendationProjectedMetricsError> {
1282 if let Some(err) = proto::json::Error::parse(&res) {
1283 match err.typ.as_str() {
1284 "AccessDeniedException" => {
1285 return RusotoError::Service(
1286 GetEC2RecommendationProjectedMetricsError::AccessDenied(err.msg),
1287 )
1288 }
1289 "InternalServerException" => {
1290 return RusotoError::Service(
1291 GetEC2RecommendationProjectedMetricsError::InternalServer(err.msg),
1292 )
1293 }
1294 "InvalidParameterValueException" => {
1295 return RusotoError::Service(
1296 GetEC2RecommendationProjectedMetricsError::InvalidParameterValue(err.msg),
1297 )
1298 }
1299 "MissingAuthenticationToken" => {
1300 return RusotoError::Service(
1301 GetEC2RecommendationProjectedMetricsError::MissingAuthenticationToken(
1302 err.msg,
1303 ),
1304 )
1305 }
1306 "OptInRequiredException" => {
1307 return RusotoError::Service(
1308 GetEC2RecommendationProjectedMetricsError::OptInRequired(err.msg),
1309 )
1310 }
1311 "ResourceNotFoundException" => {
1312 return RusotoError::Service(
1313 GetEC2RecommendationProjectedMetricsError::ResourceNotFound(err.msg),
1314 )
1315 }
1316 "ServiceUnavailableException" => {
1317 return RusotoError::Service(
1318 GetEC2RecommendationProjectedMetricsError::ServiceUnavailable(err.msg),
1319 )
1320 }
1321 "ThrottlingException" => {
1322 return RusotoError::Service(
1323 GetEC2RecommendationProjectedMetricsError::Throttling(err.msg),
1324 )
1325 }
1326 "ValidationException" => return RusotoError::Validation(err.msg),
1327 _ => {}
1328 }
1329 }
1330 RusotoError::Unknown(res)
1331 }
1332}
1333impl fmt::Display for GetEC2RecommendationProjectedMetricsError {
1334 #[allow(unused_variables)]
1335 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1336 match *self {
1337 GetEC2RecommendationProjectedMetricsError::AccessDenied(ref cause) => {
1338 write!(f, "{}", cause)
1339 }
1340 GetEC2RecommendationProjectedMetricsError::InternalServer(ref cause) => {
1341 write!(f, "{}", cause)
1342 }
1343 GetEC2RecommendationProjectedMetricsError::InvalidParameterValue(ref cause) => {
1344 write!(f, "{}", cause)
1345 }
1346 GetEC2RecommendationProjectedMetricsError::MissingAuthenticationToken(ref cause) => {
1347 write!(f, "{}", cause)
1348 }
1349 GetEC2RecommendationProjectedMetricsError::OptInRequired(ref cause) => {
1350 write!(f, "{}", cause)
1351 }
1352 GetEC2RecommendationProjectedMetricsError::ResourceNotFound(ref cause) => {
1353 write!(f, "{}", cause)
1354 }
1355 GetEC2RecommendationProjectedMetricsError::ServiceUnavailable(ref cause) => {
1356 write!(f, "{}", cause)
1357 }
1358 GetEC2RecommendationProjectedMetricsError::Throttling(ref cause) => {
1359 write!(f, "{}", cause)
1360 }
1361 }
1362 }
1363}
1364impl Error for GetEC2RecommendationProjectedMetricsError {}
1365#[derive(Debug, PartialEq)]
1367pub enum GetEnrollmentStatusError {
1368 AccessDenied(String),
1370 InternalServer(String),
1372 InvalidParameterValue(String),
1374 MissingAuthenticationToken(String),
1376 ServiceUnavailable(String),
1378 Throttling(String),
1380}
1381
1382impl GetEnrollmentStatusError {
1383 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<GetEnrollmentStatusError> {
1384 if let Some(err) = proto::json::Error::parse(&res) {
1385 match err.typ.as_str() {
1386 "AccessDeniedException" => {
1387 return RusotoError::Service(GetEnrollmentStatusError::AccessDenied(err.msg))
1388 }
1389 "InternalServerException" => {
1390 return RusotoError::Service(GetEnrollmentStatusError::InternalServer(err.msg))
1391 }
1392 "InvalidParameterValueException" => {
1393 return RusotoError::Service(GetEnrollmentStatusError::InvalidParameterValue(
1394 err.msg,
1395 ))
1396 }
1397 "MissingAuthenticationToken" => {
1398 return RusotoError::Service(
1399 GetEnrollmentStatusError::MissingAuthenticationToken(err.msg),
1400 )
1401 }
1402 "ServiceUnavailableException" => {
1403 return RusotoError::Service(GetEnrollmentStatusError::ServiceUnavailable(
1404 err.msg,
1405 ))
1406 }
1407 "ThrottlingException" => {
1408 return RusotoError::Service(GetEnrollmentStatusError::Throttling(err.msg))
1409 }
1410 "ValidationException" => return RusotoError::Validation(err.msg),
1411 _ => {}
1412 }
1413 }
1414 RusotoError::Unknown(res)
1415 }
1416}
1417impl fmt::Display for GetEnrollmentStatusError {
1418 #[allow(unused_variables)]
1419 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1420 match *self {
1421 GetEnrollmentStatusError::AccessDenied(ref cause) => write!(f, "{}", cause),
1422 GetEnrollmentStatusError::InternalServer(ref cause) => write!(f, "{}", cause),
1423 GetEnrollmentStatusError::InvalidParameterValue(ref cause) => write!(f, "{}", cause),
1424 GetEnrollmentStatusError::MissingAuthenticationToken(ref cause) => {
1425 write!(f, "{}", cause)
1426 }
1427 GetEnrollmentStatusError::ServiceUnavailable(ref cause) => write!(f, "{}", cause),
1428 GetEnrollmentStatusError::Throttling(ref cause) => write!(f, "{}", cause),
1429 }
1430 }
1431}
1432impl Error for GetEnrollmentStatusError {}
1433#[derive(Debug, PartialEq)]
1435pub enum GetRecommendationSummariesError {
1436 AccessDenied(String),
1438 InternalServer(String),
1440 InvalidParameterValue(String),
1442 MissingAuthenticationToken(String),
1444 OptInRequired(String),
1446 ServiceUnavailable(String),
1448 Throttling(String),
1450}
1451
1452impl GetRecommendationSummariesError {
1453 pub fn from_response(
1454 res: BufferedHttpResponse,
1455 ) -> RusotoError<GetRecommendationSummariesError> {
1456 if let Some(err) = proto::json::Error::parse(&res) {
1457 match err.typ.as_str() {
1458 "AccessDeniedException" => {
1459 return RusotoError::Service(GetRecommendationSummariesError::AccessDenied(
1460 err.msg,
1461 ))
1462 }
1463 "InternalServerException" => {
1464 return RusotoError::Service(GetRecommendationSummariesError::InternalServer(
1465 err.msg,
1466 ))
1467 }
1468 "InvalidParameterValueException" => {
1469 return RusotoError::Service(
1470 GetRecommendationSummariesError::InvalidParameterValue(err.msg),
1471 )
1472 }
1473 "MissingAuthenticationToken" => {
1474 return RusotoError::Service(
1475 GetRecommendationSummariesError::MissingAuthenticationToken(err.msg),
1476 )
1477 }
1478 "OptInRequiredException" => {
1479 return RusotoError::Service(GetRecommendationSummariesError::OptInRequired(
1480 err.msg,
1481 ))
1482 }
1483 "ServiceUnavailableException" => {
1484 return RusotoError::Service(
1485 GetRecommendationSummariesError::ServiceUnavailable(err.msg),
1486 )
1487 }
1488 "ThrottlingException" => {
1489 return RusotoError::Service(GetRecommendationSummariesError::Throttling(
1490 err.msg,
1491 ))
1492 }
1493 "ValidationException" => return RusotoError::Validation(err.msg),
1494 _ => {}
1495 }
1496 }
1497 RusotoError::Unknown(res)
1498 }
1499}
1500impl fmt::Display for GetRecommendationSummariesError {
1501 #[allow(unused_variables)]
1502 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1503 match *self {
1504 GetRecommendationSummariesError::AccessDenied(ref cause) => write!(f, "{}", cause),
1505 GetRecommendationSummariesError::InternalServer(ref cause) => write!(f, "{}", cause),
1506 GetRecommendationSummariesError::InvalidParameterValue(ref cause) => {
1507 write!(f, "{}", cause)
1508 }
1509 GetRecommendationSummariesError::MissingAuthenticationToken(ref cause) => {
1510 write!(f, "{}", cause)
1511 }
1512 GetRecommendationSummariesError::OptInRequired(ref cause) => write!(f, "{}", cause),
1513 GetRecommendationSummariesError::ServiceUnavailable(ref cause) => {
1514 write!(f, "{}", cause)
1515 }
1516 GetRecommendationSummariesError::Throttling(ref cause) => write!(f, "{}", cause),
1517 }
1518 }
1519}
1520impl Error for GetRecommendationSummariesError {}
1521#[derive(Debug, PartialEq)]
1523pub enum UpdateEnrollmentStatusError {
1524 AccessDenied(String),
1526 InternalServer(String),
1528 InvalidParameterValue(String),
1530 MissingAuthenticationToken(String),
1532 ServiceUnavailable(String),
1534 Throttling(String),
1536}
1537
1538impl UpdateEnrollmentStatusError {
1539 pub fn from_response(res: BufferedHttpResponse) -> RusotoError<UpdateEnrollmentStatusError> {
1540 if let Some(err) = proto::json::Error::parse(&res) {
1541 match err.typ.as_str() {
1542 "AccessDeniedException" => {
1543 return RusotoError::Service(UpdateEnrollmentStatusError::AccessDenied(err.msg))
1544 }
1545 "InternalServerException" => {
1546 return RusotoError::Service(UpdateEnrollmentStatusError::InternalServer(
1547 err.msg,
1548 ))
1549 }
1550 "InvalidParameterValueException" => {
1551 return RusotoError::Service(
1552 UpdateEnrollmentStatusError::InvalidParameterValue(err.msg),
1553 )
1554 }
1555 "MissingAuthenticationToken" => {
1556 return RusotoError::Service(
1557 UpdateEnrollmentStatusError::MissingAuthenticationToken(err.msg),
1558 )
1559 }
1560 "ServiceUnavailableException" => {
1561 return RusotoError::Service(UpdateEnrollmentStatusError::ServiceUnavailable(
1562 err.msg,
1563 ))
1564 }
1565 "ThrottlingException" => {
1566 return RusotoError::Service(UpdateEnrollmentStatusError::Throttling(err.msg))
1567 }
1568 "ValidationException" => return RusotoError::Validation(err.msg),
1569 _ => {}
1570 }
1571 }
1572 RusotoError::Unknown(res)
1573 }
1574}
1575impl fmt::Display for UpdateEnrollmentStatusError {
1576 #[allow(unused_variables)]
1577 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1578 match *self {
1579 UpdateEnrollmentStatusError::AccessDenied(ref cause) => write!(f, "{}", cause),
1580 UpdateEnrollmentStatusError::InternalServer(ref cause) => write!(f, "{}", cause),
1581 UpdateEnrollmentStatusError::InvalidParameterValue(ref cause) => write!(f, "{}", cause),
1582 UpdateEnrollmentStatusError::MissingAuthenticationToken(ref cause) => {
1583 write!(f, "{}", cause)
1584 }
1585 UpdateEnrollmentStatusError::ServiceUnavailable(ref cause) => write!(f, "{}", cause),
1586 UpdateEnrollmentStatusError::Throttling(ref cause) => write!(f, "{}", cause),
1587 }
1588 }
1589}
1590impl Error for UpdateEnrollmentStatusError {}
1591#[async_trait]
1593pub trait ComputeOptimizer {
1594 async fn describe_recommendation_export_jobs(
1596 &self,
1597 input: DescribeRecommendationExportJobsRequest,
1598 ) -> Result<
1599 DescribeRecommendationExportJobsResponse,
1600 RusotoError<DescribeRecommendationExportJobsError>,
1601 >;
1602
1603 async fn export_auto_scaling_group_recommendations(
1605 &self,
1606 input: ExportAutoScalingGroupRecommendationsRequest,
1607 ) -> Result<
1608 ExportAutoScalingGroupRecommendationsResponse,
1609 RusotoError<ExportAutoScalingGroupRecommendationsError>,
1610 >;
1611
1612 async fn export_ec2_instance_recommendations(
1614 &self,
1615 input: ExportEC2InstanceRecommendationsRequest,
1616 ) -> Result<
1617 ExportEC2InstanceRecommendationsResponse,
1618 RusotoError<ExportEC2InstanceRecommendationsError>,
1619 >;
1620
1621 async fn get_auto_scaling_group_recommendations(
1623 &self,
1624 input: GetAutoScalingGroupRecommendationsRequest,
1625 ) -> Result<
1626 GetAutoScalingGroupRecommendationsResponse,
1627 RusotoError<GetAutoScalingGroupRecommendationsError>,
1628 >;
1629
1630 async fn get_ec2_instance_recommendations(
1632 &self,
1633 input: GetEC2InstanceRecommendationsRequest,
1634 ) -> Result<
1635 GetEC2InstanceRecommendationsResponse,
1636 RusotoError<GetEC2InstanceRecommendationsError>,
1637 >;
1638
1639 async fn get_ec2_recommendation_projected_metrics(
1641 &self,
1642 input: GetEC2RecommendationProjectedMetricsRequest,
1643 ) -> Result<
1644 GetEC2RecommendationProjectedMetricsResponse,
1645 RusotoError<GetEC2RecommendationProjectedMetricsError>,
1646 >;
1647
1648 async fn get_enrollment_status(
1650 &self,
1651 ) -> Result<GetEnrollmentStatusResponse, RusotoError<GetEnrollmentStatusError>>;
1652
1653 async fn get_recommendation_summaries(
1655 &self,
1656 input: GetRecommendationSummariesRequest,
1657 ) -> Result<GetRecommendationSummariesResponse, RusotoError<GetRecommendationSummariesError>>;
1658
1659 async fn update_enrollment_status(
1661 &self,
1662 input: UpdateEnrollmentStatusRequest,
1663 ) -> Result<UpdateEnrollmentStatusResponse, RusotoError<UpdateEnrollmentStatusError>>;
1664}
1665#[derive(Clone)]
1667pub struct ComputeOptimizerClient {
1668 client: Client,
1669 region: region::Region,
1670}
1671
1672impl ComputeOptimizerClient {
1673 pub fn new(region: region::Region) -> ComputeOptimizerClient {
1677 ComputeOptimizerClient {
1678 client: Client::shared(),
1679 region,
1680 }
1681 }
1682
1683 pub fn new_with<P, D>(
1684 request_dispatcher: D,
1685 credentials_provider: P,
1686 region: region::Region,
1687 ) -> ComputeOptimizerClient
1688 where
1689 P: ProvideAwsCredentials + Send + Sync + 'static,
1690 D: DispatchSignedRequest + Send + Sync + 'static,
1691 {
1692 ComputeOptimizerClient {
1693 client: Client::new_with(credentials_provider, request_dispatcher),
1694 region,
1695 }
1696 }
1697
1698 pub fn new_with_client(client: Client, region: region::Region) -> ComputeOptimizerClient {
1699 ComputeOptimizerClient { client, region }
1700 }
1701}
1702
1703#[async_trait]
1704impl ComputeOptimizer for ComputeOptimizerClient {
1705 async fn describe_recommendation_export_jobs(
1707 &self,
1708 input: DescribeRecommendationExportJobsRequest,
1709 ) -> Result<
1710 DescribeRecommendationExportJobsResponse,
1711 RusotoError<DescribeRecommendationExportJobsError>,
1712 > {
1713 let mut request = self.new_signed_request("POST", "/");
1714 request.add_header(
1715 "x-amz-target",
1716 "ComputeOptimizerService.DescribeRecommendationExportJobs",
1717 );
1718 let encoded = serde_json::to_string(&input).unwrap();
1719 request.set_payload(Some(encoded));
1720
1721 let response = self
1722 .sign_and_dispatch(
1723 request,
1724 DescribeRecommendationExportJobsError::from_response,
1725 )
1726 .await?;
1727 let mut response = response;
1728 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1729 proto::json::ResponsePayload::new(&response)
1730 .deserialize::<DescribeRecommendationExportJobsResponse, _>()
1731 }
1732
1733 async fn export_auto_scaling_group_recommendations(
1735 &self,
1736 input: ExportAutoScalingGroupRecommendationsRequest,
1737 ) -> Result<
1738 ExportAutoScalingGroupRecommendationsResponse,
1739 RusotoError<ExportAutoScalingGroupRecommendationsError>,
1740 > {
1741 let mut request = self.new_signed_request("POST", "/");
1742 request.add_header(
1743 "x-amz-target",
1744 "ComputeOptimizerService.ExportAutoScalingGroupRecommendations",
1745 );
1746 let encoded = serde_json::to_string(&input).unwrap();
1747 request.set_payload(Some(encoded));
1748
1749 let response = self
1750 .sign_and_dispatch(
1751 request,
1752 ExportAutoScalingGroupRecommendationsError::from_response,
1753 )
1754 .await?;
1755 let mut response = response;
1756 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1757 proto::json::ResponsePayload::new(&response)
1758 .deserialize::<ExportAutoScalingGroupRecommendationsResponse, _>()
1759 }
1760
1761 async fn export_ec2_instance_recommendations(
1763 &self,
1764 input: ExportEC2InstanceRecommendationsRequest,
1765 ) -> Result<
1766 ExportEC2InstanceRecommendationsResponse,
1767 RusotoError<ExportEC2InstanceRecommendationsError>,
1768 > {
1769 let mut request = self.new_signed_request("POST", "/");
1770 request.add_header(
1771 "x-amz-target",
1772 "ComputeOptimizerService.ExportEC2InstanceRecommendations",
1773 );
1774 let encoded = serde_json::to_string(&input).unwrap();
1775 request.set_payload(Some(encoded));
1776
1777 let response = self
1778 .sign_and_dispatch(
1779 request,
1780 ExportEC2InstanceRecommendationsError::from_response,
1781 )
1782 .await?;
1783 let mut response = response;
1784 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1785 proto::json::ResponsePayload::new(&response)
1786 .deserialize::<ExportEC2InstanceRecommendationsResponse, _>()
1787 }
1788
1789 async fn get_auto_scaling_group_recommendations(
1791 &self,
1792 input: GetAutoScalingGroupRecommendationsRequest,
1793 ) -> Result<
1794 GetAutoScalingGroupRecommendationsResponse,
1795 RusotoError<GetAutoScalingGroupRecommendationsError>,
1796 > {
1797 let mut request = self.new_signed_request("POST", "/");
1798 request.add_header(
1799 "x-amz-target",
1800 "ComputeOptimizerService.GetAutoScalingGroupRecommendations",
1801 );
1802 let encoded = serde_json::to_string(&input).unwrap();
1803 request.set_payload(Some(encoded));
1804
1805 let response = self
1806 .sign_and_dispatch(
1807 request,
1808 GetAutoScalingGroupRecommendationsError::from_response,
1809 )
1810 .await?;
1811 let mut response = response;
1812 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1813 proto::json::ResponsePayload::new(&response)
1814 .deserialize::<GetAutoScalingGroupRecommendationsResponse, _>()
1815 }
1816
1817 async fn get_ec2_instance_recommendations(
1819 &self,
1820 input: GetEC2InstanceRecommendationsRequest,
1821 ) -> Result<
1822 GetEC2InstanceRecommendationsResponse,
1823 RusotoError<GetEC2InstanceRecommendationsError>,
1824 > {
1825 let mut request = self.new_signed_request("POST", "/");
1826 request.add_header(
1827 "x-amz-target",
1828 "ComputeOptimizerService.GetEC2InstanceRecommendations",
1829 );
1830 let encoded = serde_json::to_string(&input).unwrap();
1831 request.set_payload(Some(encoded));
1832
1833 let response = self
1834 .sign_and_dispatch(request, GetEC2InstanceRecommendationsError::from_response)
1835 .await?;
1836 let mut response = response;
1837 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1838 proto::json::ResponsePayload::new(&response)
1839 .deserialize::<GetEC2InstanceRecommendationsResponse, _>()
1840 }
1841
1842 async fn get_ec2_recommendation_projected_metrics(
1844 &self,
1845 input: GetEC2RecommendationProjectedMetricsRequest,
1846 ) -> Result<
1847 GetEC2RecommendationProjectedMetricsResponse,
1848 RusotoError<GetEC2RecommendationProjectedMetricsError>,
1849 > {
1850 let mut request = self.new_signed_request("POST", "/");
1851 request.add_header(
1852 "x-amz-target",
1853 "ComputeOptimizerService.GetEC2RecommendationProjectedMetrics",
1854 );
1855 let encoded = serde_json::to_string(&input).unwrap();
1856 request.set_payload(Some(encoded));
1857
1858 let response = self
1859 .sign_and_dispatch(
1860 request,
1861 GetEC2RecommendationProjectedMetricsError::from_response,
1862 )
1863 .await?;
1864 let mut response = response;
1865 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1866 proto::json::ResponsePayload::new(&response)
1867 .deserialize::<GetEC2RecommendationProjectedMetricsResponse, _>()
1868 }
1869
1870 async fn get_enrollment_status(
1872 &self,
1873 ) -> Result<GetEnrollmentStatusResponse, RusotoError<GetEnrollmentStatusError>> {
1874 let mut request = self.new_signed_request("POST", "/");
1875 request.add_header(
1876 "x-amz-target",
1877 "ComputeOptimizerService.GetEnrollmentStatus",
1878 );
1879 request.set_payload(Some(bytes::Bytes::from_static(b"{}")));
1880
1881 let response = self
1882 .sign_and_dispatch(request, GetEnrollmentStatusError::from_response)
1883 .await?;
1884 let mut response = response;
1885 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1886 proto::json::ResponsePayload::new(&response).deserialize::<GetEnrollmentStatusResponse, _>()
1887 }
1888
1889 async fn get_recommendation_summaries(
1891 &self,
1892 input: GetRecommendationSummariesRequest,
1893 ) -> Result<GetRecommendationSummariesResponse, RusotoError<GetRecommendationSummariesError>>
1894 {
1895 let mut request = self.new_signed_request("POST", "/");
1896 request.add_header(
1897 "x-amz-target",
1898 "ComputeOptimizerService.GetRecommendationSummaries",
1899 );
1900 let encoded = serde_json::to_string(&input).unwrap();
1901 request.set_payload(Some(encoded));
1902
1903 let response = self
1904 .sign_and_dispatch(request, GetRecommendationSummariesError::from_response)
1905 .await?;
1906 let mut response = response;
1907 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1908 proto::json::ResponsePayload::new(&response)
1909 .deserialize::<GetRecommendationSummariesResponse, _>()
1910 }
1911
1912 async fn update_enrollment_status(
1914 &self,
1915 input: UpdateEnrollmentStatusRequest,
1916 ) -> Result<UpdateEnrollmentStatusResponse, RusotoError<UpdateEnrollmentStatusError>> {
1917 let mut request = self.new_signed_request("POST", "/");
1918 request.add_header(
1919 "x-amz-target",
1920 "ComputeOptimizerService.UpdateEnrollmentStatus",
1921 );
1922 let encoded = serde_json::to_string(&input).unwrap();
1923 request.set_payload(Some(encoded));
1924
1925 let response = self
1926 .sign_and_dispatch(request, UpdateEnrollmentStatusError::from_response)
1927 .await?;
1928 let mut response = response;
1929 let response = response.buffer().await.map_err(RusotoError::HttpDispatch)?;
1930 proto::json::ResponsePayload::new(&response)
1931 .deserialize::<UpdateEnrollmentStatusResponse, _>()
1932 }
1933}