
com.amazonaws.services.dlm.model.PolicyDetails Maven / Gradle / Ivy
/*
* Copyright 2018-2023 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;
/**
*
* [All policy types] 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 {
/**
*
* [All policy types] The valid target resource types and actions a policy can manage. Specify
* EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS
* snapshots. Specify IMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of
* EBS-backed AMIs. Specify EVENT_BASED_POLICY
to create an event-based policy that performs specific
* actions when a defined event occurs in your Amazon Web Services account.
*
*
* The default is EBS_SNAPSHOT_MANAGEMENT
.
*
*/
private String policyType;
/**
*
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. 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;
/**
*
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources are
* located in an Amazon Web Services Region, specify CLOUD
. If the source resources are located on an
* Outpost in your account, specify OUTPOST
.
*
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified type
* with matching target tags across all of the Outposts in your account.
*
*/
private java.util.List resourceLocations;
/**
*
* [Snapshot and AMI policies only] The single tag that identifies targeted resources for this policy.
*
*/
private java.util.List targetTags;
/**
*
* [Snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI lifecycle
* policies. A policy can have up to four schedules—one mandatory schedule and up to three optional schedules.
*
*/
private java.util.List schedules;
/**
*
* [Snapshot and AMI policies only] A set of optional parameters for snapshot and AMI lifecycle policies.
*
*
*
* If you are modifying a policy that was created or previously modified using the Amazon Data Lifecycle Manager
* console, then you must include this parameter and specify either the default values or the new values that you
* require. You can't omit this parameter or set its values to null.
*
*
*/
private Parameters parameters;
/**
*
* [Event-based policies only] The event that activates the event-based policy.
*
*/
private EventSource eventSource;
/**
*
* [Event-based policies only] The actions to be performed when the event-based policy is activated. You can
* specify only one action per policy.
*
*/
private java.util.List actions;
/**
*
* [All policy types] The valid target resource types and actions a policy can manage. Specify
* EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS
* snapshots. Specify IMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of
* EBS-backed AMIs. Specify EVENT_BASED_POLICY
to create an event-based policy that performs specific
* actions when a defined event occurs in your Amazon Web Services account.
*
*
* The default is EBS_SNAPSHOT_MANAGEMENT
.
*
*
* @param policyType
* [All policy types] The valid target resource types and actions a policy can manage. Specify
* EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS
* snapshots. Specify IMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle
* of EBS-backed AMIs. Specify EVENT_BASED_POLICY
to create an event-based policy that performs
* specific actions when a defined event occurs in your Amazon Web Services account.
*
* The default is EBS_SNAPSHOT_MANAGEMENT
.
* @see PolicyTypeValues
*/
public void setPolicyType(String policyType) {
this.policyType = policyType;
}
/**
*
* [All policy types] The valid target resource types and actions a policy can manage. Specify
* EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS
* snapshots. Specify IMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of
* EBS-backed AMIs. Specify EVENT_BASED_POLICY
to create an event-based policy that performs specific
* actions when a defined event occurs in your Amazon Web Services account.
*
*
* The default is EBS_SNAPSHOT_MANAGEMENT
.
*
*
* @return [All policy types] The valid target resource types and actions a policy can manage. Specify
* EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon
* EBS snapshots. Specify IMAGE_MANAGEMENT
to create a lifecycle policy that manages the
* lifecycle of EBS-backed AMIs. Specify EVENT_BASED_POLICY
to create an event-based policy
* that performs specific actions when a defined event occurs in your Amazon Web Services account.
*
* The default is EBS_SNAPSHOT_MANAGEMENT
.
* @see PolicyTypeValues
*/
public String getPolicyType() {
return this.policyType;
}
/**
*
* [All policy types] The valid target resource types and actions a policy can manage. Specify
* EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS
* snapshots. Specify IMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of
* EBS-backed AMIs. Specify EVENT_BASED_POLICY
to create an event-based policy that performs specific
* actions when a defined event occurs in your Amazon Web Services account.
*
*
* The default is EBS_SNAPSHOT_MANAGEMENT
.
*
*
* @param policyType
* [All policy types] The valid target resource types and actions a policy can manage. Specify
* EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS
* snapshots. Specify IMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle
* of EBS-backed AMIs. Specify EVENT_BASED_POLICY
to create an event-based policy that performs
* specific actions when a defined event occurs in your Amazon Web Services account.
*
* 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;
}
/**
*
* [All policy types] The valid target resource types and actions a policy can manage. Specify
* EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS
* snapshots. Specify IMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of
* EBS-backed AMIs. Specify EVENT_BASED_POLICY
to create an event-based policy that performs specific
* actions when a defined event occurs in your Amazon Web Services account.
*
*
* The default is EBS_SNAPSHOT_MANAGEMENT
.
*
*
* @param policyType
* [All policy types] The valid target resource types and actions a policy can manage. Specify
* EBS_SNAPSHOT_MANAGEMENT
to create a lifecycle policy that manages the lifecycle of Amazon EBS
* snapshots. Specify IMAGE_MANAGEMENT
to create a lifecycle policy that manages the lifecycle
* of EBS-backed AMIs. Specify EVENT_BASED_POLICY
to create an event-based policy that performs
* specific actions when a defined event occurs in your Amazon Web Services account.
*
* 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;
}
/**
*
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. Use
* VOLUME
to create snapshots of individual volumes or use INSTANCE
to create multi-volume
* snapshots from the volumes for an instance.
*
*
* @return [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. 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;
}
/**
*
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. Use
* VOLUME
to create snapshots of individual volumes or use INSTANCE
to create multi-volume
* snapshots from the volumes for an instance.
*
*
* @param resourceTypes
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. 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);
}
/**
*
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. 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
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. 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;
}
/**
*
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. Use
* VOLUME
to create snapshots of individual volumes or use INSTANCE
to create multi-volume
* snapshots from the volumes for an instance.
*
*
* @param resourceTypes
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. 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;
}
/**
*
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. Use
* VOLUME
to create snapshots of individual volumes or use INSTANCE
to create multi-volume
* snapshots from the volumes for an instance.
*
*
* @param resourceTypes
* [Snapshot policies only] The target resource type for snapshot and AMI lifecycle policies. 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;
}
/**
*
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources are
* located in an Amazon Web Services Region, specify CLOUD
. If the source resources are located on an
* Outpost in your account, specify OUTPOST
.
*
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified type
* with matching target tags across all of the Outposts in your account.
*
*
* @return [Snapshot and AMI policies only] The location of the resources to backup. If the source resources
* are located in an Amazon Web Services Region, specify CLOUD
. If the source resources are
* located on an Outpost in your account, specify OUTPOST
.
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the
* specified type with matching target tags across all of the Outposts in your account.
* @see ResourceLocationValues
*/
public java.util.List getResourceLocations() {
return resourceLocations;
}
/**
*
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources are
* located in an Amazon Web Services Region, specify CLOUD
. If the source resources are located on an
* Outpost in your account, specify OUTPOST
.
*
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified type
* with matching target tags across all of the Outposts in your account.
*
*
* @param resourceLocations
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources
* are located in an Amazon Web Services Region, specify CLOUD
. If the source resources are
* located on an Outpost in your account, specify OUTPOST
.
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified
* type with matching target tags across all of the Outposts in your account.
* @see ResourceLocationValues
*/
public void setResourceLocations(java.util.Collection resourceLocations) {
if (resourceLocations == null) {
this.resourceLocations = null;
return;
}
this.resourceLocations = new java.util.ArrayList(resourceLocations);
}
/**
*
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources are
* located in an Amazon Web Services Region, specify CLOUD
. If the source resources are located on an
* Outpost in your account, specify OUTPOST
.
*
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified type
* with matching target tags across all of the Outposts in your account.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setResourceLocations(java.util.Collection)} or {@link #withResourceLocations(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param resourceLocations
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources
* are located in an Amazon Web Services Region, specify CLOUD
. If the source resources are
* located on an Outpost in your account, specify OUTPOST
.
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified
* type with matching target tags across all of the Outposts in your account.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceLocationValues
*/
public PolicyDetails withResourceLocations(String... resourceLocations) {
if (this.resourceLocations == null) {
setResourceLocations(new java.util.ArrayList(resourceLocations.length));
}
for (String ele : resourceLocations) {
this.resourceLocations.add(ele);
}
return this;
}
/**
*
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources are
* located in an Amazon Web Services Region, specify CLOUD
. If the source resources are located on an
* Outpost in your account, specify OUTPOST
.
*
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified type
* with matching target tags across all of the Outposts in your account.
*
*
* @param resourceLocations
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources
* are located in an Amazon Web Services Region, specify CLOUD
. If the source resources are
* located on an Outpost in your account, specify OUTPOST
.
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified
* type with matching target tags across all of the Outposts in your account.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceLocationValues
*/
public PolicyDetails withResourceLocations(java.util.Collection resourceLocations) {
setResourceLocations(resourceLocations);
return this;
}
/**
*
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources are
* located in an Amazon Web Services Region, specify CLOUD
. If the source resources are located on an
* Outpost in your account, specify OUTPOST
.
*
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified type
* with matching target tags across all of the Outposts in your account.
*
*
* @param resourceLocations
* [Snapshot and AMI policies only] The location of the resources to backup. If the source resources
* are located in an Amazon Web Services Region, specify CLOUD
. If the source resources are
* located on an Outpost in your account, specify OUTPOST
.
*
* If you specify OUTPOST
, Amazon Data Lifecycle Manager backs up all resources of the specified
* type with matching target tags across all of the Outposts in your account.
* @return Returns a reference to this object so that method calls can be chained together.
* @see ResourceLocationValues
*/
public PolicyDetails withResourceLocations(ResourceLocationValues... resourceLocations) {
java.util.ArrayList resourceLocationsCopy = new java.util.ArrayList(resourceLocations.length);
for (ResourceLocationValues value : resourceLocations) {
resourceLocationsCopy.add(value.toString());
}
if (getResourceLocations() == null) {
setResourceLocations(resourceLocationsCopy);
} else {
getResourceLocations().addAll(resourceLocationsCopy);
}
return this;
}
/**
*
* [Snapshot and AMI policies only] The single tag that identifies targeted resources for this policy.
*
*
* @return [Snapshot and AMI policies only] The single tag that identifies targeted resources for this
* policy.
*/
public java.util.List getTargetTags() {
return targetTags;
}
/**
*
* [Snapshot and AMI policies only] The single tag that identifies targeted resources for this policy.
*
*
* @param targetTags
* [Snapshot and AMI policies only] 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);
}
/**
*
* [Snapshot and AMI policies only] 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
* [Snapshot and AMI policies only] 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;
}
/**
*
* [Snapshot and AMI policies only] The single tag that identifies targeted resources for this policy.
*
*
* @param targetTags
* [Snapshot and AMI policies only] 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;
}
/**
*
* [Snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI lifecycle
* policies. A policy can have up to four schedules—one mandatory schedule and up to three optional schedules.
*
*
* @return [Snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI
* lifecycle policies. A policy can have up to four schedules—one mandatory schedule and up to three
* optional schedules.
*/
public java.util.List getSchedules() {
return schedules;
}
/**
*
* [Snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI lifecycle
* policies. A policy can have up to four schedules—one mandatory schedule and up to three optional schedules.
*
*
* @param schedules
* [Snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI
* lifecycle policies. 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);
}
/**
*
* [Snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI lifecycle
* policies. 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
* [Snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI
* lifecycle policies. 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;
}
/**
*
* [Snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI lifecycle
* policies. A policy can have up to four schedules—one mandatory schedule and up to three optional schedules.
*
*
* @param schedules
* [Snapshot and AMI policies only] The schedules of policy-defined actions for snapshot and AMI
* lifecycle policies. 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;
}
/**
*
* [Snapshot and AMI policies only] A set of optional parameters for snapshot and AMI lifecycle policies.
*
*
*
* If you are modifying a policy that was created or previously modified using the Amazon Data Lifecycle Manager
* console, then you must include this parameter and specify either the default values or the new values that you
* require. You can't omit this parameter or set its values to null.
*
*
*
* @param parameters
* [Snapshot and AMI policies only] A set of optional parameters for snapshot and AMI lifecycle
* policies.
*
* If you are modifying a policy that was created or previously modified using the Amazon Data Lifecycle
* Manager console, then you must include this parameter and specify either the default values or the new
* values that you require. You can't omit this parameter or set its values to null.
*
*/
public void setParameters(Parameters parameters) {
this.parameters = parameters;
}
/**
*
* [Snapshot and AMI policies only] A set of optional parameters for snapshot and AMI lifecycle policies.
*
*
*
* If you are modifying a policy that was created or previously modified using the Amazon Data Lifecycle Manager
* console, then you must include this parameter and specify either the default values or the new values that you
* require. You can't omit this parameter or set its values to null.
*
*
*
* @return [Snapshot and AMI policies only] A set of optional parameters for snapshot and AMI lifecycle
* policies.
*
* If you are modifying a policy that was created or previously modified using the Amazon Data Lifecycle
* Manager console, then you must include this parameter and specify either the default values or the new
* values that you require. You can't omit this parameter or set its values to null.
*
*/
public Parameters getParameters() {
return this.parameters;
}
/**
*
* [Snapshot and AMI policies only] A set of optional parameters for snapshot and AMI lifecycle policies.
*
*
*
* If you are modifying a policy that was created or previously modified using the Amazon Data Lifecycle Manager
* console, then you must include this parameter and specify either the default values or the new values that you
* require. You can't omit this parameter or set its values to null.
*
*
*
* @param parameters
* [Snapshot and AMI policies only] A set of optional parameters for snapshot and AMI lifecycle
* policies.
*
* If you are modifying a policy that was created or previously modified using the Amazon Data Lifecycle
* Manager console, then you must include this parameter and specify either the default values or the new
* values that you require. You can't omit this parameter or set its values to null.
*
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PolicyDetails withParameters(Parameters parameters) {
setParameters(parameters);
return this;
}
/**
*
* [Event-based policies only] The event that activates the event-based policy.
*
*
* @param eventSource
* [Event-based policies only] The event that activates the event-based policy.
*/
public void setEventSource(EventSource eventSource) {
this.eventSource = eventSource;
}
/**
*
* [Event-based policies only] The event that activates the event-based policy.
*
*
* @return [Event-based policies only] The event that activates the event-based policy.
*/
public EventSource getEventSource() {
return this.eventSource;
}
/**
*
* [Event-based policies only] The event that activates the event-based policy.
*
*
* @param eventSource
* [Event-based policies only] The event that activates the event-based policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PolicyDetails withEventSource(EventSource eventSource) {
setEventSource(eventSource);
return this;
}
/**
*
* [Event-based policies only] The actions to be performed when the event-based policy is activated. You can
* specify only one action per policy.
*
*
* @return [Event-based policies only] The actions to be performed when the event-based policy is activated.
* You can specify only one action per policy.
*/
public java.util.List getActions() {
return actions;
}
/**
*
* [Event-based policies only] The actions to be performed when the event-based policy is activated. You can
* specify only one action per policy.
*
*
* @param actions
* [Event-based policies only] The actions to be performed when the event-based policy is activated.
* You can specify only one action per policy.
*/
public void setActions(java.util.Collection actions) {
if (actions == null) {
this.actions = null;
return;
}
this.actions = new java.util.ArrayList(actions);
}
/**
*
* [Event-based policies only] The actions to be performed when the event-based policy is activated. You can
* specify only one action per policy.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setActions(java.util.Collection)} or {@link #withActions(java.util.Collection)} if you want to override
* the existing values.
*
*
* @param actions
* [Event-based policies only] The actions to be performed when the event-based policy is activated.
* You can specify only one action per policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PolicyDetails withActions(Action... actions) {
if (this.actions == null) {
setActions(new java.util.ArrayList(actions.length));
}
for (Action ele : actions) {
this.actions.add(ele);
}
return this;
}
/**
*
* [Event-based policies only] The actions to be performed when the event-based policy is activated. You can
* specify only one action per policy.
*
*
* @param actions
* [Event-based policies only] The actions to be performed when the event-based policy is activated.
* You can specify only one action per policy.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public PolicyDetails withActions(java.util.Collection actions) {
setActions(actions);
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 (getResourceLocations() != null)
sb.append("ResourceLocations: ").append(getResourceLocations()).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()).append(",");
if (getEventSource() != null)
sb.append("EventSource: ").append(getEventSource()).append(",");
if (getActions() != null)
sb.append("Actions: ").append(getActions());
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.getResourceLocations() == null ^ this.getResourceLocations() == null)
return false;
if (other.getResourceLocations() != null && other.getResourceLocations().equals(this.getResourceLocations()) == 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;
if (other.getEventSource() == null ^ this.getEventSource() == null)
return false;
if (other.getEventSource() != null && other.getEventSource().equals(this.getEventSource()) == false)
return false;
if (other.getActions() == null ^ this.getActions() == null)
return false;
if (other.getActions() != null && other.getActions().equals(this.getActions()) == 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 + ((getResourceLocations() == null) ? 0 : getResourceLocations().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());
hashCode = prime * hashCode + ((getEventSource() == null) ? 0 : getEventSource().hashCode());
hashCode = prime * hashCode + ((getActions() == null) ? 0 : getActions().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);
}
}