@Generated(value="com.amazonaws:aws-java-sdk-code-generator") public class Expression extends Object implements Serializable, Cloneable, StructuredPojo
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
. The Expression
for that
looks like this:
{ "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"] }}} ] }
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" ] } }
For GetRightsizingRecommendation
action, a combination of OR and NOT is not supported. OR is not
supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also
limited to LINKED_ACCOUNT
, REGION
, or RIGHTSIZING_TYPE
.
Constructor and Description |
---|
Expression() |
Modifier and Type | Method and Description |
---|---|
Expression |
clone() |
boolean |
equals(Object obj) |
List<Expression> |
getAnd()
Return results that match both
Dimension objects. |
CostCategoryValues |
getCostCategories()
The filter based on
CostCategory values. |
DimensionValues |
getDimensions()
The specific
Dimension to use for Expression . |
Expression |
getNot()
Return results that don't match a
Dimension object. |
List<Expression> |
getOr()
Return results that match either
Dimension object. |
TagValues |
getTags()
The specific
Tag to use for Expression . |
int |
hashCode() |
void |
marshall(ProtocolMarshaller protocolMarshaller)
Marshalls this structured data using the given
ProtocolMarshaller . |
void |
setAnd(Collection<Expression> and)
Return results that match both
Dimension objects. |
void |
setCostCategories(CostCategoryValues costCategories)
The filter based on
CostCategory values. |
void |
setDimensions(DimensionValues dimensions)
The specific
Dimension to use for Expression . |
void |
setNot(Expression not)
Return results that don't match a
Dimension object. |
void |
setOr(Collection<Expression> or)
Return results that match either
Dimension object. |
void |
setTags(TagValues tags)
The specific
Tag to use for Expression . |
String |
toString()
Returns a string representation of this object.
|
Expression |
withAnd(Collection<Expression> and)
Return results that match both
Dimension objects. |
Expression |
withAnd(Expression... and)
Return results that match both
Dimension objects. |
Expression |
withCostCategories(CostCategoryValues costCategories)
The filter based on
CostCategory values. |
Expression |
withDimensions(DimensionValues dimensions)
The specific
Dimension to use for Expression . |
Expression |
withNot(Expression not)
Return results that don't match a
Dimension object. |
Expression |
withOr(Collection<Expression> or)
Return results that match either
Dimension object. |
Expression |
withOr(Expression... or)
Return results that match either
Dimension object. |
Expression |
withTags(TagValues tags)
The specific
Tag to use for Expression . |
public List<Expression> getOr()
Return results that match either Dimension
object.
Dimension
object.public void setOr(Collection<Expression> or)
Return results that match either Dimension
object.
or
- Return results that match either Dimension
object.public Expression withOr(Expression... or)
Return results that match either Dimension
object.
NOTE: This method appends the values to the existing list (if any). Use
setOr(java.util.Collection)
or withOr(java.util.Collection)
if you want to override the
existing values.
or
- Return results that match either Dimension
object.public Expression withOr(Collection<Expression> or)
Return results that match either Dimension
object.
or
- Return results that match either Dimension
object.public List<Expression> getAnd()
Return results that match both Dimension
objects.
Dimension
objects.public void setAnd(Collection<Expression> and)
Return results that match both Dimension
objects.
and
- Return results that match both Dimension
objects.public Expression withAnd(Expression... and)
Return results that match both Dimension
objects.
NOTE: This method appends the values to the existing list (if any). Use
setAnd(java.util.Collection)
or withAnd(java.util.Collection)
if you want to override the
existing values.
and
- Return results that match both Dimension
objects.public Expression withAnd(Collection<Expression> and)
Return results that match both Dimension
objects.
and
- Return results that match both Dimension
objects.public void setNot(Expression not)
Return results that don't match a Dimension
object.
not
- Return results that don't match a Dimension
object.public Expression getNot()
Return results that don't match a Dimension
object.
Dimension
object.public Expression withNot(Expression not)
Return results that don't match a Dimension
object.
not
- Return results that don't match a Dimension
object.public void setDimensions(DimensionValues dimensions)
The specific Dimension
to use for Expression
.
dimensions
- The specific Dimension
to use for Expression
.public DimensionValues getDimensions()
The specific Dimension
to use for Expression
.
Dimension
to use for Expression
.public Expression withDimensions(DimensionValues dimensions)
The specific Dimension
to use for Expression
.
dimensions
- The specific Dimension
to use for Expression
.public void setTags(TagValues tags)
The specific Tag
to use for Expression
.
tags
- The specific Tag
to use for Expression
.public TagValues getTags()
The specific Tag
to use for Expression
.
Tag
to use for Expression
.public Expression withTags(TagValues tags)
The specific Tag
to use for Expression
.
tags
- The specific Tag
to use for Expression
.public void setCostCategories(CostCategoryValues costCategories)
The filter based on CostCategory
values.
costCategories
- The filter based on CostCategory
values.public CostCategoryValues getCostCategories()
The filter based on CostCategory
values.
CostCategory
values.public Expression withCostCategories(CostCategoryValues costCategories)
The filter based on CostCategory
values.
costCategories
- The filter based on CostCategory
values.public String toString()
toString
in class Object
Object.toString()
public Expression clone()
public void marshall(ProtocolMarshaller protocolMarshaller)
StructuredPojo
ProtocolMarshaller
.marshall
in interface StructuredPojo
protocolMarshaller
- Implementation of ProtocolMarshaller
used to marshall this object's data.