
com.amazonaws.services.snowball.model.Notification Maven / Gradle / Ivy
Show all versions of aws-java-sdk-snowball Show documentation
/*
* Copyright 2011-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.snowball.model;
import java.io.Serializable;
/**
*
* The Amazon Simple Notification Service (Amazon SNS) notification settings
* associated with a specific job. The Notification
object is
* returned as a part of the response syntax of the DescribeJob
* action in the JobMetadata
data type.
*
*
* When the notification settings are defined during job creation, you can
* choose to notify based on a specific set of job states using the
* JobStatesToNotify
array of strings, or you can specify that you
* want to have Amazon SNS notifications sent out for all job states with
* NotifyAll
set to true.
*
*/
public class Notification implements Serializable, Cloneable {
/**
*
* The new SNS TopicArn
that you want to associate with this
* job. You can create Amazon Resource Names (ARNs) for topics by using the
*
* CreateTopic Amazon SNS API action.
*
*
* Note that you can subscribe email addresses to an Amazon SNS topic
* through the AWS Management Console, or by using the Subscribe AWS Simple Notification Service (SNS) API action.
*
*/
private String snsTopicARN;
/**
*
* The list of job states that will trigger a notification for this job.
*
*/
private java.util.List jobStatesToNotify;
/**
*
* Any change in job state will trigger a notification for this job.
*
*/
private Boolean notifyAll;
/**
*
* The new SNS TopicArn
that you want to associate with this
* job. You can create Amazon Resource Names (ARNs) for topics by using the
*
* CreateTopic Amazon SNS API action.
*
*
* Note that you can subscribe email addresses to an Amazon SNS topic
* through the AWS Management Console, or by using the Subscribe AWS Simple Notification Service (SNS) API action.
*
*
* @param snsTopicARN
* The new SNS TopicArn
that you want to associate with
* this job. You can create Amazon Resource Names (ARNs) for topics
* by using the CreateTopic Amazon SNS API action.
*
* Note that you can subscribe email addresses to an Amazon SNS topic
* through the AWS Management Console, or by using the Subscribe AWS Simple Notification Service (SNS) API action.
*/
public void setSnsTopicARN(String snsTopicARN) {
this.snsTopicARN = snsTopicARN;
}
/**
*
* The new SNS TopicArn
that you want to associate with this
* job. You can create Amazon Resource Names (ARNs) for topics by using the
*
* CreateTopic Amazon SNS API action.
*
*
* Note that you can subscribe email addresses to an Amazon SNS topic
* through the AWS Management Console, or by using the Subscribe AWS Simple Notification Service (SNS) API action.
*
*
* @return The new SNS TopicArn
that you want to associate with
* this job. You can create Amazon Resource Names (ARNs) for topics
* by using the CreateTopic Amazon SNS API action.
*
* Note that you can subscribe email addresses to an Amazon SNS
* topic through the AWS Management Console, or by using the Subscribe AWS Simple Notification Service (SNS) API action.
*/
public String getSnsTopicARN() {
return this.snsTopicARN;
}
/**
*
* The new SNS TopicArn
that you want to associate with this
* job. You can create Amazon Resource Names (ARNs) for topics by using the
*
* CreateTopic Amazon SNS API action.
*
*
* Note that you can subscribe email addresses to an Amazon SNS topic
* through the AWS Management Console, or by using the Subscribe AWS Simple Notification Service (SNS) API action.
*
*
* @param snsTopicARN
* The new SNS TopicArn
that you want to associate with
* this job. You can create Amazon Resource Names (ARNs) for topics
* by using the CreateTopic Amazon SNS API action.
*
* Note that you can subscribe email addresses to an Amazon SNS topic
* through the AWS Management Console, or by using the Subscribe AWS Simple Notification Service (SNS) API action.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Notification withSnsTopicARN(String snsTopicARN) {
setSnsTopicARN(snsTopicARN);
return this;
}
/**
*
* The list of job states that will trigger a notification for this job.
*
*
* @return The list of job states that will trigger a notification for this
* job.
* @see JobState
*/
public java.util.List getJobStatesToNotify() {
return jobStatesToNotify;
}
/**
*
* The list of job states that will trigger a notification for this job.
*
*
* @param jobStatesToNotify
* The list of job states that will trigger a notification for this
* job.
* @see JobState
*/
public void setJobStatesToNotify(
java.util.Collection jobStatesToNotify) {
if (jobStatesToNotify == null) {
this.jobStatesToNotify = null;
return;
}
this.jobStatesToNotify = new java.util.ArrayList(
jobStatesToNotify);
}
/**
*
* The list of job states that will trigger a notification for this job.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setJobStatesToNotify(java.util.Collection)} or
* {@link #withJobStatesToNotify(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param jobStatesToNotify
* The list of job states that will trigger a notification for this
* job.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see JobState
*/
public Notification withJobStatesToNotify(String... jobStatesToNotify) {
if (this.jobStatesToNotify == null) {
setJobStatesToNotify(new java.util.ArrayList(
jobStatesToNotify.length));
}
for (String ele : jobStatesToNotify) {
this.jobStatesToNotify.add(ele);
}
return this;
}
/**
*
* The list of job states that will trigger a notification for this job.
*
*
* @param jobStatesToNotify
* The list of job states that will trigger a notification for this
* job.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see JobState
*/
public Notification withJobStatesToNotify(
java.util.Collection jobStatesToNotify) {
setJobStatesToNotify(jobStatesToNotify);
return this;
}
/**
*
* The list of job states that will trigger a notification for this job.
*
*
* @param jobStatesToNotify
* The list of job states that will trigger a notification for this
* job.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see JobState
*/
public Notification withJobStatesToNotify(JobState... jobStatesToNotify) {
java.util.ArrayList jobStatesToNotifyCopy = new java.util.ArrayList(
jobStatesToNotify.length);
for (JobState value : jobStatesToNotify) {
jobStatesToNotifyCopy.add(value.toString());
}
if (getJobStatesToNotify() == null) {
setJobStatesToNotify(jobStatesToNotifyCopy);
} else {
getJobStatesToNotify().addAll(jobStatesToNotifyCopy);
}
return this;
}
/**
*
* Any change in job state will trigger a notification for this job.
*
*
* @param notifyAll
* Any change in job state will trigger a notification for this job.
*/
public void setNotifyAll(Boolean notifyAll) {
this.notifyAll = notifyAll;
}
/**
*
* Any change in job state will trigger a notification for this job.
*
*
* @return Any change in job state will trigger a notification for this job.
*/
public Boolean getNotifyAll() {
return this.notifyAll;
}
/**
*
* Any change in job state will trigger a notification for this job.
*
*
* @param notifyAll
* Any change in job state will trigger a notification for this job.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public Notification withNotifyAll(Boolean notifyAll) {
setNotifyAll(notifyAll);
return this;
}
/**
*
* Any change in job state will trigger a notification for this job.
*
*
* @return Any change in job state will trigger a notification for this job.
*/
public Boolean isNotifyAll() {
return this.notifyAll;
}
/**
* 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 (getSnsTopicARN() != null)
sb.append("SnsTopicARN: " + getSnsTopicARN() + ",");
if (getJobStatesToNotify() != null)
sb.append("JobStatesToNotify: " + getJobStatesToNotify() + ",");
if (getNotifyAll() != null)
sb.append("NotifyAll: " + getNotifyAll());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof Notification == false)
return false;
Notification other = (Notification) obj;
if (other.getSnsTopicARN() == null ^ this.getSnsTopicARN() == null)
return false;
if (other.getSnsTopicARN() != null
&& other.getSnsTopicARN().equals(this.getSnsTopicARN()) == false)
return false;
if (other.getJobStatesToNotify() == null
^ this.getJobStatesToNotify() == null)
return false;
if (other.getJobStatesToNotify() != null
&& other.getJobStatesToNotify().equals(
this.getJobStatesToNotify()) == false)
return false;
if (other.getNotifyAll() == null ^ this.getNotifyAll() == null)
return false;
if (other.getNotifyAll() != null
&& other.getNotifyAll().equals(this.getNotifyAll()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getSnsTopicARN() == null) ? 0 : getSnsTopicARN().hashCode());
hashCode = prime
* hashCode
+ ((getJobStatesToNotify() == null) ? 0
: getJobStatesToNotify().hashCode());
hashCode = prime * hashCode
+ ((getNotifyAll() == null) ? 0 : getNotifyAll().hashCode());
return hashCode;
}
@Override
public Notification clone() {
try {
return (Notification) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}