@Generated(value="software.amazon.awssdk:codegen") public class Expression extends Object implements StructuredPojo, ToCopyableBuilder<Expression.Builder,Expression>
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" ] }}, {"Tag": { "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 will create an error.
{ "And": [ ... ], "DimensionValues": { "Dimension": "UsageType", "Values": [ "DataTransfer" ] } }
Modifier and Type | Class and Description |
---|---|
static interface |
Expression.Builder |
Modifier and Type | Method and Description |
---|---|
List<Expression> |
and()
Return results that match both
Dimension objects. |
static Expression.Builder |
builder() |
DimensionValues |
dimensions()
The specific
Dimension to use for Expression . |
boolean |
equals(Object obj) |
<T> Optional<T> |
getValueForField(String fieldName,
Class<T> clazz) |
int |
hashCode() |
void |
marshall(ProtocolMarshaller protocolMarshaller)
Marshalls this structured data using the given
ProtocolMarshaller . |
Expression |
not()
Return results that don't match
Dimension . |
List<Expression> |
or()
Return results that match either
Dimension . |
static Class<? extends Expression.Builder> |
serializableBuilderClass() |
TagValues |
tags()
The specific
Tag to use for Expression . |
Expression.Builder |
toBuilder()
Take this object and create a builder that contains all of the current property values of this object.
|
String |
toString() |
copy
public List<Expression> or()
Return results that match either Dimension
.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
Dimension
.public List<Expression> and()
Return results that match both Dimension
objects.
Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
Dimension
objects.public Expression not()
Return results that don't match Dimension
.
Dimension
.public DimensionValues dimensions()
The specific Dimension
to use for Expression
.
Dimension
to use for Expression
.public TagValues tags()
The specific Tag
to use for Expression
.
Tag
to use for Expression
.public Expression.Builder toBuilder()
ToCopyableBuilder
toBuilder
in interface ToCopyableBuilder<Expression.Builder,Expression>
public static Expression.Builder builder()
public static Class<? extends Expression.Builder> serializableBuilderClass()
public void marshall(ProtocolMarshaller protocolMarshaller)
StructuredPojo
ProtocolMarshaller
.marshall
in interface StructuredPojo
protocolMarshaller
- Implementation of ProtocolMarshaller
used to marshall this object's data.Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.