All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.freetier.model.Expression Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Free Tier module holds the client classes that are used for communicating with AWS Free Tier Service

There is a newer version: 1.12.778
Show newest version
/*
 * Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.freetier.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * 

* Use Expression to filter in the GetFreeTierUsage API operation. *

*

* You can use the following patterns: *

*
    *
  • *

    * Simple dimension values (Dimensions root operator) *

    *
  • *
  • *

    * Complex expressions with logical operators (AND, NOT, and OR root operators). *

    *
  • *
*

* For simple dimension values, you can set the dimension name, values, and match type for the filters that you * plan to use. *

*

* Example for simple dimension values *

*

* You can filter to match exactly for REGION==us-east-1 OR REGION==us-west-1. *

*

* The corresponding Expression appears like the following: * { "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ], "MatchOptions": ["EQUALS"] } } *

*

* As shown in the previous example, lists of dimension values are combined with OR when you apply the * filter. *

*

* For complex expressions with logical operators, you can have nested expressions to use the logical operators * and specify advanced filtering. *

*

* Example for complex expressions with logical operators *

*

* You can filter by * ((REGION == us-east-1 OR REGION == us-west-1) OR (SERVICE CONTAINS AWSLambda)) AND (USAGE_TYPE !CONTAINS DataTransfer) * . *

*

* The corresponding Expression appears like the following: * { "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ], "MatchOptions": ["EQUALS"] }}, {"Dimensions": { "Key": "SERVICE", "Values": ["AWSLambda"], "MatchOptions": ["CONTAINS"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"], "MatchOptions": ["CONTAINS"] }}} ] } *

*

* In the following Contents, you must specify exactly one of the following root operators. *

* * @see AWS API * Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Expression implements Serializable, Cloneable, StructuredPojo { /** *

* Return results that match all Expressions that you specified in the array. *

*/ private java.util.List and; /** *

* The specific dimension, values, and match type to filter objects with. *

*/ private DimensionValues dimensions; /** *

* Return results that don’t match the Expression that you specified. *

*/ private Expression not; /** *

* Return results that match any of the Expressions that you specified. in the array. *

*/ private java.util.List or; /** *

* Return results that match all Expressions that you specified in the array. *

* * @return Return results that match all Expressions that you specified in the array. */ public java.util.List getAnd() { return and; } /** *

* Return results that match all Expressions that you specified in the array. *

* * @param and * Return results that match all Expressions that you specified in the array. */ public void setAnd(java.util.Collection and) { if (and == null) { this.and = null; return; } this.and = new java.util.ArrayList(and); } /** *

* Return results that match all Expressions that you specified in the array. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setAnd(java.util.Collection)} or {@link #withAnd(java.util.Collection)} if you want to override the * existing values. *

* * @param and * Return results that match all Expressions that you specified in the array. * @return Returns a reference to this object so that method calls can be chained together. */ public Expression withAnd(Expression... and) { if (this.and == null) { setAnd(new java.util.ArrayList(and.length)); } for (Expression ele : and) { this.and.add(ele); } return this; } /** *

* Return results that match all Expressions that you specified in the array. *

* * @param and * Return results that match all Expressions that you specified in the array. * @return Returns a reference to this object so that method calls can be chained together. */ public Expression withAnd(java.util.Collection and) { setAnd(and); return this; } /** *

* The specific dimension, values, and match type to filter objects with. *

* * @param dimensions * The specific dimension, values, and match type to filter objects with. */ public void setDimensions(DimensionValues dimensions) { this.dimensions = dimensions; } /** *

* The specific dimension, values, and match type to filter objects with. *

* * @return The specific dimension, values, and match type to filter objects with. */ public DimensionValues getDimensions() { return this.dimensions; } /** *

* The specific dimension, values, and match type to filter objects with. *

* * @param dimensions * The specific dimension, values, and match type to filter objects with. * @return Returns a reference to this object so that method calls can be chained together. */ public Expression withDimensions(DimensionValues dimensions) { setDimensions(dimensions); return this; } /** *

* Return results that don’t match the Expression that you specified. *

* * @param not * Return results that don’t match the Expression that you specified. */ public void setNot(Expression not) { this.not = not; } /** *

* Return results that don’t match the Expression that you specified. *

* * @return Return results that don’t match the Expression that you specified. */ public Expression getNot() { return this.not; } /** *

* Return results that don’t match the Expression that you specified. *

* * @param not * Return results that don’t match the Expression that you specified. * @return Returns a reference to this object so that method calls can be chained together. */ public Expression withNot(Expression not) { setNot(not); return this; } /** *

* Return results that match any of the Expressions that you specified. in the array. *

* * @return Return results that match any of the Expressions that you specified. in the array. */ public java.util.List getOr() { return or; } /** *

* Return results that match any of the Expressions that you specified. in the array. *

* * @param or * Return results that match any of the Expressions that you specified. in the array. */ public void setOr(java.util.Collection or) { if (or == null) { this.or = null; return; } this.or = new java.util.ArrayList(or); } /** *

* Return results that match any of the Expressions that you specified. in the array. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setOr(java.util.Collection)} or {@link #withOr(java.util.Collection)} if you want to override the * existing values. *

* * @param or * Return results that match any of the Expressions that you specified. in the array. * @return Returns a reference to this object so that method calls can be chained together. */ public Expression withOr(Expression... or) { if (this.or == null) { setOr(new java.util.ArrayList(or.length)); } for (Expression ele : or) { this.or.add(ele); } return this; } /** *

* Return results that match any of the Expressions that you specified. in the array. *

* * @param or * Return results that match any of the Expressions that you specified. in the array. * @return Returns a reference to this object so that method calls can be chained together. */ public Expression withOr(java.util.Collection or) { setOr(or); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getAnd() != null) sb.append("And: ").append(getAnd()).append(","); if (getDimensions() != null) sb.append("Dimensions: ").append(getDimensions()).append(","); if (getNot() != null) sb.append("Not: ").append(getNot()).append(","); if (getOr() != null) sb.append("Or: ").append(getOr()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Expression == false) return false; Expression other = (Expression) obj; if (other.getAnd() == null ^ this.getAnd() == null) return false; if (other.getAnd() != null && other.getAnd().equals(this.getAnd()) == false) return false; if (other.getDimensions() == null ^ this.getDimensions() == null) return false; if (other.getDimensions() != null && other.getDimensions().equals(this.getDimensions()) == false) return false; if (other.getNot() == null ^ this.getNot() == null) return false; if (other.getNot() != null && other.getNot().equals(this.getNot()) == false) return false; if (other.getOr() == null ^ this.getOr() == null) return false; if (other.getOr() != null && other.getOr().equals(this.getOr()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getAnd() == null) ? 0 : getAnd().hashCode()); hashCode = prime * hashCode + ((getDimensions() == null) ? 0 : getDimensions().hashCode()); hashCode = prime * hashCode + ((getNot() == null) ? 0 : getNot().hashCode()); hashCode = prime * hashCode + ((getOr() == null) ? 0 : getOr().hashCode()); return hashCode; } @Override public Expression clone() { try { return (Expression) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.freetier.model.transform.ExpressionMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy