@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 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" ] } }
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. |
DimensionValues |
getDimensions()
The specific
Dimension to use for Expression . |
Expression |
getNot()
Return results that don't match
Dimension . |
List<Expression> |
getOr()
Return results that match either
Dimension . |
TagValues |
getTags()
The specific
Tag to use for Expression . |
int |
hashCode() |
void |
marshall(ProtocolMarshaller protocolMarshaller) |
void |
setAnd(Collection<Expression> and)
Return results that match both
Dimension objects. |
void |
setDimensions(DimensionValues dimensions)
The specific
Dimension to use for Expression . |
void |
setNot(Expression not)
Return results that don't match
Dimension . |
void |
setOr(Collection<Expression> or)
Return results that match either
Dimension . |
void |
setTags(TagValues tags)
The specific
Tag to use for Expression . |
String |
toString()
Returns a string representation of this object; useful for testing and debugging.
|
Expression |
withAnd(Collection<Expression> and)
Return results that match both
Dimension objects. |
Expression |
withAnd(Expression... and)
Return results that match both
Dimension objects. |
Expression |
withDimensions(DimensionValues dimensions)
The specific
Dimension to use for Expression . |
Expression |
withNot(Expression not)
Return results that don't match
Dimension . |
Expression |
withOr(Collection<Expression> or)
Return results that match either
Dimension . |
Expression |
withOr(Expression... or)
Return results that match either
Dimension . |
Expression |
withTags(TagValues tags)
The specific
Tag to use for Expression . |
public List<Expression> getOr()
Return results that match either Dimension
.
Dimension
.public void setOr(Collection<Expression> or)
Return results that match either Dimension
.
or
- Return results that match either Dimension
.public Expression withOr(Expression... or)
Return results that match either Dimension
.
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
.public Expression withOr(Collection<Expression> or)
Return results that match either Dimension
.
or
- Return results that match either Dimension
.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 Dimension
.
not
- Return results that don't match Dimension
.public Expression getNot()
Return results that don't match Dimension
.
Dimension
.public Expression withNot(Expression not)
Return results that don't match Dimension
.
not
- Return results that don't match Dimension
.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 String toString()
toString
in class Object
Object.toString()
public Expression clone()
public void marshall(ProtocolMarshaller protocolMarshaller)
marshall
in interface StructuredPojo
Copyright © 2018. All rights reserved.