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. For GetRightsizingRecommendation, the Region is a full name (for example, REGION==US East (N. Virginia). The Expression 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 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" }}} ] } { "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 for Expression.
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
tags TagValues?
The specific Tag to use for Expression.
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