software.amazon.awssdk.services.sagemaker.model.DescribeModelResponse Maven / Gradle / Ivy
Show all versions of sagemaker Show documentation
/*
* 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.time.Instant;
import java.util.Arrays;
import java.util.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
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 DescribeModelResponse extends SageMakerResponse implements
ToCopyableBuilder {
private static final SdkField MODEL_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ModelName").getter(getter(DescribeModelResponse::modelName)).setter(setter(Builder::modelName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelName").build()).build();
private static final SdkField PRIMARY_CONTAINER_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("PrimaryContainer")
.getter(getter(DescribeModelResponse::primaryContainer)).setter(setter(Builder::primaryContainer))
.constructor(ContainerDefinition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PrimaryContainer").build()).build();
private static final SdkField> CONTAINERS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Containers")
.getter(getter(DescribeModelResponse::containers))
.setter(setter(Builder::containers))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Containers").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ContainerDefinition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField INFERENCE_EXECUTION_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("InferenceExecutionConfig")
.getter(getter(DescribeModelResponse::inferenceExecutionConfig)).setter(setter(Builder::inferenceExecutionConfig))
.constructor(InferenceExecutionConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InferenceExecutionConfig").build())
.build();
private static final SdkField EXECUTION_ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ExecutionRoleArn").getter(getter(DescribeModelResponse::executionRoleArn))
.setter(setter(Builder::executionRoleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ExecutionRoleArn").build()).build();
private static final SdkField VPC_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("VpcConfig").getter(getter(DescribeModelResponse::vpcConfig)).setter(setter(Builder::vpcConfig))
.constructor(VpcConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("VpcConfig").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(DescribeModelResponse::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField MODEL_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ModelArn").getter(getter(DescribeModelResponse::modelArn)).setter(setter(Builder::modelArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModelArn").build()).build();
private static final SdkField ENABLE_NETWORK_ISOLATION_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("EnableNetworkIsolation").getter(getter(DescribeModelResponse::enableNetworkIsolation))
.setter(setter(Builder::enableNetworkIsolation))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EnableNetworkIsolation").build())
.build();
private static final SdkField DEPLOYMENT_RECOMMENDATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DeploymentRecommendation")
.getter(getter(DescribeModelResponse::deploymentRecommendation)).setter(setter(Builder::deploymentRecommendation))
.constructor(DeploymentRecommendation::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DeploymentRecommendation").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MODEL_NAME_FIELD,
PRIMARY_CONTAINER_FIELD, CONTAINERS_FIELD, INFERENCE_EXECUTION_CONFIG_FIELD, EXECUTION_ROLE_ARN_FIELD,
VPC_CONFIG_FIELD, CREATION_TIME_FIELD, MODEL_ARN_FIELD, ENABLE_NETWORK_ISOLATION_FIELD,
DEPLOYMENT_RECOMMENDATION_FIELD));
private final String modelName;
private final ContainerDefinition primaryContainer;
private final List containers;
private final InferenceExecutionConfig inferenceExecutionConfig;
private final String executionRoleArn;
private final VpcConfig vpcConfig;
private final Instant creationTime;
private final String modelArn;
private final Boolean enableNetworkIsolation;
private final DeploymentRecommendation deploymentRecommendation;
private DescribeModelResponse(BuilderImpl builder) {
super(builder);
this.modelName = builder.modelName;
this.primaryContainer = builder.primaryContainer;
this.containers = builder.containers;
this.inferenceExecutionConfig = builder.inferenceExecutionConfig;
this.executionRoleArn = builder.executionRoleArn;
this.vpcConfig = builder.vpcConfig;
this.creationTime = builder.creationTime;
this.modelArn = builder.modelArn;
this.enableNetworkIsolation = builder.enableNetworkIsolation;
this.deploymentRecommendation = builder.deploymentRecommendation;
}
/**
*
* Name of the SageMaker model.
*
*
* @return Name of the SageMaker model.
*/
public final String modelName() {
return modelName;
}
/**
*
* The location of the primary inference code, associated artifacts, and custom environment map that the inference
* code uses when it is deployed in production.
*
*
* @return The location of the primary inference code, associated artifacts, and custom environment map that the
* inference code uses when it is deployed in production.
*/
public final ContainerDefinition primaryContainer() {
return primaryContainer;
}
/**
* For responses, this returns true if the service returned a value for the Containers 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 hasContainers() {
return containers != null && !(containers instanceof SdkAutoConstructList);
}
/**
*
* The containers in the inference pipeline.
*
*
* 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 #hasContainers} method.
*
*
* @return The containers in the inference pipeline.
*/
public final List containers() {
return containers;
}
/**
*
* Specifies details of how containers in a multi-container endpoint are called.
*
*
* @return Specifies details of how containers in a multi-container endpoint are called.
*/
public final InferenceExecutionConfig inferenceExecutionConfig() {
return inferenceExecutionConfig;
}
/**
*
* The Amazon Resource Name (ARN) of the IAM role that you specified for the model.
*
*
* @return The Amazon Resource Name (ARN) of the IAM role that you specified for the model.
*/
public final String executionRoleArn() {
return executionRoleArn;
}
/**
*
* A VpcConfig object
* that specifies the VPC that this model has access to. For more information, see Protect Endpoints by Using an Amazon Virtual
* Private Cloud
*
*
* @return A VpcConfig
* object that specifies the VPC that this model has access to. For more information, see Protect Endpoints by Using an Amazon
* Virtual Private Cloud
*/
public final VpcConfig vpcConfig() {
return vpcConfig;
}
/**
*
* A timestamp that shows when the model was created.
*
*
* @return A timestamp that shows when the model was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* The Amazon Resource Name (ARN) of the model.
*
*
* @return The Amazon Resource Name (ARN) of the model.
*/
public final String modelArn() {
return modelArn;
}
/**
*
* If True
, no inbound or outbound network calls can be made to or from the model container.
*
*
* @return If True
, no inbound or outbound network calls can be made to or from the model container.
*/
public final Boolean enableNetworkIsolation() {
return enableNetworkIsolation;
}
/**
*
* A set of recommended deployment configurations for the model.
*
*
* @return A set of recommended deployment configurations for the model.
*/
public final DeploymentRecommendation deploymentRecommendation() {
return deploymentRecommendation;
}
@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(modelName());
hashCode = 31 * hashCode + Objects.hashCode(primaryContainer());
hashCode = 31 * hashCode + Objects.hashCode(hasContainers() ? containers() : null);
hashCode = 31 * hashCode + Objects.hashCode(inferenceExecutionConfig());
hashCode = 31 * hashCode + Objects.hashCode(executionRoleArn());
hashCode = 31 * hashCode + Objects.hashCode(vpcConfig());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(modelArn());
hashCode = 31 * hashCode + Objects.hashCode(enableNetworkIsolation());
hashCode = 31 * hashCode + Objects.hashCode(deploymentRecommendation());
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 DescribeModelResponse)) {
return false;
}
DescribeModelResponse other = (DescribeModelResponse) obj;
return Objects.equals(modelName(), other.modelName()) && Objects.equals(primaryContainer(), other.primaryContainer())
&& hasContainers() == other.hasContainers() && Objects.equals(containers(), other.containers())
&& Objects.equals(inferenceExecutionConfig(), other.inferenceExecutionConfig())
&& Objects.equals(executionRoleArn(), other.executionRoleArn()) && Objects.equals(vpcConfig(), other.vpcConfig())
&& Objects.equals(creationTime(), other.creationTime()) && Objects.equals(modelArn(), other.modelArn())
&& Objects.equals(enableNetworkIsolation(), other.enableNetworkIsolation())
&& Objects.equals(deploymentRecommendation(), other.deploymentRecommendation());
}
/**
* 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("DescribeModelResponse").add("ModelName", modelName())
.add("PrimaryContainer", primaryContainer()).add("Containers", hasContainers() ? containers() : null)
.add("InferenceExecutionConfig", inferenceExecutionConfig()).add("ExecutionRoleArn", executionRoleArn())
.add("VpcConfig", vpcConfig()).add("CreationTime", creationTime()).add("ModelArn", modelArn())
.add("EnableNetworkIsolation", enableNetworkIsolation())
.add("DeploymentRecommendation", deploymentRecommendation()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "ModelName":
return Optional.ofNullable(clazz.cast(modelName()));
case "PrimaryContainer":
return Optional.ofNullable(clazz.cast(primaryContainer()));
case "Containers":
return Optional.ofNullable(clazz.cast(containers()));
case "InferenceExecutionConfig":
return Optional.ofNullable(clazz.cast(inferenceExecutionConfig()));
case "ExecutionRoleArn":
return Optional.ofNullable(clazz.cast(executionRoleArn()));
case "VpcConfig":
return Optional.ofNullable(clazz.cast(vpcConfig()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "ModelArn":
return Optional.ofNullable(clazz.cast(modelArn()));
case "EnableNetworkIsolation":
return Optional.ofNullable(clazz.cast(enableNetworkIsolation()));
case "DeploymentRecommendation":
return Optional.ofNullable(clazz.cast(deploymentRecommendation()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function