All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.glue.model.TriggerUpdate Maven / Gradle / Ivy

Go to download

The AWS Java SDK for AWS Glue module holds the client classes that are used for communicating with AWS Glue Service

There is a newer version: 2.29.39
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((TriggerUpdate) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* Reserved for future use. *

* * @param name * Reserved for future use. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* 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. */ Builder description(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 * * ? *). *

* * @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. */ Builder schedule(String schedule); /** *

* 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. */ Builder actions(Collection actions); /** *

* 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. */ Builder actions(Action... actions); /** *

* The actions initiated by this trigger. *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.glue.model.Action.Builder} avoiding the need to create one manually * via {@link software.amazon.awssdk.services.glue.model.Action#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.glue.model.Action.Builder#build()} is called immediately and its * result is passed to {@link #actions(List)}. * * @param actions * a consumer that will call methods on {@link software.amazon.awssdk.services.glue.model.Action.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #actions(java.util.Collection) */ Builder actions(Consumer... actions); /** *

* 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. */ Builder predicate(Predicate predicate); /** *

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

* This is a convenience method that creates an instance of the {@link Predicate.Builder} avoiding the need to * create one manually via {@link Predicate#builder()}. * *

* When the {@link Consumer} completes, {@link Predicate.Builder#build()} is called immediately and its result * is passed to {@link #predicate(Predicate)}. * * @param predicate * a consumer that will call methods on {@link Predicate.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #predicate(Predicate) */ default Builder predicate(Consumer predicate) { return predicate(Predicate.builder().applyMutation(predicate).build()); } /** *

* 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. */ Builder eventBatchingCondition(EventBatchingCondition eventBatchingCondition); /** *

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

* This is a convenience method that creates an instance of the {@link EventBatchingCondition.Builder} avoiding * the need to create one manually via {@link EventBatchingCondition#builder()}. * *

* When the {@link Consumer} completes, {@link EventBatchingCondition.Builder#build()} is called immediately and * its result is passed to {@link #eventBatchingCondition(EventBatchingCondition)}. * * @param eventBatchingCondition * a consumer that will call methods on {@link EventBatchingCondition.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #eventBatchingCondition(EventBatchingCondition) */ default Builder eventBatchingCondition(Consumer eventBatchingCondition) { return eventBatchingCondition(EventBatchingCondition.builder().applyMutation(eventBatchingCondition).build()); } } static final class BuilderImpl implements Builder { private String name; private String description; private String schedule; private List actions = DefaultSdkAutoConstructList.getInstance(); private Predicate predicate; private EventBatchingCondition eventBatchingCondition; private BuilderImpl() { } private BuilderImpl(TriggerUpdate model) { name(model.name); description(model.description); schedule(model.schedule); actions(model.actions); predicate(model.predicate); eventBatchingCondition(model.eventBatchingCondition); } public final String getName() { return name; } public final void setName(String name) { this.name = name; } @Override public final Builder name(String name) { this.name = name; return this; } public final String getDescription() { return description; } public final void setDescription(String description) { this.description = description; } @Override public final Builder description(String description) { this.description = description; return this; } public final String getSchedule() { return schedule; } public final void setSchedule(String schedule) { this.schedule = schedule; } @Override public final Builder schedule(String schedule) { this.schedule = schedule; return this; } public final List getActions() { List result = ActionListCopier.copyToBuilder(this.actions); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setActions(Collection actions) { this.actions = ActionListCopier.copyFromBuilder(actions); } @Override public final Builder actions(Collection actions) { this.actions = ActionListCopier.copy(actions); return this; } @Override @SafeVarargs public final Builder actions(Action... actions) { actions(Arrays.asList(actions)); return this; } @Override @SafeVarargs public final Builder actions(Consumer... actions) { actions(Stream.of(actions).map(c -> Action.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } public final Predicate.Builder getPredicate() { return predicate != null ? predicate.toBuilder() : null; } public final void setPredicate(Predicate.BuilderImpl predicate) { this.predicate = predicate != null ? predicate.build() : null; } @Override public final Builder predicate(Predicate predicate) { this.predicate = predicate; return this; } public final EventBatchingCondition.Builder getEventBatchingCondition() { return eventBatchingCondition != null ? eventBatchingCondition.toBuilder() : null; } public final void setEventBatchingCondition(EventBatchingCondition.BuilderImpl eventBatchingCondition) { this.eventBatchingCondition = eventBatchingCondition != null ? eventBatchingCondition.build() : null; } @Override public final Builder eventBatchingCondition(EventBatchingCondition eventBatchingCondition) { this.eventBatchingCondition = eventBatchingCondition; return this; } @Override public TriggerUpdate build() { return new TriggerUpdate(this); } @Override public List> sdkFields() { return SDK_FIELDS; } @Override public Map> sdkFieldNameToField() { return SDK_NAME_TO_FIELD; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy