aws_sdk_costexplorer/client/get_cost_and_usage_comparisons.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2impl super::Client {
3 /// Constructs a fluent builder for the [`GetCostAndUsageComparisons`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder) operation.
4 /// This operation supports pagination; See [`into_paginator()`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::into_paginator).
5 ///
6 /// - The fluent builder is configurable:
7 /// - [`billing_view_arn(impl Into<String>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::billing_view_arn) / [`set_billing_view_arn(Option<String>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::set_billing_view_arn):<br>required: **false**<br><p>The Amazon Resource Name (ARN) that uniquely identifies a specific billing view. The ARN is used to specify which particular billing view you want to interact with or retrieve information from when making API calls related to Amazon Web Services Billing and Cost Management features. The BillingViewArn can be retrieved by calling the ListBillingViews API.</p><br>
8 /// - [`baseline_time_period(DateInterval)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::baseline_time_period) / [`set_baseline_time_period(Option<DateInterval>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::set_baseline_time_period):<br>required: **true**<br><p>The reference time period for comparison. This time period serves as the baseline against which other cost and usage data will be compared. The interval must start and end on the first day of a month, with a duration of exactly one month.</p><br>
9 /// - [`comparison_time_period(DateInterval)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::comparison_time_period) / [`set_comparison_time_period(Option<DateInterval>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::set_comparison_time_period):<br>required: **true**<br><p>The comparison time period for analysis. This time period's cost and usage data will be compared against the baseline time period. The interval must start and end on the first day of a month, with a duration of exactly one month.</p><br>
10 /// - [`metric_for_comparison(impl Into<String>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::metric_for_comparison) / [`set_metric_for_comparison(Option<String>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::set_metric_for_comparison):<br>required: **true**<br><p>The cost and usage metric to compare. Valid values are <code>AmortizedCost</code>, <code>BlendedCost</code>, <code>NetAmortizedCost</code>, <code>NetUnblendedCost</code>, <code>NormalizedUsageAmount</code>, <code>UnblendedCost</code>, and <code>UsageQuantity</code>.</p><br>
11 /// - [`filter(Expression)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::filter) / [`set_filter(Option<Expression>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::set_filter):<br>required: **false**<br><p>Use <code>Expression</code> to filter in various Cost Explorer APIs.</p> <p>Not all <code>Expression</code> types are supported in each API. Refer to the documentation for each specific API to see what is supported.</p> <p>There are two patterns:</p> <ul> <li> <p>Simple dimension values.</p> <ul> <li> <p>There are three types of simple dimension values: <code>CostCategories</code>, <code>Tags</code>, and <code>Dimensions</code>.</p> <ul> <li> <p>Specify the <code>CostCategories</code> field to define a filter that acts on Cost Categories.</p></li> <li> <p>Specify the <code>Tags</code> field to define a filter that acts on Cost Allocation Tags.</p></li> <li> <p>Specify the <code>Dimensions</code> field to define a filter that acts on the <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_DimensionValues.html"> <code>DimensionValues</code> </a>.</p></li> </ul></li> <li> <p>For each filter type, you can set the dimension name and values for the filters that you plan to use.</p> <ul> <li> <p>For example, you can filter for <code>REGION==us-east-1 OR REGION==us-west-1</code>. For <code>GetRightsizingRecommendation</code>, the Region is a full name (for example, <code>REGION==US East (N. Virginia)</code>.</p></li> <li> <p>The corresponding <code>Expression</code> for this example is as follows: <code>{ "Dimensions": { "Key": "REGION", "Values": \[ "us-east-1", "us-west-1" \] } }</code></p></li> <li> <p>As shown in the previous example, lists of dimension values are combined with <code>OR</code> when applying the filter.</p></li> </ul></li> <li> <p>You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.</p> <ul> <li> <p>For example, you can filter for linked account names that start with "a".</p></li> <li> <p>The corresponding <code>Expression</code> for this example is as follows: <code>{ "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": \[ "STARTS_WITH" \], "Values": \[ "a" \] } }</code></p></li> </ul></li> </ul></li> <li> <p>Compound <code>Expression</code> types with logical operations.</p> <ul> <li> <p>You can use multiple <code>Expression</code> types and the logical operators <code>AND/OR/NOT</code> to create a list of one or more <code>Expression</code> objects. By doing this, you can filter by more advanced options.</p></li> <li> <p>For example, you can filter by <code>((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer)</code>.</p></li> <li> <p>The corresponding <code>Expression</code> for this example is as follows: <code>{ "And": \[ {"Or": \[ {"Dimensions": { "Key": "REGION", "Values": \[ "us-east-1", "us-west-1" \] }}, {"Tags": { "Key": "TagName", "Values": \["Value1"\] } } \]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": \["DataTransfer"\] }}} \] }</code></p></li> </ul><note> <p>Because each <code>Expression</code> can have only one operator, the service returns an error if more than one is specified. The following example shows an <code>Expression</code> object that creates an error: <code>{ "And": \[ ... \], "Dimensions": { "Key": "USAGE_TYPE", "Values": \[ "DataTransfer" \] } }</code></p> <p>The following is an example of the corresponding error message: <code>"Expression has more than one roots. Only one root operator is allowed for each expression: And, Or, Not, Dimensions, Tags, CostCategories"</code></p> </note></li> </ul><note> <p>For the <code>GetRightsizingRecommendation</code> action, a combination of OR and NOT isn't supported. OR isn't supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also limited to <code>LINKED_ACCOUNT</code>, <code>REGION</code>, or <code>RIGHTSIZING_TYPE</code>.</p> <p>For the <code>GetReservationPurchaseRecommendation</code> action, only NOT is supported. AND and OR aren't supported. Dimensions are limited to <code>LINKED_ACCOUNT</code>.</p> </note><br>
12 /// - [`group_by(GroupDefinition)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::group_by) / [`set_group_by(Option<Vec::<GroupDefinition>>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::set_group_by):<br>required: **false**<br><p>You can group results using the attributes <code>DIMENSION</code>, <code>TAG</code>, and <code>COST_CATEGORY</code>.</p><br>
13 /// - [`max_results(i32)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::max_results) / [`set_max_results(Option<i32>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::set_max_results):<br>required: **false**<br><p>The maximum number of results that are returned for the request.</p><br>
14 /// - [`next_page_token(impl Into<String>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::next_page_token) / [`set_next_page_token(Option<String>)`](crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::set_next_page_token):<br>required: **false**<br><p>The token to retrieve the next set of paginated results.</p><br>
15 /// - On success, responds with [`GetCostAndUsageComparisonsOutput`](crate::operation::get_cost_and_usage_comparisons::GetCostAndUsageComparisonsOutput) with field(s):
16 /// - [`cost_and_usage_comparisons(Option<Vec::<CostAndUsageComparison>>)`](crate::operation::get_cost_and_usage_comparisons::GetCostAndUsageComparisonsOutput::cost_and_usage_comparisons): <p>An array of comparison results showing cost and usage metrics between <code>BaselineTimePeriod</code> and <code>ComparisonTimePeriod</code>.</p>
17 /// - [`total_cost_and_usage(Option<HashMap::<String, ComparisonMetricValue>>)`](crate::operation::get_cost_and_usage_comparisons::GetCostAndUsageComparisonsOutput::total_cost_and_usage): <p>A summary of the total cost and usage, comparing amounts between <code>BaselineTimePeriod</code> and <code>ComparisonTimePeriod</code> and their differences. This total represents the aggregate total across all paginated results, if the response spans multiple pages.</p>
18 /// - [`next_page_token(Option<String>)`](crate::operation::get_cost_and_usage_comparisons::GetCostAndUsageComparisonsOutput::next_page_token): <p>The token to retrieve the next set of paginated results.</p>
19 /// - On failure, responds with [`SdkError<GetCostAndUsageComparisonsError>`](crate::operation::get_cost_and_usage_comparisons::GetCostAndUsageComparisonsError)
20 pub fn get_cost_and_usage_comparisons(
21 &self,
22 ) -> crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder {
23 crate::operation::get_cost_and_usage_comparisons::builders::GetCostAndUsageComparisonsFluentBuilder::new(self.handle.clone())
24 }
25}