software.amazon.awssdk.services.sagemaker.model.EndpointMetadata 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.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.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 metadata of the endpoint.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class EndpointMetadata implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ENDPOINT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointName").getter(getter(EndpointMetadata::endpointName)).setter(setter(Builder::endpointName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointName").build()).build();
private static final SdkField ENDPOINT_CONFIG_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointConfigName").getter(getter(EndpointMetadata::endpointConfigName))
.setter(setter(Builder::endpointConfigName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointConfigName").build())
.build();
private static final SdkField ENDPOINT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointStatus").getter(getter(EndpointMetadata::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)
.memberName("FailureReason").getter(getter(EndpointMetadata::failureReason)).setter(setter(Builder::failureReason))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FailureReason").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENDPOINT_NAME_FIELD,
ENDPOINT_CONFIG_NAME_FIELD, ENDPOINT_STATUS_FIELD, FAILURE_REASON_FIELD));
private static final long serialVersionUID = 1L;
private final String endpointName;
private final String endpointConfigName;
private final String endpointStatus;
private final String failureReason;
private EndpointMetadata(BuilderImpl builder) {
this.endpointName = builder.endpointName;
this.endpointConfigName = builder.endpointConfigName;
this.endpointStatus = builder.endpointStatus;
this.failureReason = builder.failureReason;
}
/**
*
* The name of the endpoint.
*
*
* @return The name of the endpoint.
*/
public final String endpointName() {
return endpointName;
}
/**
*
* The name of the endpoint configuration.
*
*
* @return The name of the endpoint configuration.
*/
public final String endpointConfigName() {
return endpointConfigName;
}
/**
*
* The status of the endpoint. For possible values of the status of an endpoint, see EndpointSummary.
*
*
* 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. For possible values of the status of an endpoint, see EndpointSummary.
* @see EndpointStatus
*/
public final EndpointStatus endpointStatus() {
return EndpointStatus.fromValue(endpointStatus);
}
/**
*
* The status of the endpoint. For possible values of the status of an endpoint, see EndpointSummary.
*
*
* 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. For possible values of the status of an endpoint, see EndpointSummary.
* @see EndpointStatus
*/
public final String endpointStatusAsString() {
return endpointStatus;
}
/**
*
* If the status of the endpoint is Failed
, or the status is InService
but update
* operation fails, this provides the reason why it failed.
*
*
* @return If the status of the endpoint is Failed
, or the status is InService
but update
* operation fails, this provides the reason why it failed.
*/
public final String failureReason() {
return failureReason;
}
@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 + Objects.hashCode(endpointName());
hashCode = 31 * hashCode + Objects.hashCode(endpointConfigName());
hashCode = 31 * hashCode + Objects.hashCode(endpointStatusAsString());
hashCode = 31 * hashCode + Objects.hashCode(failureReason());
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 EndpointMetadata)) {
return false;
}
EndpointMetadata other = (EndpointMetadata) obj;
return Objects.equals(endpointName(), other.endpointName())
&& Objects.equals(endpointConfigName(), other.endpointConfigName())
&& Objects.equals(endpointStatusAsString(), other.endpointStatusAsString())
&& Objects.equals(failureReason(), other.failureReason());
}
/**
* 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("EndpointMetadata").add("EndpointName", endpointName())
.add("EndpointConfigName", endpointConfigName()).add("EndpointStatus", endpointStatusAsString())
.add("FailureReason", failureReason()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "EndpointName":
return Optional.ofNullable(clazz.cast(endpointName()));
case "EndpointConfigName":
return Optional.ofNullable(clazz.cast(endpointConfigName()));
case "EndpointStatus":
return Optional.ofNullable(clazz.cast(endpointStatusAsString()));
case "FailureReason":
return Optional.ofNullable(clazz.cast(failureReason()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function