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

software.amazon.awssdk.services.fis.model.ExperimentTemplateAction Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Fis module holds the client classes that are used for communicating with Fis.

There is a newer version: 2.30.1
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.fis.model;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
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.Function;
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.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Describes an action for an experiment template. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ExperimentTemplateAction implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ACTION_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("actionId").getter(getter(ExperimentTemplateAction::actionId)).setter(setter(Builder::actionId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actionId").build()).build(); private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("description").getter(getter(ExperimentTemplateAction::description)).setter(setter(Builder::description)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build(); private static final SdkField> PARAMETERS_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("parameters") .getter(getter(ExperimentTemplateAction::parameters)) .setter(setter(Builder::parameters)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("parameters").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final SdkField> TARGETS_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("targets") .getter(getter(ExperimentTemplateAction::targets)) .setter(setter(Builder::targets)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targets").build(), MapTrait.builder() .keyLocationName("key") .valueLocationName("value") .valueFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("value").build()).build()).build()).build(); private static final SdkField> START_AFTER_FIELD = SdkField .> builder(MarshallingType.LIST) .memberName("startAfter") .getter(getter(ExperimentTemplateAction::startAfter)) .setter(setter(Builder::startAfter)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("startAfter").build(), ListTrait .builder() .memberLocationName(null) .memberFieldInfo( SdkField. builder(MarshallingType.STRING) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD) .locationName("member").build()).build()).build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTION_ID_FIELD, DESCRIPTION_FIELD, PARAMETERS_FIELD, TARGETS_FIELD, START_AFTER_FIELD)); private static final long serialVersionUID = 1L; private final String actionId; private final String description; private final Map parameters; private final Map targets; private final List startAfter; private ExperimentTemplateAction(BuilderImpl builder) { this.actionId = builder.actionId; this.description = builder.description; this.parameters = builder.parameters; this.targets = builder.targets; this.startAfter = builder.startAfter; } /** *

* The ID of the action. *

* * @return The ID of the action. */ public final String actionId() { return actionId; } /** *

* A description for the action. *

* * @return A description for the action. */ public final String description() { return description; } /** * For responses, this returns true if the service returned a value for the Parameters 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 hasParameters() { return parameters != null && !(parameters instanceof SdkAutoConstructMap); } /** *

* The parameters for the action. *

*

* 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 #hasParameters} method. *

* * @return The parameters for the action. */ public final Map parameters() { return parameters; } /** * For responses, this returns true if the service returned a value for the Targets 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 hasTargets() { return targets != null && !(targets instanceof SdkAutoConstructMap); } /** *

* The targets for the action. *

*

* 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 #hasTargets} method. *

* * @return The targets for the action. */ public final Map targets() { return targets; } /** * For responses, this returns true if the service returned a value for the StartAfter 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 hasStartAfter() { return startAfter != null && !(startAfter instanceof SdkAutoConstructList); } /** *

* The name of the action that must be completed before the current action starts. *

*

* 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 #hasStartAfter} method. *

* * @return The name of the action that must be completed before the current action starts. */ public final List startAfter() { return startAfter; } @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(actionId()); hashCode = 31 * hashCode + Objects.hashCode(description()); hashCode = 31 * hashCode + Objects.hashCode(hasParameters() ? parameters() : null); hashCode = 31 * hashCode + Objects.hashCode(hasTargets() ? targets() : null); hashCode = 31 * hashCode + Objects.hashCode(hasStartAfter() ? startAfter() : null); 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 ExperimentTemplateAction)) { return false; } ExperimentTemplateAction other = (ExperimentTemplateAction) obj; return Objects.equals(actionId(), other.actionId()) && Objects.equals(description(), other.description()) && hasParameters() == other.hasParameters() && Objects.equals(parameters(), other.parameters()) && hasTargets() == other.hasTargets() && Objects.equals(targets(), other.targets()) && hasStartAfter() == other.hasStartAfter() && Objects.equals(startAfter(), other.startAfter()); } /** * 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("ExperimentTemplateAction").add("ActionId", actionId()).add("Description", description()) .add("Parameters", hasParameters() ? parameters() : null).add("Targets", hasTargets() ? targets() : null) .add("StartAfter", hasStartAfter() ? startAfter() : null).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "actionId": return Optional.ofNullable(clazz.cast(actionId())); case "description": return Optional.ofNullable(clazz.cast(description())); case "parameters": return Optional.ofNullable(clazz.cast(parameters())); case "targets": return Optional.ofNullable(clazz.cast(targets())); case "startAfter": return Optional.ofNullable(clazz.cast(startAfter())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ExperimentTemplateAction) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the action. *

* * @param actionId * The ID of the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder actionId(String actionId); /** *

* A description for the action. *

* * @param description * A description for the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder description(String description); /** *

* The parameters for the action. *

* * @param parameters * The parameters for the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder parameters(Map parameters); /** *

* The targets for the action. *

* * @param targets * The targets for the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targets(Map targets); /** *

* The name of the action that must be completed before the current action starts. *

* * @param startAfter * The name of the action that must be completed before the current action starts. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startAfter(Collection startAfter); /** *

* The name of the action that must be completed before the current action starts. *

* * @param startAfter * The name of the action that must be completed before the current action starts. * @return Returns a reference to this object so that method calls can be chained together. */ Builder startAfter(String... startAfter); } static final class BuilderImpl implements Builder { private String actionId; private String description; private Map parameters = DefaultSdkAutoConstructMap.getInstance(); private Map targets = DefaultSdkAutoConstructMap.getInstance(); private List startAfter = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(ExperimentTemplateAction model) { actionId(model.actionId); description(model.description); parameters(model.parameters); targets(model.targets); startAfter(model.startAfter); } public final String getActionId() { return actionId; } public final void setActionId(String actionId) { this.actionId = actionId; } @Override public final Builder actionId(String actionId) { this.actionId = actionId; 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 Map getParameters() { if (parameters instanceof SdkAutoConstructMap) { return null; } return parameters; } public final void setParameters(Map parameters) { this.parameters = ExperimentTemplateActionParameterMapCopier.copy(parameters); } @Override public final Builder parameters(Map parameters) { this.parameters = ExperimentTemplateActionParameterMapCopier.copy(parameters); return this; } public final Map getTargets() { if (targets instanceof SdkAutoConstructMap) { return null; } return targets; } public final void setTargets(Map targets) { this.targets = ExperimentTemplateActionTargetMapCopier.copy(targets); } @Override public final Builder targets(Map targets) { this.targets = ExperimentTemplateActionTargetMapCopier.copy(targets); return this; } public final Collection getStartAfter() { if (startAfter instanceof SdkAutoConstructList) { return null; } return startAfter; } public final void setStartAfter(Collection startAfter) { this.startAfter = ExperimentTemplateActionStartAfterListCopier.copy(startAfter); } @Override public final Builder startAfter(Collection startAfter) { this.startAfter = ExperimentTemplateActionStartAfterListCopier.copy(startAfter); return this; } @Override @SafeVarargs public final Builder startAfter(String... startAfter) { startAfter(Arrays.asList(startAfter)); return this; } @Override public ExperimentTemplateAction build() { return new ExperimentTemplateAction(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy