software.amazon.awssdk.services.sagemaker.model.TransformInput 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.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.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.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Describes the input source of a transform job and the way the transform job consumes it.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class TransformInput implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField DATA_SOURCE_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("DataSource")
.getter(getter(TransformInput::dataSource)).setter(setter(Builder::dataSource))
.constructor(TransformDataSource::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataSource").build()).build();
private static final SdkField CONTENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ContentType").getter(getter(TransformInput::contentType)).setter(setter(Builder::contentType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContentType").build()).build();
private static final SdkField COMPRESSION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CompressionType").getter(getter(TransformInput::compressionTypeAsString))
.setter(setter(Builder::compressionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompressionType").build()).build();
private static final SdkField SPLIT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("SplitType").getter(getter(TransformInput::splitTypeAsString)).setter(setter(Builder::splitType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("SplitType").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(DATA_SOURCE_FIELD,
CONTENT_TYPE_FIELD, COMPRESSION_TYPE_FIELD, SPLIT_TYPE_FIELD));
private static final long serialVersionUID = 1L;
private final TransformDataSource dataSource;
private final String contentType;
private final String compressionType;
private final String splitType;
private TransformInput(BuilderImpl builder) {
this.dataSource = builder.dataSource;
this.contentType = builder.contentType;
this.compressionType = builder.compressionType;
this.splitType = builder.splitType;
}
/**
*
* Describes the location of the channel data, which is, the S3 location of the input data that the model can
* consume.
*
*
* @return Describes the location of the channel data, which is, the S3 location of the input data that the model
* can consume.
*/
public final TransformDataSource dataSource() {
return dataSource;
}
/**
*
* The multipurpose internet mail extension (MIME) type of the data. Amazon SageMaker uses the MIME type with each
* http call to transfer data to the transform job.
*
*
* @return The multipurpose internet mail extension (MIME) type of the data. Amazon SageMaker uses the MIME type
* with each http call to transfer data to the transform job.
*/
public final String contentType() {
return contentType;
}
/**
*
* If your transform data is compressed, specify the compression type. Amazon SageMaker automatically decompresses
* the data for the transform job accordingly. The default value is None
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #compressionType}
* will return {@link CompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #compressionTypeAsString}.
*
*
* @return If your transform data is compressed, specify the compression type. Amazon SageMaker automatically
* decompresses the data for the transform job accordingly. The default value is None
.
* @see CompressionType
*/
public final CompressionType compressionType() {
return CompressionType.fromValue(compressionType);
}
/**
*
* If your transform data is compressed, specify the compression type. Amazon SageMaker automatically decompresses
* the data for the transform job accordingly. The default value is None
.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #compressionType}
* will return {@link CompressionType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #compressionTypeAsString}.
*
*
* @return If your transform data is compressed, specify the compression type. Amazon SageMaker automatically
* decompresses the data for the transform job accordingly. The default value is None
.
* @see CompressionType
*/
public final String compressionTypeAsString() {
return compressionType;
}
/**
*
* The method to use to split the transform job's data files into smaller batches. Splitting is necessary when the
* total size of each object is too large to fit in a single request. You can also use data splitting to improve
* performance by processing multiple concurrent mini-batches. The default value for SplitType
is
* None
, which indicates that input data files are not split, and request payloads contain the entire
* contents of an input object. Set the value of this parameter to Line
to split records on a newline
* character boundary. SplitType
also supports a number of record-oriented binary data formats.
* Currently, the supported record formats are:
*
*
* -
*
* RecordIO
*
*
* -
*
* TFRecord
*
*
*
*
* When splitting is enabled, the size of a mini-batch depends on the values of the BatchStrategy
and
* MaxPayloadInMB
parameters. When the value of BatchStrategy
is MultiRecord
,
* Amazon SageMaker sends the maximum number of records in each request, up to the MaxPayloadInMB
* limit. If the value of BatchStrategy
is SingleRecord
, Amazon SageMaker sends individual
* records in each request.
*
*
*
* Some data formats represent a record as a binary payload wrapped with extra padding bytes. When splitting is
* applied to a binary data format, padding is removed if the value of BatchStrategy
is set to
* SingleRecord
. Padding is not removed if the value of BatchStrategy
is set to
* MultiRecord
.
*
*
* For more information about RecordIO
, see Create
* a Dataset Using RecordIO in the MXNet documentation. For more information about TFRecord
, see Consuming TFRecord data in the
* TensorFlow documentation.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #splitType} will
* return {@link SplitType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #splitTypeAsString}.
*
*
* @return The method to use to split the transform job's data files into smaller batches. Splitting is necessary
* when the total size of each object is too large to fit in a single request. You can also use data
* splitting to improve performance by processing multiple concurrent mini-batches. The default value for
* SplitType
is None
, which indicates that input data files are not split, and
* request payloads contain the entire contents of an input object. Set the value of this parameter to
* Line
to split records on a newline character boundary. SplitType
also supports
* a number of record-oriented binary data formats. Currently, the supported record formats are:
*
* -
*
* RecordIO
*
*
* -
*
* TFRecord
*
*
*
*
* When splitting is enabled, the size of a mini-batch depends on the values of the
* BatchStrategy
and MaxPayloadInMB
parameters. When the value of
* BatchStrategy
is MultiRecord
, Amazon SageMaker sends the maximum number of
* records in each request, up to the MaxPayloadInMB
limit. If the value of
* BatchStrategy
is SingleRecord
, Amazon SageMaker sends individual records in
* each request.
*
*
*
* Some data formats represent a record as a binary payload wrapped with extra padding bytes. When splitting
* is applied to a binary data format, padding is removed if the value of BatchStrategy
is set
* to SingleRecord
. Padding is not removed if the value of BatchStrategy
is set to
* MultiRecord
.
*
*
* For more information about RecordIO
, see Create a Dataset Using RecordIO in the MXNet
* documentation. For more information about TFRecord
, see Consuming TFRecord data in the
* TensorFlow documentation.
*
* @see SplitType
*/
public final SplitType splitType() {
return SplitType.fromValue(splitType);
}
/**
*
* The method to use to split the transform job's data files into smaller batches. Splitting is necessary when the
* total size of each object is too large to fit in a single request. You can also use data splitting to improve
* performance by processing multiple concurrent mini-batches. The default value for SplitType
is
* None
, which indicates that input data files are not split, and request payloads contain the entire
* contents of an input object. Set the value of this parameter to Line
to split records on a newline
* character boundary. SplitType
also supports a number of record-oriented binary data formats.
* Currently, the supported record formats are:
*
*
* -
*
* RecordIO
*
*
* -
*
* TFRecord
*
*
*
*
* When splitting is enabled, the size of a mini-batch depends on the values of the BatchStrategy
and
* MaxPayloadInMB
parameters. When the value of BatchStrategy
is MultiRecord
,
* Amazon SageMaker sends the maximum number of records in each request, up to the MaxPayloadInMB
* limit. If the value of BatchStrategy
is SingleRecord
, Amazon SageMaker sends individual
* records in each request.
*
*
*
* Some data formats represent a record as a binary payload wrapped with extra padding bytes. When splitting is
* applied to a binary data format, padding is removed if the value of BatchStrategy
is set to
* SingleRecord
. Padding is not removed if the value of BatchStrategy
is set to
* MultiRecord
.
*
*
* For more information about RecordIO
, see Create
* a Dataset Using RecordIO in the MXNet documentation. For more information about TFRecord
, see Consuming TFRecord data in the
* TensorFlow documentation.
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #splitType} will
* return {@link SplitType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #splitTypeAsString}.
*
*
* @return The method to use to split the transform job's data files into smaller batches. Splitting is necessary
* when the total size of each object is too large to fit in a single request. You can also use data
* splitting to improve performance by processing multiple concurrent mini-batches. The default value for
* SplitType
is None
, which indicates that input data files are not split, and
* request payloads contain the entire contents of an input object. Set the value of this parameter to
* Line
to split records on a newline character boundary. SplitType
also supports
* a number of record-oriented binary data formats. Currently, the supported record formats are:
*
* -
*
* RecordIO
*
*
* -
*
* TFRecord
*
*
*
*
* When splitting is enabled, the size of a mini-batch depends on the values of the
* BatchStrategy
and MaxPayloadInMB
parameters. When the value of
* BatchStrategy
is MultiRecord
, Amazon SageMaker sends the maximum number of
* records in each request, up to the MaxPayloadInMB
limit. If the value of
* BatchStrategy
is SingleRecord
, Amazon SageMaker sends individual records in
* each request.
*
*
*
* Some data formats represent a record as a binary payload wrapped with extra padding bytes. When splitting
* is applied to a binary data format, padding is removed if the value of BatchStrategy
is set
* to SingleRecord
. Padding is not removed if the value of BatchStrategy
is set to
* MultiRecord
.
*
*
* For more information about RecordIO
, see Create a Dataset Using RecordIO in the MXNet
* documentation. For more information about TFRecord
, see Consuming TFRecord data in the
* TensorFlow documentation.
*
* @see SplitType
*/
public final String splitTypeAsString() {
return splitType;
}
@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(dataSource());
hashCode = 31 * hashCode + Objects.hashCode(contentType());
hashCode = 31 * hashCode + Objects.hashCode(compressionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(splitTypeAsString());
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 TransformInput)) {
return false;
}
TransformInput other = (TransformInput) obj;
return Objects.equals(dataSource(), other.dataSource()) && Objects.equals(contentType(), other.contentType())
&& Objects.equals(compressionTypeAsString(), other.compressionTypeAsString())
&& Objects.equals(splitTypeAsString(), other.splitTypeAsString());
}
/**
* 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("TransformInput").add("DataSource", dataSource()).add("ContentType", contentType())
.add("CompressionType", compressionTypeAsString()).add("SplitType", splitTypeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "DataSource":
return Optional.ofNullable(clazz.cast(dataSource()));
case "ContentType":
return Optional.ofNullable(clazz.cast(contentType()));
case "CompressionType":
return Optional.ofNullable(clazz.cast(compressionTypeAsString()));
case "SplitType":
return Optional.ofNullable(clazz.cast(splitTypeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function