software.amazon.awssdk.services.machinelearning.model.RealtimeEndpointInfo 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.machinelearning.model;
import java.io.Serializable;
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.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;
/**
*
* Describes the real-time endpoint information for an MLModel
.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class RealtimeEndpointInfo implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField PEAK_REQUESTS_PER_SECOND_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("PeakRequestsPerSecond").getter(getter(RealtimeEndpointInfo::peakRequestsPerSecond))
.setter(setter(Builder::peakRequestsPerSecond))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("PeakRequestsPerSecond").build())
.build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.memberName("CreatedAt").getter(getter(RealtimeEndpointInfo::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedAt").build()).build();
private static final SdkField ENDPOINT_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointUrl").getter(getter(RealtimeEndpointInfo::endpointUrl)).setter(setter(Builder::endpointUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointUrl").build()).build();
private static final SdkField ENDPOINT_STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointStatus").getter(getter(RealtimeEndpointInfo::endpointStatusAsString))
.setter(setter(Builder::endpointStatus))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EndpointStatus").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
PEAK_REQUESTS_PER_SECOND_FIELD, CREATED_AT_FIELD, ENDPOINT_URL_FIELD, ENDPOINT_STATUS_FIELD));
private static final long serialVersionUID = 1L;
private final Integer peakRequestsPerSecond;
private final Instant createdAt;
private final String endpointUrl;
private final String endpointStatus;
private RealtimeEndpointInfo(BuilderImpl builder) {
this.peakRequestsPerSecond = builder.peakRequestsPerSecond;
this.createdAt = builder.createdAt;
this.endpointUrl = builder.endpointUrl;
this.endpointStatus = builder.endpointStatus;
}
/**
*
* The maximum processing rate for the real-time endpoint for MLModel
, measured in incoming requests
* per second.
*
*
* @return The maximum processing rate for the real-time endpoint for MLModel
, measured in incoming
* requests per second.
*/
public final Integer peakRequestsPerSecond() {
return peakRequestsPerSecond;
}
/**
*
* The time that the request to create the real-time endpoint for the MLModel
was received. The time is
* expressed in epoch time.
*
*
* @return The time that the request to create the real-time endpoint for the MLModel
was received. The
* time is expressed in epoch time.
*/
public final Instant createdAt() {
return createdAt;
}
/**
*
* The URI that specifies where to send real-time prediction requests for the MLModel
.
*
* Note
*
* The application must wait until the real-time endpoint is ready before using this URI.
*
*
*
* @return The URI that specifies where to send real-time prediction requests for the MLModel
.
* Note
*
* The application must wait until the real-time endpoint is ready before using this URI.
*
*/
public final String endpointUrl() {
return endpointUrl;
}
/**
*
* The current status of the real-time endpoint for the MLModel
. This element can have one of the
* following values:
*
*
* -
NONE
- Endpoint does not exist or was previously deleted.
* -
READY
- Endpoint is ready to be used for real-time predictions.
* -
UPDATING
- Updating/creating the endpoint.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #endpointStatus}
* will return {@link RealtimeEndpointStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #endpointStatusAsString}.
*
*
* @return The current status of the real-time endpoint for the MLModel
. This element can have one of
* the following values:
*
* -
NONE
- Endpoint does not exist or was previously deleted.
* -
READY
- Endpoint is ready to be used for real-time predictions.
* -
UPDATING
- Updating/creating the endpoint.
* @see RealtimeEndpointStatus
*/
public final RealtimeEndpointStatus endpointStatus() {
return RealtimeEndpointStatus.fromValue(endpointStatus);
}
/**
*
* The current status of the real-time endpoint for the MLModel
. This element can have one of the
* following values:
*
*
* -
NONE
- Endpoint does not exist or was previously deleted.
* -
READY
- Endpoint is ready to be used for real-time predictions.
* -
UPDATING
- Updating/creating the endpoint.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #endpointStatus}
* will return {@link RealtimeEndpointStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #endpointStatusAsString}.
*
*
* @return The current status of the real-time endpoint for the MLModel
. This element can have one of
* the following values:
*
* -
NONE
- Endpoint does not exist or was previously deleted.
* -
READY
- Endpoint is ready to be used for real-time predictions.
* -
UPDATING
- Updating/creating the endpoint.
* @see RealtimeEndpointStatus
*/
public final String endpointStatusAsString() {
return endpointStatus;
}
@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(peakRequestsPerSecond());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(endpointUrl());
hashCode = 31 * hashCode + Objects.hashCode(endpointStatusAsString());
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 RealtimeEndpointInfo)) {
return false;
}
RealtimeEndpointInfo other = (RealtimeEndpointInfo) obj;
return Objects.equals(peakRequestsPerSecond(), other.peakRequestsPerSecond())
&& Objects.equals(createdAt(), other.createdAt()) && Objects.equals(endpointUrl(), other.endpointUrl())
&& Objects.equals(endpointStatusAsString(), other.endpointStatusAsString());
}
/**
* 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("RealtimeEndpointInfo").add("PeakRequestsPerSecond", peakRequestsPerSecond())
.add("CreatedAt", createdAt()).add("EndpointUrl", endpointUrl()).add("EndpointStatus", endpointStatusAsString())
.build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "PeakRequestsPerSecond":
return Optional.ofNullable(clazz.cast(peakRequestsPerSecond()));
case "CreatedAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "EndpointUrl":
return Optional.ofNullable(clazz.cast(endpointUrl()));
case "EndpointStatus":
return Optional.ofNullable(clazz.cast(endpointStatusAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function