
com.amazonaws.services.codecommit.model.RepositoryTrigger Maven / Gradle / Ivy
Show all versions of aws-java-sdk-codecommit 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.codecommit.model;
import java.io.Serializable;
/**
*
* Information about a trigger for a repository.
*
*/
public class RepositoryTrigger implements Serializable, Cloneable {
/**
*
* The name of the trigger.
*
*/
private String name;
/**
*
* The ARN of the resource that is the target for a trigger. For example,
* the ARN of a topic in Amazon Simple Notification Service (SNS).
*
*/
private String destinationArn;
/**
*
* Any custom data associated with the trigger that will be included in the
* information sent to the target of the trigger.
*
*/
private String customData;
/**
*
* The branches that will be included in the trigger configuration. If no
* branches are specified, the trigger will apply to all branches.
*
*/
private java.util.List branches;
/**
*
* The repository events that will cause the trigger to run actions in
* another service, such as sending a notification through Amazon Simple
* Notification Service (SNS). If no events are specified, the trigger will
* run for all repository events.
*
*/
private java.util.List events;
/**
*
* The name of the trigger.
*
*
* @param name
* The name of the trigger.
*/
public void setName(String name) {
this.name = name;
}
/**
*
* The name of the trigger.
*
*
* @return The name of the trigger.
*/
public String getName() {
return this.name;
}
/**
*
* The name of the trigger.
*
*
* @param name
* The name of the trigger.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public RepositoryTrigger withName(String name) {
setName(name);
return this;
}
/**
*
* The ARN of the resource that is the target for a trigger. For example,
* the ARN of a topic in Amazon Simple Notification Service (SNS).
*
*
* @param destinationArn
* The ARN of the resource that is the target for a trigger. For
* example, the ARN of a topic in Amazon Simple Notification Service
* (SNS).
*/
public void setDestinationArn(String destinationArn) {
this.destinationArn = destinationArn;
}
/**
*
* The ARN of the resource that is the target for a trigger. For example,
* the ARN of a topic in Amazon Simple Notification Service (SNS).
*
*
* @return The ARN of the resource that is the target for a trigger. For
* example, the ARN of a topic in Amazon Simple Notification Service
* (SNS).
*/
public String getDestinationArn() {
return this.destinationArn;
}
/**
*
* The ARN of the resource that is the target for a trigger. For example,
* the ARN of a topic in Amazon Simple Notification Service (SNS).
*
*
* @param destinationArn
* The ARN of the resource that is the target for a trigger. For
* example, the ARN of a topic in Amazon Simple Notification Service
* (SNS).
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public RepositoryTrigger withDestinationArn(String destinationArn) {
setDestinationArn(destinationArn);
return this;
}
/**
*
* Any custom data associated with the trigger that will be included in the
* information sent to the target of the trigger.
*
*
* @param customData
* Any custom data associated with the trigger that will be included
* in the information sent to the target of the trigger.
*/
public void setCustomData(String customData) {
this.customData = customData;
}
/**
*
* Any custom data associated with the trigger that will be included in the
* information sent to the target of the trigger.
*
*
* @return Any custom data associated with the trigger that will be included
* in the information sent to the target of the trigger.
*/
public String getCustomData() {
return this.customData;
}
/**
*
* Any custom data associated with the trigger that will be included in the
* information sent to the target of the trigger.
*
*
* @param customData
* Any custom data associated with the trigger that will be included
* in the information sent to the target of the trigger.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public RepositoryTrigger withCustomData(String customData) {
setCustomData(customData);
return this;
}
/**
*
* The branches that will be included in the trigger configuration. If no
* branches are specified, the trigger will apply to all branches.
*
*
* @return The branches that will be included in the trigger configuration.
* If no branches are specified, the trigger will apply to all
* branches.
*/
public java.util.List getBranches() {
return branches;
}
/**
*
* The branches that will be included in the trigger configuration. If no
* branches are specified, the trigger will apply to all branches.
*
*
* @param branches
* The branches that will be included in the trigger configuration.
* If no branches are specified, the trigger will apply to all
* branches.
*/
public void setBranches(java.util.Collection branches) {
if (branches == null) {
this.branches = null;
return;
}
this.branches = new java.util.ArrayList(branches);
}
/**
*
* The branches that will be included in the trigger configuration. If no
* branches are specified, the trigger will apply to all branches.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setBranches(java.util.Collection)} or
* {@link #withBranches(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param branches
* The branches that will be included in the trigger configuration.
* If no branches are specified, the trigger will apply to all
* branches.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public RepositoryTrigger withBranches(String... branches) {
if (this.branches == null) {
setBranches(new java.util.ArrayList(branches.length));
}
for (String ele : branches) {
this.branches.add(ele);
}
return this;
}
/**
*
* The branches that will be included in the trigger configuration. If no
* branches are specified, the trigger will apply to all branches.
*
*
* @param branches
* The branches that will be included in the trigger configuration.
* If no branches are specified, the trigger will apply to all
* branches.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public RepositoryTrigger withBranches(java.util.Collection branches) {
setBranches(branches);
return this;
}
/**
*
* The repository events that will cause the trigger to run actions in
* another service, such as sending a notification through Amazon Simple
* Notification Service (SNS). If no events are specified, the trigger will
* run for all repository events.
*
*
* @return The repository events that will cause the trigger to run actions
* in another service, such as sending a notification through Amazon
* Simple Notification Service (SNS). If no events are specified,
* the trigger will run for all repository events.
* @see RepositoryTriggerEventEnum
*/
public java.util.List getEvents() {
return events;
}
/**
*
* The repository events that will cause the trigger to run actions in
* another service, such as sending a notification through Amazon Simple
* Notification Service (SNS). If no events are specified, the trigger will
* run for all repository events.
*
*
* @param events
* The repository events that will cause the trigger to run actions
* in another service, such as sending a notification through Amazon
* Simple Notification Service (SNS). If no events are specified, the
* trigger will run for all repository events.
* @see RepositoryTriggerEventEnum
*/
public void setEvents(java.util.Collection events) {
if (events == null) {
this.events = null;
return;
}
this.events = new java.util.ArrayList(events);
}
/**
*
* The repository events that will cause the trigger to run actions in
* another service, such as sending a notification through Amazon Simple
* Notification Service (SNS). If no events are specified, the trigger will
* run for all repository events.
*
*
* NOTE: This method appends the values to the existing list (if
* any). Use {@link #setEvents(java.util.Collection)} or
* {@link #withEvents(java.util.Collection)} if you want to override the
* existing values.
*
*
* @param events
* The repository events that will cause the trigger to run actions
* in another service, such as sending a notification through Amazon
* Simple Notification Service (SNS). If no events are specified, the
* trigger will run for all repository events.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see RepositoryTriggerEventEnum
*/
public RepositoryTrigger withEvents(String... events) {
if (this.events == null) {
setEvents(new java.util.ArrayList(events.length));
}
for (String ele : events) {
this.events.add(ele);
}
return this;
}
/**
*
* The repository events that will cause the trigger to run actions in
* another service, such as sending a notification through Amazon Simple
* Notification Service (SNS). If no events are specified, the trigger will
* run for all repository events.
*
*
* @param events
* The repository events that will cause the trigger to run actions
* in another service, such as sending a notification through Amazon
* Simple Notification Service (SNS). If no events are specified, the
* trigger will run for all repository events.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see RepositoryTriggerEventEnum
*/
public RepositoryTrigger withEvents(java.util.Collection events) {
setEvents(events);
return this;
}
/**
*
* The repository events that will cause the trigger to run actions in
* another service, such as sending a notification through Amazon Simple
* Notification Service (SNS). If no events are specified, the trigger will
* run for all repository events.
*
*
* @param events
* The repository events that will cause the trigger to run actions
* in another service, such as sending a notification through Amazon
* Simple Notification Service (SNS). If no events are specified, the
* trigger will run for all repository events.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see RepositoryTriggerEventEnum
*/
public RepositoryTrigger withEvents(RepositoryTriggerEventEnum... events) {
java.util.ArrayList eventsCopy = new java.util.ArrayList(
events.length);
for (RepositoryTriggerEventEnum value : events) {
eventsCopy.add(value.toString());
}
if (getEvents() == null) {
setEvents(eventsCopy);
} else {
getEvents().addAll(eventsCopy);
}
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 (getName() != null)
sb.append("Name: " + getName() + ",");
if (getDestinationArn() != null)
sb.append("DestinationArn: " + getDestinationArn() + ",");
if (getCustomData() != null)
sb.append("CustomData: " + getCustomData() + ",");
if (getBranches() != null)
sb.append("Branches: " + getBranches() + ",");
if (getEvents() != null)
sb.append("Events: " + getEvents());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof RepositoryTrigger == false)
return false;
RepositoryTrigger other = (RepositoryTrigger) obj;
if (other.getName() == null ^ this.getName() == null)
return false;
if (other.getName() != null
&& other.getName().equals(this.getName()) == false)
return false;
if (other.getDestinationArn() == null
^ this.getDestinationArn() == null)
return false;
if (other.getDestinationArn() != null
&& other.getDestinationArn().equals(this.getDestinationArn()) == false)
return false;
if (other.getCustomData() == null ^ this.getCustomData() == null)
return false;
if (other.getCustomData() != null
&& other.getCustomData().equals(this.getCustomData()) == false)
return false;
if (other.getBranches() == null ^ this.getBranches() == null)
return false;
if (other.getBranches() != null
&& other.getBranches().equals(this.getBranches()) == false)
return false;
if (other.getEvents() == null ^ this.getEvents() == null)
return false;
if (other.getEvents() != null
&& other.getEvents().equals(this.getEvents()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getName() == null) ? 0 : getName().hashCode());
hashCode = prime
* hashCode
+ ((getDestinationArn() == null) ? 0 : getDestinationArn()
.hashCode());
hashCode = prime * hashCode
+ ((getCustomData() == null) ? 0 : getCustomData().hashCode());
hashCode = prime * hashCode
+ ((getBranches() == null) ? 0 : getBranches().hashCode());
hashCode = prime * hashCode
+ ((getEvents() == null) ? 0 : getEvents().hashCode());
return hashCode;
}
@Override
public RepositoryTrigger clone() {
try {
return (RepositoryTrigger) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}