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

software.amazon.awssdk.services.snowball.model.S3Resource 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.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 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 getter(Function g) { return obj -> g.apply((S3Resource) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The Amazon Resource Name (ARN) of an Amazon S3 bucket. *

* * @param bucketArn * The Amazon Resource Name (ARN) of an Amazon S3 bucket. * @return Returns a reference to this object so that method calls can be chained together. */ Builder bucketArn(String 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. *

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

* 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. *

* This is a convenience method that creates an instance of the {@link KeyRange.Builder} avoiding the need to * create one manually via {@link KeyRange#builder()}. * *

* When the {@link Consumer} completes, {@link KeyRange.Builder#build()} is called immediately and its result is * passed to {@link #keyRange(KeyRange)}. * * @param keyRange * a consumer that will call methods on {@link KeyRange.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #keyRange(KeyRange) */ default Builder keyRange(Consumer keyRange) { return keyRange(KeyRange.builder().applyMutation(keyRange).build()); } /** *

* 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). *

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

* 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). *

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

* 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). *

* This is a convenience method that creates an instance of the * {@link software.amazon.awssdk.services.snowball.model.TargetOnDeviceService.Builder} avoiding the need to * create one manually via * {@link software.amazon.awssdk.services.snowball.model.TargetOnDeviceService#builder()}. * *

* When the {@link Consumer} completes, * {@link software.amazon.awssdk.services.snowball.model.TargetOnDeviceService.Builder#build()} is called * immediately and its result is passed to {@link #targetOnDeviceServices(List)}. * * @param targetOnDeviceServices * a consumer that will call methods on * {@link software.amazon.awssdk.services.snowball.model.TargetOnDeviceService.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #targetOnDeviceServices(java.util.Collection) */ Builder targetOnDeviceServices(Consumer... targetOnDeviceServices); } static final class BuilderImpl implements Builder { private String bucketArn; private KeyRange keyRange; private List targetOnDeviceServices = DefaultSdkAutoConstructList.getInstance(); private BuilderImpl() { } private BuilderImpl(S3Resource model) { bucketArn(model.bucketArn); keyRange(model.keyRange); targetOnDeviceServices(model.targetOnDeviceServices); } public final String getBucketArn() { return bucketArn; } public final void setBucketArn(String bucketArn) { this.bucketArn = bucketArn; } @Override public final Builder bucketArn(String bucketArn) { this.bucketArn = bucketArn; return this; } public final KeyRange.Builder getKeyRange() { return keyRange != null ? keyRange.toBuilder() : null; } public final void setKeyRange(KeyRange.BuilderImpl keyRange) { this.keyRange = keyRange != null ? keyRange.build() : null; } @Override public final Builder keyRange(KeyRange keyRange) { this.keyRange = keyRange; return this; } public final List getTargetOnDeviceServices() { List result = TargetOnDeviceServiceListCopier .copyToBuilder(this.targetOnDeviceServices); if (result instanceof SdkAutoConstructList) { return null; } return result; } public final void setTargetOnDeviceServices(Collection targetOnDeviceServices) { this.targetOnDeviceServices = TargetOnDeviceServiceListCopier.copyFromBuilder(targetOnDeviceServices); } @Override public final Builder targetOnDeviceServices(Collection targetOnDeviceServices) { this.targetOnDeviceServices = TargetOnDeviceServiceListCopier.copy(targetOnDeviceServices); return this; } @Override @SafeVarargs public final Builder targetOnDeviceServices(TargetOnDeviceService... targetOnDeviceServices) { targetOnDeviceServices(Arrays.asList(targetOnDeviceServices)); return this; } @Override @SafeVarargs public final Builder targetOnDeviceServices(Consumer... targetOnDeviceServices) { targetOnDeviceServices(Stream.of(targetOnDeviceServices) .map(c -> TargetOnDeviceService.builder().applyMutation(c).build()).collect(Collectors.toList())); return this; } @Override public S3Resource build() { return new S3Resource(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy