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

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 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 getter(Function g) { return obj -> g.apply((EndpointInputConfiguration) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The instance types to use for the load test. *

* * @param instanceType * The instance types to use for the load test. * @see ProductionVariantInstanceType * @return Returns a reference to this object so that method calls can be chained together. * @see ProductionVariantInstanceType */ Builder instanceType(String instanceType); /** *

* The instance types to use for the load test. *

* * @param instanceType * The instance types to use for the load test. * @see ProductionVariantInstanceType * @return Returns a reference to this object so that method calls can be chained together. * @see ProductionVariantInstanceType */ Builder instanceType(ProductionVariantInstanceType instanceType); /** *

* The inference specification name in the model package version. *

* * @param inferenceSpecificationName * The inference specification name in the model package version. * @return Returns a reference to this object so that method calls can be chained together. */ Builder inferenceSpecificationName(String inferenceSpecificationName); /** *

* The parameter you want to benchmark against. *

* * @param environmentParameterRanges * The parameter you want to benchmark against. * @return Returns a reference to this object so that method calls can be chained together. */ Builder environmentParameterRanges(EnvironmentParameterRanges environmentParameterRanges); /** *

* The parameter you want to benchmark against. *

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

* When the {@link Consumer} completes, {@link EnvironmentParameterRanges.Builder#build()} is called immediately * and its result is passed to {@link #environmentParameterRanges(EnvironmentParameterRanges)}. * * @param environmentParameterRanges * a consumer that will call methods on {@link EnvironmentParameterRanges.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #environmentParameterRanges(EnvironmentParameterRanges) */ default Builder environmentParameterRanges(Consumer environmentParameterRanges) { return environmentParameterRanges(EnvironmentParameterRanges.builder().applyMutation(environmentParameterRanges) .build()); } /** * Sets the value of the ServerlessConfig property for this object. * * @param serverlessConfig * The new value for the ServerlessConfig property for this object. * @return Returns a reference to this object so that method calls can be chained together. */ Builder serverlessConfig(ProductionVariantServerlessConfig serverlessConfig); /** * Sets the value of the ServerlessConfig property for this object. * * This is a convenience method that creates an instance of the * {@link ProductionVariantServerlessConfig.Builder} avoiding the need to create one manually via * {@link ProductionVariantServerlessConfig#builder()}. * *

* When the {@link Consumer} completes, {@link ProductionVariantServerlessConfig.Builder#build()} is called * immediately and its result is passed to {@link #serverlessConfig(ProductionVariantServerlessConfig)}. * * @param serverlessConfig * a consumer that will call methods on {@link ProductionVariantServerlessConfig.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #serverlessConfig(ProductionVariantServerlessConfig) */ default Builder serverlessConfig(Consumer serverlessConfig) { return serverlessConfig(ProductionVariantServerlessConfig.builder().applyMutation(serverlessConfig).build()); } } static final class BuilderImpl implements Builder { private String instanceType; private String inferenceSpecificationName; private EnvironmentParameterRanges environmentParameterRanges; private ProductionVariantServerlessConfig serverlessConfig; private BuilderImpl() { } private BuilderImpl(EndpointInputConfiguration model) { instanceType(model.instanceType); inferenceSpecificationName(model.inferenceSpecificationName); environmentParameterRanges(model.environmentParameterRanges); serverlessConfig(model.serverlessConfig); } public final String getInstanceType() { return instanceType; } public final void setInstanceType(String instanceType) { this.instanceType = instanceType; } @Override public final Builder instanceType(String instanceType) { this.instanceType = instanceType; return this; } @Override public final Builder instanceType(ProductionVariantInstanceType instanceType) { this.instanceType(instanceType == null ? null : instanceType.toString()); return this; } public final String getInferenceSpecificationName() { return inferenceSpecificationName; } public final void setInferenceSpecificationName(String inferenceSpecificationName) { this.inferenceSpecificationName = inferenceSpecificationName; } @Override public final Builder inferenceSpecificationName(String inferenceSpecificationName) { this.inferenceSpecificationName = inferenceSpecificationName; return this; } public final EnvironmentParameterRanges.Builder getEnvironmentParameterRanges() { return environmentParameterRanges != null ? environmentParameterRanges.toBuilder() : null; } public final void setEnvironmentParameterRanges(EnvironmentParameterRanges.BuilderImpl environmentParameterRanges) { this.environmentParameterRanges = environmentParameterRanges != null ? environmentParameterRanges.build() : null; } @Override public final Builder environmentParameterRanges(EnvironmentParameterRanges environmentParameterRanges) { this.environmentParameterRanges = environmentParameterRanges; return this; } public final ProductionVariantServerlessConfig.Builder getServerlessConfig() { return serverlessConfig != null ? serverlessConfig.toBuilder() : null; } public final void setServerlessConfig(ProductionVariantServerlessConfig.BuilderImpl serverlessConfig) { this.serverlessConfig = serverlessConfig != null ? serverlessConfig.build() : null; } @Override public final Builder serverlessConfig(ProductionVariantServerlessConfig serverlessConfig) { this.serverlessConfig = serverlessConfig; return this; } @Override public EndpointInputConfiguration build() { return new EndpointInputConfiguration(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy