software.amazon.awssdk.services.databrew.model.JobSample Maven / Gradle / Ivy
Show all versions of databrew 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.databrew.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.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;
/**
*
* A sample configuration for profile jobs only, which determines the number of rows on which the profile job is run. If
* a JobSample
value isn't provided, the default is used. The default value is CUSTOM_ROWS for the mode
* parameter and 20,000 for the size parameter.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JobSample implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField MODE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Mode")
.getter(getter(JobSample::modeAsString)).setter(setter(Builder::mode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Mode").build()).build();
private static final SdkField SIZE_FIELD = SdkField. builder(MarshallingType.LONG).memberName("Size")
.getter(getter(JobSample::size)).setter(setter(Builder::size))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Size").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MODE_FIELD, SIZE_FIELD));
private static final long serialVersionUID = 1L;
private final String mode;
private final Long size;
private JobSample(BuilderImpl builder) {
this.mode = builder.mode;
this.size = builder.size;
}
/**
*
* A value that determines whether the profile job is run on the entire dataset or a specified number of rows. This
* value must be one of the following:
*
*
* -
*
* FULL_DATASET - The profile job is run on the entire dataset.
*
*
* -
*
* CUSTOM_ROWS - The profile job is run on the number of rows specified in the Size
parameter.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #mode} will return
* {@link SampleMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #modeAsString}.
*
*
* @return A value that determines whether the profile job is run on the entire dataset or a specified number of
* rows. This value must be one of the following:
*
* -
*
* FULL_DATASET - The profile job is run on the entire dataset.
*
*
* -
*
* CUSTOM_ROWS - The profile job is run on the number of rows specified in the Size
parameter.
*
*
* @see SampleMode
*/
public final SampleMode mode() {
return SampleMode.fromValue(mode);
}
/**
*
* A value that determines whether the profile job is run on the entire dataset or a specified number of rows. This
* value must be one of the following:
*
*
* -
*
* FULL_DATASET - The profile job is run on the entire dataset.
*
*
* -
*
* CUSTOM_ROWS - The profile job is run on the number of rows specified in the Size
parameter.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #mode} will return
* {@link SampleMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #modeAsString}.
*
*
* @return A value that determines whether the profile job is run on the entire dataset or a specified number of
* rows. This value must be one of the following:
*
* -
*
* FULL_DATASET - The profile job is run on the entire dataset.
*
*
* -
*
* CUSTOM_ROWS - The profile job is run on the number of rows specified in the Size
parameter.
*
*
* @see SampleMode
*/
public final String modeAsString() {
return mode;
}
/**
*
* The Size
parameter is only required when the mode is CUSTOM_ROWS. The profile job is run on the
* specified number of rows. The maximum value for size is Long.MAX_VALUE.
*
*
* Long.MAX_VALUE = 9223372036854775807
*
*
* @return The Size
parameter is only required when the mode is CUSTOM_ROWS. The profile job is run on
* the specified number of rows. The maximum value for size is Long.MAX_VALUE.
*
* Long.MAX_VALUE = 9223372036854775807
*/
public final Long size() {
return size;
}
@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(modeAsString());
hashCode = 31 * hashCode + Objects.hashCode(size());
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 JobSample)) {
return false;
}
JobSample other = (JobSample) obj;
return Objects.equals(modeAsString(), other.modeAsString()) && Objects.equals(size(), other.size());
}
/**
* 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("JobSample").add("Mode", modeAsString()).add("Size", size()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Mode":
return Optional.ofNullable(clazz.cast(modeAsString()));
case "Size":
return Optional.ofNullable(clazz.cast(size()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function
*
* -
*
* FULL_DATASET - The profile job is run on the entire dataset.
*
*
* -
*
* CUSTOM_ROWS - The profile job is run on the number of rows specified in the Size
* parameter.
*
*
* @see SampleMode
* @return Returns a reference to this object so that method calls can be chained together.
* @see SampleMode
*/
Builder mode(String mode);
/**
*
* A value that determines whether the profile job is run on the entire dataset or a specified number of rows.
* This value must be one of the following:
*
*
* -
*
* FULL_DATASET - The profile job is run on the entire dataset.
*
*
* -
*
* CUSTOM_ROWS - The profile job is run on the number of rows specified in the Size
parameter.
*
*
*
*
* @param mode
* A value that determines whether the profile job is run on the entire dataset or a specified number of
* rows. This value must be one of the following:
*
* -
*
* FULL_DATASET - The profile job is run on the entire dataset.
*
*
* -
*
* CUSTOM_ROWS - The profile job is run on the number of rows specified in the Size
* parameter.
*
*
* @see SampleMode
* @return Returns a reference to this object so that method calls can be chained together.
* @see SampleMode
*/
Builder mode(SampleMode mode);
/**
*
* The Size
parameter is only required when the mode is CUSTOM_ROWS. The profile job is run on the
* specified number of rows. The maximum value for size is Long.MAX_VALUE.
*
*
* Long.MAX_VALUE = 9223372036854775807
*
*
* @param size
* The Size
parameter is only required when the mode is CUSTOM_ROWS. The profile job is run
* on the specified number of rows. The maximum value for size is Long.MAX_VALUE.
*
* Long.MAX_VALUE = 9223372036854775807
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder size(Long size);
}
static final class BuilderImpl implements Builder {
private String mode;
private Long size;
private BuilderImpl() {
}
private BuilderImpl(JobSample model) {
mode(model.mode);
size(model.size);
}
public final String getMode() {
return mode;
}
public final void setMode(String mode) {
this.mode = mode;
}
@Override
public final Builder mode(String mode) {
this.mode = mode;
return this;
}
@Override
public final Builder mode(SampleMode mode) {
this.mode(mode == null ? null : mode.toString());
return this;
}
public final Long getSize() {
return size;
}
public final void setSize(Long size) {
this.size = size;
}
@Override
public final Builder size(Long size) {
this.size = size;
return this;
}
@Override
public JobSample build() {
return new JobSample(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}