@Generated(value="com.amazonaws:aws-java-sdk-code-generator") public class Expression extends Object implements Serializable, Cloneable, StructuredPojo
Use Expression to filter in various Cost Explorer APIs.
Not all Expression types are supported in each API. Refer to the documentation for each specific API to
see what is supported.
There are two patterns:
Simple dimension values.
There are three types of simple dimension values: CostCategories, Tags, and
Dimensions.
Specify the CostCategories field to define a filter that acts on Cost Categories.
Specify the Tags field to define a filter that acts on Cost Allocation Tags.
Specify the Dimensions field to define a filter that acts on the
DimensionValues .
For each filter type, 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 corresponding Expression for this example is as follows:
{ "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] } }
As shown in the previous example, lists of dimension values are combined with OR when applying the
filter.
You can also set different match options to further control how the filter behaves. Not all APIs support match options. Refer to the documentation for each specific API to see what is supported.
For example, you can filter for linked account names that start with "a".
The corresponding Expression for this example is as follows:
{ "Dimensions": { "Key": "LINKED_ACCOUNT_NAME", "MatchOptions": [ "STARTS_WITH" ], "Values": [ "a" ] } }
Compound Expression types 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. By doing this, you can filter by more advanced options.
For example, you can filter by
((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer).
The corresponding Expression for this example is as follows:
{ "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": [ ... ], "Dimensions": { "Key": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }
The following is an example of the corresponding error message:
"Expression has more than one roots. Only one root operator is allowed for each expression: And, Or, Not, Dimensions, Tags, CostCategories"
For the GetRightsizingRecommendation action, a combination of OR and NOT isn't supported. OR isn't
supported between different dimensions, or dimensions and tags. NOT operators aren't supported. Dimensions are also
limited to LINKED_ACCOUNT, REGION, or RIGHTSIZING_TYPE.
For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren't supported.
Dimensions are limited to LINKED_ACCOUNT.
| 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 that's 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 that's 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 that's 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 that's based on CostCategory values.
costCategories - The filter that's based on CostCategory values.public CostCategoryValues getCostCategories()
The filter that's based on CostCategory values.
CostCategory values.public Expression withCostCategories(CostCategoryValues costCategories)
The filter that's based on CostCategory values.
costCategories - The filter that's based on CostCategory values.public String toString()
toString in class ObjectObject.toString()public Expression clone()
public void marshall(ProtocolMarshaller protocolMarshaller)
StructuredPojoProtocolMarshaller.marshall in interface StructuredPojoprotocolMarshaller - Implementation of ProtocolMarshaller used to marshall this object's data.