
software.amazon.awssdk.services.machinelearning.model.GetBatchPredictionResponse Maven / Gradle / Ivy
/*
* Copyright 2014-2019 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.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;
/**
*
* Represents the output of a GetBatchPrediction
operation and describes a BatchPrediction
.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class GetBatchPredictionResponse extends MachineLearningResponse implements
ToCopyableBuilder {
private static final SdkField BATCH_PREDICTION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::batchPredictionId)).setter(setter(Builder::batchPredictionId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BatchPredictionId").build()).build();
private static final SdkField ML_MODEL_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::mlModelId)).setter(setter(Builder::mlModelId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MLModelId").build()).build();
private static final SdkField BATCH_PREDICTION_DATA_SOURCE_ID_FIELD = SdkField
. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::batchPredictionDataSourceId))
.setter(setter(Builder::batchPredictionDataSourceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BatchPredictionDataSourceId")
.build()).build();
private static final SdkField INPUT_DATA_LOCATION_S3_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::inputDataLocationS3)).setter(setter(Builder::inputDataLocationS3))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InputDataLocationS3").build())
.build();
private static final SdkField CREATED_BY_IAM_USER_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::createdByIamUser)).setter(setter(Builder::createdByIamUser))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedByIamUser").build()).build();
private static final SdkField CREATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(GetBatchPredictionResponse::createdAt)).setter(setter(Builder::createdAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedAt").build()).build();
private static final SdkField LAST_UPDATED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(GetBatchPredictionResponse::lastUpdatedAt)).setter(setter(Builder::lastUpdatedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastUpdatedAt").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::statusAsString)).setter(setter(Builder::status))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build();
private static final SdkField OUTPUT_URI_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::outputUri)).setter(setter(Builder::outputUri))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("OutputUri").build()).build();
private static final SdkField LOG_URI_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::logUri)).setter(setter(Builder::logUri))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LogUri").build()).build();
private static final SdkField MESSAGE_FIELD = SdkField. builder(MarshallingType.STRING)
.getter(getter(GetBatchPredictionResponse::message)).setter(setter(Builder::message))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Message").build()).build();
private static final SdkField COMPUTE_TIME_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(GetBatchPredictionResponse::computeTime)).setter(setter(Builder::computeTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ComputeTime").build()).build();
private static final SdkField FINISHED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(GetBatchPredictionResponse::finishedAt)).setter(setter(Builder::finishedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("FinishedAt").build()).build();
private static final SdkField STARTED_AT_FIELD = SdkField. builder(MarshallingType.INSTANT)
.getter(getter(GetBatchPredictionResponse::startedAt)).setter(setter(Builder::startedAt))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartedAt").build()).build();
private static final SdkField TOTAL_RECORD_COUNT_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(GetBatchPredictionResponse::totalRecordCount)).setter(setter(Builder::totalRecordCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalRecordCount").build()).build();
private static final SdkField INVALID_RECORD_COUNT_FIELD = SdkField. builder(MarshallingType.LONG)
.getter(getter(GetBatchPredictionResponse::invalidRecordCount)).setter(setter(Builder::invalidRecordCount))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InvalidRecordCount").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BATCH_PREDICTION_ID_FIELD,
ML_MODEL_ID_FIELD, BATCH_PREDICTION_DATA_SOURCE_ID_FIELD, INPUT_DATA_LOCATION_S3_FIELD, CREATED_BY_IAM_USER_FIELD,
CREATED_AT_FIELD, LAST_UPDATED_AT_FIELD, NAME_FIELD, STATUS_FIELD, OUTPUT_URI_FIELD, LOG_URI_FIELD, MESSAGE_FIELD,
COMPUTE_TIME_FIELD, FINISHED_AT_FIELD, STARTED_AT_FIELD, TOTAL_RECORD_COUNT_FIELD, INVALID_RECORD_COUNT_FIELD));
private final String batchPredictionId;
private final String mlModelId;
private final String batchPredictionDataSourceId;
private final String inputDataLocationS3;
private final String createdByIamUser;
private final Instant createdAt;
private final Instant lastUpdatedAt;
private final String name;
private final String status;
private final String outputUri;
private final String logUri;
private final String message;
private final Long computeTime;
private final Instant finishedAt;
private final Instant startedAt;
private final Long totalRecordCount;
private final Long invalidRecordCount;
private GetBatchPredictionResponse(BuilderImpl builder) {
super(builder);
this.batchPredictionId = builder.batchPredictionId;
this.mlModelId = builder.mlModelId;
this.batchPredictionDataSourceId = builder.batchPredictionDataSourceId;
this.inputDataLocationS3 = builder.inputDataLocationS3;
this.createdByIamUser = builder.createdByIamUser;
this.createdAt = builder.createdAt;
this.lastUpdatedAt = builder.lastUpdatedAt;
this.name = builder.name;
this.status = builder.status;
this.outputUri = builder.outputUri;
this.logUri = builder.logUri;
this.message = builder.message;
this.computeTime = builder.computeTime;
this.finishedAt = builder.finishedAt;
this.startedAt = builder.startedAt;
this.totalRecordCount = builder.totalRecordCount;
this.invalidRecordCount = builder.invalidRecordCount;
}
/**
*
* An ID assigned to the BatchPrediction
at creation. This value should be identical to the value of
* the BatchPredictionID
in the request.
*
*
* @return An ID assigned to the BatchPrediction
at creation. This value should be identical to the
* value of the BatchPredictionID
in the request.
*/
public String batchPredictionId() {
return batchPredictionId;
}
/**
*
* The ID of the MLModel
that generated predictions for the BatchPrediction
request.
*
*
* @return The ID of the MLModel
that generated predictions for the BatchPrediction
* request.
*/
public String mlModelId() {
return mlModelId;
}
/**
*
* The ID of the DataSource
that was used to create the BatchPrediction
.
*
*
* @return The ID of the DataSource
that was used to create the BatchPrediction
.
*/
public String batchPredictionDataSourceId() {
return batchPredictionDataSourceId;
}
/**
*
* The location of the data file or directory in Amazon Simple Storage Service (Amazon S3).
*
*
* @return The location of the data file or directory in Amazon Simple Storage Service (Amazon S3).
*/
public String inputDataLocationS3() {
return inputDataLocationS3;
}
/**
*
* The AWS user account that invoked the BatchPrediction
. The account type can be either an AWS root
* account or an AWS Identity and Access Management (IAM) user account.
*
*
* @return The AWS user account that invoked the BatchPrediction
. The account type can be either an AWS
* root account or an AWS Identity and Access Management (IAM) user account.
*/
public String createdByIamUser() {
return createdByIamUser;
}
/**
*
* The time when the BatchPrediction
was created. The time is expressed in epoch time.
*
*
* @return The time when the BatchPrediction
was created. The time is expressed in epoch time.
*/
public Instant createdAt() {
return createdAt;
}
/**
*
* The time of the most recent edit to BatchPrediction
. The time is expressed in epoch time.
*
*
* @return The time of the most recent edit to BatchPrediction
. The time is expressed in epoch time.
*/
public Instant lastUpdatedAt() {
return lastUpdatedAt;
}
/**
*
* A user-supplied name or description of the BatchPrediction
.
*
*
* @return A user-supplied name or description of the BatchPrediction
.
*/
public String name() {
return name;
}
/**
*
* The status of the BatchPrediction
, which can be one of the following values:
*
*
* -
PENDING
- Amazon Machine Learning (Amazon ML) submitted a request to generate batch predictions.
*
* -
INPROGRESS
- The batch predictions are in progress.
* -
FAILED
- The request to perform a batch prediction did not run to completion. It is not usable.
* -
COMPLETED
- The batch prediction process completed successfully.
* -
DELETED
- The BatchPrediction
is marked as deleted. It is not usable.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link EntityStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the BatchPrediction
, which can be one of the following values:
*
* -
PENDING
- Amazon Machine Learning (Amazon ML) submitted a request to generate batch
* predictions.
* -
INPROGRESS
- The batch predictions are in progress.
* -
FAILED
- The request to perform a batch prediction did not run to completion. It is not
* usable.
* -
COMPLETED
- The batch prediction process completed successfully.
* -
DELETED
- The BatchPrediction
is marked as deleted. It is not usable.
* @see EntityStatus
*/
public EntityStatus status() {
return EntityStatus.fromValue(status);
}
/**
*
* The status of the BatchPrediction
, which can be one of the following values:
*
*
* -
PENDING
- Amazon Machine Learning (Amazon ML) submitted a request to generate batch predictions.
*
* -
INPROGRESS
- The batch predictions are in progress.
* -
FAILED
- The request to perform a batch prediction did not run to completion. It is not usable.
* -
COMPLETED
- The batch prediction process completed successfully.
* -
DELETED
- The BatchPrediction
is marked as deleted. It is not usable.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #status} will
* return {@link EntityStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #statusAsString}.
*
*
* @return The status of the BatchPrediction
, which can be one of the following values:
*
* -
PENDING
- Amazon Machine Learning (Amazon ML) submitted a request to generate batch
* predictions.
* -
INPROGRESS
- The batch predictions are in progress.
* -
FAILED
- The request to perform a batch prediction did not run to completion. It is not
* usable.
* -
COMPLETED
- The batch prediction process completed successfully.
* -
DELETED
- The BatchPrediction
is marked as deleted. It is not usable.
* @see EntityStatus
*/
public String statusAsString() {
return status;
}
/**
*
* The location of an Amazon S3 bucket or directory to receive the operation results.
*
*
* @return The location of an Amazon S3 bucket or directory to receive the operation results.
*/
public String outputUri() {
return outputUri;
}
/**
*
* A link to the file that contains logs of the CreateBatchPrediction
operation.
*
*
* @return A link to the file that contains logs of the CreateBatchPrediction
operation.
*/
public String logUri() {
return logUri;
}
/**
*
* A description of the most recent details about processing the batch prediction request.
*
*
* @return A description of the most recent details about processing the batch prediction request.
*/
public String message() {
return message;
}
/**
*
* The approximate CPU time in milliseconds that Amazon Machine Learning spent processing the
* BatchPrediction
, normalized and scaled on computation resources. ComputeTime
is only
* available if the BatchPrediction
is in the COMPLETED
state.
*
*
* @return The approximate CPU time in milliseconds that Amazon Machine Learning spent processing the
* BatchPrediction
, normalized and scaled on computation resources. ComputeTime
is
* only available if the BatchPrediction
is in the COMPLETED
state.
*/
public Long computeTime() {
return computeTime;
}
/**
*
* The epoch time when Amazon Machine Learning marked the BatchPrediction
as COMPLETED
or
* FAILED
. FinishedAt
is only available when the BatchPrediction
is in the
* COMPLETED
or FAILED
state.
*
*
* @return The epoch time when Amazon Machine Learning marked the BatchPrediction
as
* COMPLETED
or FAILED
. FinishedAt
is only available when the
* BatchPrediction
is in the COMPLETED
or FAILED
state.
*/
public Instant finishedAt() {
return finishedAt;
}
/**
*
* The epoch time when Amazon Machine Learning marked the BatchPrediction
as INPROGRESS
.
* StartedAt
isn't available if the BatchPrediction
is in the PENDING
state.
*
*
* @return The epoch time when Amazon Machine Learning marked the BatchPrediction
as
* INPROGRESS
. StartedAt
isn't available if the BatchPrediction
is in
* the PENDING
state.
*/
public Instant startedAt() {
return startedAt;
}
/**
*
* The number of total records that Amazon Machine Learning saw while processing the BatchPrediction
.
*
*
* @return The number of total records that Amazon Machine Learning saw while processing the
* BatchPrediction
.
*/
public Long totalRecordCount() {
return totalRecordCount;
}
/**
*
* The number of invalid records that Amazon Machine Learning saw while processing the BatchPrediction
.
*
*
* @return The number of invalid records that Amazon Machine Learning saw while processing the
* BatchPrediction
.
*/
public Long invalidRecordCount() {
return invalidRecordCount;
}
@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 + Objects.hashCode(batchPredictionId());
hashCode = 31 * hashCode + Objects.hashCode(mlModelId());
hashCode = 31 * hashCode + Objects.hashCode(batchPredictionDataSourceId());
hashCode = 31 * hashCode + Objects.hashCode(inputDataLocationS3());
hashCode = 31 * hashCode + Objects.hashCode(createdByIamUser());
hashCode = 31 * hashCode + Objects.hashCode(createdAt());
hashCode = 31 * hashCode + Objects.hashCode(lastUpdatedAt());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(statusAsString());
hashCode = 31 * hashCode + Objects.hashCode(outputUri());
hashCode = 31 * hashCode + Objects.hashCode(logUri());
hashCode = 31 * hashCode + Objects.hashCode(message());
hashCode = 31 * hashCode + Objects.hashCode(computeTime());
hashCode = 31 * hashCode + Objects.hashCode(finishedAt());
hashCode = 31 * hashCode + Objects.hashCode(startedAt());
hashCode = 31 * hashCode + Objects.hashCode(totalRecordCount());
hashCode = 31 * hashCode + Objects.hashCode(invalidRecordCount());
return hashCode;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof GetBatchPredictionResponse)) {
return false;
}
GetBatchPredictionResponse other = (GetBatchPredictionResponse) obj;
return Objects.equals(batchPredictionId(), other.batchPredictionId()) && Objects.equals(mlModelId(), other.mlModelId())
&& Objects.equals(batchPredictionDataSourceId(), other.batchPredictionDataSourceId())
&& Objects.equals(inputDataLocationS3(), other.inputDataLocationS3())
&& Objects.equals(createdByIamUser(), other.createdByIamUser()) && Objects.equals(createdAt(), other.createdAt())
&& Objects.equals(lastUpdatedAt(), other.lastUpdatedAt()) && Objects.equals(name(), other.name())
&& Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(outputUri(), other.outputUri())
&& Objects.equals(logUri(), other.logUri()) && Objects.equals(message(), other.message())
&& Objects.equals(computeTime(), other.computeTime()) && Objects.equals(finishedAt(), other.finishedAt())
&& Objects.equals(startedAt(), other.startedAt()) && Objects.equals(totalRecordCount(), other.totalRecordCount())
&& Objects.equals(invalidRecordCount(), other.invalidRecordCount());
}
/**
* 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("GetBatchPredictionResponse").add("BatchPredictionId", batchPredictionId())
.add("MLModelId", mlModelId()).add("BatchPredictionDataSourceId", batchPredictionDataSourceId())
.add("InputDataLocationS3", inputDataLocationS3()).add("CreatedByIamUser", createdByIamUser())
.add("CreatedAt", createdAt()).add("LastUpdatedAt", lastUpdatedAt()).add("Name", name())
.add("Status", statusAsString()).add("OutputUri", outputUri()).add("LogUri", logUri()).add("Message", message())
.add("ComputeTime", computeTime()).add("FinishedAt", finishedAt()).add("StartedAt", startedAt())
.add("TotalRecordCount", totalRecordCount()).add("InvalidRecordCount", invalidRecordCount()).build();
}
public Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BatchPredictionId":
return Optional.ofNullable(clazz.cast(batchPredictionId()));
case "MLModelId":
return Optional.ofNullable(clazz.cast(mlModelId()));
case "BatchPredictionDataSourceId":
return Optional.ofNullable(clazz.cast(batchPredictionDataSourceId()));
case "InputDataLocationS3":
return Optional.ofNullable(clazz.cast(inputDataLocationS3()));
case "CreatedByIamUser":
return Optional.ofNullable(clazz.cast(createdByIamUser()));
case "CreatedAt":
return Optional.ofNullable(clazz.cast(createdAt()));
case "LastUpdatedAt":
return Optional.ofNullable(clazz.cast(lastUpdatedAt()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "Status":
return Optional.ofNullable(clazz.cast(statusAsString()));
case "OutputUri":
return Optional.ofNullable(clazz.cast(outputUri()));
case "LogUri":
return Optional.ofNullable(clazz.cast(logUri()));
case "Message":
return Optional.ofNullable(clazz.cast(message()));
case "ComputeTime":
return Optional.ofNullable(clazz.cast(computeTime()));
case "FinishedAt":
return Optional.ofNullable(clazz.cast(finishedAt()));
case "StartedAt":
return Optional.ofNullable(clazz.cast(startedAt()));
case "TotalRecordCount":
return Optional.ofNullable(clazz.cast(totalRecordCount()));
case "InvalidRecordCount":
return Optional.ofNullable(clazz.cast(invalidRecordCount()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function