Expression class
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. ForGetRightsizingRecommendation, the Region is a full name (for example,REGION==US East (N. Virginia). TheExpressionexample looks like:{ "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
ExpressionandDimensionValuesobjects using eitherwith*methods orset*methods in multiple lines. -
Compound dimension values with logical operations - You can use multiple
Expressiontypes and the logical operatorsAND/OR/NOTto create a list of one or moreExpressionobjects. 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). TheExpressionfor 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"}}} ] }{ "And":..., "DimensionValues": { "Dimension": "USAGE_TYPE", "Values":"DataTransfer"} }
Constructors
-
Expression({List<
Expression> ? and, CostCategoryValues? costCategories, DimensionValues? dimensions, Expression? not, List<Expression> ? or, TagValues? tags}) -
Expression.fromJson(Map<
String, dynamic> json) -
factory
Properties
-
and
→ List<
Expression> ? -
Return results that match both
Dimensionobjects.final - costCategories → CostCategoryValues?
-
The filter based on
CostCategoryvalues.final - dimensions → DimensionValues?
-
The specific
Dimensionto use forExpression.final - hashCode → int
-
The hash code for this object.
no setterinherited
- not → Expression?
-
Return results that don't match a
Dimensionobject.final -
or
→ List<
Expression> ? -
Return results that match either
Dimensionobject.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
The specific
Tagto use forExpression.final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited