com.amazonaws.services.backup.model.ControlScope Maven / Gradle / Ivy
Show all versions of aws-java-sdk-backup Show documentation
/*
* Copyright 2017-2022 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.backup.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* A framework consists of one or more controls. Each control has its own control scope. The control 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. If no scope is specified, evaluations for the rule are triggered when any resource in your recording
* group changes in configuration.
*
*
*
* To set a control scope that includes all of a particular resource, leave the ControlScope
empty or do
* not pass it when calling CreateFramework
.
*
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ControlScope implements Serializable, Cloneable, StructuredPojo {
/**
*
* The ID of the only Amazon Web Services resource that you want your control scope to contain.
*
*/
private java.util.List complianceResourceIds;
/**
*
* Describes whether the control scope includes one or more types of resources, such as EFS
or
* RDS
.
*
*/
private java.util.List complianceResourceTypes;
/**
*
* The tag key-value pair applied to those Amazon Web Services resources that you want to trigger an evaluation for
* a rule. A maximum of one key-value pair can be provided. The tag value is optional, but it cannot be an empty
* string. The structure to assign a tag is: [{"Key":"string","Value":"string"}]
.
*
*/
private java.util.Map tags;
/**
*
* The ID of the only Amazon Web Services resource that you want your control scope to contain.
*
*
* @return The ID of the only Amazon Web Services resource that you want your control scope to contain.
*/
public java.util.List getComplianceResourceIds() {
return complianceResourceIds;
}
/**
*
* The ID of the only Amazon Web Services resource that you want your control scope to contain.
*
*
* @param complianceResourceIds
* The ID of the only Amazon Web Services resource that you want your control scope to contain.
*/
public void setComplianceResourceIds(java.util.Collection complianceResourceIds) {
if (complianceResourceIds == null) {
this.complianceResourceIds = null;
return;
}
this.complianceResourceIds = new java.util.ArrayList(complianceResourceIds);
}
/**
*
* The ID of the only Amazon Web Services resource that you want your control scope to contain.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setComplianceResourceIds(java.util.Collection)} or
* {@link #withComplianceResourceIds(java.util.Collection)} if you want to override the existing values.
*
*
* @param complianceResourceIds
* The ID of the only Amazon Web Services resource that you want your control scope to contain.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ControlScope withComplianceResourceIds(String... complianceResourceIds) {
if (this.complianceResourceIds == null) {
setComplianceResourceIds(new java.util.ArrayList(complianceResourceIds.length));
}
for (String ele : complianceResourceIds) {
this.complianceResourceIds.add(ele);
}
return this;
}
/**
*
* The ID of the only Amazon Web Services resource that you want your control scope to contain.
*
*
* @param complianceResourceIds
* The ID of the only Amazon Web Services resource that you want your control scope to contain.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ControlScope withComplianceResourceIds(java.util.Collection complianceResourceIds) {
setComplianceResourceIds(complianceResourceIds);
return this;
}
/**
*
* Describes whether the control scope includes one or more types of resources, such as EFS
or
* RDS
.
*
*
* @return Describes whether the control scope includes one or more types of resources, such as EFS
or
* RDS
.
*/
public java.util.List getComplianceResourceTypes() {
return complianceResourceTypes;
}
/**
*
* Describes whether the control scope includes one or more types of resources, such as EFS
or
* RDS
.
*
*
* @param complianceResourceTypes
* Describes whether the control scope includes one or more types of resources, such as EFS
or
* RDS
.
*/
public void setComplianceResourceTypes(java.util.Collection complianceResourceTypes) {
if (complianceResourceTypes == null) {
this.complianceResourceTypes = null;
return;
}
this.complianceResourceTypes = new java.util.ArrayList(complianceResourceTypes);
}
/**
*
* Describes whether the control scope includes one or more types of resources, such as EFS
or
* RDS
.
*
*
* 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
* Describes whether the control scope includes one or more types of resources, such as EFS
or
* RDS
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ControlScope withComplianceResourceTypes(String... complianceResourceTypes) {
if (this.complianceResourceTypes == null) {
setComplianceResourceTypes(new java.util.ArrayList(complianceResourceTypes.length));
}
for (String ele : complianceResourceTypes) {
this.complianceResourceTypes.add(ele);
}
return this;
}
/**
*
* Describes whether the control scope includes one or more types of resources, such as EFS
or
* RDS
.
*
*
* @param complianceResourceTypes
* Describes whether the control scope includes one or more types of resources, such as EFS
or
* RDS
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ControlScope withComplianceResourceTypes(java.util.Collection complianceResourceTypes) {
setComplianceResourceTypes(complianceResourceTypes);
return this;
}
/**
*
* The tag key-value pair applied to those Amazon Web Services resources that you want to trigger an evaluation for
* a rule. A maximum of one key-value pair can be provided. The tag value is optional, but it cannot be an empty
* string. The structure to assign a tag is: [{"Key":"string","Value":"string"}]
.
*
*
* @return The tag key-value pair applied to those Amazon Web Services resources that you want to trigger an
* evaluation for a rule. A maximum of one key-value pair can be provided. The tag value is optional, but it
* cannot be an empty string. The structure to assign a tag is:
* [{"Key":"string","Value":"string"}]
.
*/
public java.util.Map getTags() {
return tags;
}
/**
*
* The tag key-value pair applied to those Amazon Web Services resources that you want to trigger an evaluation for
* a rule. A maximum of one key-value pair can be provided. The tag value is optional, but it cannot be an empty
* string. The structure to assign a tag is: [{"Key":"string","Value":"string"}]
.
*
*
* @param tags
* The tag key-value pair applied to those Amazon Web Services resources that you want to trigger an
* evaluation for a rule. A maximum of one key-value pair can be provided. The tag value is optional, but it
* cannot be an empty string. The structure to assign a tag is:
* [{"Key":"string","Value":"string"}]
.
*/
public void setTags(java.util.Map tags) {
this.tags = tags;
}
/**
*
* The tag key-value pair applied to those Amazon Web Services resources that you want to trigger an evaluation for
* a rule. A maximum of one key-value pair can be provided. The tag value is optional, but it cannot be an empty
* string. The structure to assign a tag is: [{"Key":"string","Value":"string"}]
.
*
*
* @param tags
* The tag key-value pair applied to those Amazon Web Services resources that you want to trigger an
* evaluation for a rule. A maximum of one key-value pair can be provided. The tag value is optional, but it
* cannot be an empty string. The structure to assign a tag is:
* [{"Key":"string","Value":"string"}]
.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ControlScope withTags(java.util.Map tags) {
setTags(tags);
return this;
}
/**
* Add a single Tags entry
*
* @see ControlScope#withTags
* @returns a reference to this object so that method calls can be chained together.
*/
public ControlScope addTagsEntry(String key, String value) {
if (null == this.tags) {
this.tags = new java.util.HashMap();
}
if (this.tags.containsKey(key))
throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
this.tags.put(key, value);
return this;
}
/**
* Removes all the entries added into Tags.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public ControlScope clearTagsEntries() {
this.tags = null;
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 (getComplianceResourceIds() != null)
sb.append("ComplianceResourceIds: ").append(getComplianceResourceIds()).append(",");
if (getComplianceResourceTypes() != null)
sb.append("ComplianceResourceTypes: ").append(getComplianceResourceTypes()).append(",");
if (getTags() != null)
sb.append("Tags: ").append(getTags());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof ControlScope == false)
return false;
ControlScope other = (ControlScope) obj;
if (other.getComplianceResourceIds() == null ^ this.getComplianceResourceIds() == null)
return false;
if (other.getComplianceResourceIds() != null && other.getComplianceResourceIds().equals(this.getComplianceResourceIds()) == false)
return false;
if (other.getComplianceResourceTypes() == null ^ this.getComplianceResourceTypes() == null)
return false;
if (other.getComplianceResourceTypes() != null && other.getComplianceResourceTypes().equals(this.getComplianceResourceTypes()) == false)
return false;
if (other.getTags() == null ^ this.getTags() == null)
return false;
if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getComplianceResourceIds() == null) ? 0 : getComplianceResourceIds().hashCode());
hashCode = prime * hashCode + ((getComplianceResourceTypes() == null) ? 0 : getComplianceResourceTypes().hashCode());
hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
return hashCode;
}
@Override
public ControlScope clone() {
try {
return (ControlScope) 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.backup.model.transform.ControlScopeMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}