
com.amazonaws.services.config.model.Scope Maven / Gradle / Ivy
Show all versions of aws-java-sdk-config Show documentation
/*
* Copyright 2010-2016 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.config.model;
import java.io.Serializable;
/**
*
* Defines which resources trigger an evaluation for an AWS Config rule. The
* scope can include one or more resource types, a combination of a tag key and
* value, or a combination of one resource type and one resource ID. Specify a
* scope to constrain which resources trigger an evaluation for a rule.
* Otherwise, evaluations for the rule are triggered when any resource in your
* recording group changes in configuration.
*
*/
public class Scope implements Serializable, Cloneable {
/**
*
* The resource types of only those AWS resources that you want to trigger
* an evaluation for the rule. You can only specify one type if you also
* specify a resource ID for ComplianceResourceId
.
*
*/
private com.amazonaws.internal.SdkInternalList complianceResourceTypes;
/**
*
* The tag key that is applied to only those AWS resources that you want you
* want to trigger an evaluation for the rule.
*
*/
private String tagKey;
/**
*
* The tag value applied to only those AWS resources that you want to
* trigger an evaluation for the rule. If you specify a value for
* TagValue
, you must also specify a value for
* TagKey
.
*
*/
private String tagValue;
/**
*
* The IDs of the only AWS resource that you want to trigger an evaluation
* for the rule. If you specify a resource ID, you must specify one resource
* type for ComplianceResourceTypes
.
*
*/
private String complianceResourceId;
/**
*
* The resource types of only those AWS resources that you want to trigger
* an evaluation for the rule. You can only specify one type if you also
* specify a resource ID for ComplianceResourceId
.
*
*
* @return The resource types of only those AWS resources that you want to
* trigger an evaluation for the rule. You can only specify one type
* if you also specify a resource ID for
* ComplianceResourceId
.
*/
public java.util.List getComplianceResourceTypes() {
if (complianceResourceTypes == null) {
complianceResourceTypes = new com.amazonaws.internal.SdkInternalList();
}
return complianceResourceTypes;
}
/**
*
* The resource types of only those AWS resources that you want to trigger
* an evaluation for the rule. You can only specify one type if you also
* specify a resource ID for ComplianceResourceId
.
*
*
* @param complianceResourceTypes
* The resource types of only those AWS resources that you want to
* trigger an evaluation for the rule. You can only specify one type
* if you also specify a resource ID for
* ComplianceResourceId
.
*/
public void setComplianceResourceTypes(
java.util.Collection complianceResourceTypes) {
if (complianceResourceTypes == null) {
this.complianceResourceTypes = null;
return;
}
this.complianceResourceTypes = new com.amazonaws.internal.SdkInternalList(
complianceResourceTypes);
}
/**
*
* The resource types of only those AWS resources that you want to trigger
* an evaluation for the rule. You can only specify one type if you also
* specify a resource ID for ComplianceResourceId
.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setComplianceResourceTypes(java.util.Collection)} or
* {@link #withComplianceResourceTypes(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param complianceResourceTypes
* The resource types of only those AWS resources that you want to
* trigger an evaluation for the rule. You can only specify one type
* if you also specify a resource ID for
* ComplianceResourceId
.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Scope withComplianceResourceTypes(String... complianceResourceTypes) {
if (this.complianceResourceTypes == null) {
setComplianceResourceTypes(new com.amazonaws.internal.SdkInternalList(
complianceResourceTypes.length));
}
for (String ele : complianceResourceTypes) {
this.complianceResourceTypes.add(ele);
}
return this;
}
/**
*
* The resource types of only those AWS resources that you want to trigger
* an evaluation for the rule. You can only specify one type if you also
* specify a resource ID for ComplianceResourceId
.
*
*
* @param complianceResourceTypes
* The resource types of only those AWS resources that you want to
* trigger an evaluation for the rule. You can only specify one type
* if you also specify a resource ID for
* ComplianceResourceId
.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Scope withComplianceResourceTypes(
java.util.Collection complianceResourceTypes) {
setComplianceResourceTypes(complianceResourceTypes);
return this;
}
/**
*
* The tag key that is applied to only those AWS resources that you want you
* want to trigger an evaluation for the rule.
*
*
* @param tagKey
* The tag key that is applied to only those AWS resources that you
* want you want to trigger an evaluation for the rule.
*/
public void setTagKey(String tagKey) {
this.tagKey = tagKey;
}
/**
*
* The tag key that is applied to only those AWS resources that you want you
* want to trigger an evaluation for the rule.
*
*
* @return The tag key that is applied to only those AWS resources that you
* want you want to trigger an evaluation for the rule.
*/
public String getTagKey() {
return this.tagKey;
}
/**
*
* The tag key that is applied to only those AWS resources that you want you
* want to trigger an evaluation for the rule.
*
*
* @param tagKey
* The tag key that is applied to only those AWS resources that you
* want you want to trigger an evaluation for the rule.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Scope withTagKey(String tagKey) {
setTagKey(tagKey);
return this;
}
/**
*
* The tag value applied to only those AWS resources that you want to
* trigger an evaluation for the rule. If you specify a value for
* TagValue
, you must also specify a value for
* TagKey
.
*
*
* @param tagValue
* The tag value applied to only those AWS resources that you want to
* trigger an evaluation for the rule. If you specify a value for
* TagValue
, you must also specify a value for
* TagKey
.
*/
public void setTagValue(String tagValue) {
this.tagValue = tagValue;
}
/**
*
* The tag value applied to only those AWS resources that you want to
* trigger an evaluation for the rule. If you specify a value for
* TagValue
, you must also specify a value for
* TagKey
.
*
*
* @return The tag value applied to only those AWS resources that you want
* to trigger an evaluation for the rule. If you specify a value for
* TagValue
, you must also specify a value for
* TagKey
.
*/
public String getTagValue() {
return this.tagValue;
}
/**
*
* The tag value applied to only those AWS resources that you want to
* trigger an evaluation for the rule. If you specify a value for
* TagValue
, you must also specify a value for
* TagKey
.
*
*
* @param tagValue
* The tag value applied to only those AWS resources that you want to
* trigger an evaluation for the rule. If you specify a value for
* TagValue
, you must also specify a value for
* TagKey
.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Scope withTagValue(String tagValue) {
setTagValue(tagValue);
return this;
}
/**
*
* The IDs of the only AWS resource that you want to trigger an evaluation
* for the rule. If you specify a resource ID, you must specify one resource
* type for ComplianceResourceTypes
.
*
*
* @param complianceResourceId
* The IDs of the only AWS resource that you want to trigger an
* evaluation for the rule. If you specify a resource ID, you must
* specify one resource type for ComplianceResourceTypes
* .
*/
public void setComplianceResourceId(String complianceResourceId) {
this.complianceResourceId = complianceResourceId;
}
/**
*
* The IDs of the only AWS resource that you want to trigger an evaluation
* for the rule. If you specify a resource ID, you must specify one resource
* type for ComplianceResourceTypes
.
*
*
* @return The IDs of the only AWS resource that you want to trigger an
* evaluation for the rule. If you specify a resource ID, you must
* specify one resource type for
* ComplianceResourceTypes
.
*/
public String getComplianceResourceId() {
return this.complianceResourceId;
}
/**
*
* The IDs of the only AWS resource that you want to trigger an evaluation
* for the rule. If you specify a resource ID, you must specify one resource
* type for ComplianceResourceTypes
.
*
*
* @param complianceResourceId
* The IDs of the only AWS resource that you want to trigger an
* evaluation for the rule. If you specify a resource ID, you must
* specify one resource type for ComplianceResourceTypes
* .
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Scope withComplianceResourceId(String complianceResourceId) {
setComplianceResourceId(complianceResourceId);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getComplianceResourceTypes() != null)
sb.append("ComplianceResourceTypes: "
+ getComplianceResourceTypes() + ",");
if (getTagKey() != null)
sb.append("TagKey: " + getTagKey() + ",");
if (getTagValue() != null)
sb.append("TagValue: " + getTagValue() + ",");
if (getComplianceResourceId() != null)
sb.append("ComplianceResourceId: " + getComplianceResourceId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Scope == false)
return false;
Scope other = (Scope) obj;
if (other.getComplianceResourceTypes() == null
^ this.getComplianceResourceTypes() == null)
return false;
if (other.getComplianceResourceTypes() != null
&& other.getComplianceResourceTypes().equals(
this.getComplianceResourceTypes()) == false)
return false;
if (other.getTagKey() == null ^ this.getTagKey() == null)
return false;
if (other.getTagKey() != null
&& other.getTagKey().equals(this.getTagKey()) == false)
return false;
if (other.getTagValue() == null ^ this.getTagValue() == null)
return false;
if (other.getTagValue() != null
&& other.getTagValue().equals(this.getTagValue()) == false)
return false;
if (other.getComplianceResourceId() == null
^ this.getComplianceResourceId() == null)
return false;
if (other.getComplianceResourceId() != null
&& other.getComplianceResourceId().equals(
this.getComplianceResourceId()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getComplianceResourceTypes() == null) ? 0
: getComplianceResourceTypes().hashCode());
hashCode = prime * hashCode
+ ((getTagKey() == null) ? 0 : getTagKey().hashCode());
hashCode = prime * hashCode
+ ((getTagValue() == null) ? 0 : getTagValue().hashCode());
hashCode = prime
* hashCode
+ ((getComplianceResourceId() == null) ? 0
: getComplianceResourceId().hashCode());
return hashCode;
}
@Override
public Scope clone() {
try {
return (Scope) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}