
software.amazon.awssdk.services.sagemaker.model.GetScalingConfigurationRecommendationResponse 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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetScalingConfigurationRecommendationResponse extends SageMakerResponse implements
ToCopyableBuilder {
private static final SdkField INFERENCE_RECOMMENDATIONS_JOB_NAME_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("InferenceRecommendationsJobName")
.getter(getter(GetScalingConfigurationRecommendationResponse::inferenceRecommendationsJobName))
.setter(setter(Builder::inferenceRecommendationsJobName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InferenceRecommendationsJobName")
.build()).build();
private static final SdkField RECOMMENDATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RecommendationId").getter(getter(GetScalingConfigurationRecommendationResponse::recommendationId))
.setter(setter(Builder::recommendationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RecommendationId").build()).build();
private static final SdkField ENDPOINT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointName").getter(getter(GetScalingConfigurationRecommendationResponse::endpointName))
.setter(setter(Builder::endpointName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointName").build()).build();
private static final SdkField TARGET_CPU_UTILIZATION_PER_CORE_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("TargetCpuUtilizationPerCore")
.getter(getter(GetScalingConfigurationRecommendationResponse::targetCpuUtilizationPerCore))
.setter(setter(Builder::targetCpuUtilizationPerCore))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetCpuUtilizationPerCore")
.build()).build();
private static final SdkField SCALING_POLICY_OBJECTIVE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ScalingPolicyObjective")
.getter(getter(GetScalingConfigurationRecommendationResponse::scalingPolicyObjective))
.setter(setter(Builder::scalingPolicyObjective)).constructor(ScalingPolicyObjective::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ScalingPolicyObjective").build())
.build();
private static final SdkField METRIC_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("Metric")
.getter(getter(GetScalingConfigurationRecommendationResponse::metric)).setter(setter(Builder::metric))
.constructor(ScalingPolicyMetric::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Metric").build()).build();
private static final SdkField DYNAMIC_SCALING_CONFIGURATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.memberName("DynamicScalingConfiguration")
.getter(getter(GetScalingConfigurationRecommendationResponse::dynamicScalingConfiguration))
.setter(setter(Builder::dynamicScalingConfiguration))
.constructor(DynamicScalingConfiguration::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DynamicScalingConfiguration")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
INFERENCE_RECOMMENDATIONS_JOB_NAME_FIELD, RECOMMENDATION_ID_FIELD, ENDPOINT_NAME_FIELD,
TARGET_CPU_UTILIZATION_PER_CORE_FIELD, SCALING_POLICY_OBJECTIVE_FIELD, METRIC_FIELD,
DYNAMIC_SCALING_CONFIGURATION_FIELD));
private final String inferenceRecommendationsJobName;
private final String recommendationId;
private final String endpointName;
private final Integer targetCpuUtilizationPerCore;
private final ScalingPolicyObjective scalingPolicyObjective;
private final ScalingPolicyMetric metric;
private final DynamicScalingConfiguration dynamicScalingConfiguration;
private GetScalingConfigurationRecommendationResponse(BuilderImpl builder) {
super(builder);
this.inferenceRecommendationsJobName = builder.inferenceRecommendationsJobName;
this.recommendationId = builder.recommendationId;
this.endpointName = builder.endpointName;
this.targetCpuUtilizationPerCore = builder.targetCpuUtilizationPerCore;
this.scalingPolicyObjective = builder.scalingPolicyObjective;
this.metric = builder.metric;
this.dynamicScalingConfiguration = builder.dynamicScalingConfiguration;
}
/**
*
* The name of a previously completed Inference Recommender job.
*
*
* @return The name of a previously completed Inference Recommender job.
*/
public final String inferenceRecommendationsJobName() {
return inferenceRecommendationsJobName;
}
/**
*
* The recommendation ID of a previously completed inference recommendation.
*
*
* @return The recommendation ID of a previously completed inference recommendation.
*/
public final String recommendationId() {
return recommendationId;
}
/**
*
* The name of an endpoint benchmarked during a previously completed Inference Recommender job.
*
*
* @return The name of an endpoint benchmarked during a previously completed Inference Recommender job.
*/
public final String endpointName() {
return endpointName;
}
/**
*
* The percentage of how much utilization you want an instance to use before autoscaling, which you specified in the
* request. The default value is 50%.
*
*
* @return The percentage of how much utilization you want an instance to use before autoscaling, which you
* specified in the request. The default value is 50%.
*/
public final Integer targetCpuUtilizationPerCore() {
return targetCpuUtilizationPerCore;
}
/**
*
* An object representing the anticipated traffic pattern for an endpoint that you specified in the request.
*
*
* @return An object representing the anticipated traffic pattern for an endpoint that you specified in the request.
*/
public final ScalingPolicyObjective scalingPolicyObjective() {
return scalingPolicyObjective;
}
/**
*
* An object with a list of metrics that were benchmarked during the previously completed Inference Recommender job.
*
*
* @return An object with a list of metrics that were benchmarked during the previously completed Inference
* Recommender job.
*/
public final ScalingPolicyMetric metric() {
return metric;
}
/**
*
* An object with the recommended values for you to specify when creating an autoscaling policy.
*
*
* @return An object with the recommended values for you to specify when creating an autoscaling policy.
*/
public final DynamicScalingConfiguration dynamicScalingConfiguration() {
return dynamicScalingConfiguration;
}
@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(inferenceRecommendationsJobName());
hashCode = 31 * hashCode + Objects.hashCode(recommendationId());
hashCode = 31 * hashCode + Objects.hashCode(endpointName());
hashCode = 31 * hashCode + Objects.hashCode(targetCpuUtilizationPerCore());
hashCode = 31 * hashCode + Objects.hashCode(scalingPolicyObjective());
hashCode = 31 * hashCode + Objects.hashCode(metric());
hashCode = 31 * hashCode + Objects.hashCode(dynamicScalingConfiguration());
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 GetScalingConfigurationRecommendationResponse)) {
return false;
}
GetScalingConfigurationRecommendationResponse other = (GetScalingConfigurationRecommendationResponse) obj;
return Objects.equals(inferenceRecommendationsJobName(), other.inferenceRecommendationsJobName())
&& Objects.equals(recommendationId(), other.recommendationId())
&& Objects.equals(endpointName(), other.endpointName())
&& Objects.equals(targetCpuUtilizationPerCore(), other.targetCpuUtilizationPerCore())
&& Objects.equals(scalingPolicyObjective(), other.scalingPolicyObjective())
&& Objects.equals(metric(), other.metric())
&& Objects.equals(dynamicScalingConfiguration(), other.dynamicScalingConfiguration());
}
/**
* 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("GetScalingConfigurationRecommendationResponse")
.add("InferenceRecommendationsJobName", inferenceRecommendationsJobName())
.add("RecommendationId", recommendationId()).add("EndpointName", endpointName())
.add("TargetCpuUtilizationPerCore", targetCpuUtilizationPerCore())
.add("ScalingPolicyObjective", scalingPolicyObjective()).add("Metric", metric())
.add("DynamicScalingConfiguration", dynamicScalingConfiguration()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "InferenceRecommendationsJobName":
return Optional.ofNullable(clazz.cast(inferenceRecommendationsJobName()));
case "RecommendationId":
return Optional.ofNullable(clazz.cast(recommendationId()));
case "EndpointName":
return Optional.ofNullable(clazz.cast(endpointName()));
case "TargetCpuUtilizationPerCore":
return Optional.ofNullable(clazz.cast(targetCpuUtilizationPerCore()));
case "ScalingPolicyObjective":
return Optional.ofNullable(clazz.cast(scalingPolicyObjective()));
case "Metric":
return Optional.ofNullable(clazz.cast(metric()));
case "DynamicScalingConfiguration":
return Optional.ofNullable(clazz.cast(dynamicScalingConfiguration()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function