software.amazon.awssdk.services.emr.model.InstanceFleetModifyConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of emr Show documentation
Show all versions of emr Show documentation
The AWS Java SDK for Amazon EMR module holds the client classes that are used for communicating with
Amazon Elastic MapReduce Service
/*
* 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.emr.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
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.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Configuration parameters for an instance fleet modification request.
*
*
*
* The instance fleet configuration is available only in Amazon EMR releases 4.8.0 and later, excluding 5.0.x versions.
*
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class InstanceFleetModifyConfig implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField INSTANCE_FLEET_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceFleetId").getter(getter(InstanceFleetModifyConfig::instanceFleetId))
.setter(setter(Builder::instanceFleetId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceFleetId").build()).build();
private static final SdkField TARGET_ON_DEMAND_CAPACITY_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TargetOnDemandCapacity").getter(getter(InstanceFleetModifyConfig::targetOnDemandCapacity))
.setter(setter(Builder::targetOnDemandCapacity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetOnDemandCapacity").build())
.build();
private static final SdkField TARGET_SPOT_CAPACITY_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("TargetSpotCapacity").getter(getter(InstanceFleetModifyConfig::targetSpotCapacity))
.setter(setter(Builder::targetSpotCapacity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetSpotCapacity").build())
.build();
private static final SdkField RESIZE_SPECIFICATIONS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ResizeSpecifications")
.getter(getter(InstanceFleetModifyConfig::resizeSpecifications)).setter(setter(Builder::resizeSpecifications))
.constructor(InstanceFleetResizingSpecifications::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ResizeSpecifications").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INSTANCE_FLEET_ID_FIELD,
TARGET_ON_DEMAND_CAPACITY_FIELD, TARGET_SPOT_CAPACITY_FIELD, RESIZE_SPECIFICATIONS_FIELD));
private static final long serialVersionUID = 1L;
private final String instanceFleetId;
private final Integer targetOnDemandCapacity;
private final Integer targetSpotCapacity;
private final InstanceFleetResizingSpecifications resizeSpecifications;
private InstanceFleetModifyConfig(BuilderImpl builder) {
this.instanceFleetId = builder.instanceFleetId;
this.targetOnDemandCapacity = builder.targetOnDemandCapacity;
this.targetSpotCapacity = builder.targetSpotCapacity;
this.resizeSpecifications = builder.resizeSpecifications;
}
/**
*
* A unique identifier for the instance fleet.
*
*
* @return A unique identifier for the instance fleet.
*/
public final String instanceFleetId() {
return instanceFleetId;
}
/**
*
* The target capacity of On-Demand units for the instance fleet. For more information see
* InstanceFleetConfig$TargetOnDemandCapacity.
*
*
* @return The target capacity of On-Demand units for the instance fleet. For more information see
* InstanceFleetConfig$TargetOnDemandCapacity.
*/
public final Integer targetOnDemandCapacity() {
return targetOnDemandCapacity;
}
/**
*
* The target capacity of Spot units for the instance fleet. For more information, see
* InstanceFleetConfig$TargetSpotCapacity.
*
*
* @return The target capacity of Spot units for the instance fleet. For more information, see
* InstanceFleetConfig$TargetSpotCapacity.
*/
public final Integer targetSpotCapacity() {
return targetSpotCapacity;
}
/**
*
* The resize specification for the instance fleet.
*
*
* @return The resize specification for the instance fleet.
*/
public final InstanceFleetResizingSpecifications resizeSpecifications() {
return resizeSpecifications;
}
@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(instanceFleetId());
hashCode = 31 * hashCode + Objects.hashCode(targetOnDemandCapacity());
hashCode = 31 * hashCode + Objects.hashCode(targetSpotCapacity());
hashCode = 31 * hashCode + Objects.hashCode(resizeSpecifications());
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 InstanceFleetModifyConfig)) {
return false;
}
InstanceFleetModifyConfig other = (InstanceFleetModifyConfig) obj;
return Objects.equals(instanceFleetId(), other.instanceFleetId())
&& Objects.equals(targetOnDemandCapacity(), other.targetOnDemandCapacity())
&& Objects.equals(targetSpotCapacity(), other.targetSpotCapacity())
&& Objects.equals(resizeSpecifications(), other.resizeSpecifications());
}
/**
* 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("InstanceFleetModifyConfig").add("InstanceFleetId", instanceFleetId())
.add("TargetOnDemandCapacity", targetOnDemandCapacity()).add("TargetSpotCapacity", targetSpotCapacity())
.add("ResizeSpecifications", resizeSpecifications()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "InstanceFleetId":
return Optional.ofNullable(clazz.cast(instanceFleetId()));
case "TargetOnDemandCapacity":
return Optional.ofNullable(clazz.cast(targetOnDemandCapacity()));
case "TargetSpotCapacity":
return Optional.ofNullable(clazz.cast(targetSpotCapacity()));
case "ResizeSpecifications":
return Optional.ofNullable(clazz.cast(resizeSpecifications()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function