Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
software.amazon.awssdk.services.fis.model.UpdateExperimentTemplateRequest Maven / Gradle / Ivy
/*
* 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.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.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.awscore.AwsRequestOverrideConfiguration;
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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class UpdateExperimentTemplateRequest extends FisRequest implements
ToCopyableBuilder {
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("id")
.getter(getter(UpdateExperimentTemplateRequest::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("id").build()).build();
private static final SdkField DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("description").getter(getter(UpdateExperimentTemplateRequest::description))
.setter(setter(Builder::description))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("description").build()).build();
private static final SdkField> STOP_CONDITIONS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("stopConditions")
.getter(getter(UpdateExperimentTemplateRequest::stopConditions))
.setter(setter(Builder::stopConditions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("stopConditions").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(UpdateExperimentTemplateStopConditionInput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField> TARGETS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("targets")
.getter(getter(UpdateExperimentTemplateRequest::targets))
.setter(setter(Builder::targets))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("targets").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(UpdateExperimentTemplateTargetInput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField> ACTIONS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("actions")
.getter(getter(UpdateExperimentTemplateRequest::actions))
.setter(setter(Builder::actions))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("actions").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(UpdateExperimentTemplateActionInputItem::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("roleArn").getter(getter(UpdateExperimentTemplateRequest::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleArn").build()).build();
private static final SdkField LOG_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("logConfiguration")
.getter(getter(UpdateExperimentTemplateRequest::logConfiguration)).setter(setter(Builder::logConfiguration))
.constructor(UpdateExperimentTemplateLogConfigurationInput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("logConfiguration").build()).build();
private static final SdkField EXPERIMENT_OPTIONS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("experimentOptions")
.getter(getter(UpdateExperimentTemplateRequest::experimentOptions)).setter(setter(Builder::experimentOptions))
.constructor(UpdateExperimentTemplateExperimentOptionsInput::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("experimentOptions").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, DESCRIPTION_FIELD,
STOP_CONDITIONS_FIELD, TARGETS_FIELD, ACTIONS_FIELD, ROLE_ARN_FIELD, LOG_CONFIGURATION_FIELD,
EXPERIMENT_OPTIONS_FIELD));
private final String id;
private final String description;
private final List stopConditions;
private final Map targets;
private final Map actions;
private final String roleArn;
private final UpdateExperimentTemplateLogConfigurationInput logConfiguration;
private final UpdateExperimentTemplateExperimentOptionsInput experimentOptions;
private UpdateExperimentTemplateRequest(BuilderImpl builder) {
super(builder);
this.id = builder.id;
this.description = builder.description;
this.stopConditions = builder.stopConditions;
this.targets = builder.targets;
this.actions = builder.actions;
this.roleArn = builder.roleArn;
this.logConfiguration = builder.logConfiguration;
this.experimentOptions = builder.experimentOptions;
}
/**
*
* The ID of the experiment template.
*
*
* @return The ID of the experiment template.
*/
public final String id() {
return id;
}
/**
*
* A description for the template.
*
*
* @return A description for the template.
*/
public final String description() {
return description;
}
/**
* For responses, this returns true if the service returned a value for the StopConditions 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 hasStopConditions() {
return stopConditions != null && !(stopConditions instanceof SdkAutoConstructList);
}
/**
*
* The stop conditions for the experiment.
*
*
* 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 #hasStopConditions} method.
*
*
* @return The stop conditions for the experiment.
*/
public final List stopConditions() {
return stopConditions;
}
/**
* 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 experiment.
*
*
* 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 experiment.
*/
public final Map targets() {
return targets;
}
/**
* 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 SdkAutoConstructMap);
}
/**
*
* The actions for the experiment.
*
*
* 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 for the experiment.
*/
public final Map actions() {
return actions;
}
/**
*
* The Amazon Resource Name (ARN) of an IAM role that grants the FIS service permission to perform service actions
* on your behalf.
*
*
* @return The Amazon Resource Name (ARN) of an IAM role that grants the FIS service permission to perform service
* actions on your behalf.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* The configuration for experiment logging.
*
*
* @return The configuration for experiment logging.
*/
public final UpdateExperimentTemplateLogConfigurationInput logConfiguration() {
return logConfiguration;
}
/**
*
* The experiment options for the experiment template.
*
*
* @return The experiment options for the experiment template.
*/
public final UpdateExperimentTemplateExperimentOptionsInput experimentOptions() {
return experimentOptions;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(description());
hashCode = 31 * hashCode + Objects.hashCode(hasStopConditions() ? stopConditions() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasTargets() ? targets() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasActions() ? actions() : null);
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(logConfiguration());
hashCode = 31 * hashCode + Objects.hashCode(experimentOptions());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof UpdateExperimentTemplateRequest)) {
return false;
}
UpdateExperimentTemplateRequest other = (UpdateExperimentTemplateRequest) obj;
return Objects.equals(id(), other.id()) && Objects.equals(description(), other.description())
&& hasStopConditions() == other.hasStopConditions() && Objects.equals(stopConditions(), other.stopConditions())
&& hasTargets() == other.hasTargets() && Objects.equals(targets(), other.targets())
&& hasActions() == other.hasActions() && Objects.equals(actions(), other.actions())
&& Objects.equals(roleArn(), other.roleArn()) && Objects.equals(logConfiguration(), other.logConfiguration())
&& Objects.equals(experimentOptions(), other.experimentOptions());
}
/**
* 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("UpdateExperimentTemplateRequest").add("Id", id()).add("Description", description())
.add("StopConditions", hasStopConditions() ? stopConditions() : null)
.add("Targets", hasTargets() ? targets() : null).add("Actions", hasActions() ? actions() : null)
.add("RoleArn", roleArn()).add("LogConfiguration", logConfiguration())
.add("ExperimentOptions", experimentOptions()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "id":
return Optional.ofNullable(clazz.cast(id()));
case "description":
return Optional.ofNullable(clazz.cast(description()));
case "stopConditions":
return Optional.ofNullable(clazz.cast(stopConditions()));
case "targets":
return Optional.ofNullable(clazz.cast(targets()));
case "actions":
return Optional.ofNullable(clazz.cast(actions()));
case "roleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "logConfiguration":
return Optional.ofNullable(clazz.cast(logConfiguration()));
case "experimentOptions":
return Optional.ofNullable(clazz.cast(experimentOptions()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((UpdateExperimentTemplateRequest) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends FisRequest.Builder, SdkPojo, CopyableBuilder {
/**
*
* The ID of the experiment template.
*
*
* @param id
* The ID of the experiment template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* A description for the template.
*
*
* @param description
* A description for the template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder description(String description);
/**
*
* The stop conditions for the experiment.
*
*
* @param stopConditions
* The stop conditions for the experiment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stopConditions(Collection stopConditions);
/**
*
* The stop conditions for the experiment.
*
*
* @param stopConditions
* The stop conditions for the experiment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder stopConditions(UpdateExperimentTemplateStopConditionInput... stopConditions);
/**
*
* The stop conditions for the experiment.
*
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.fis.model.UpdateExperimentTemplateStopConditionInput.Builder} avoiding
* the need to create one manually via
* {@link software.amazon.awssdk.services.fis.model.UpdateExperimentTemplateStopConditionInput#builder()}.
*
*
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.fis.model.UpdateExperimentTemplateStopConditionInput.Builder#build()}
* is called immediately and its result is passed to {@link
* #stopConditions(List)}.
*
* @param stopConditions
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.fis.model.UpdateExperimentTemplateStopConditionInput.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #stopConditions(java.util.Collection)
*/
Builder stopConditions(Consumer... stopConditions);
/**
*
* The targets for the experiment.
*
*
* @param targets
* The targets for the experiment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder targets(Map targets);
/**
*
* The actions for the experiment.
*
*
* @param actions
* The actions for the experiment.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder actions(Map actions);
/**
*
* The Amazon Resource Name (ARN) of an IAM role that grants the FIS service permission to perform service
* actions on your behalf.
*
*
* @param roleArn
* The Amazon Resource Name (ARN) of an IAM role that grants the FIS service permission to perform
* service actions on your behalf.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder roleArn(String roleArn);
/**
*
* The configuration for experiment logging.
*
*
* @param logConfiguration
* The configuration for experiment logging.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder logConfiguration(UpdateExperimentTemplateLogConfigurationInput logConfiguration);
/**
*
* The configuration for experiment logging.
*
* This is a convenience method that creates an instance of the
* {@link UpdateExperimentTemplateLogConfigurationInput.Builder} avoiding the need to create one manually via
* {@link UpdateExperimentTemplateLogConfigurationInput#builder()}.
*
*
* When the {@link Consumer} completes, {@link UpdateExperimentTemplateLogConfigurationInput.Builder#build()} is
* called immediately and its result is passed to
* {@link #logConfiguration(UpdateExperimentTemplateLogConfigurationInput)}.
*
* @param logConfiguration
* a consumer that will call methods on {@link UpdateExperimentTemplateLogConfigurationInput.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #logConfiguration(UpdateExperimentTemplateLogConfigurationInput)
*/
default Builder logConfiguration(Consumer logConfiguration) {
return logConfiguration(UpdateExperimentTemplateLogConfigurationInput.builder().applyMutation(logConfiguration)
.build());
}
/**
*
* The experiment options for the experiment template.
*
*
* @param experimentOptions
* The experiment options for the experiment template.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder experimentOptions(UpdateExperimentTemplateExperimentOptionsInput experimentOptions);
/**
*
* The experiment options for the experiment template.
*
* This is a convenience method that creates an instance of the
* {@link UpdateExperimentTemplateExperimentOptionsInput.Builder} avoiding the need to create one manually via
* {@link UpdateExperimentTemplateExperimentOptionsInput#builder()}.
*
*
* When the {@link Consumer} completes, {@link UpdateExperimentTemplateExperimentOptionsInput.Builder#build()}
* is called immediately and its result is passed to
* {@link #experimentOptions(UpdateExperimentTemplateExperimentOptionsInput)}.
*
* @param experimentOptions
* a consumer that will call methods on {@link UpdateExperimentTemplateExperimentOptionsInput.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #experimentOptions(UpdateExperimentTemplateExperimentOptionsInput)
*/
default Builder experimentOptions(Consumer experimentOptions) {
return experimentOptions(UpdateExperimentTemplateExperimentOptionsInput.builder().applyMutation(experimentOptions)
.build());
}
@Override
Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
@Override
Builder overrideConfiguration(Consumer builderConsumer);
}
static final class BuilderImpl extends FisRequest.BuilderImpl implements Builder {
private String id;
private String description;
private List stopConditions = DefaultSdkAutoConstructList.getInstance();
private Map targets = DefaultSdkAutoConstructMap.getInstance();
private Map actions = DefaultSdkAutoConstructMap.getInstance();
private String roleArn;
private UpdateExperimentTemplateLogConfigurationInput logConfiguration;
private UpdateExperimentTemplateExperimentOptionsInput experimentOptions;
private BuilderImpl() {
}
private BuilderImpl(UpdateExperimentTemplateRequest model) {
super(model);
id(model.id);
description(model.description);
stopConditions(model.stopConditions);
targets(model.targets);
actions(model.actions);
roleArn(model.roleArn);
logConfiguration(model.logConfiguration);
experimentOptions(model.experimentOptions);
}
public final String getId() {
return id;
}
public final void setId(String id) {
this.id = id;
}
@Override
public final Builder id(String id) {
this.id = id;
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 List getStopConditions() {
List result = UpdateExperimentTemplateStopConditionInputListCopier
.copyToBuilder(this.stopConditions);
if (result instanceof SdkAutoConstructList) {
return null;
}
return result;
}
public final void setStopConditions(Collection stopConditions) {
this.stopConditions = UpdateExperimentTemplateStopConditionInputListCopier.copyFromBuilder(stopConditions);
}
@Override
public final Builder stopConditions(Collection stopConditions) {
this.stopConditions = UpdateExperimentTemplateStopConditionInputListCopier.copy(stopConditions);
return this;
}
@Override
@SafeVarargs
public final Builder stopConditions(UpdateExperimentTemplateStopConditionInput... stopConditions) {
stopConditions(Arrays.asList(stopConditions));
return this;
}
@Override
@SafeVarargs
public final Builder stopConditions(Consumer... stopConditions) {
stopConditions(Stream.of(stopConditions)
.map(c -> UpdateExperimentTemplateStopConditionInput.builder().applyMutation(c).build())
.collect(Collectors.toList()));
return this;
}
public final Map getTargets() {
Map result = UpdateExperimentTemplateTargetInputMapCopier
.copyToBuilder(this.targets);
if (result instanceof SdkAutoConstructMap) {
return null;
}
return result;
}
public final void setTargets(Map targets) {
this.targets = UpdateExperimentTemplateTargetInputMapCopier.copyFromBuilder(targets);
}
@Override
public final Builder targets(Map targets) {
this.targets = UpdateExperimentTemplateTargetInputMapCopier.copy(targets);
return this;
}
public final Map getActions() {
Map result = UpdateExperimentTemplateActionInputMapCopier
.copyToBuilder(this.actions);
if (result instanceof SdkAutoConstructMap) {
return null;
}
return result;
}
public final void setActions(Map actions) {
this.actions = UpdateExperimentTemplateActionInputMapCopier.copyFromBuilder(actions);
}
@Override
public final Builder actions(Map actions) {
this.actions = UpdateExperimentTemplateActionInputMapCopier.copy(actions);
return this;
}
public final String getRoleArn() {
return roleArn;
}
public final void setRoleArn(String roleArn) {
this.roleArn = roleArn;
}
@Override
public final Builder roleArn(String roleArn) {
this.roleArn = roleArn;
return this;
}
public final UpdateExperimentTemplateLogConfigurationInput.Builder getLogConfiguration() {
return logConfiguration != null ? logConfiguration.toBuilder() : null;
}
public final void setLogConfiguration(UpdateExperimentTemplateLogConfigurationInput.BuilderImpl logConfiguration) {
this.logConfiguration = logConfiguration != null ? logConfiguration.build() : null;
}
@Override
public final Builder logConfiguration(UpdateExperimentTemplateLogConfigurationInput logConfiguration) {
this.logConfiguration = logConfiguration;
return this;
}
public final UpdateExperimentTemplateExperimentOptionsInput.Builder getExperimentOptions() {
return experimentOptions != null ? experimentOptions.toBuilder() : null;
}
public final void setExperimentOptions(UpdateExperimentTemplateExperimentOptionsInput.BuilderImpl experimentOptions) {
this.experimentOptions = experimentOptions != null ? experimentOptions.build() : null;
}
@Override
public final Builder experimentOptions(UpdateExperimentTemplateExperimentOptionsInput experimentOptions) {
this.experimentOptions = experimentOptions;
return this;
}
@Override
public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
super.overrideConfiguration(overrideConfiguration);
return this;
}
@Override
public Builder overrideConfiguration(Consumer builderConsumer) {
super.overrideConfiguration(builderConsumer);
return this;
}
@Override
public UpdateExperimentTemplateRequest build() {
return new UpdateExperimentTemplateRequest(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}