software.amazon.awssdk.services.snowball.model.DataTransfer Maven / Gradle / Ivy
Show all versions of snowball 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.snowball.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;
/**
*
* Defines the real-time status of a Snow device's data transfer while the device is at Amazon Web Services. This data
* is only available while a job has a JobState
value of InProgress
, for both import and
* export jobs.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class DataTransfer implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField BYTES_TRANSFERRED_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("BytesTransferred").getter(getter(DataTransfer::bytesTransferred))
.setter(setter(Builder::bytesTransferred))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BytesTransferred").build()).build();
private static final SdkField OBJECTS_TRANSFERRED_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("ObjectsTransferred").getter(getter(DataTransfer::objectsTransferred))
.setter(setter(Builder::objectsTransferred))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ObjectsTransferred").build())
.build();
private static final SdkField TOTAL_BYTES_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("TotalBytes").getter(getter(DataTransfer::totalBytes)).setter(setter(Builder::totalBytes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalBytes").build()).build();
private static final SdkField TOTAL_OBJECTS_FIELD = SdkField. builder(MarshallingType.LONG)
.memberName("TotalObjects").getter(getter(DataTransfer::totalObjects)).setter(setter(Builder::totalObjects))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TotalObjects").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BYTES_TRANSFERRED_FIELD,
OBJECTS_TRANSFERRED_FIELD, TOTAL_BYTES_FIELD, TOTAL_OBJECTS_FIELD));
private static final long serialVersionUID = 1L;
private final Long bytesTransferred;
private final Long objectsTransferred;
private final Long totalBytes;
private final Long totalObjects;
private DataTransfer(BuilderImpl builder) {
this.bytesTransferred = builder.bytesTransferred;
this.objectsTransferred = builder.objectsTransferred;
this.totalBytes = builder.totalBytes;
this.totalObjects = builder.totalObjects;
}
/**
*
* The number of bytes transferred between a Snow device and Amazon S3.
*
*
* @return The number of bytes transferred between a Snow device and Amazon S3.
*/
public final Long bytesTransferred() {
return bytesTransferred;
}
/**
*
* The number of objects transferred between a Snow device and Amazon S3.
*
*
* @return The number of objects transferred between a Snow device and Amazon S3.
*/
public final Long objectsTransferred() {
return objectsTransferred;
}
/**
*
* The total bytes of data for a transfer between a Snow device and Amazon S3. This value is set to 0 (zero) until
* all the keys that will be transferred have been listed.
*
*
* @return The total bytes of data for a transfer between a Snow device and Amazon S3. This value is set to 0 (zero)
* until all the keys that will be transferred have been listed.
*/
public final Long totalBytes() {
return totalBytes;
}
/**
*
* The total number of objects for a transfer between a Snow device and Amazon S3. This value is set to 0 (zero)
* until all the keys that will be transferred have been listed.
*
*
* @return The total number of objects for a transfer between a Snow device and Amazon S3. This value is set to 0
* (zero) until all the keys that will be transferred have been listed.
*/
public final Long totalObjects() {
return totalObjects;
}
@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(bytesTransferred());
hashCode = 31 * hashCode + Objects.hashCode(objectsTransferred());
hashCode = 31 * hashCode + Objects.hashCode(totalBytes());
hashCode = 31 * hashCode + Objects.hashCode(totalObjects());
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 DataTransfer)) {
return false;
}
DataTransfer other = (DataTransfer) obj;
return Objects.equals(bytesTransferred(), other.bytesTransferred())
&& Objects.equals(objectsTransferred(), other.objectsTransferred())
&& Objects.equals(totalBytes(), other.totalBytes()) && Objects.equals(totalObjects(), other.totalObjects());
}
/**
* 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("DataTransfer").add("BytesTransferred", bytesTransferred())
.add("ObjectsTransferred", objectsTransferred()).add("TotalBytes", totalBytes())
.add("TotalObjects", totalObjects()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BytesTransferred":
return Optional.ofNullable(clazz.cast(bytesTransferred()));
case "ObjectsTransferred":
return Optional.ofNullable(clazz.cast(objectsTransferred()));
case "TotalBytes":
return Optional.ofNullable(clazz.cast(totalBytes()));
case "TotalObjects":
return Optional.ofNullable(clazz.cast(totalObjects()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function