
software.amazon.awssdk.services.sagemaker.model.DatasetDefinition Maven / Gradle / Ivy
Show all versions of sagemaker 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.sagemaker.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
*
* Configuration for Dataset Definition inputs. The Dataset Definition input must specify exactly one of either
* AthenaDatasetDefinition
or RedshiftDatasetDefinition
types.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DatasetDefinition implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField ATHENA_DATASET_DEFINITION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("AthenaDatasetDefinition")
.getter(getter(DatasetDefinition::athenaDatasetDefinition)).setter(setter(Builder::athenaDatasetDefinition))
.constructor(AthenaDatasetDefinition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("AthenaDatasetDefinition").build())
.build();
private static final SdkField REDSHIFT_DATASET_DEFINITION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("RedshiftDatasetDefinition")
.getter(getter(DatasetDefinition::redshiftDatasetDefinition)).setter(setter(Builder::redshiftDatasetDefinition))
.constructor(RedshiftDatasetDefinition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RedshiftDatasetDefinition").build())
.build();
private static final SdkField LOCAL_PATH_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LocalPath").getter(getter(DatasetDefinition::localPath)).setter(setter(Builder::localPath))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocalPath").build()).build();
private static final SdkField DATA_DISTRIBUTION_TYPE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("DataDistributionType").getter(getter(DatasetDefinition::dataDistributionTypeAsString))
.setter(setter(Builder::dataDistributionType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("DataDistributionType").build())
.build();
private static final SdkField INPUT_MODE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InputMode").getter(getter(DatasetDefinition::inputModeAsString)).setter(setter(Builder::inputMode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InputMode").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(
ATHENA_DATASET_DEFINITION_FIELD, REDSHIFT_DATASET_DEFINITION_FIELD, LOCAL_PATH_FIELD, DATA_DISTRIBUTION_TYPE_FIELD,
INPUT_MODE_FIELD));
private static final Map> SDK_NAME_TO_FIELD = memberNameToFieldInitializer();
private static final long serialVersionUID = 1L;
private final AthenaDatasetDefinition athenaDatasetDefinition;
private final RedshiftDatasetDefinition redshiftDatasetDefinition;
private final String localPath;
private final String dataDistributionType;
private final String inputMode;
private DatasetDefinition(BuilderImpl builder) {
this.athenaDatasetDefinition = builder.athenaDatasetDefinition;
this.redshiftDatasetDefinition = builder.redshiftDatasetDefinition;
this.localPath = builder.localPath;
this.dataDistributionType = builder.dataDistributionType;
this.inputMode = builder.inputMode;
}
/**
* Returns the value of the AthenaDatasetDefinition property for this object.
*
* @return The value of the AthenaDatasetDefinition property for this object.
*/
public final AthenaDatasetDefinition athenaDatasetDefinition() {
return athenaDatasetDefinition;
}
/**
* Returns the value of the RedshiftDatasetDefinition property for this object.
*
* @return The value of the RedshiftDatasetDefinition property for this object.
*/
public final RedshiftDatasetDefinition redshiftDatasetDefinition() {
return redshiftDatasetDefinition;
}
/**
*
* The local path where you want Amazon SageMaker to download the Dataset Definition inputs to run a processing job.
* LocalPath
is an absolute path to the input data. This is a required parameter when
* AppManaged
is False
(default).
*
*
* @return The local path where you want Amazon SageMaker to download the Dataset Definition inputs to run a
* processing job. LocalPath
is an absolute path to the input data. This is a required
* parameter when AppManaged
is False
(default).
*/
public final String localPath() {
return localPath;
}
/**
*
* Whether the generated dataset is FullyReplicated
or ShardedByS3Key
(default).
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dataDistributionType} will return {@link DataDistributionType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dataDistributionTypeAsString}.
*
*
* @return Whether the generated dataset is FullyReplicated
or ShardedByS3Key
(default).
* @see DataDistributionType
*/
public final DataDistributionType dataDistributionType() {
return DataDistributionType.fromValue(dataDistributionType);
}
/**
*
* Whether the generated dataset is FullyReplicated
or ShardedByS3Key
(default).
*
*
* If the service returns an enum value that is not available in the current SDK version,
* {@link #dataDistributionType} will return {@link DataDistributionType#UNKNOWN_TO_SDK_VERSION}. The raw value
* returned by the service is available from {@link #dataDistributionTypeAsString}.
*
*
* @return Whether the generated dataset is FullyReplicated
or ShardedByS3Key
(default).
* @see DataDistributionType
*/
public final String dataDistributionTypeAsString() {
return dataDistributionType;
}
/**
*
* Whether to use File
or Pipe
input mode. In File
(default) mode, Amazon
* SageMaker copies the data from the input source onto the local Amazon Elastic Block Store (Amazon EBS) volumes
* before starting your training algorithm. This is the most commonly used input mode. In Pipe
mode,
* Amazon SageMaker streams input data from the source directly to your algorithm without using the EBS volume.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #inputMode} will
* return {@link InputMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #inputModeAsString}.
*
*
* @return Whether to use File
or Pipe
input mode. In File
(default) mode,
* Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block Store (Amazon
* EBS) volumes before starting your training algorithm. This is the most commonly used input mode. In
* Pipe
mode, Amazon SageMaker streams input data from the source directly to your algorithm
* without using the EBS volume.
* @see InputMode
*/
public final InputMode inputMode() {
return InputMode.fromValue(inputMode);
}
/**
*
* Whether to use File
or Pipe
input mode. In File
(default) mode, Amazon
* SageMaker copies the data from the input source onto the local Amazon Elastic Block Store (Amazon EBS) volumes
* before starting your training algorithm. This is the most commonly used input mode. In Pipe
mode,
* Amazon SageMaker streams input data from the source directly to your algorithm without using the EBS volume.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #inputMode} will
* return {@link InputMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #inputModeAsString}.
*
*
* @return Whether to use File
or Pipe
input mode. In File
(default) mode,
* Amazon SageMaker copies the data from the input source onto the local Amazon Elastic Block Store (Amazon
* EBS) volumes before starting your training algorithm. This is the most commonly used input mode. In
* Pipe
mode, Amazon SageMaker streams input data from the source directly to your algorithm
* without using the EBS volume.
* @see InputMode
*/
public final String inputModeAsString() {
return inputMode;
}
@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(athenaDatasetDefinition());
hashCode = 31 * hashCode + Objects.hashCode(redshiftDatasetDefinition());
hashCode = 31 * hashCode + Objects.hashCode(localPath());
hashCode = 31 * hashCode + Objects.hashCode(dataDistributionTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(inputModeAsString());
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 DatasetDefinition)) {
return false;
}
DatasetDefinition other = (DatasetDefinition) obj;
return Objects.equals(athenaDatasetDefinition(), other.athenaDatasetDefinition())
&& Objects.equals(redshiftDatasetDefinition(), other.redshiftDatasetDefinition())
&& Objects.equals(localPath(), other.localPath())
&& Objects.equals(dataDistributionTypeAsString(), other.dataDistributionTypeAsString())
&& Objects.equals(inputModeAsString(), other.inputModeAsString());
}
/**
* 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("DatasetDefinition").add("AthenaDatasetDefinition", athenaDatasetDefinition())
.add("RedshiftDatasetDefinition", redshiftDatasetDefinition()).add("LocalPath", localPath())
.add("DataDistributionType", dataDistributionTypeAsString()).add("InputMode", inputModeAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "AthenaDatasetDefinition":
return Optional.ofNullable(clazz.cast(athenaDatasetDefinition()));
case "RedshiftDatasetDefinition":
return Optional.ofNullable(clazz.cast(redshiftDatasetDefinition()));
case "LocalPath":
return Optional.ofNullable(clazz.cast(localPath()));
case "DataDistributionType":
return Optional.ofNullable(clazz.cast(dataDistributionTypeAsString()));
case "InputMode":
return Optional.ofNullable(clazz.cast(inputModeAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
@Override
public final Map> sdkFieldNameToField() {
return SDK_NAME_TO_FIELD;
}
private static Map> memberNameToFieldInitializer() {
Map> map = new HashMap<>();
map.put("AthenaDatasetDefinition", ATHENA_DATASET_DEFINITION_FIELD);
map.put("RedshiftDatasetDefinition", REDSHIFT_DATASET_DEFINITION_FIELD);
map.put("LocalPath", LOCAL_PATH_FIELD);
map.put("DataDistributionType", DATA_DISTRIBUTION_TYPE_FIELD);
map.put("InputMode", INPUT_MODE_FIELD);
return Collections.unmodifiableMap(map);
}
private static Function