com.amazonaws.services.simplesystemsmanagement.model.NotificationConfig Maven / Gradle / Ivy
/*
* Copyright 2019-2024 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;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Configurations for sending notifications.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class NotificationConfig implements Serializable, Cloneable, StructuredPojo {
/**
*
* An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes
* notifications about command status changes to this topic.
*
*/
private String notificationArn;
/**
*
* The different events for which you can receive notifications. To learn more about these events, see Monitoring
* Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services Systems Manager
* User Guide.
*
*/
private com.amazonaws.internal.SdkInternalList notificationEvents;
/**
*
* The type of notification.
*
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node basis
* when the status of a command changes.
*
*
*
*/
private String notificationType;
/**
*
* An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes
* notifications about command status changes to this topic.
*
*
* @param notificationArn
* An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command
* pushes notifications about command status changes to this topic.
*/
public void setNotificationArn(String notificationArn) {
this.notificationArn = notificationArn;
}
/**
*
* An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes
* notifications about command status changes to this topic.
*
*
* @return An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command
* pushes notifications about command status changes to this topic.
*/
public String getNotificationArn() {
return this.notificationArn;
}
/**
*
* An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command pushes
* notifications about command status changes to this topic.
*
*
* @param notificationArn
* An Amazon Resource Name (ARN) for an Amazon Simple Notification Service (Amazon SNS) topic. Run Command
* 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. To learn more about these events, see Monitoring
* Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services Systems Manager
* User Guide.
*
*
* @return The different events for which you can receive notifications. To learn more about these events, see
* Monitoring Systems Manager status changes using Amazon SNS notifications in the Amazon Web
* Services Systems Manager 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. To learn more about these events, see Monitoring
* Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services Systems Manager
* User Guide.
*
*
* @param notificationEvents
* The different events for which you can receive notifications. To learn more about these events, see
* Monitoring Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services
* Systems Manager 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. To learn more about these events, see Monitoring
* Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services Systems Manager
* 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. To learn more about these events, see
* Monitoring Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services
* Systems Manager 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. To learn more about these events, see Monitoring
* Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services Systems Manager
* User Guide.
*
*
* @param notificationEvents
* The different events for which you can receive notifications. To learn more about these events, see
* Monitoring Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services
* Systems Manager 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. To learn more about these events, see Monitoring
* Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services Systems Manager
* User Guide.
*
*
* @param notificationEvents
* The different events for which you can receive notifications. To learn more about these events, see
* Monitoring Systems Manager status changes using Amazon SNS notifications in the Amazon Web Services
* Systems Manager 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;
}
/**
*
* The type of notification.
*
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node basis
* when the status of a command changes.
*
*
*
*
* @param notificationType
* The type of notification.
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node
* basis when the status of a command changes.
*
*
* @see NotificationType
*/
public void setNotificationType(String notificationType) {
this.notificationType = notificationType;
}
/**
*
* The type of notification.
*
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node basis
* when the status of a command changes.
*
*
*
*
* @return The type of notification.
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node
* basis when the status of a command changes.
*
*
* @see NotificationType
*/
public String getNotificationType() {
return this.notificationType;
}
/**
*
* The type of notification.
*
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node basis
* when the status of a command changes.
*
*
*
*
* @param notificationType
* The type of notification.
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node
* 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;
}
/**
*
* The type of notification.
*
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node basis
* when the status of a command changes.
*
*
*
*
* @param notificationType
* The type of notification.
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node
* basis when the status of a command changes.
*
*
* @see NotificationType
*/
public void setNotificationType(NotificationType notificationType) {
withNotificationType(notificationType);
}
/**
*
* The type of notification.
*
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node basis
* when the status of a command changes.
*
*
*
*
* @param notificationType
* The type of notification.
*
* -
*
* Command
: Receive notification when the status of a command changes.
*
*
* -
*
* Invocation
: For commands sent to multiple managed nodes, receive notification on a per-node
* 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) {
this.notificationType = notificationType.toString();
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 (getNotificationArn() != null)
sb.append("NotificationArn: ").append(getNotificationArn()).append(",");
if (getNotificationEvents() != null)
sb.append("NotificationEvents: ").append(getNotificationEvents()).append(",");
if (getNotificationType() != null)
sb.append("NotificationType: ").append(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);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.simplesystemsmanagement.model.transform.NotificationConfigMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}