All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.services.snowball.model.DataTransfer Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Snowball module holds the client classes that are used for communicating with Amazon Snowball.

There is a newer version: 2.29.15
Show newest version
/*
 * 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 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 getter(Function g) { return obj -> g.apply((DataTransfer) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The number of bytes transferred between a Snow device and Amazon S3. *

* * @param bytesTransferred * The number of bytes transferred between a Snow device and Amazon S3. * @return Returns a reference to this object so that method calls can be chained together. */ Builder bytesTransferred(Long bytesTransferred); /** *

* The number of objects transferred between a Snow device and Amazon S3. *

* * @param objectsTransferred * The number of objects transferred between a Snow device and Amazon S3. * @return Returns a reference to this object so that method calls can be chained together. */ Builder objectsTransferred(Long 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. *

* * @param totalBytes * 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 Returns a reference to this object so that method calls can be chained together. */ Builder totalBytes(Long 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. *

* * @param totalObjects * 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 Returns a reference to this object so that method calls can be chained together. */ Builder totalObjects(Long totalObjects); } static final class BuilderImpl implements Builder { private Long bytesTransferred; private Long objectsTransferred; private Long totalBytes; private Long totalObjects; private BuilderImpl() { } private BuilderImpl(DataTransfer model) { bytesTransferred(model.bytesTransferred); objectsTransferred(model.objectsTransferred); totalBytes(model.totalBytes); totalObjects(model.totalObjects); } public final Long getBytesTransferred() { return bytesTransferred; } public final void setBytesTransferred(Long bytesTransferred) { this.bytesTransferred = bytesTransferred; } @Override public final Builder bytesTransferred(Long bytesTransferred) { this.bytesTransferred = bytesTransferred; return this; } public final Long getObjectsTransferred() { return objectsTransferred; } public final void setObjectsTransferred(Long objectsTransferred) { this.objectsTransferred = objectsTransferred; } @Override public final Builder objectsTransferred(Long objectsTransferred) { this.objectsTransferred = objectsTransferred; return this; } public final Long getTotalBytes() { return totalBytes; } public final void setTotalBytes(Long totalBytes) { this.totalBytes = totalBytes; } @Override public final Builder totalBytes(Long totalBytes) { this.totalBytes = totalBytes; return this; } public final Long getTotalObjects() { return totalObjects; } public final void setTotalObjects(Long totalObjects) { this.totalObjects = totalObjects; } @Override public final Builder totalObjects(Long totalObjects) { this.totalObjects = totalObjects; return this; } @Override public DataTransfer build() { return new DataTransfer(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy