software.amazon.awssdk.services.bedrock.model.GetModelInvocationJobResponse Maven / Gradle / Ivy
Show all versions of bedrock 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.bedrock.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.core.traits.TimestampFormatTrait;
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 GetModelInvocationJobResponse extends BedrockResponse implements
ToCopyableBuilder {
private static final SdkField JOB_ARN_FIELD = SdkField. builder(MarshallingType.STRING).memberName("jobArn")
.getter(getter(GetModelInvocationJobResponse::jobArn)).setter(setter(Builder::jobArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobArn").build()).build();
private static final SdkField JOB_NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("jobName").getter(getter(GetModelInvocationJobResponse::jobName)).setter(setter(Builder::jobName))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobName").build()).build();
private static final SdkField MODEL_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("modelId").getter(getter(GetModelInvocationJobResponse::modelId)).setter(setter(Builder::modelId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("modelId").build()).build();
private static final SdkField CLIENT_REQUEST_TOKEN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("clientRequestToken").getter(getter(GetModelInvocationJobResponse::clientRequestToken))
.setter(setter(Builder::clientRequestToken))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("clientRequestToken").build())
.build();
private static final SdkField ROLE_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("roleArn").getter(getter(GetModelInvocationJobResponse::roleArn)).setter(setter(Builder::roleArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("roleArn").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("status")
.getter(getter(GetModelInvocationJobResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("status").build()).build();
private static final SdkField MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("message")
.getter(getter(GetModelInvocationJobResponse::message)).setter(setter(Builder::message))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("message").build()).build();
private static final SdkField SUBMIT_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("submitTime")
.getter(getter(GetModelInvocationJobResponse::submitTime))
.setter(setter(Builder::submitTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("submitTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField LAST_MODIFIED_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("lastModifiedTime")
.getter(getter(GetModelInvocationJobResponse::lastModifiedTime))
.setter(setter(Builder::lastModifiedTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("lastModifiedTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField END_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("endTime")
.getter(getter(GetModelInvocationJobResponse::endTime))
.setter(setter(Builder::endTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("endTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final SdkField INPUT_DATA_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("inputDataConfig")
.getter(getter(GetModelInvocationJobResponse::inputDataConfig)).setter(setter(Builder::inputDataConfig))
.constructor(ModelInvocationJobInputDataConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("inputDataConfig").build()).build();
private static final SdkField OUTPUT_DATA_CONFIG_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("outputDataConfig")
.getter(getter(GetModelInvocationJobResponse::outputDataConfig)).setter(setter(Builder::outputDataConfig))
.constructor(ModelInvocationJobOutputDataConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("outputDataConfig").build()).build();
private static final SdkField VPC_CONFIG_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("vpcConfig").getter(getter(GetModelInvocationJobResponse::vpcConfig)).setter(setter(Builder::vpcConfig))
.constructor(VpcConfig::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("vpcConfig").build()).build();
private static final SdkField TIMEOUT_DURATION_IN_HOURS_FIELD = SdkField. builder(MarshallingType.INTEGER)
.memberName("timeoutDurationInHours").getter(getter(GetModelInvocationJobResponse::timeoutDurationInHours))
.setter(setter(Builder::timeoutDurationInHours))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("timeoutDurationInHours").build())
.build();
private static final SdkField JOB_EXPIRATION_TIME_FIELD = SdkField
. builder(MarshallingType.INSTANT)
.memberName("jobExpirationTime")
.getter(getter(GetModelInvocationJobResponse::jobExpirationTime))
.setter(setter(Builder::jobExpirationTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("jobExpirationTime").build(),
TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(JOB_ARN_FIELD, JOB_NAME_FIELD,
MODEL_ID_FIELD, CLIENT_REQUEST_TOKEN_FIELD, ROLE_ARN_FIELD, STATUS_FIELD, MESSAGE_FIELD, SUBMIT_TIME_FIELD,
LAST_MODIFIED_TIME_FIELD, END_TIME_FIELD, INPUT_DATA_CONFIG_FIELD, OUTPUT_DATA_CONFIG_FIELD, VPC_CONFIG_FIELD,
TIMEOUT_DURATION_IN_HOURS_FIELD, JOB_EXPIRATION_TIME_FIELD));
private final String jobArn;
private final String jobName;
private final String modelId;
private final String clientRequestToken;
private final String roleArn;
private final String status;
private final String message;
private final Instant submitTime;
private final Instant lastModifiedTime;
private final Instant endTime;
private final ModelInvocationJobInputDataConfig inputDataConfig;
private final ModelInvocationJobOutputDataConfig outputDataConfig;
private final VpcConfig vpcConfig;
private final Integer timeoutDurationInHours;
private final Instant jobExpirationTime;
private GetModelInvocationJobResponse(BuilderImpl builder) {
super(builder);
this.jobArn = builder.jobArn;
this.jobName = builder.jobName;
this.modelId = builder.modelId;
this.clientRequestToken = builder.clientRequestToken;
this.roleArn = builder.roleArn;
this.status = builder.status;
this.message = builder.message;
this.submitTime = builder.submitTime;
this.lastModifiedTime = builder.lastModifiedTime;
this.endTime = builder.endTime;
this.inputDataConfig = builder.inputDataConfig;
this.outputDataConfig = builder.outputDataConfig;
this.vpcConfig = builder.vpcConfig;
this.timeoutDurationInHours = builder.timeoutDurationInHours;
this.jobExpirationTime = builder.jobExpirationTime;
}
/**
*
* The Amazon Resource Name (ARN) of the batch inference job.
*
*
* @return The Amazon Resource Name (ARN) of the batch inference job.
*/
public final String jobArn() {
return jobArn;
}
/**
*
* The name of the batch inference job.
*
*
* @return The name of the batch inference job.
*/
public final String jobName() {
return jobName;
}
/**
*
* The unique identifier of the foundation model used for model inference.
*
*
* @return The unique identifier of the foundation model used for model inference.
*/
public final String modelId() {
return modelId;
}
/**
*
* A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token
* matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more
* information, see Ensuring
* idempotency.
*
*
* @return A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If
* this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error.
* For more information, see Ensuring
* idempotency.
*/
public final String clientRequestToken() {
return clientRequestToken;
}
/**
*
* The Amazon Resource Name (ARN) of the service role with permissions to carry out and manage batch inference. You
* can use the console to create a default service role or follow the steps at Create a service role for batch
* inference.
*
*
* @return The Amazon Resource Name (ARN) of the service role with permissions to carry out and manage batch
* inference. You can use the console to create a default service role or follow the steps at Create a service role for
* batch inference.
*/
public final String roleArn() {
return roleArn;
}
/**
*
* The status of the batch inference job.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ModelInvocationJobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return The status of the batch inference job.
* @see ModelInvocationJobStatus
*/
public final ModelInvocationJobStatus status() {
return ModelInvocationJobStatus.fromValue(status);
}
/**
*
* The status of the batch inference job.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link ModelInvocationJobStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is
* available from {@link #statusAsString}.
*
*
* @return The status of the batch inference job.
* @see ModelInvocationJobStatus
*/
public final String statusAsString() {
return status;
}
/**
*
* If the batch inference job failed, this field contains a message describing why the job failed.
*
*
* @return If the batch inference job failed, this field contains a message describing why the job failed.
*/
public final String message() {
return message;
}
/**
*
* The time at which the batch inference job was submitted.
*
*
* @return The time at which the batch inference job was submitted.
*/
public final Instant submitTime() {
return submitTime;
}
/**
*
* The time at which the batch inference job was last modified.
*
*
* @return The time at which the batch inference job was last modified.
*/
public final Instant lastModifiedTime() {
return lastModifiedTime;
}
/**
*
* The time at which the batch inference job ended.
*
*
* @return The time at which the batch inference job ended.
*/
public final Instant endTime() {
return endTime;
}
/**
*
* Details about the location of the input to the batch inference job.
*
*
* @return Details about the location of the input to the batch inference job.
*/
public final ModelInvocationJobInputDataConfig inputDataConfig() {
return inputDataConfig;
}
/**
*
* Details about the location of the output of the batch inference job.
*
*
* @return Details about the location of the output of the batch inference job.
*/
public final ModelInvocationJobOutputDataConfig outputDataConfig() {
return outputDataConfig;
}
/**
*
* The configuration of the Virtual Private Cloud (VPC) for the data in the batch inference job. For more
* information, see Protect batch
* inference jobs using a VPC.
*
*
* @return The configuration of the Virtual Private Cloud (VPC) for the data in the batch inference job. For more
* information, see Protect batch inference
* jobs using a VPC.
*/
public final VpcConfig vpcConfig() {
return vpcConfig;
}
/**
*
* The number of hours after which batch inference job was set to time out.
*
*
* @return The number of hours after which batch inference job was set to time out.
*/
public final Integer timeoutDurationInHours() {
return timeoutDurationInHours;
}
/**
*
* The time at which the batch inference job times or timed out.
*
*
* @return The time at which the batch inference job times or timed out.
*/
public final Instant jobExpirationTime() {
return jobExpirationTime;
}
@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(jobArn());
hashCode = 31 * hashCode + Objects.hashCode(jobName());
hashCode = 31 * hashCode + Objects.hashCode(modelId());
hashCode = 31 * hashCode + Objects.hashCode(clientRequestToken());
hashCode = 31 * hashCode + Objects.hashCode(roleArn());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(message());
hashCode = 31 * hashCode + Objects.hashCode(submitTime());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedTime());
hashCode = 31 * hashCode + Objects.hashCode(endTime());
hashCode = 31 * hashCode + Objects.hashCode(inputDataConfig());
hashCode = 31 * hashCode + Objects.hashCode(outputDataConfig());
hashCode = 31 * hashCode + Objects.hashCode(vpcConfig());
hashCode = 31 * hashCode + Objects.hashCode(timeoutDurationInHours());
hashCode = 31 * hashCode + Objects.hashCode(jobExpirationTime());
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 GetModelInvocationJobResponse)) {
return false;
}
GetModelInvocationJobResponse other = (GetModelInvocationJobResponse) obj;
return Objects.equals(jobArn(), other.jobArn()) && Objects.equals(jobName(), other.jobName())
&& Objects.equals(modelId(), other.modelId()) && Objects.equals(clientRequestToken(), other.clientRequestToken())
&& Objects.equals(roleArn(), other.roleArn()) && Objects.equals(statusAsString(), other.statusAsString())
&& Objects.equals(message(), other.message()) && Objects.equals(submitTime(), other.submitTime())
&& Objects.equals(lastModifiedTime(), other.lastModifiedTime()) && Objects.equals(endTime(), other.endTime())
&& Objects.equals(inputDataConfig(), other.inputDataConfig())
&& Objects.equals(outputDataConfig(), other.outputDataConfig()) && Objects.equals(vpcConfig(), other.vpcConfig())
&& Objects.equals(timeoutDurationInHours(), other.timeoutDurationInHours())
&& Objects.equals(jobExpirationTime(), other.jobExpirationTime());
}
/**
* 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("GetModelInvocationJobResponse").add("JobArn", jobArn()).add("JobName", jobName())
.add("ModelId", modelId()).add("ClientRequestToken", clientRequestToken()).add("RoleArn", roleArn())
.add("Status", statusAsString()).add("Message", message() == null ? null : "*** Sensitive Data Redacted ***")
.add("SubmitTime", submitTime()).add("LastModifiedTime", lastModifiedTime()).add("EndTime", endTime())
.add("InputDataConfig", inputDataConfig()).add("OutputDataConfig", outputDataConfig())
.add("VpcConfig", vpcConfig()).add("TimeoutDurationInHours", timeoutDurationInHours())
.add("JobExpirationTime", jobExpirationTime()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "jobArn":
return Optional.ofNullable(clazz.cast(jobArn()));
case "jobName":
return Optional.ofNullable(clazz.cast(jobName()));
case "modelId":
return Optional.ofNullable(clazz.cast(modelId()));
case "clientRequestToken":
return Optional.ofNullable(clazz.cast(clientRequestToken()));
case "roleArn":
return Optional.ofNullable(clazz.cast(roleArn()));
case "status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "message":
return Optional.ofNullable(clazz.cast(message()));
case "submitTime":
return Optional.ofNullable(clazz.cast(submitTime()));
case "lastModifiedTime":
return Optional.ofNullable(clazz.cast(lastModifiedTime()));
case "endTime":
return Optional.ofNullable(clazz.cast(endTime()));
case "inputDataConfig":
return Optional.ofNullable(clazz.cast(inputDataConfig()));
case "outputDataConfig":
return Optional.ofNullable(clazz.cast(outputDataConfig()));
case "vpcConfig":
return Optional.ofNullable(clazz.cast(vpcConfig()));
case "timeoutDurationInHours":
return Optional.ofNullable(clazz.cast(timeoutDurationInHours()));
case "jobExpirationTime":
return Optional.ofNullable(clazz.cast(jobExpirationTime()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function