
software.amazon.awssdk.services.sagemaker.model.DescribeAlgorithmResponse 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.time.Instant;
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 DescribeAlgorithmResponse extends SageMakerResponse implements
ToCopyableBuilder {
private static final SdkField ALGORITHM_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AlgorithmName").getter(getter(DescribeAlgorithmResponse::algorithmName))
.setter(setter(Builder::algorithmName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlgorithmName").build()).build();
private static final SdkField ALGORITHM_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AlgorithmArn").getter(getter(DescribeAlgorithmResponse::algorithmArn))
.setter(setter(Builder::algorithmArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlgorithmArn").build()).build();
private static final SdkField ALGORITHM_DESCRIPTION_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AlgorithmDescription").getter(getter(DescribeAlgorithmResponse::algorithmDescription))
.setter(setter(Builder::algorithmDescription))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlgorithmDescription").build())
.build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreationTime").getter(getter(DescribeAlgorithmResponse::creationTime))
.setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField TRAINING_SPECIFICATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("TrainingSpecification")
.getter(getter(DescribeAlgorithmResponse::trainingSpecification)).setter(setter(Builder::trainingSpecification))
.constructor(TrainingSpecification::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TrainingSpecification").build())
.build();
private static final SdkField INFERENCE_SPECIFICATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("InferenceSpecification")
.getter(getter(DescribeAlgorithmResponse::inferenceSpecification)).setter(setter(Builder::inferenceSpecification))
.constructor(InferenceSpecification::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InferenceSpecification").build())
.build();
private static final SdkField VALIDATION_SPECIFICATION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("ValidationSpecification")
.getter(getter(DescribeAlgorithmResponse::validationSpecification)).setter(setter(Builder::validationSpecification))
.constructor(AlgorithmValidationSpecification::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ValidationSpecification").build())
.build();
private static final SdkField ALGORITHM_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("AlgorithmStatus").getter(getter(DescribeAlgorithmResponse::algorithmStatusAsString))
.setter(setter(Builder::algorithmStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlgorithmStatus").build()).build();
private static final SdkField ALGORITHM_STATUS_DETAILS_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AlgorithmStatusDetails")
.getter(getter(DescribeAlgorithmResponse::algorithmStatusDetails)).setter(setter(Builder::algorithmStatusDetails))
.constructor(AlgorithmStatusDetails::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AlgorithmStatusDetails").build())
.build();
private static final SdkField PRODUCT_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ProductId").getter(getter(DescribeAlgorithmResponse::productId)).setter(setter(Builder::productId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProductId").build()).build();
private static final SdkField CERTIFY_FOR_MARKETPLACE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("CertifyForMarketplace").getter(getter(DescribeAlgorithmResponse::certifyForMarketplace))
.setter(setter(Builder::certifyForMarketplace))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CertifyForMarketplace").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ALGORITHM_NAME_FIELD,
ALGORITHM_ARN_FIELD, ALGORITHM_DESCRIPTION_FIELD, CREATION_TIME_FIELD, TRAINING_SPECIFICATION_FIELD,
INFERENCE_SPECIFICATION_FIELD, VALIDATION_SPECIFICATION_FIELD, ALGORITHM_STATUS_FIELD,
ALGORITHM_STATUS_DETAILS_FIELD, PRODUCT_ID_FIELD, CERTIFY_FOR_MARKETPLACE_FIELD));
private final String algorithmName;
private final String algorithmArn;
private final String algorithmDescription;
private final Instant creationTime;
private final TrainingSpecification trainingSpecification;
private final InferenceSpecification inferenceSpecification;
private final AlgorithmValidationSpecification validationSpecification;
private final String algorithmStatus;
private final AlgorithmStatusDetails algorithmStatusDetails;
private final String productId;
private final Boolean certifyForMarketplace;
private DescribeAlgorithmResponse(BuilderImpl builder) {
super(builder);
this.algorithmName = builder.algorithmName;
this.algorithmArn = builder.algorithmArn;
this.algorithmDescription = builder.algorithmDescription;
this.creationTime = builder.creationTime;
this.trainingSpecification = builder.trainingSpecification;
this.inferenceSpecification = builder.inferenceSpecification;
this.validationSpecification = builder.validationSpecification;
this.algorithmStatus = builder.algorithmStatus;
this.algorithmStatusDetails = builder.algorithmStatusDetails;
this.productId = builder.productId;
this.certifyForMarketplace = builder.certifyForMarketplace;
}
/**
*
* The name of the algorithm being described.
*
*
* @return The name of the algorithm being described.
*/
public final String algorithmName() {
return algorithmName;
}
/**
*
* The Amazon Resource Name (ARN) of the algorithm.
*
*
* @return The Amazon Resource Name (ARN) of the algorithm.
*/
public final String algorithmArn() {
return algorithmArn;
}
/**
*
* A brief summary about the algorithm.
*
*
* @return A brief summary about the algorithm.
*/
public final String algorithmDescription() {
return algorithmDescription;
}
/**
*
* A timestamp specifying when the algorithm was created.
*
*
* @return A timestamp specifying when the algorithm was created.
*/
public final Instant creationTime() {
return creationTime;
}
/**
*
* Details about training jobs run by this algorithm.
*
*
* @return Details about training jobs run by this algorithm.
*/
public final TrainingSpecification trainingSpecification() {
return trainingSpecification;
}
/**
*
* Details about inference jobs that the algorithm runs.
*
*
* @return Details about inference jobs that the algorithm runs.
*/
public final InferenceSpecification inferenceSpecification() {
return inferenceSpecification;
}
/**
*
* Details about configurations for one or more training jobs that Amazon SageMaker runs to test the algorithm.
*
*
* @return Details about configurations for one or more training jobs that Amazon SageMaker runs to test the
* algorithm.
*/
public final AlgorithmValidationSpecification validationSpecification() {
return validationSpecification;
}
/**
*
* The current status of the algorithm.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #algorithmStatus}
* will return {@link AlgorithmStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #algorithmStatusAsString}.
*
*
* @return The current status of the algorithm.
* @see AlgorithmStatus
*/
public final AlgorithmStatus algorithmStatus() {
return AlgorithmStatus.fromValue(algorithmStatus);
}
/**
*
* The current status of the algorithm.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #algorithmStatus}
* will return {@link AlgorithmStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #algorithmStatusAsString}.
*
*
* @return The current status of the algorithm.
* @see AlgorithmStatus
*/
public final String algorithmStatusAsString() {
return algorithmStatus;
}
/**
*
* Details about the current status of the algorithm.
*
*
* @return Details about the current status of the algorithm.
*/
public final AlgorithmStatusDetails algorithmStatusDetails() {
return algorithmStatusDetails;
}
/**
*
* The product identifier of the algorithm.
*
*
* @return The product identifier of the algorithm.
*/
public final String productId() {
return productId;
}
/**
*
* Whether the algorithm is certified to be listed in AWS Marketplace.
*
*
* @return Whether the algorithm is certified to be listed in AWS Marketplace.
*/
public final Boolean certifyForMarketplace() {
return certifyForMarketplace;
}
@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(algorithmName());
hashCode = 31 * hashCode + Objects.hashCode(algorithmArn());
hashCode = 31 * hashCode + Objects.hashCode(algorithmDescription());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(trainingSpecification());
hashCode = 31 * hashCode + Objects.hashCode(inferenceSpecification());
hashCode = 31 * hashCode + Objects.hashCode(validationSpecification());
hashCode = 31 * hashCode + Objects.hashCode(algorithmStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(algorithmStatusDetails());
hashCode = 31 * hashCode + Objects.hashCode(productId());
hashCode = 31 * hashCode + Objects.hashCode(certifyForMarketplace());
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 DescribeAlgorithmResponse)) {
return false;
}
DescribeAlgorithmResponse other = (DescribeAlgorithmResponse) obj;
return Objects.equals(algorithmName(), other.algorithmName()) && Objects.equals(algorithmArn(), other.algorithmArn())
&& Objects.equals(algorithmDescription(), other.algorithmDescription())
&& Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(trainingSpecification(), other.trainingSpecification())
&& Objects.equals(inferenceSpecification(), other.inferenceSpecification())
&& Objects.equals(validationSpecification(), other.validationSpecification())
&& Objects.equals(algorithmStatusAsString(), other.algorithmStatusAsString())
&& Objects.equals(algorithmStatusDetails(), other.algorithmStatusDetails())
&& Objects.equals(productId(), other.productId())
&& Objects.equals(certifyForMarketplace(), other.certifyForMarketplace());
}
/**
* 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("DescribeAlgorithmResponse").add("AlgorithmName", algorithmName())
.add("AlgorithmArn", algorithmArn()).add("AlgorithmDescription", algorithmDescription())
.add("CreationTime", creationTime()).add("TrainingSpecification", trainingSpecification())
.add("InferenceSpecification", inferenceSpecification())
.add("ValidationSpecification", validationSpecification()).add("AlgorithmStatus", algorithmStatusAsString())
.add("AlgorithmStatusDetails", algorithmStatusDetails()).add("ProductId", productId())
.add("CertifyForMarketplace", certifyForMarketplace()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AlgorithmName":
return Optional.ofNullable(clazz.cast(algorithmName()));
case "AlgorithmArn":
return Optional.ofNullable(clazz.cast(algorithmArn()));
case "AlgorithmDescription":
return Optional.ofNullable(clazz.cast(algorithmDescription()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "TrainingSpecification":
return Optional.ofNullable(clazz.cast(trainingSpecification()));
case "InferenceSpecification":
return Optional.ofNullable(clazz.cast(inferenceSpecification()));
case "ValidationSpecification":
return Optional.ofNullable(clazz.cast(validationSpecification()));
case "AlgorithmStatus":
return Optional.ofNullable(clazz.cast(algorithmStatusAsString()));
case "AlgorithmStatusDetails":
return Optional.ofNullable(clazz.cast(algorithmStatusDetails()));
case "ProductId":
return Optional.ofNullable(clazz.cast(productId()));
case "CertifyForMarketplace":
return Optional.ofNullable(clazz.cast(certifyForMarketplace()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function