/* * Copyright 2018-2023 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.glue.model; import java.io.Serializable; import javax.annotation.Generated; import com.amazonaws.protocol.StructuredPojo; import com.amazonaws.protocol.ProtocolMarshaller; /** *

* Information about a specific trigger. *

* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class Trigger implements Serializable, Cloneable, StructuredPojo { /** *

* The name of the trigger. *

*/ private String name; /** *

* The name of the workflow associated with the trigger. *

*/ private String workflowName; /** *

* Reserved for future use. *

*/ private String id; /** *

* The type of trigger that this is. *

*/ private String type; /** *

* The current state of the trigger. *

*/ private String state; /** *

* A description of this trigger. *

*/ private String description; /** *

* A cron expression used to specify the schedule (see Time-Based Schedules for * Jobs and Crawlers. For example, to run something every day at 12:15 UTC, you would specify: * cron(15 12 * * ? *). *

*/ private String schedule; /** *

* The actions initiated by this trigger. *

*/ private java.util.List actions; /** *

* The predicate of this trigger, which defines when it will fire. *

*/ private Predicate predicate; /** *

* Batch condition that must be met (specified number of events received or batch time window expired) before * EventBridge event trigger fires. *

*/ private EventBatchingCondition eventBatchingCondition; /** *

* 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 Trigger withName(String name) { setName(name); return this; } /** *

* The name of the workflow associated with the trigger. *

* * @param workflowName * The name of the workflow associated with the trigger. */ public void setWorkflowName(String workflowName) { this.workflowName = workflowName; } /** *

* The name of the workflow associated with the trigger. *

* * @return The name of the workflow associated with the trigger. */ public String getWorkflowName() { return this.workflowName; } /** *

* The name of the workflow associated with the trigger. *

* * @param workflowName * The name of the workflow associated with the trigger. * @return Returns a reference to this object so that method calls can be chained together. */ public Trigger withWorkflowName(String workflowName) { setWorkflowName(workflowName); return this; } /** *

* Reserved for future use. *

* * @param id * Reserved for future use. */ public void setId(String id) { this.id = id; } /** *

* Reserved for future use. *

* * @return Reserved for future use. */ public String getId() { return this.id; } /** *

* Reserved for future use. *

* * @param id * Reserved for future use. * @return Returns a reference to this object so that method calls can be chained together. */ public Trigger withId(String id) { setId(id); return this; } /** *

* The type of trigger that this is. *

* * @param type * The type of trigger that this is. * @see TriggerType */ public void setType(String type) { this.type = type; } /** *

* The type of trigger that this is. *

* * @return The type of trigger that this is. * @see TriggerType */ public String getType() { return this.type; } /** *

* The type of trigger that this is. *

* * @param type * The type of trigger that this is. * @return Returns a reference to this object so that method calls can be chained together. * @see TriggerType */ public Trigger withType(String type) { setType(type); return this; } /** *

* The type of trigger that this is. *

* * @param type * The type of trigger that this is. * @return Returns a reference to this object so that method calls can be chained together. * @see TriggerType */ public Trigger withType(TriggerType type) { this.type = type.toString(); return this; } /** *

* The current state of the trigger. *

* * @param state * The current state of the trigger. * @see TriggerState */ public void setState(String state) { this.state = state; } /** *

* The current state of the trigger. *

* * @return The current state of the trigger. * @see TriggerState */ public String getState() { return this.state; } /** *

* The current state of the trigger. *

* * @param state * The current state of the trigger. * @return Returns a reference to this object so that method calls can be chained together. * @see TriggerState */ public Trigger withState(String state) { setState(state); return this; } /** *

* The current state of the trigger. *

* * @param state * The current state of the trigger. * @return Returns a reference to this object so that method calls can be chained together. * @see TriggerState */ public Trigger withState(TriggerState state) { this.state = state.toString(); return this; } /** *

* A description of this trigger. *

* * @param description * A description of this trigger. */ public void setDescription(String description) { this.description = description; } /** *

* A description of this trigger. *

* * @return A description of this trigger. */ public String getDescription() { return this.description; } /** *

* A description of this trigger. *

* * @param description * A description of this trigger. * @return Returns a reference to this object so that method calls can be chained together. */ public Trigger withDescription(String description) { setDescription(description); return this; } /** *

* A cron expression used to specify the schedule (see Time-Based Schedules for * Jobs and Crawlers. For example, to run something every day at 12:15 UTC, you would specify: * cron(15 12 * * ? *). *

* * @param schedule * A cron expression used to specify the schedule (see Time-Based * Schedules for Jobs and Crawlers. For example, to run something every day at 12:15 UTC, you would * specify: cron(15 12 * * ? *). */ public void setSchedule(String schedule) { this.schedule = schedule; } /** *

* A cron expression used to specify the schedule (see Time-Based Schedules for * Jobs and Crawlers. For example, to run something every day at 12:15 UTC, you would specify: * cron(15 12 * * ? *). *

* * @return A cron expression used to specify the schedule (see Time-Based * Schedules for Jobs and Crawlers. For example, to run something every day at 12:15 UTC, you would * specify: cron(15 12 * * ? *). */ public String getSchedule() { return this.schedule; } /** *

* A cron expression used to specify the schedule (see Time-Based Schedules for * Jobs and Crawlers. For example, to run something every day at 12:15 UTC, you would specify: * cron(15 12 * * ? *). *

* * @param schedule * A cron expression used to specify the schedule (see Time-Based * Schedules for Jobs and Crawlers. For example, to run something every day at 12:15 UTC, you would * specify: cron(15 12 * * ? *). * @return Returns a reference to this object so that method calls can be chained together. */ public Trigger withSchedule(String schedule) { setSchedule(schedule); return this; } /** *

* The actions initiated by this trigger. *

* * @return The actions initiated by this trigger. */ public java.util.List getActions() { return actions; } /** *

* The actions initiated by this trigger. *

* * @param actions * The actions initiated by this trigger. */ public void setActions(java.util.Collection actions) { if (actions == null) { this.actions = null; return; } this.actions = new java.util.ArrayList(actions); } /** *

* The actions initiated by this trigger. *

*

* NOTE: This method appends the values to the existing list (if any). Use * {@link #setActions(java.util.Collection)} or {@link #withActions(java.util.Collection)} if you want to override * the existing values. *

* * @param actions * The actions initiated by this trigger. * @return Returns a reference to this object so that method calls can be chained together. */ public Trigger withActions(Action... actions) { if (this.actions == null) { setActions(new java.util.ArrayList(actions.length)); } for (Action ele : actions) { this.actions.add(ele); } return this; } /** *

* The actions initiated by this trigger. *

* * @param actions * The actions initiated by this trigger. * @return Returns a reference to this object so that method calls can be chained together. */ public Trigger withActions(java.util.Collection actions) { setActions(actions); return this; } /** *

* The predicate of this trigger, which defines when it will fire. *

* * @param predicate * The predicate of this trigger, which defines when it will fire. */ public void setPredicate(Predicate predicate) { this.predicate = predicate; } /** *

* The predicate of this trigger, which defines when it will fire. *

* * @return The predicate of this trigger, which defines when it will fire. */ public Predicate getPredicate() { return this.predicate; } /** *

* The predicate of this trigger, which defines when it will fire. *

* * @param predicate * The predicate of this trigger, which defines when it will fire. * @return Returns a reference to this object so that method calls can be chained together. */ public Trigger withPredicate(Predicate predicate) { setPredicate(predicate); return this; } /** *

* Batch condition that must be met (specified number of events received or batch time window expired) before * EventBridge event trigger fires. *

* * @param eventBatchingCondition * Batch condition that must be met (specified number of events received or batch time window expired) before * EventBridge event trigger fires. */ public void setEventBatchingCondition(EventBatchingCondition eventBatchingCondition) { this.eventBatchingCondition = eventBatchingCondition; } /** *

* Batch condition that must be met (specified number of events received or batch time window expired) before * EventBridge event trigger fires. *

* * @return Batch condition that must be met (specified number of events received or batch time window expired) * before EventBridge event trigger fires. */ public EventBatchingCondition getEventBatchingCondition() { return this.eventBatchingCondition; } /** *

* Batch condition that must be met (specified number of events received or batch time window expired) before * EventBridge event trigger fires. *

* * @param eventBatchingCondition * Batch condition that must be met (specified number of events received or batch time window expired) before * EventBridge event trigger fires. * @return Returns a reference to this object so that method calls can be chained together. */ public Trigger withEventBatchingCondition(EventBatchingCondition eventBatchingCondition) { setEventBatchingCondition(eventBatchingCondition); 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 (getName() != null) sb.append("Name: ").append(getName()).append(","); if (getWorkflowName() != null) sb.append("WorkflowName: ").append(getWorkflowName()).append(","); if (getId() != null) sb.append("Id: ").append(getId()).append(","); if (getType() != null) sb.append("Type: ").append(getType()).append(","); if (getState() != null) sb.append("State: ").append(getState()).append(","); if (getDescription() != null) sb.append("Description: ").append(getDescription()).append(","); if (getSchedule() != null) sb.append("Schedule: ").append(getSchedule()).append(","); if (getActions() != null) sb.append("Actions: ").append(getActions()).append(","); if (getPredicate() != null) sb.append("Predicate: ").append(getPredicate()).append(","); if (getEventBatchingCondition() != null) sb.append("EventBatchingCondition: ").append(getEventBatchingCondition()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Trigger == false) return false; Trigger other = (Trigger) obj; if (other.getName() == null ^ this.getName() == null) return false; if (other.getName() != null && other.getName().equals(this.getName()) == false) return false; if (other.getWorkflowName() == null ^ this.getWorkflowName() == null) return false; if (other.getWorkflowName() != null && other.getWorkflowName().equals(this.getWorkflowName()) == false) return false; if (other.getId() == null ^ this.getId() == null) return false; if (other.getId() != null && other.getId().equals(this.getId()) == false) return false; if (other.getType() == null ^ this.getType() == null) return false; if (other.getType() != null && other.getType().equals(this.getType()) == false) return false; if (other.getState() == null ^ this.getState() == null) return false; if (other.getState() != null && other.getState().equals(this.getState()) == false) return false; if (other.getDescription() == null ^ this.getDescription() == null) return false; if (other.getDescription() != null && other.getDescription().equals(this.getDescription()) == false) return false; if (other.getSchedule() == null ^ this.getSchedule() == null) return false; if (other.getSchedule() != null && other.getSchedule().equals(this.getSchedule()) == false) return false; if (other.getActions() == null ^ this.getActions() == null) return false; if (other.getActions() != null && other.getActions().equals(this.getActions()) == false) return false; if (other.getPredicate() == null ^ this.getPredicate() == null) return false; if (other.getPredicate() != null && other.getPredicate().equals(this.getPredicate()) == false) return false; if (other.getEventBatchingCondition() == null ^ this.getEventBatchingCondition() == null) return false; if (other.getEventBatchingCondition() != null && other.getEventBatchingCondition().equals(this.getEventBatchingCondition()) == 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 + ((getWorkflowName() == null) ? 0 : getWorkflowName().hashCode()); hashCode = prime * hashCode + ((getId() == null) ? 0 : getId().hashCode()); hashCode = prime * hashCode + ((getType() == null) ? 0 : getType().hashCode()); hashCode = prime * hashCode + ((getState() == null) ? 0 : getState().hashCode()); hashCode = prime * hashCode + ((getDescription() == null) ? 0 : getDescription().hashCode()); hashCode = prime * hashCode + ((getSchedule() == null) ? 0 : getSchedule().hashCode()); hashCode = prime * hashCode + ((getActions() == null) ? 0 : getActions().hashCode()); hashCode = prime * hashCode + ((getPredicate() == null) ? 0 : getPredicate().hashCode()); hashCode = prime * hashCode + ((getEventBatchingCondition() == null) ? 0 : getEventBatchingCondition().hashCode()); return hashCode; } @Override public Trigger clone() { try { return (Trigger) 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.glue.model.transform.TriggerMarshaller.getInstance().marshall(this, protocolMarshaller); } }