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)
. TheExpression
example 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
Expression
andDimensionValues
objects using eitherwith*
methods orset*
methods in multiple lines. -
Compound dimension values with logical operations - You can use multiple
Expression
types and the logical operatorsAND/OR/NOT
to create a list of one or moreExpression
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)
. TheExpression
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"
}}} ] }{ "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
Dimension
objects.final - costCategories → CostCategoryValues?
-
The filter based on
CostCategory
values.final - dimensions → DimensionValues?
-
The specific
Dimension
to use forExpression
.final - hashCode → int
-
The hash code for this object.
no setterinherited
- not → Expression?
-
Return results that don't match a
Dimension
object.final -
or
→ List<
Expression> ? -
Return results that match either
Dimension
object.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
The specific
Tag
to 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