com.amazonaws.services.codedeploy.model.TriggerConfig Maven / Gradle / Ivy
Show all versions of aws-java-sdk-codedeploy Show documentation
/*
* Copyright 2012-2017 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.codedeploy.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
*
* Information about notification triggers for the deployment group.
*
*
* @see AWS API
* Documentation
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class TriggerConfig implements Serializable, Cloneable, StructuredPojo {
/**
*
* The name of the notification trigger.
*
*/
private String triggerName;
/**
*
* The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or instance
* events are sent.
*
*/
private String triggerTargetArn;
/**
*
* The event type or types for which notifications are triggered.
*
*/
private com.amazonaws.internal.SdkInternalList triggerEvents;
/**
*
* The name of the notification trigger.
*
*
* @param triggerName
* The name of the notification trigger.
*/
public void setTriggerName(String triggerName) {
this.triggerName = triggerName;
}
/**
*
* The name of the notification trigger.
*
*
* @return The name of the notification trigger.
*/
public String getTriggerName() {
return this.triggerName;
}
/**
*
* The name of the notification trigger.
*
*
* @param triggerName
* The name of the notification trigger.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TriggerConfig withTriggerName(String triggerName) {
setTriggerName(triggerName);
return this;
}
/**
*
* The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or instance
* events are sent.
*
*
* @param triggerTargetArn
* The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or
* instance events are sent.
*/
public void setTriggerTargetArn(String triggerTargetArn) {
this.triggerTargetArn = triggerTargetArn;
}
/**
*
* The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or instance
* events are sent.
*
*
* @return The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or
* instance events are sent.
*/
public String getTriggerTargetArn() {
return this.triggerTargetArn;
}
/**
*
* The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or instance
* events are sent.
*
*
* @param triggerTargetArn
* The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or
* instance events are sent.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public TriggerConfig withTriggerTargetArn(String triggerTargetArn) {
setTriggerTargetArn(triggerTargetArn);
return this;
}
/**
*
* The event type or types for which notifications are triggered.
*
*
* @return The event type or types for which notifications are triggered.
* @see TriggerEventType
*/
public java.util.List getTriggerEvents() {
if (triggerEvents == null) {
triggerEvents = new com.amazonaws.internal.SdkInternalList();
}
return triggerEvents;
}
/**
*
* The event type or types for which notifications are triggered.
*
*
* @param triggerEvents
* The event type or types for which notifications are triggered.
* @see TriggerEventType
*/
public void setTriggerEvents(java.util.Collection triggerEvents) {
if (triggerEvents == null) {
this.triggerEvents = null;
return;
}
this.triggerEvents = new com.amazonaws.internal.SdkInternalList(triggerEvents);
}
/**
*
* The event type or types for which notifications are triggered.
*
*
* NOTE: This method appends the values to the existing list (if any). Use
* {@link #setTriggerEvents(java.util.Collection)} or {@link #withTriggerEvents(java.util.Collection)} if you want
* to override the existing values.
*
*
* @param triggerEvents
* The event type or types for which notifications are triggered.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TriggerEventType
*/
public TriggerConfig withTriggerEvents(String... triggerEvents) {
if (this.triggerEvents == null) {
setTriggerEvents(new com.amazonaws.internal.SdkInternalList(triggerEvents.length));
}
for (String ele : triggerEvents) {
this.triggerEvents.add(ele);
}
return this;
}
/**
*
* The event type or types for which notifications are triggered.
*
*
* @param triggerEvents
* The event type or types for which notifications are triggered.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TriggerEventType
*/
public TriggerConfig withTriggerEvents(java.util.Collection triggerEvents) {
setTriggerEvents(triggerEvents);
return this;
}
/**
*
* The event type or types for which notifications are triggered.
*
*
* @param triggerEvents
* The event type or types for which notifications are triggered.
* @return Returns a reference to this object so that method calls can be chained together.
* @see TriggerEventType
*/
public TriggerConfig withTriggerEvents(TriggerEventType... triggerEvents) {
com.amazonaws.internal.SdkInternalList triggerEventsCopy = new com.amazonaws.internal.SdkInternalList(triggerEvents.length);
for (TriggerEventType value : triggerEvents) {
triggerEventsCopy.add(value.toString());
}
if (getTriggerEvents() == null) {
setTriggerEvents(triggerEventsCopy);
} else {
getTriggerEvents().addAll(triggerEventsCopy);
}
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 (getTriggerName() != null)
sb.append("TriggerName: ").append(getTriggerName()).append(",");
if (getTriggerTargetArn() != null)
sb.append("TriggerTargetArn: ").append(getTriggerTargetArn()).append(",");
if (getTriggerEvents() != null)
sb.append("TriggerEvents: ").append(getTriggerEvents());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof TriggerConfig == false)
return false;
TriggerConfig other = (TriggerConfig) obj;
if (other.getTriggerName() == null ^ this.getTriggerName() == null)
return false;
if (other.getTriggerName() != null && other.getTriggerName().equals(this.getTriggerName()) == false)
return false;
if (other.getTriggerTargetArn() == null ^ this.getTriggerTargetArn() == null)
return false;
if (other.getTriggerTargetArn() != null && other.getTriggerTargetArn().equals(this.getTriggerTargetArn()) == false)
return false;
if (other.getTriggerEvents() == null ^ this.getTriggerEvents() == null)
return false;
if (other.getTriggerEvents() != null && other.getTriggerEvents().equals(this.getTriggerEvents()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getTriggerName() == null) ? 0 : getTriggerName().hashCode());
hashCode = prime * hashCode + ((getTriggerTargetArn() == null) ? 0 : getTriggerTargetArn().hashCode());
hashCode = prime * hashCode + ((getTriggerEvents() == null) ? 0 : getTriggerEvents().hashCode());
return hashCode;
}
@Override
public TriggerConfig clone() {
try {
return (TriggerConfig) 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.codedeploy.model.transform.TriggerConfigMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}