
software.amazon.awssdk.services.sagemaker.model.DescribeEndpointResponse 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.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 DescribeEndpointResponse extends SageMakerResponse implements
ToCopyableBuilder {
private static final SdkField ENDPOINT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeEndpointResponse::endpointName)).setter(setter(Builder::endpointName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointName").build()).build();
private static final SdkField ENDPOINT_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeEndpointResponse::endpointArn)).setter(setter(Builder::endpointArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointArn").build()).build();
private static final SdkField ENDPOINT_CONFIG_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeEndpointResponse::endpointConfigName)).setter(setter(Builder::endpointConfigName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointConfigName").build())
.build();
private static final SdkField> PRODUCTION_VARIANTS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.getter(getter(DescribeEndpointResponse::productionVariants))
.setter(setter(Builder::productionVariants))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ProductionVariants").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(ProductionVariantSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final SdkField DATA_CAPTURE_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO)
.getter(getter(DescribeEndpointResponse::dataCaptureConfig)).setter(setter(Builder::dataCaptureConfig))
.constructor(DataCaptureConfigSummary::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataCaptureConfig").build()).build();
private static final SdkField ENDPOINT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeEndpointResponse::endpointStatusAsString)).setter(setter(Builder::endpointStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointStatus").build()).build();
private static final SdkField FAILURE_REASON_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(DescribeEndpointResponse::failureReason)).setter(setter(Builder::failureReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureReason").build()).build();
private static final SdkField CREATION_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(DescribeEndpointResponse::creationTime)).setter(setter(Builder::creationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationTime").build()).build();
private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(DescribeEndpointResponse::lastModifiedTime)).setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedTime").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENDPOINT_NAME_FIELD,
ENDPOINT_ARN_FIELD, ENDPOINT_CONFIG_NAME_FIELD, PRODUCTION_VARIANTS_FIELD, DATA_CAPTURE_CONFIG_FIELD,
ENDPOINT_STATUS_FIELD, FAILURE_REASON_FIELD, CREATION_TIME_FIELD, LAST_MODIFIED_TIME_FIELD));
private final String endpointName;
private final String endpointArn;
private final String endpointConfigName;
private final List productionVariants;
private final DataCaptureConfigSummary dataCaptureConfig;
private final String endpointStatus;
private final String failureReason;
private final Instant creationTime;
private final Instant lastModifiedTime;
private DescribeEndpointResponse(BuilderImpl builder) {
super(builder);
this.endpointName = builder.endpointName;
this.endpointArn = builder.endpointArn;
this.endpointConfigName = builder.endpointConfigName;
this.productionVariants = builder.productionVariants;
this.dataCaptureConfig = builder.dataCaptureConfig;
this.endpointStatus = builder.endpointStatus;
this.failureReason = builder.failureReason;
this.creationTime = builder.creationTime;
this.lastModifiedTime = builder.lastModifiedTime;
}
/**
*
* Name of the endpoint.
*
*
* @return Name of the endpoint.
*/
public String endpointName() {
return endpointName;
}
/**
*
* The Amazon Resource Name (ARN) of the endpoint.
*
*
* @return The Amazon Resource Name (ARN) of the endpoint.
*/
public String endpointArn() {
return endpointArn;
}
/**
*
* The name of the endpoint configuration associated with this endpoint.
*
*
* @return The name of the endpoint configuration associated with this endpoint.
*/
public String endpointConfigName() {
return endpointConfigName;
}
/**
* Returns true if the ProductionVariants property was specified by the sender (it may be empty), or false if the
* sender did not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS
* service.
*/
public boolean hasProductionVariants() {
return productionVariants != null && !(productionVariants instanceof SdkAutoConstructList);
}
/**
*
* An array of ProductionVariantSummary objects, one for each model hosted behind this endpoint.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasProductionVariants()} to see if a value was sent in this field.
*
*
* @return An array of ProductionVariantSummary objects, one for each model hosted behind this endpoint.
*/
public List productionVariants() {
return productionVariants;
}
/**
* Returns the value of the DataCaptureConfig property for this object.
*
* @return The value of the DataCaptureConfig property for this object.
*/
public DataCaptureConfigSummary dataCaptureConfig() {
return dataCaptureConfig;
}
/**
*
* The status of the endpoint.
*
*
* -
*
* OutOfService
: Endpoint is not available to take incoming requests.
*
*
* -
*
* Creating
: CreateEndpoint is executing.
*
*
* -
*
* Updating
: UpdateEndpoint or UpdateEndpointWeightsAndCapacities is executing.
*
*
* -
*
* SystemUpdating
: Endpoint is undergoing maintenance and cannot be updated or deleted or re-scaled
* until it has completed. This maintenance operation does not change any customer-specified values such as VPC
* config, KMS encryption, model, instance type, or instance count.
*
*
* -
*
* RollingBack
: Endpoint fails to scale up or down or change its variant weight and is in the process
* of rolling back to its previous configuration. Once the rollback completes, endpoint returns to an
* InService
status. This transitional status only applies to an endpoint that has autoscaling enabled
* and is undergoing variant weight or capacity changes as part of an UpdateEndpointWeightsAndCapacities call
* or when the UpdateEndpointWeightsAndCapacities operation is called explicitly.
*
*
* -
*
* InService
: Endpoint is available to process incoming requests.
*
*
* -
*
* Deleting
: DeleteEndpoint is executing.
*
*
* -
*
* Failed
: Endpoint could not be created, updated, or re-scaled. Use
* DescribeEndpointOutput$FailureReason for information about the failure. DeleteEndpoint is the only
* operation that can be performed on a failed endpoint.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #endpointStatus}
* will return {@link EndpointStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #endpointStatusAsString}.
*
*
* @return The status of the endpoint.
*
* -
*
* OutOfService
: Endpoint is not available to take incoming requests.
*
*
* -
*
* Creating
: CreateEndpoint is executing.
*
*
* -
*
* Updating
: UpdateEndpoint or UpdateEndpointWeightsAndCapacities is executing.
*
*
* -
*
* SystemUpdating
: Endpoint is undergoing maintenance and cannot be updated or deleted or
* re-scaled until it has completed. This maintenance operation does not change any customer-specified
* values such as VPC config, KMS encryption, model, instance type, or instance count.
*
*
* -
*
* RollingBack
: Endpoint fails to scale up or down or change its variant weight and is in the
* process of rolling back to its previous configuration. Once the rollback completes, endpoint returns to
* an InService
status. This transitional status only applies to an endpoint that has
* autoscaling enabled and is undergoing variant weight or capacity changes as part of an
* UpdateEndpointWeightsAndCapacities call or when the UpdateEndpointWeightsAndCapacities
* operation is called explicitly.
*
*
* -
*
* InService
: Endpoint is available to process incoming requests.
*
*
* -
*
* Deleting
: DeleteEndpoint is executing.
*
*
* -
*
* Failed
: Endpoint could not be created, updated, or re-scaled. Use
* DescribeEndpointOutput$FailureReason for information about the failure. DeleteEndpoint is
* the only operation that can be performed on a failed endpoint.
*
*
* @see EndpointStatus
*/
public EndpointStatus endpointStatus() {
return EndpointStatus.fromValue(endpointStatus);
}
/**
*
* The status of the endpoint.
*
*
* -
*
* OutOfService
: Endpoint is not available to take incoming requests.
*
*
* -
*
* Creating
: CreateEndpoint is executing.
*
*
* -
*
* Updating
: UpdateEndpoint or UpdateEndpointWeightsAndCapacities is executing.
*
*
* -
*
* SystemUpdating
: Endpoint is undergoing maintenance and cannot be updated or deleted or re-scaled
* until it has completed. This maintenance operation does not change any customer-specified values such as VPC
* config, KMS encryption, model, instance type, or instance count.
*
*
* -
*
* RollingBack
: Endpoint fails to scale up or down or change its variant weight and is in the process
* of rolling back to its previous configuration. Once the rollback completes, endpoint returns to an
* InService
status. This transitional status only applies to an endpoint that has autoscaling enabled
* and is undergoing variant weight or capacity changes as part of an UpdateEndpointWeightsAndCapacities call
* or when the UpdateEndpointWeightsAndCapacities operation is called explicitly.
*
*
* -
*
* InService
: Endpoint is available to process incoming requests.
*
*
* -
*
* Deleting
: DeleteEndpoint is executing.
*
*
* -
*
* Failed
: Endpoint could not be created, updated, or re-scaled. Use
* DescribeEndpointOutput$FailureReason for information about the failure. DeleteEndpoint is the only
* operation that can be performed on a failed endpoint.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #endpointStatus}
* will return {@link EndpointStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #endpointStatusAsString}.
*
*
* @return The status of the endpoint.
*
* -
*
* OutOfService
: Endpoint is not available to take incoming requests.
*
*
* -
*
* Creating
: CreateEndpoint is executing.
*
*
* -
*
* Updating
: UpdateEndpoint or UpdateEndpointWeightsAndCapacities is executing.
*
*
* -
*
* SystemUpdating
: Endpoint is undergoing maintenance and cannot be updated or deleted or
* re-scaled until it has completed. This maintenance operation does not change any customer-specified
* values such as VPC config, KMS encryption, model, instance type, or instance count.
*
*
* -
*
* RollingBack
: Endpoint fails to scale up or down or change its variant weight and is in the
* process of rolling back to its previous configuration. Once the rollback completes, endpoint returns to
* an InService
status. This transitional status only applies to an endpoint that has
* autoscaling enabled and is undergoing variant weight or capacity changes as part of an
* UpdateEndpointWeightsAndCapacities call or when the UpdateEndpointWeightsAndCapacities
* operation is called explicitly.
*
*
* -
*
* InService
: Endpoint is available to process incoming requests.
*
*
* -
*
* Deleting
: DeleteEndpoint is executing.
*
*
* -
*
* Failed
: Endpoint could not be created, updated, or re-scaled. Use
* DescribeEndpointOutput$FailureReason for information about the failure. DeleteEndpoint is
* the only operation that can be performed on a failed endpoint.
*
*
* @see EndpointStatus
*/
public String endpointStatusAsString() {
return endpointStatus;
}
/**
*
* If the status of the endpoint is Failed
, the reason why it failed.
*
*
* @return If the status of the endpoint is Failed
, the reason why it failed.
*/
public String failureReason() {
return failureReason;
}
/**
*
* A timestamp that shows when the endpoint was created.
*
*
* @return A timestamp that shows when the endpoint was created.
*/
public Instant creationTime() {
return creationTime;
}
/**
*
* A timestamp that shows when the endpoint was last modified.
*
*
* @return A timestamp that shows when the endpoint was last modified.
*/
public Instant lastModifiedTime() {
return lastModifiedTime;
}
@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 int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(endpointName());
hashCode = 31 * hashCode + Objects.hashCode(endpointArn());
hashCode = 31 * hashCode + Objects.hashCode(endpointConfigName());
hashCode = 31 * hashCode + Objects.hashCode(productionVariants());
hashCode = 31 * hashCode + Objects.hashCode(dataCaptureConfig());
hashCode = 31 * hashCode + Objects.hashCode(endpointStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(failureReason());
hashCode = 31 * hashCode + Objects.hashCode(creationTime());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
return hashCode;
}
@Override
public boolean equals(Object obj) {
return super.equals(obj) && equalsBySdkFields(obj);
}
@Override
public boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof DescribeEndpointResponse)) {
return false;
}
DescribeEndpointResponse other = (DescribeEndpointResponse) obj;
return Objects.equals(endpointName(), other.endpointName()) && Objects.equals(endpointArn(), other.endpointArn())
&& Objects.equals(endpointConfigName(), other.endpointConfigName())
&& Objects.equals(productionVariants(), other.productionVariants())
&& Objects.equals(dataCaptureConfig(), other.dataCaptureConfig())
&& Objects.equals(endpointStatusAsString(), other.endpointStatusAsString())
&& Objects.equals(failureReason(), other.failureReason()) && Objects.equals(creationTime(), other.creationTime())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime());
}
/**
* 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 String toString() {
return ToString.builder("DescribeEndpointResponse").add("EndpointName", endpointName()).add("EndpointArn", endpointArn())
.add("EndpointConfigName", endpointConfigName()).add("ProductionVariants", productionVariants())
.add("DataCaptureConfig", dataCaptureConfig()).add("EndpointStatus", endpointStatusAsString())
.add("FailureReason", failureReason()).add("CreationTime", creationTime())
.add("LastModifiedTime", lastModifiedTime()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "EndpointName":
return Optional.ofNullable(clazz.cast(endpointName()));
case "EndpointArn":
return Optional.ofNullable(clazz.cast(endpointArn()));
case "EndpointConfigName":
return Optional.ofNullable(clazz.cast(endpointConfigName()));
case "ProductionVariants":
return Optional.ofNullable(clazz.cast(productionVariants()));
case "DataCaptureConfig":
return Optional.ofNullable(clazz.cast(dataCaptureConfig()));
case "EndpointStatus":
return Optional.ofNullable(clazz.cast(endpointStatusAsString()));
case "FailureReason":
return Optional.ofNullable(clazz.cast(failureReason()));
case "CreationTime":
return Optional.ofNullable(clazz.cast(creationTime()));
case "LastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function