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 INSTANCETYPE==m4.xlarge OR INSTANCETYPE==c4.large
. The Expression
for that looks like this:
{ "Dimensions": { "Key": "INSTANCETYPE", "Values": [ "m4.xlarge", “c4.large” ] } }
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 ((INSTANCETYPE == m4.large OR INSTANCETYPE == m3.large) OR (TAG.Type == Type1)) AND (USAGETYPE != DataTransfer)
. The Expression
for that looks like this:
{ "And": [ {"Or": [ {"Dimensions": { "Key": "INSTANCETYPE", "Values": [ "m4.x.large", "c4.large" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGETYPE", "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" ] } }
and: Option<Vec<Expression>>
Return results that match both Dimension
objects.
The specific Dimension
to use for Expression
.
Return results that don't match a Dimension
object.
Return results that match either Dimension
object.
The specific Tag
to use for Expression
.
Performs copy-assignment from source
. Read more
Returns the "default value" for a type. Read more
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Formats the value using the given formatter. Read more
Serialize this value into the given Serde serializer. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static