
software.amazon.awssdk.services.sagemaker.model.EndpointInputConfiguration 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.sagemaker.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;
/**
*
* The endpoint configuration for the load test.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EndpointInputConfiguration implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField INSTANCE_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InstanceType").getter(getter(EndpointInputConfiguration::instanceTypeAsString))
.setter(setter(Builder::instanceType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InstanceType").build()).build();
private static final SdkField INFERENCE_SPECIFICATION_NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("InferenceSpecificationName")
.getter(getter(EndpointInputConfiguration::inferenceSpecificationName))
.setter(setter(Builder::inferenceSpecificationName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InferenceSpecificationName").build())
.build();
private static final SdkField ENVIRONMENT_PARAMETER_RANGES_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("EnvironmentParameterRanges")
.getter(getter(EndpointInputConfiguration::environmentParameterRanges))
.setter(setter(Builder::environmentParameterRanges))
.constructor(EnvironmentParameterRanges::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnvironmentParameterRanges").build())
.build();
private static final SdkField SERVERLESS_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ServerlessConfig")
.getter(getter(EndpointInputConfiguration::serverlessConfig)).setter(setter(Builder::serverlessConfig))
.constructor(ProductionVariantServerlessConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ServerlessConfig").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INSTANCE_TYPE_FIELD,
INFERENCE_SPECIFICATION_NAME_FIELD, ENVIRONMENT_PARAMETER_RANGES_FIELD, SERVERLESS_CONFIG_FIELD));
private static final long serialVersionUID = 1L;
private final String instanceType;
private final String inferenceSpecificationName;
private final EnvironmentParameterRanges environmentParameterRanges;
private final ProductionVariantServerlessConfig serverlessConfig;
private EndpointInputConfiguration(BuilderImpl builder) {
this.instanceType = builder.instanceType;
this.inferenceSpecificationName = builder.inferenceSpecificationName;
this.environmentParameterRanges = builder.environmentParameterRanges;
this.serverlessConfig = builder.serverlessConfig;
}
/**
*
* The instance types to use for the load test.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link ProductionVariantInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #instanceTypeAsString}.
*
*
* @return The instance types to use for the load test.
* @see ProductionVariantInstanceType
*/
public final ProductionVariantInstanceType instanceType() {
return ProductionVariantInstanceType.fromValue(instanceType);
}
/**
*
* The instance types to use for the load test.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #instanceType} will
* return {@link ProductionVariantInstanceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #instanceTypeAsString}.
*
*
* @return The instance types to use for the load test.
* @see ProductionVariantInstanceType
*/
public final String instanceTypeAsString() {
return instanceType;
}
/**
*
* The inference specification name in the model package version.
*
*
* @return The inference specification name in the model package version.
*/
public final String inferenceSpecificationName() {
return inferenceSpecificationName;
}
/**
*
* The parameter you want to benchmark against.
*
*
* @return The parameter you want to benchmark against.
*/
public final EnvironmentParameterRanges environmentParameterRanges() {
return environmentParameterRanges;
}
/**
* Returns the value of the ServerlessConfig property for this object.
*
* @return The value of the ServerlessConfig property for this object.
*/
public final ProductionVariantServerlessConfig serverlessConfig() {
return serverlessConfig;
}
@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(instanceTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(inferenceSpecificationName());
hashCode = 31 * hashCode + Objects.hashCode(environmentParameterRanges());
hashCode = 31 * hashCode + Objects.hashCode(serverlessConfig());
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 EndpointInputConfiguration)) {
return false;
}
EndpointInputConfiguration other = (EndpointInputConfiguration) obj;
return Objects.equals(instanceTypeAsString(), other.instanceTypeAsString())
&& Objects.equals(inferenceSpecificationName(), other.inferenceSpecificationName())
&& Objects.equals(environmentParameterRanges(), other.environmentParameterRanges())
&& Objects.equals(serverlessConfig(), other.serverlessConfig());
}
/**
* 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("EndpointInputConfiguration").add("InstanceType", instanceTypeAsString())
.add("InferenceSpecificationName", inferenceSpecificationName())
.add("EnvironmentParameterRanges", environmentParameterRanges()).add("ServerlessConfig", serverlessConfig())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "InstanceType":
return Optional.ofNullable(clazz.cast(instanceTypeAsString()));
case "InferenceSpecificationName":
return Optional.ofNullable(clazz.cast(inferenceSpecificationName()));
case "EnvironmentParameterRanges":
return Optional.ofNullable(clazz.cast(environmentParameterRanges()));
case "ServerlessConfig":
return Optional.ofNullable(clazz.cast(serverlessConfig()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function