com.amazonaws.services.iotevents.model.NotificationAction Maven / Gradle / Ivy
Show all versions of aws-java-sdk-iotevents Show documentation
/*
* 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.iotevents.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Contains the notification settings of an alarm model. The settings apply to all alarms that were created based on
* this alarm model.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class NotificationAction implements Serializable, Cloneable, StructuredPojo {
/**
*
* Specifies an AWS Lambda function to manage alarm notifications. You can create one or use the AWS Lambda function
* provided by AWS IoT Events.
*
*/
private NotificationTargetActions action;
/**
*
* Contains the configuration information of SMS notifications.
*
*/
private java.util.List smsConfigurations;
/**
*
* Contains the configuration information of email notifications.
*
*/
private java.util.List emailConfigurations;
/**
*
* Specifies an AWS Lambda function to manage alarm notifications. You can create one or use the AWS Lambda function
* provided by AWS IoT Events.
*
*
* @param action
* Specifies an AWS Lambda function to manage alarm notifications. You can create one or use the AWS Lambda function
* provided by AWS IoT Events.
*/
public void setAction(NotificationTargetActions action) {
this.action = action;
}
/**
*
* Specifies an AWS Lambda function to manage alarm notifications. You can create one or use the AWS Lambda function
* provided by AWS IoT Events.
*
*
* @return Specifies an AWS Lambda function to manage alarm notifications. You can create one or use the AWS Lambda
* function provided by AWS IoT Events.
*/
public NotificationTargetActions getAction() {
return this.action;
}
/**
*
* Specifies an AWS Lambda function to manage alarm notifications. You can create one or use the AWS Lambda function
* provided by AWS IoT Events.
*
*
* @param action
* Specifies an AWS Lambda function to manage alarm notifications. You can create one or use the AWS Lambda function
* provided by AWS IoT Events.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NotificationAction withAction(NotificationTargetActions action) {
setAction(action);
return this;
}
/**
*
* Contains the configuration information of SMS notifications.
*
*
* @return Contains the configuration information of SMS notifications.
*/
public java.util.List getSmsConfigurations() {
return smsConfigurations;
}
/**
*
* Contains the configuration information of SMS notifications.
*
*
* @param smsConfigurations
* Contains the configuration information of SMS notifications.
*/
public void setSmsConfigurations(java.util.Collection smsConfigurations) {
if (smsConfigurations == null) {
this.smsConfigurations = null;
return;
}
this.smsConfigurations = new java.util.ArrayList(smsConfigurations);
}
/**
*
* Contains the configuration information of SMS notifications.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setSmsConfigurations(java.util.Collection)} or {@link #withSmsConfigurations(java.util.Collection)} if
* you want to override the existing values.
*
*
* @param smsConfigurations
* Contains the configuration information of SMS notifications.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NotificationAction withSmsConfigurations(SMSConfiguration... smsConfigurations) {
if (this.smsConfigurations == null) {
setSmsConfigurations(new java.util.ArrayList(smsConfigurations.length));
}
for (SMSConfiguration ele : smsConfigurations) {
this.smsConfigurations.add(ele);
}
return this;
}
/**
*
* Contains the configuration information of SMS notifications.
*
*
* @param smsConfigurations
* Contains the configuration information of SMS notifications.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NotificationAction withSmsConfigurations(java.util.Collection smsConfigurations) {
setSmsConfigurations(smsConfigurations);
return this;
}
/**
*
* Contains the configuration information of email notifications.
*
*
* @return Contains the configuration information of email notifications.
*/
public java.util.List getEmailConfigurations() {
return emailConfigurations;
}
/**
*
* Contains the configuration information of email notifications.
*
*
* @param emailConfigurations
* Contains the configuration information of email notifications.
*/
public void setEmailConfigurations(java.util.Collection emailConfigurations) {
if (emailConfigurations == null) {
this.emailConfigurations = null;
return;
}
this.emailConfigurations = new java.util.ArrayList(emailConfigurations);
}
/**
*
* Contains the configuration information of email notifications.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setEmailConfigurations(java.util.Collection)} or {@link #withEmailConfigurations(java.util.Collection)}
* if you want to override the existing values.
*
*
* @param emailConfigurations
* Contains the configuration information of email notifications.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NotificationAction withEmailConfigurations(EmailConfiguration... emailConfigurations) {
if (this.emailConfigurations == null) {
setEmailConfigurations(new java.util.ArrayList(emailConfigurations.length));
}
for (EmailConfiguration ele : emailConfigurations) {
this.emailConfigurations.add(ele);
}
return this;
}
/**
*
* Contains the configuration information of email notifications.
*
*
* @param emailConfigurations
* Contains the configuration information of email notifications.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public NotificationAction withEmailConfigurations(java.util.Collection emailConfigurations) {
setEmailConfigurations(emailConfigurations);
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 (getAction() != null)
sb.append("Action: ").append(getAction()).append(",");
if (getSmsConfigurations() != null)
sb.append("SmsConfigurations: ").append(getSmsConfigurations()).append(",");
if (getEmailConfigurations() != null)
sb.append("EmailConfigurations: ").append(getEmailConfigurations());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof NotificationAction == false)
return false;
NotificationAction other = (NotificationAction) obj;
if (other.getAction() == null ^ this.getAction() == null)
return false;
if (other.getAction() != null && other.getAction().equals(this.getAction()) == false)
return false;
if (other.getSmsConfigurations() == null ^ this.getSmsConfigurations() == null)
return false;
if (other.getSmsConfigurations() != null && other.getSmsConfigurations().equals(this.getSmsConfigurations()) == false)
return false;
if (other.getEmailConfigurations() == null ^ this.getEmailConfigurations() == null)
return false;
if (other.getEmailConfigurations() != null && other.getEmailConfigurations().equals(this.getEmailConfigurations()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getAction() == null) ? 0 : getAction().hashCode());
hashCode = prime * hashCode + ((getSmsConfigurations() == null) ? 0 : getSmsConfigurations().hashCode());
hashCode = prime * hashCode + ((getEmailConfigurations() == null) ? 0 : getEmailConfigurations().hashCode());
return hashCode;
}
@Override
public NotificationAction clone() {
try {
return (NotificationAction) 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.iotevents.model.transform.NotificationActionMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}