/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include #include #include #include #include #include #include namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace CostExplorer { namespace Model { /** *

Use Expression to filter by cost or by usage. There are two * patterns:

  • Simple dimension values - You can set the dimension * name and values for the filters that you plan to use. For example, you can * filter for REGION==us-east-1 OR REGION==us-west-1. The * Expression for that looks like this:

    { "Dimensions": * { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } }

    The * list of dimension values are OR'd together to retrieve cost or usage data. You * can create Expression and DimensionValues objects * using either with* methods or set* methods in multiple * lines.

  • Compound dimension values with logical operations - * You can use multiple Expression types and the logical operators * AND/OR/NOT to create a list of one or more Expression * objects. This allows you to filter on more advanced options. For example, you * can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type * == Type1)) AND (USAGE_TYPE != DataTransfer). The Expression * for that looks like this:

    { "And": [ {"Or": [ {"Dimensions": { * "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": * "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": * "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }

    Because * each Expression can have only one operator, the service returns an * error if more than one is specified. The following example shows an * Expression object that creates an error.

    { * "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ * "DataTransfer" ] } }

For * GetRightsizingRecommendation action, a combination of OR and NOT is * not supported. OR is not supported between different dimensions, or dimensions * and tags. NOT operators aren't supported. Dimensions are also limited to * LINKED_ACCOUNT, REGION, or * RIGHTSIZING_TYPE.

See Also:

AWS API * Reference

*/ class AWS_COSTEXPLORER_API Expression { public: Expression(); Expression(Aws::Utils::Json::JsonView jsonValue); Expression& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** *

Return results that match either Dimension object.

*/ inline const Aws::Vector& GetOr() const{ return m_or; } /** *

Return results that match either Dimension object.

*/ inline bool OrHasBeenSet() const { return m_orHasBeenSet; } /** *

Return results that match either Dimension object.

*/ inline void SetOr(const Aws::Vector& value) { m_orHasBeenSet = true; m_or = value; } /** *

Return results that match either Dimension object.

*/ inline void SetOr(Aws::Vector&& value) { m_orHasBeenSet = true; m_or = std::move(value); } /** *

Return results that match either Dimension object.

*/ inline Expression& WithOr(const Aws::Vector& value) { SetOr(value); return *this;} /** *

Return results that match either Dimension object.

*/ inline Expression& WithOr(Aws::Vector&& value) { SetOr(std::move(value)); return *this;} /** *

Return results that match either Dimension object.

*/ inline Expression& AddOr(const Expression& value) { m_orHasBeenSet = true; m_or.push_back(value); return *this; } /** *

Return results that match either Dimension object.

*/ inline Expression& AddOr(Expression&& value) { m_orHasBeenSet = true; m_or.push_back(std::move(value)); return *this; } /** *

Return results that match both Dimension objects.

*/ inline const Aws::Vector& GetAnd() const{ return m_and; } /** *

Return results that match both Dimension objects.

*/ inline bool AndHasBeenSet() const { return m_andHasBeenSet; } /** *

Return results that match both Dimension objects.

*/ inline void SetAnd(const Aws::Vector& value) { m_andHasBeenSet = true; m_and = value; } /** *

Return results that match both Dimension objects.

*/ inline void SetAnd(Aws::Vector&& value) { m_andHasBeenSet = true; m_and = std::move(value); } /** *

Return results that match both Dimension objects.

*/ inline Expression& WithAnd(const Aws::Vector& value) { SetAnd(value); return *this;} /** *

Return results that match both Dimension objects.

*/ inline Expression& WithAnd(Aws::Vector&& value) { SetAnd(std::move(value)); return *this;} /** *

Return results that match both Dimension objects.

*/ inline Expression& AddAnd(const Expression& value) { m_andHasBeenSet = true; m_and.push_back(value); return *this; } /** *

Return results that match both Dimension objects.

*/ inline Expression& AddAnd(Expression&& value) { m_andHasBeenSet = true; m_and.push_back(std::move(value)); return *this; } /** *

Return results that don't match a Dimension object.

*/ inline const Expression& GetNot() const{ return m_not[0]; } /** *

Return results that don't match a Dimension object.

*/ inline bool NotHasBeenSet() const { return m_notHasBeenSet; } /** *

Return results that don't match a Dimension object.

*/ inline void SetNot(const Expression& value) { m_notHasBeenSet = true; m_not.resize(1); m_not[0] = value; } /** *

Return results that don't match a Dimension object.

*/ inline void SetNot(Expression&& value) { m_notHasBeenSet = true; m_not.resize(1); m_not[0] = std::move(value); } /** *

Return results that don't match a Dimension object.

*/ inline Expression& WithNot(const Expression& value) { SetNot(value); return *this;} /** *

Return results that don't match a Dimension object.

*/ inline Expression& WithNot(Expression&& value) { SetNot(std::move(value)); return *this;} /** *

The specific Dimension to use for Expression.

*/ inline const DimensionValues& GetDimensions() const{ return m_dimensions; } /** *

The specific Dimension to use for Expression.

*/ inline bool DimensionsHasBeenSet() const { return m_dimensionsHasBeenSet; } /** *

The specific Dimension to use for Expression.

*/ inline void SetDimensions(const DimensionValues& value) { m_dimensionsHasBeenSet = true; m_dimensions = value; } /** *

The specific Dimension to use for Expression.

*/ inline void SetDimensions(DimensionValues&& value) { m_dimensionsHasBeenSet = true; m_dimensions = std::move(value); } /** *

The specific Dimension to use for Expression.

*/ inline Expression& WithDimensions(const DimensionValues& value) { SetDimensions(value); return *this;} /** *

The specific Dimension to use for Expression.

*/ inline Expression& WithDimensions(DimensionValues&& value) { SetDimensions(std::move(value)); return *this;} /** *

The specific Tag to use for Expression.

*/ inline const TagValues& GetTags() const{ return m_tags; } /** *

The specific Tag to use for Expression.

*/ inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; } /** *

The specific Tag to use for Expression.

*/ inline void SetTags(const TagValues& value) { m_tagsHasBeenSet = true; m_tags = value; } /** *

The specific Tag to use for Expression.

*/ inline void SetTags(TagValues&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); } /** *

The specific Tag to use for Expression.

*/ inline Expression& WithTags(const TagValues& value) { SetTags(value); return *this;} /** *

The specific Tag to use for Expression.

*/ inline Expression& WithTags(TagValues&& value) { SetTags(std::move(value)); return *this;} /** *

The filter based on CostCategory values.

*/ inline const CostCategoryValues& GetCostCategories() const{ return m_costCategories; } /** *

The filter based on CostCategory values.

*/ inline bool CostCategoriesHasBeenSet() const { return m_costCategoriesHasBeenSet; } /** *

The filter based on CostCategory values.

*/ inline void SetCostCategories(const CostCategoryValues& value) { m_costCategoriesHasBeenSet = true; m_costCategories = value; } /** *

The filter based on CostCategory values.

*/ inline void SetCostCategories(CostCategoryValues&& value) { m_costCategoriesHasBeenSet = true; m_costCategories = std::move(value); } /** *

The filter based on CostCategory values.

*/ inline Expression& WithCostCategories(const CostCategoryValues& value) { SetCostCategories(value); return *this;} /** *

The filter based on CostCategory values.

*/ inline Expression& WithCostCategories(CostCategoryValues&& value) { SetCostCategories(std::move(value)); return *this;} private: Aws::Vector m_or; bool m_orHasBeenSet; Aws::Vector m_and; bool m_andHasBeenSet; Aws::Vector m_not; bool m_notHasBeenSet; DimensionValues m_dimensions; bool m_dimensionsHasBeenSet; TagValues m_tags; bool m_tagsHasBeenSet; CostCategoryValues m_costCategories; bool m_costCategoriesHasBeenSet; }; } // namespace Model } // namespace CostExplorer } // namespace Aws