
com.amazonaws.services.dlm.model.PolicyDetails Maven / Gradle / Ivy
/*
* Copyright 2015-2020 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.dlm.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Specifies the configuration of a lifecycle policy.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class PolicyDetails implements Serializable, Cloneable, StructuredPojo {
/**
*
* The valid target resource types and actions a policy can manage. The default is EBS_SNAPSHOT_MANAGEMENT.
*
*/
private String policyType;
/**
*
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create multi-volume
* snapshots from the volumes for an instance.
*
*/
private java.util.List resourceTypes;
/**
*
* The single tag that identifies targeted resources for this policy.
*
*/
private java.util.List targetTags;
/**
*
* The schedules of policy-defined actions. A policy can have up to four schedules - one mandatory schedule and up
* to three optional schedules.
*
*/
private java.util.List schedules;
/**
*
* A set of optional parameters for the policy.
*
*/
private Parameters parameters;
/**
*
* The valid target resource types and actions a policy can manage. The default is EBS_SNAPSHOT_MANAGEMENT.
*
*
* @param policyType
* The valid target resource types and actions a policy can manage. The default is EBS_SNAPSHOT_MANAGEMENT.
* @see PolicyTypeValues
*/
public void setPolicyType(String policyType) {
this.policyType = policyType;
}
/**
*
* The valid target resource types and actions a policy can manage. The default is EBS_SNAPSHOT_MANAGEMENT.
*
*
* @return The valid target resource types and actions a policy can manage. The default is EBS_SNAPSHOT_MANAGEMENT.
* @see PolicyTypeValues
*/
public String getPolicyType() {
return this.policyType;
}
/**
*
* The valid target resource types and actions a policy can manage. The default is EBS_SNAPSHOT_MANAGEMENT.
*
*
* @param policyType
* The valid target resource types and actions a policy can manage. The default is EBS_SNAPSHOT_MANAGEMENT.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PolicyTypeValues
*/
public PolicyDetails withPolicyType(String policyType) {
setPolicyType(policyType);
return this;
}
/**
*
* The valid target resource types and actions a policy can manage. The default is EBS_SNAPSHOT_MANAGEMENT.
*
*
* @param policyType
* The valid target resource types and actions a policy can manage. The default is EBS_SNAPSHOT_MANAGEMENT.
* @return Returns a reference to this object so that method calls can be chained together.
* @see PolicyTypeValues
*/
public PolicyDetails withPolicyType(PolicyTypeValues policyType) {
this.policyType = policyType.toString();
return this;
}
/**
*
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create multi-volume
* snapshots from the volumes for an instance.
*
*
* @return The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create
* multi-volume snapshots from the volumes for an instance.
* @see ResourceTypeValues
*/
public java.util.List getResourceTypes() {
return resourceTypes;
}
/**
*
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create multi-volume
* snapshots from the volumes for an instance.
*
*
* @param resourceTypes
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create
* multi-volume snapshots from the volumes for an instance.
* @see ResourceTypeValues
*/
public void setResourceTypes(java.util.Collection resourceTypes) {
if (resourceTypes == null) {
this.resourceTypes = null;
return;
}
this.resourceTypes = new java.util.ArrayList(resourceTypes);
}
/**
*
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create multi-volume
* snapshots from the volumes for an instance.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setResourceTypes(java.util.Collection)} or {@link #withResourceTypes(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param resourceTypes
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create
* multi-volume snapshots from the volumes for an instance.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceTypeValues
*/
public PolicyDetails withResourceTypes(String... resourceTypes) {
if (this.resourceTypes == null) {
setResourceTypes(new java.util.ArrayList(resourceTypes.length));
}
for (String ele : resourceTypes) {
this.resourceTypes.add(ele);
}
return this;
}
/**
*
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create multi-volume
* snapshots from the volumes for an instance.
*
*
* @param resourceTypes
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create
* multi-volume snapshots from the volumes for an instance.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceTypeValues
*/
public PolicyDetails withResourceTypes(java.util.Collection resourceTypes) {
setResourceTypes(resourceTypes);
return this;
}
/**
*
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create multi-volume
* snapshots from the volumes for an instance.
*
*
* @param resourceTypes
* The resource type. Use VOLUME to create snapshots of individual volumes or use INSTANCE to create
* multi-volume snapshots from the volumes for an instance.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceTypeValues
*/
public PolicyDetails withResourceTypes(ResourceTypeValues... resourceTypes) {
java.util.ArrayList resourceTypesCopy = new java.util.ArrayList(resourceTypes.length);
for (ResourceTypeValues value : resourceTypes) {
resourceTypesCopy.add(value.toString());
}
if (getResourceTypes() == null) {
setResourceTypes(resourceTypesCopy);
} else {
getResourceTypes().addAll(resourceTypesCopy);
}
return this;
}
/**
*
* The single tag that identifies targeted resources for this policy.
*
*
* @return The single tag that identifies targeted resources for this policy.
*/
public java.util.List getTargetTags() {
return targetTags;
}
/**
*
* The single tag that identifies targeted resources for this policy.
*
*
* @param targetTags
* The single tag that identifies targeted resources for this policy.
*/
public void setTargetTags(java.util.Collection targetTags) {
if (targetTags == null) {
this.targetTags = null;
return;
}
this.targetTags = new java.util.ArrayList(targetTags);
}
/**
*
* The single tag that identifies targeted resources for this policy.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTargetTags(java.util.Collection)} or {@link #withTargetTags(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param targetTags
* The single tag that identifies targeted resources for this policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PolicyDetails withTargetTags(Tag... targetTags) {
if (this.targetTags == null) {
setTargetTags(new java.util.ArrayList(targetTags.length));
}
for (Tag ele : targetTags) {
this.targetTags.add(ele);
}
return this;
}
/**
*
* The single tag that identifies targeted resources for this policy.
*
*
* @param targetTags
* The single tag that identifies targeted resources for this policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PolicyDetails withTargetTags(java.util.Collection targetTags) {
setTargetTags(targetTags);
return this;
}
/**
*
* The schedules of policy-defined actions. A policy can have up to four schedules - one mandatory schedule and up
* to three optional schedules.
*
*
* @return The schedules of policy-defined actions. A policy can have up to four schedules - one mandatory schedule
* and up to three optional schedules.
*/
public java.util.List getSchedules() {
return schedules;
}
/**
*
* The schedules of policy-defined actions. A policy can have up to four schedules - one mandatory schedule and up
* to three optional schedules.
*
*
* @param schedules
* The schedules of policy-defined actions. A policy can have up to four schedules - one mandatory schedule
* and up to three optional schedules.
*/
public void setSchedules(java.util.Collection schedules) {
if (schedules == null) {
this.schedules = null;
return;
}
this.schedules = new java.util.ArrayList(schedules);
}
/**
*
* The schedules of policy-defined actions. A policy can have up to four schedules - one mandatory schedule and up
* to three optional schedules.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSchedules(java.util.Collection)} or {@link #withSchedules(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param schedules
* The schedules of policy-defined actions. A policy can have up to four schedules - one mandatory schedule
* and up to three optional schedules.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PolicyDetails withSchedules(Schedule... schedules) {
if (this.schedules == null) {
setSchedules(new java.util.ArrayList(schedules.length));
}
for (Schedule ele : schedules) {
this.schedules.add(ele);
}
return this;
}
/**
*
* The schedules of policy-defined actions. A policy can have up to four schedules - one mandatory schedule and up
* to three optional schedules.
*
*
* @param schedules
* The schedules of policy-defined actions. A policy can have up to four schedules - one mandatory schedule
* and up to three optional schedules.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PolicyDetails withSchedules(java.util.Collection schedules) {
setSchedules(schedules);
return this;
}
/**
*
* A set of optional parameters for the policy.
*
*
* @param parameters
* A set of optional parameters for the policy.
*/
public void setParameters(Parameters parameters) {
this.parameters = parameters;
}
/**
*
* A set of optional parameters for the policy.
*
*
* @return A set of optional parameters for the policy.
*/
public Parameters getParameters() {
return this.parameters;
}
/**
*
* A set of optional parameters for the policy.
*
*
* @param parameters
* A set of optional parameters for the policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PolicyDetails withParameters(Parameters parameters) {
setParameters(parameters);
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 (getPolicyType() != null)
sb.append("PolicyType: ").append(getPolicyType()).append(",");
if (getResourceTypes() != null)
sb.append("ResourceTypes: ").append(getResourceTypes()).append(",");
if (getTargetTags() != null)
sb.append("TargetTags: ").append(getTargetTags()).append(",");
if (getSchedules() != null)
sb.append("Schedules: ").append(getSchedules()).append(",");
if (getParameters() != null)
sb.append("Parameters: ").append(getParameters());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PolicyDetails == false)
return false;
PolicyDetails other = (PolicyDetails) obj;
if (other.getPolicyType() == null ^ this.getPolicyType() == null)
return false;
if (other.getPolicyType() != null && other.getPolicyType().equals(this.getPolicyType()) == false)
return false;
if (other.getResourceTypes() == null ^ this.getResourceTypes() == null)
return false;
if (other.getResourceTypes() != null && other.getResourceTypes().equals(this.getResourceTypes()) == false)
return false;
if (other.getTargetTags() == null ^ this.getTargetTags() == null)
return false;
if (other.getTargetTags() != null && other.getTargetTags().equals(this.getTargetTags()) == false)
return false;
if (other.getSchedules() == null ^ this.getSchedules() == null)
return false;
if (other.getSchedules() != null && other.getSchedules().equals(this.getSchedules()) == false)
return false;
if (other.getParameters() == null ^ this.getParameters() == null)
return false;
if (other.getParameters() != null && other.getParameters().equals(this.getParameters()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getPolicyType() == null) ? 0 : getPolicyType().hashCode());
hashCode = prime * hashCode + ((getResourceTypes() == null) ? 0 : getResourceTypes().hashCode());
hashCode = prime * hashCode + ((getTargetTags() == null) ? 0 : getTargetTags().hashCode());
hashCode = prime * hashCode + ((getSchedules() == null) ? 0 : getSchedules().hashCode());
hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode());
return hashCode;
}
@Override
public PolicyDetails clone() {
try {
return (PolicyDetails) 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.dlm.model.transform.PolicyDetailsMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}