
com.amazonaws.services.simplesystemsmanagement.model.NotificationConfig Maven / Gradle / Ivy
Show all versions of aws-java-sdk-osgi 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.simplesystemsmanagement.model;
import java.io.Serializable;
/**
*
* Configurations for sending notifications.
*
*/
public class NotificationConfig implements Serializable, Cloneable {
/**
*
* An Amazon Resource Name (ARN) for a Simple Notification Service (SNS)
* topic. SSM pushes notifications about command status changes to this
* topic.
*
*/
private String notificationArn;
/**
*
* The different events for which you can receive notifications. These
* events include the following: All (events), InProgress, Success,
* TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User
* Guide .
*
*/
private com.amazonaws.internal.SdkInternalList notificationEvents;
/**
*
* Command: Receive notification when the status of a command changes.
* Invocation: For commands sent to multiple instances, receive notification
* on a per-instance basis when the status of a command changes.
*
*/
private String notificationType;
/**
*
* An Amazon Resource Name (ARN) for a Simple Notification Service (SNS)
* topic. SSM pushes notifications about command status changes to this
* topic.
*
*
* @param notificationArn
* An Amazon Resource Name (ARN) for a Simple Notification Service
* (SNS) topic. SSM pushes notifications about command status changes
* to this topic.
*/
public void setNotificationArn(String notificationArn) {
this.notificationArn = notificationArn;
}
/**
*
* An Amazon Resource Name (ARN) for a Simple Notification Service (SNS)
* topic. SSM pushes notifications about command status changes to this
* topic.
*
*
* @return An Amazon Resource Name (ARN) for a Simple Notification Service
* (SNS) topic. SSM pushes notifications about command status
* changes to this topic.
*/
public String getNotificationArn() {
return this.notificationArn;
}
/**
*
* An Amazon Resource Name (ARN) for a Simple Notification Service (SNS)
* topic. SSM pushes notifications about command status changes to this
* topic.
*
*
* @param notificationArn
* An Amazon Resource Name (ARN) for a Simple Notification Service
* (SNS) topic. SSM pushes notifications about command status changes
* to this topic.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public NotificationConfig withNotificationArn(String notificationArn) {
setNotificationArn(notificationArn);
return this;
}
/**
*
* The different events for which you can receive notifications. These
* events include the following: All (events), InProgress, Success,
* TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User
* Guide .
*
*
* @return The different events for which you can receive notifications.
* These events include the following: All (events), InProgress,
* Success, TimedOut, Cancelled, Failed. To learn more about these
* events, see Monitoring Commands in the Amazon Elastic Compute Cloud
* User Guide .
* @see NotificationEvent
*/
public java.util.List getNotificationEvents() {
if (notificationEvents == null) {
notificationEvents = new com.amazonaws.internal.SdkInternalList();
}
return notificationEvents;
}
/**
*
* The different events for which you can receive notifications. These
* events include the following: All (events), InProgress, Success,
* TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User
* Guide .
*
*
* @param notificationEvents
* The different events for which you can receive notifications.
* These events include the following: All (events), InProgress,
* Success, TimedOut, Cancelled, Failed. To learn more about these
* events, see Monitoring Commands in the Amazon Elastic Compute Cloud
* User Guide .
* @see NotificationEvent
*/
public void setNotificationEvents(
java.util.Collection notificationEvents) {
if (notificationEvents == null) {
this.notificationEvents = null;
return;
}
this.notificationEvents = new com.amazonaws.internal.SdkInternalList(
notificationEvents);
}
/**
*
* The different events for which you can receive notifications. These
* events include the following: All (events), InProgress, Success,
* TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User
* Guide .
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setNotificationEvents(java.util.Collection)} or
* {@link #withNotificationEvents(java.util.Collection)} if you want to
* override the existing values.
*
*
* @param notificationEvents
* The different events for which you can receive notifications.
* These events include the following: All (events), InProgress,
* Success, TimedOut, Cancelled, Failed. To learn more about these
* events, see Monitoring Commands in the Amazon Elastic Compute Cloud
* User Guide .
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see NotificationEvent
*/
public NotificationConfig withNotificationEvents(
String... notificationEvents) {
if (this.notificationEvents == null) {
setNotificationEvents(new com.amazonaws.internal.SdkInternalList(
notificationEvents.length));
}
for (String ele : notificationEvents) {
this.notificationEvents.add(ele);
}
return this;
}
/**
*
* The different events for which you can receive notifications. These
* events include the following: All (events), InProgress, Success,
* TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User
* Guide .
*
*
* @param notificationEvents
* The different events for which you can receive notifications.
* These events include the following: All (events), InProgress,
* Success, TimedOut, Cancelled, Failed. To learn more about these
* events, see Monitoring Commands in the Amazon Elastic Compute Cloud
* User Guide .
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see NotificationEvent
*/
public NotificationConfig withNotificationEvents(
java.util.Collection notificationEvents) {
setNotificationEvents(notificationEvents);
return this;
}
/**
*
* The different events for which you can receive notifications. These
* events include the following: All (events), InProgress, Success,
* TimedOut, Cancelled, Failed. To learn more about these events, see Monitoring Commands in the Amazon Elastic Compute Cloud User
* Guide .
*
*
* @param notificationEvents
* The different events for which you can receive notifications.
* These events include the following: All (events), InProgress,
* Success, TimedOut, Cancelled, Failed. To learn more about these
* events, see Monitoring Commands in the Amazon Elastic Compute Cloud
* User Guide .
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see NotificationEvent
*/
public NotificationConfig withNotificationEvents(
NotificationEvent... notificationEvents) {
com.amazonaws.internal.SdkInternalList notificationEventsCopy = new com.amazonaws.internal.SdkInternalList(
notificationEvents.length);
for (NotificationEvent value : notificationEvents) {
notificationEventsCopy.add(value.toString());
}
if (getNotificationEvents() == null) {
setNotificationEvents(notificationEventsCopy);
} else {
getNotificationEvents().addAll(notificationEventsCopy);
}
return this;
}
/**
*
* Command: Receive notification when the status of a command changes.
* Invocation: For commands sent to multiple instances, receive notification
* on a per-instance basis when the status of a command changes.
*
*
* @param notificationType
* Command: Receive notification when the status of a command
* changes. Invocation: For commands sent to multiple instances,
* receive notification on a per-instance basis when the status of a
* command changes.
* @see NotificationType
*/
public void setNotificationType(String notificationType) {
this.notificationType = notificationType;
}
/**
*
* Command: Receive notification when the status of a command changes.
* Invocation: For commands sent to multiple instances, receive notification
* on a per-instance basis when the status of a command changes.
*
*
* @return Command: Receive notification when the status of a command
* changes. Invocation: For commands sent to multiple instances,
* receive notification on a per-instance basis when the status of a
* command changes.
* @see NotificationType
*/
public String getNotificationType() {
return this.notificationType;
}
/**
*
* Command: Receive notification when the status of a command changes.
* Invocation: For commands sent to multiple instances, receive notification
* on a per-instance basis when the status of a command changes.
*
*
* @param notificationType
* Command: Receive notification when the status of a command
* changes. Invocation: For commands sent to multiple instances,
* receive notification on a per-instance basis when the status of a
* command changes.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see NotificationType
*/
public NotificationConfig withNotificationType(String notificationType) {
setNotificationType(notificationType);
return this;
}
/**
*
* Command: Receive notification when the status of a command changes.
* Invocation: For commands sent to multiple instances, receive notification
* on a per-instance basis when the status of a command changes.
*
*
* @param notificationType
* Command: Receive notification when the status of a command
* changes. Invocation: For commands sent to multiple instances,
* receive notification on a per-instance basis when the status of a
* command changes.
* @see NotificationType
*/
public void setNotificationType(NotificationType notificationType) {
this.notificationType = notificationType.toString();
}
/**
*
* Command: Receive notification when the status of a command changes.
* Invocation: For commands sent to multiple instances, receive notification
* on a per-instance basis when the status of a command changes.
*
*
* @param notificationType
* Command: Receive notification when the status of a command
* changes. Invocation: For commands sent to multiple instances,
* receive notification on a per-instance basis when the status of a
* command changes.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see NotificationType
*/
public NotificationConfig withNotificationType(
NotificationType notificationType) {
setNotificationType(notificationType);
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 (getNotificationArn() != null)
sb.append("NotificationArn: " + getNotificationArn() + ",");
if (getNotificationEvents() != null)
sb.append("NotificationEvents: " + getNotificationEvents() + ",");
if (getNotificationType() != null)
sb.append("NotificationType: " + getNotificationType());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof NotificationConfig == false)
return false;
NotificationConfig other = (NotificationConfig) obj;
if (other.getNotificationArn() == null
^ this.getNotificationArn() == null)
return false;
if (other.getNotificationArn() != null
&& other.getNotificationArn().equals(this.getNotificationArn()) == false)
return false;
if (other.getNotificationEvents() == null
^ this.getNotificationEvents() == null)
return false;
if (other.getNotificationEvents() != null
&& other.getNotificationEvents().equals(
this.getNotificationEvents()) == false)
return false;
if (other.getNotificationType() == null
^ this.getNotificationType() == null)
return false;
if (other.getNotificationType() != null
&& other.getNotificationType().equals(
this.getNotificationType()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime
* hashCode
+ ((getNotificationArn() == null) ? 0 : getNotificationArn()
.hashCode());
hashCode = prime
* hashCode
+ ((getNotificationEvents() == null) ? 0
: getNotificationEvents().hashCode());
hashCode = prime
* hashCode
+ ((getNotificationType() == null) ? 0 : getNotificationType()
.hashCode());
return hashCode;
}
@Override
public NotificationConfig clone() {
try {
return (NotificationConfig) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}