software.amazon.awssdk.services.glue.model.TriggerUpdate Maven / Gradle / Ivy
Show all versions of glue Show documentation
/*
* Copyright 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 software.amazon.awssdk.services.glue.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* A structure used to provide information used to update a trigger. This object updates the previous trigger definition
* by overwriting it completely.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TriggerUpdate implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(TriggerUpdate::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Description").getter(getter(TriggerUpdate::description)).setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Description").build()).build();
private static final SdkField SCHEDULE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("Schedule").getter(getter(TriggerUpdate::schedule)).setter(setter(Builder::schedule))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Schedule").build()).build();
private static final SdkField> ACTIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Actions")
.getter(getter(TriggerUpdate::actions))
.setter(setter(Builder::actions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Actions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Action::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField PREDICATE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Predicate").getter(getter(TriggerUpdate::predicate)).setter(setter(Builder::predicate))
.constructor(Predicate::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Predicate").build()).build();
private static final SdkField EVENT_BATCHING_CONDITION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("EventBatchingCondition")
.getter(getter(TriggerUpdate::eventBatchingCondition)).setter(setter(Builder::eventBatchingCondition))
.constructor(EventBatchingCondition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EventBatchingCondition").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(NAME_FIELD, DESCRIPTION_FIELD,
SCHEDULE_FIELD, ACTIONS_FIELD, PREDICATE_FIELD, EVENT_BATCHING_CONDITION_FIELD));
private static final Map> SDK_NAME_TO_FIELD = Collections
.unmodifiableMap(new HashMap>() {
{
put("Name", NAME_FIELD);
put("Description", DESCRIPTION_FIELD);
put("Schedule", SCHEDULE_FIELD);
put("Actions", ACTIONS_FIELD);
put("Predicate", PREDICATE_FIELD);
put("EventBatchingCondition", EVENT_BATCHING_CONDITION_FIELD);
}
});
private static final long serialVersionUID = 1L;
private final String name;
private final String description;
private final String schedule;
private final List actions;
private final Predicate predicate;
private final EventBatchingCondition eventBatchingCondition;
private TriggerUpdate(BuilderImpl builder) {
this.name = builder.name;
this.description = builder.description;
this.schedule = builder.schedule;
this.actions = builder.actions;
this.predicate = builder.predicate;
this.eventBatchingCondition = builder.eventBatchingCondition;
}
/**
*
* Reserved for future use.
*
*
* @return Reserved for future use.
*/
public final String name() {
return name;
}
/**
*
* A description of this trigger.
*
*
* @return A description of this trigger.
*/
public final String description() {
return 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 * * ? *)
.
*
*
* @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 final String schedule() {
return schedule;
}
/**
* For responses, this returns true if the service returned a value for the Actions property. This DOES NOT check
* that the value is non-empty (for which, you should check the {@code isEmpty()} method on the property). This is
* useful because the SDK will never return a null collection or map, but you may need to differentiate between the
* service returning nothing (or null) and the service returning an empty collection or map. For requests, this
* returns true if a value for the property was specified in the request builder, and false if a value was not
* specified.
*/
public final boolean hasActions() {
return actions != null && !(actions instanceof SdkAutoConstructList);
}
/**
*
* The actions initiated by this trigger.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasActions} method.
*
*
* @return The actions initiated by this trigger.
*/
public final List actions() {
return actions;
}
/**
*
* The predicate of this trigger, which defines when it will fire.
*
*
* @return The predicate of this trigger, which defines when it will fire.
*/
public final Predicate predicate() {
return predicate;
}
/**
*
* 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 final EventBatchingCondition eventBatchingCondition() {
return eventBatchingCondition;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(schedule());
hashCode = 31 * hashCode + Objects.hashCode(hasActions() ? actions() : null);
hashCode = 31 * hashCode + Objects.hashCode(predicate());
hashCode = 31 * hashCode + Objects.hashCode(eventBatchingCondition());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof TriggerUpdate)) {
return false;
}
TriggerUpdate other = (TriggerUpdate) obj;
return Objects.equals(name(), other.name()) && Objects.equals(description(), other.description())
&& Objects.equals(schedule(), other.schedule()) && hasActions() == other.hasActions()
&& Objects.equals(actions(), other.actions()) && Objects.equals(predicate(), other.predicate())
&& Objects.equals(eventBatchingCondition(), other.eventBatchingCondition());
}
/**
* 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.
*/
@Override
public final String toString() {
return ToString.builder("TriggerUpdate").add("Name", name()).add("Description", description())
.add("Schedule", schedule()).add("Actions", hasActions() ? actions() : null).add("Predicate", predicate())
.add("EventBatchingCondition", eventBatchingCondition()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Description":
return Optional.ofNullable(clazz.cast(description()));
case "Schedule":
return Optional.ofNullable(clazz.cast(schedule()));
case "Actions":
return Optional.ofNullable(clazz.cast(actions()));
case "Predicate":
return Optional.ofNullable(clazz.cast(predicate()));
case "EventBatchingCondition":
return Optional.ofNullable(clazz.cast(eventBatchingCondition()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Function