software.amazon.awssdk.services.snowball.model.S3Resource 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.Collection;
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 java.util.stream.Collectors;
import java.util.stream.Stream;
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.ListTrait;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructList;
import software.amazon.awssdk.core.util.SdkAutoConstructList;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Each S3Resource
object represents an Amazon S3 bucket that your transferred data will be exported from
* or imported into. For export jobs, this object can have an optional KeyRange
value. The length of the
* range is defined at job creation, and has either an inclusive BeginMarker
, an inclusive
* EndMarker
, or both. Ranges are UTF-8 binary sorted.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class S3Resource implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField BUCKET_ARN_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("BucketArn").getter(getter(S3Resource::bucketArn)).setter(setter(Builder::bucketArn))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BucketArn").build()).build();
private static final SdkField KEY_RANGE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("KeyRange").getter(getter(S3Resource::keyRange)).setter(setter(Builder::keyRange))
.constructor(KeyRange::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyRange").build()).build();
private static final SdkField> TARGET_ON_DEVICE_SERVICES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("TargetOnDeviceServices")
.getter(getter(S3Resource::targetOnDeviceServices))
.setter(setter(Builder::targetOnDeviceServices))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetOnDeviceServices").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(TargetOnDeviceService::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").build()).build()).build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BUCKET_ARN_FIELD,
KEY_RANGE_FIELD, TARGET_ON_DEVICE_SERVICES_FIELD));
private static final long serialVersionUID = 1L;
private final String bucketArn;
private final KeyRange keyRange;
private final List targetOnDeviceServices;
private S3Resource(BuilderImpl builder) {
this.bucketArn = builder.bucketArn;
this.keyRange = builder.keyRange;
this.targetOnDeviceServices = builder.targetOnDeviceServices;
}
/**
*
* The Amazon Resource Name (ARN) of an Amazon S3 bucket.
*
*
* @return The Amazon Resource Name (ARN) of an Amazon S3 bucket.
*/
public final String bucketArn() {
return bucketArn;
}
/**
*
* For export jobs, you can provide an optional KeyRange
within a specific Amazon S3 bucket. The length
* of the range is defined at job creation, and has either an inclusive BeginMarker
, an inclusive
* EndMarker
, or both. Ranges are UTF-8 binary sorted.
*
*
* @return For export jobs, you can provide an optional KeyRange
within a specific Amazon S3 bucket.
* The length of the range is defined at job creation, and has either an inclusive BeginMarker
,
* an inclusive EndMarker
, or both. Ranges are UTF-8 binary sorted.
*/
public final KeyRange keyRange() {
return keyRange;
}
/**
* For responses, this returns true if the service returned a value for the TargetOnDeviceServices property. This
* DOES NOT check that the value is non-empty (for which, you should check the {@code isEmpty()} method on the
* property). This is useful because the SDK will never return a null collection or map, but you may need to
* differentiate between the service returning nothing (or null) and the service returning an empty collection or
* map. For requests, this returns true if a value for the property was specified in the request builder, and false
* if a value was not specified.
*/
public final boolean hasTargetOnDeviceServices() {
return targetOnDeviceServices != null && !(targetOnDeviceServices instanceof SdkAutoConstructList);
}
/**
*
* Specifies the service or services on the Snow Family device that your transferred data will be exported from or
* imported into. Amazon Web Services Snow Family supports Amazon S3 and NFS (Network File System).
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* This method will never return null. If you would like to know whether the service returned this field (so that
* you can differentiate between null and empty), you can use the {@link #hasTargetOnDeviceServices} method.
*
*
* @return Specifies the service or services on the Snow Family device that your transferred data will be exported
* from or imported into. Amazon Web Services Snow Family supports Amazon S3 and NFS (Network File System).
*/
public final List targetOnDeviceServices() {
return targetOnDeviceServices;
}
@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(bucketArn());
hashCode = 31 * hashCode + Objects.hashCode(keyRange());
hashCode = 31 * hashCode + Objects.hashCode(hasTargetOnDeviceServices() ? targetOnDeviceServices() : null);
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 S3Resource)) {
return false;
}
S3Resource other = (S3Resource) obj;
return Objects.equals(bucketArn(), other.bucketArn()) && Objects.equals(keyRange(), other.keyRange())
&& hasTargetOnDeviceServices() == other.hasTargetOnDeviceServices()
&& Objects.equals(targetOnDeviceServices(), other.targetOnDeviceServices());
}
/**
* 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("S3Resource").add("BucketArn", bucketArn()).add("KeyRange", keyRange())
.add("TargetOnDeviceServices", hasTargetOnDeviceServices() ? targetOnDeviceServices() : null).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "BucketArn":
return Optional.ofNullable(clazz.cast(bucketArn()));
case "KeyRange":
return Optional.ofNullable(clazz.cast(keyRange()));
case "TargetOnDeviceServices":
return Optional.ofNullable(clazz.cast(targetOnDeviceServices()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function