software.amazon.awssdk.services.sagemakerruntime.model.InvokeEndpointAsyncRequest Maven / Gradle / Ivy
Show all versions of sagemakerruntime 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.sagemakerruntime.model;
import java.beans.Transient;
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.awscore.AwsRequestOverrideConfiguration;
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 InvokeEndpointAsyncRequest extends SageMakerRuntimeRequest implements
ToCopyableBuilder {
private static final SdkField ENDPOINT_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("EndpointName").getter(getter(InvokeEndpointAsyncRequest::endpointName))
.setter(setter(Builder::endpointName))
.traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("EndpointName").build()).build();
private static final SdkField CONTENT_TYPE_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("ContentType")
.getter(getter(InvokeEndpointAsyncRequest::contentType))
.setter(setter(Builder::contentType))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("X-Amzn-SageMaker-Content-Type")
.build()).build();
private static final SdkField ACCEPT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Accept")
.getter(getter(InvokeEndpointAsyncRequest::accept)).setter(setter(Builder::accept))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("X-Amzn-SageMaker-Accept").build())
.build();
private static final SdkField CUSTOM_ATTRIBUTES_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("CustomAttributes")
.getter(getter(InvokeEndpointAsyncRequest::customAttributes))
.setter(setter(Builder::customAttributes))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("X-Amzn-SageMaker-Custom-Attributes")
.build()).build();
private static final SdkField INFERENCE_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("InferenceId")
.getter(getter(InvokeEndpointAsyncRequest::inferenceId))
.setter(setter(Builder::inferenceId))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("X-Amzn-SageMaker-Inference-Id")
.build()).build();
private static final SdkField INPUT_LOCATION_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("InputLocation")
.getter(getter(InvokeEndpointAsyncRequest::inputLocation))
.setter(setter(Builder::inputLocation))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("X-Amzn-SageMaker-InputLocation")
.build()).build();
private static final SdkField REQUEST_TTL_SECONDS_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("RequestTTLSeconds")
.getter(getter(InvokeEndpointAsyncRequest::requestTTLSeconds))
.setter(setter(Builder::requestTTLSeconds))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("X-Amzn-SageMaker-RequestTTLSeconds")
.build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ENDPOINT_NAME_FIELD,
CONTENT_TYPE_FIELD, ACCEPT_FIELD, CUSTOM_ATTRIBUTES_FIELD, INFERENCE_ID_FIELD, INPUT_LOCATION_FIELD,
REQUEST_TTL_SECONDS_FIELD));
private final String endpointName;
private final String contentType;
private final String accept;
private final String customAttributes;
private final String inferenceId;
private final String inputLocation;
private final Integer requestTTLSeconds;
private InvokeEndpointAsyncRequest(BuilderImpl builder) {
super(builder);
this.endpointName = builder.endpointName;
this.contentType = builder.contentType;
this.accept = builder.accept;
this.customAttributes = builder.customAttributes;
this.inferenceId = builder.inferenceId;
this.inputLocation = builder.inputLocation;
this.requestTTLSeconds = builder.requestTTLSeconds;
}
/**
*
* The name of the endpoint that you specified when you created the endpoint using the
* CreateEndpoint
API.
*
*
* @return The name of the endpoint that you specified when you created the endpoint using the
* CreateEndpoint
API.
*/
public final String endpointName() {
return endpointName;
}
/**
*
* The MIME type of the input data in the request body.
*
*
* @return The MIME type of the input data in the request body.
*/
public final String contentType() {
return contentType;
}
/**
*
* The desired MIME type of the inference in the response.
*
*
* @return The desired MIME type of the inference in the response.
*/
public final String accept() {
return accept;
}
/**
*
* Provides additional information about a request for an inference submitted to a model hosted at an Amazon
* SageMaker endpoint. The information is an opaque value that is forwarded verbatim. You could use this value, for
* example, to provide an ID that you can use to track a request or to provide other metadata that a service
* endpoint was programmed to process. The value must consist of no more than 1024 visible US-ASCII characters as
* specified in Section 3.3.6. Field Value
* Components of the Hypertext Transfer Protocol (HTTP/1.1).
*
*
* The code in your model is responsible for setting or updating any custom attributes in the response. If your code
* does not set this value in the response, an empty value is returned. For example, if a custom attribute
* represents the trace ID, your model can prepend the custom attribute with Trace ID
: in your
* post-processing function.
*
*
* This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker Python SDK.
*
*
* @return Provides additional information about a request for an inference submitted to a model hosted at an Amazon
* SageMaker endpoint. The information is an opaque value that is forwarded verbatim. You could use this
* value, for example, to provide an ID that you can use to track a request or to provide other metadata
* that a service endpoint was programmed to process. The value must consist of no more than 1024 visible
* US-ASCII characters as specified in Section 3.3.6. Field Value
* Components of the Hypertext Transfer Protocol (HTTP/1.1).
*
* The code in your model is responsible for setting or updating any custom attributes in the response. If
* your code does not set this value in the response, an empty value is returned. For example, if a custom
* attribute represents the trace ID, your model can prepend the custom attribute with Trace ID
* : in your post-processing function.
*
*
* This feature is currently supported in the Amazon Web Services SDKs but not in the Amazon SageMaker
* Python SDK.
*/
public final String customAttributes() {
return customAttributes;
}
/**
*
* The identifier for the inference request. Amazon SageMaker will generate an identifier for you if none is
* specified.
*
*
* @return The identifier for the inference request. Amazon SageMaker will generate an identifier for you if none is
* specified.
*/
public final String inferenceId() {
return inferenceId;
}
/**
*
* The Amazon S3 URI where the inference request payload is stored.
*
*
* @return The Amazon S3 URI where the inference request payload is stored.
*/
public final String inputLocation() {
return inputLocation;
}
/**
*
* Maximum age in seconds a request can be in the queue before it is marked as expired.
*
*
* @return Maximum age in seconds a request can be in the queue before it is marked as expired.
*/
public final Integer requestTTLSeconds() {
return requestTTLSeconds;
}
@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(endpointName());
hashCode = 31 * hashCode + Objects.hashCode(contentType());
hashCode = 31 * hashCode + Objects.hashCode(accept());
hashCode = 31 * hashCode + Objects.hashCode(customAttributes());
hashCode = 31 * hashCode + Objects.hashCode(inferenceId());
hashCode = 31 * hashCode + Objects.hashCode(inputLocation());
hashCode = 31 * hashCode + Objects.hashCode(requestTTLSeconds());
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 InvokeEndpointAsyncRequest)) {
return false;
}
InvokeEndpointAsyncRequest other = (InvokeEndpointAsyncRequest) obj;
return Objects.equals(endpointName(), other.endpointName()) && Objects.equals(contentType(), other.contentType())
&& Objects.equals(accept(), other.accept()) && Objects.equals(customAttributes(), other.customAttributes())
&& Objects.equals(inferenceId(), other.inferenceId()) && Objects.equals(inputLocation(), other.inputLocation())
&& Objects.equals(requestTTLSeconds(), other.requestTTLSeconds());
}
/**
* 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("InvokeEndpointAsyncRequest").add("EndpointName", endpointName())
.add("ContentType", contentType()).add("Accept", accept())
.add("CustomAttributes", customAttributes() == null ? null : "*** Sensitive Data Redacted ***")
.add("InferenceId", inferenceId()).add("InputLocation", inputLocation())
.add("RequestTTLSeconds", requestTTLSeconds()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "EndpointName":
return Optional.ofNullable(clazz.cast(endpointName()));
case "ContentType":
return Optional.ofNullable(clazz.cast(contentType()));
case "Accept":
return Optional.ofNullable(clazz.cast(accept()));
case "CustomAttributes":
return Optional.ofNullable(clazz.cast(customAttributes()));
case "InferenceId":
return Optional.ofNullable(clazz.cast(inferenceId()));
case "InputLocation":
return Optional.ofNullable(clazz.cast(inputLocation()));
case "RequestTTLSeconds":
return Optional.ofNullable(clazz.cast(requestTTLSeconds()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function