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

software.amazon.awssdk.services.s3.model.ListObjectsV2Request Maven / Gradle / Ivy

/*
 * Copyright 2014-2019 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.s3.model;

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.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
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;

/**
 */
@Generated("software.amazon.awssdk:codegen")
public final class ListObjectsV2Request extends S3Request implements
        ToCopyableBuilder {
    private static final SdkField BUCKET_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(ListObjectsV2Request::bucket))
            .setter(setter(Builder::bucket))
            .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("Bucket")
                    .unmarshallLocationName("Bucket").build()).build();

    private static final SdkField DELIMITER_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(ListObjectsV2Request::delimiter))
            .setter(setter(Builder::delimiter))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("delimiter")
                    .unmarshallLocationName("delimiter").build()).build();

    private static final SdkField ENCODING_TYPE_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(ListObjectsV2Request::encodingTypeAsString))
            .setter(setter(Builder::encodingType))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("encoding-type")
                    .unmarshallLocationName("encoding-type").build()).build();

    private static final SdkField MAX_KEYS_FIELD = SdkField
            . builder(MarshallingType.INTEGER)
            .getter(getter(ListObjectsV2Request::maxKeys))
            .setter(setter(Builder::maxKeys))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("max-keys")
                    .unmarshallLocationName("max-keys").build()).build();

    private static final SdkField PREFIX_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(ListObjectsV2Request::prefix))
            .setter(setter(Builder::prefix))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("prefix")
                    .unmarshallLocationName("prefix").build()).build();

    private static final SdkField CONTINUATION_TOKEN_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(ListObjectsV2Request::continuationToken))
            .setter(setter(Builder::continuationToken))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("continuation-token")
                    .unmarshallLocationName("continuation-token").build()).build();

    private static final SdkField FETCH_OWNER_FIELD = SdkField
            . builder(MarshallingType.BOOLEAN)
            .getter(getter(ListObjectsV2Request::fetchOwner))
            .setter(setter(Builder::fetchOwner))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("fetch-owner")
                    .unmarshallLocationName("fetch-owner").build()).build();

    private static final SdkField START_AFTER_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(ListObjectsV2Request::startAfter))
            .setter(setter(Builder::startAfter))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("start-after")
                    .unmarshallLocationName("start-after").build()).build();

    private static final SdkField REQUEST_PAYER_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .getter(getter(ListObjectsV2Request::requestPayerAsString))
            .setter(setter(Builder::requestPayer))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-request-payer")
                    .unmarshallLocationName("x-amz-request-payer").build()).build();

    private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BUCKET_FIELD, DELIMITER_FIELD,
            ENCODING_TYPE_FIELD, MAX_KEYS_FIELD, PREFIX_FIELD, CONTINUATION_TOKEN_FIELD, FETCH_OWNER_FIELD, START_AFTER_FIELD,
            REQUEST_PAYER_FIELD));

    private final String bucket;

    private final String delimiter;

    private final String encodingType;

    private final Integer maxKeys;

    private final String prefix;

    private final String continuationToken;

    private final Boolean fetchOwner;

    private final String startAfter;

    private final String requestPayer;

    private ListObjectsV2Request(BuilderImpl builder) {
        super(builder);
        this.bucket = builder.bucket;
        this.delimiter = builder.delimiter;
        this.encodingType = builder.encodingType;
        this.maxKeys = builder.maxKeys;
        this.prefix = builder.prefix;
        this.continuationToken = builder.continuationToken;
        this.fetchOwner = builder.fetchOwner;
        this.startAfter = builder.startAfter;
        this.requestPayer = builder.requestPayer;
    }

    /**
     * 

* Name of the bucket to list. *

* * @return Name of the bucket to list. */ public String bucket() { return bucket; } /** *

* A delimiter is a character you use to group keys. *

* * @return A delimiter is a character you use to group keys. */ public String delimiter() { return delimiter; } /** *

* Encoding type used by Amazon S3 to encode object keys in the response. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #encodingType} will * return {@link EncodingType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #encodingTypeAsString}. *

* * @return Encoding type used by Amazon S3 to encode object keys in the response. * @see EncodingType */ public EncodingType encodingType() { return EncodingType.fromValue(encodingType); } /** *

* Encoding type used by Amazon S3 to encode object keys in the response. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #encodingType} will * return {@link EncodingType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #encodingTypeAsString}. *

* * @return Encoding type used by Amazon S3 to encode object keys in the response. * @see EncodingType */ public String encodingTypeAsString() { return encodingType; } /** *

* Sets the maximum number of keys returned in the response. The response might contain fewer keys but will never * contain more. *

* * @return Sets the maximum number of keys returned in the response. The response might contain fewer keys but will * never contain more. */ public Integer maxKeys() { return maxKeys; } /** *

* Limits the response to keys that begin with the specified prefix. *

* * @return Limits the response to keys that begin with the specified prefix. */ public String prefix() { return prefix; } /** *

* ContinuationToken indicates Amazon S3 that the list is being continued on this bucket with a token. * ContinuationToken is obfuscated and is not a real key *

* * @return ContinuationToken indicates Amazon S3 that the list is being continued on this bucket with a token. * ContinuationToken is obfuscated and is not a real key */ public String continuationToken() { return continuationToken; } /** *

* The owner field is not present in listV2 by default, if you want to return owner field with each key in the * result then set the fetch owner field to true *

* * @return The owner field is not present in listV2 by default, if you want to return owner field with each key in * the result then set the fetch owner field to true */ public Boolean fetchOwner() { return fetchOwner; } /** *

* StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this specified key. * StartAfter can be any key in the bucket *

* * @return StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this * specified key. StartAfter can be any key in the bucket */ public String startAfter() { return startAfter; } /** *

* Confirms that the requester knows that she or he will be charged for the list objects request in V2 style. Bucket * owners need not specify this parameter in their requests. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #requestPayer} will * return {@link RequestPayer#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #requestPayerAsString}. *

* * @return Confirms that the requester knows that she or he will be charged for the list objects request in V2 * style. Bucket owners need not specify this parameter in their requests. * @see RequestPayer */ public RequestPayer requestPayer() { return RequestPayer.fromValue(requestPayer); } /** *

* Confirms that the requester knows that she or he will be charged for the list objects request in V2 style. Bucket * owners need not specify this parameter in their requests. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #requestPayer} will * return {@link RequestPayer#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #requestPayerAsString}. *

* * @return Confirms that the requester knows that she or he will be charged for the list objects request in V2 * style. Bucket owners need not specify this parameter in their requests. * @see RequestPayer */ public String requestPayerAsString() { return requestPayer; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + super.hashCode(); hashCode = 31 * hashCode + Objects.hashCode(bucket()); hashCode = 31 * hashCode + Objects.hashCode(delimiter()); hashCode = 31 * hashCode + Objects.hashCode(encodingTypeAsString()); hashCode = 31 * hashCode + Objects.hashCode(maxKeys()); hashCode = 31 * hashCode + Objects.hashCode(prefix()); hashCode = 31 * hashCode + Objects.hashCode(continuationToken()); hashCode = 31 * hashCode + Objects.hashCode(fetchOwner()); hashCode = 31 * hashCode + Objects.hashCode(startAfter()); hashCode = 31 * hashCode + Objects.hashCode(requestPayerAsString()); return hashCode; } @Override public boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ListObjectsV2Request)) { return false; } ListObjectsV2Request other = (ListObjectsV2Request) obj; return Objects.equals(bucket(), other.bucket()) && Objects.equals(delimiter(), other.delimiter()) && Objects.equals(encodingTypeAsString(), other.encodingTypeAsString()) && Objects.equals(maxKeys(), other.maxKeys()) && Objects.equals(prefix(), other.prefix()) && Objects.equals(continuationToken(), other.continuationToken()) && Objects.equals(fetchOwner(), other.fetchOwner()) && Objects.equals(startAfter(), other.startAfter()) && Objects.equals(requestPayerAsString(), other.requestPayerAsString()); } /** * 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 String toString() { return ToString.builder("ListObjectsV2Request").add("Bucket", bucket()).add("Delimiter", delimiter()) .add("EncodingType", encodingTypeAsString()).add("MaxKeys", maxKeys()).add("Prefix", prefix()) .add("ContinuationToken", continuationToken()).add("FetchOwner", fetchOwner()).add("StartAfter", startAfter()) .add("RequestPayer", requestPayerAsString()).build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Bucket": return Optional.ofNullable(clazz.cast(bucket())); case "Delimiter": return Optional.ofNullable(clazz.cast(delimiter())); case "EncodingType": return Optional.ofNullable(clazz.cast(encodingTypeAsString())); case "MaxKeys": return Optional.ofNullable(clazz.cast(maxKeys())); case "Prefix": return Optional.ofNullable(clazz.cast(prefix())); case "ContinuationToken": return Optional.ofNullable(clazz.cast(continuationToken())); case "FetchOwner": return Optional.ofNullable(clazz.cast(fetchOwner())); case "StartAfter": return Optional.ofNullable(clazz.cast(startAfter())); case "RequestPayer": return Optional.ofNullable(clazz.cast(requestPayerAsString())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ListObjectsV2Request) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends S3Request.Builder, SdkPojo, CopyableBuilder { /** *

* Name of the bucket to list. *

* * @param bucket * Name of the bucket to list. * @return Returns a reference to this object so that method calls can be chained together. */ Builder bucket(String bucket); /** *

* A delimiter is a character you use to group keys. *

* * @param delimiter * A delimiter is a character you use to group keys. * @return Returns a reference to this object so that method calls can be chained together. */ Builder delimiter(String delimiter); /** *

* Encoding type used by Amazon S3 to encode object keys in the response. *

* * @param encodingType * Encoding type used by Amazon S3 to encode object keys in the response. * @see EncodingType * @return Returns a reference to this object so that method calls can be chained together. * @see EncodingType */ Builder encodingType(String encodingType); /** *

* Encoding type used by Amazon S3 to encode object keys in the response. *

* * @param encodingType * Encoding type used by Amazon S3 to encode object keys in the response. * @see EncodingType * @return Returns a reference to this object so that method calls can be chained together. * @see EncodingType */ Builder encodingType(EncodingType encodingType); /** *

* Sets the maximum number of keys returned in the response. The response might contain fewer keys but will * never contain more. *

* * @param maxKeys * Sets the maximum number of keys returned in the response. The response might contain fewer keys but * will never contain more. * @return Returns a reference to this object so that method calls can be chained together. */ Builder maxKeys(Integer maxKeys); /** *

* Limits the response to keys that begin with the specified prefix. *

* * @param prefix * Limits the response to keys that begin with the specified prefix. * @return Returns a reference to this object so that method calls can be chained together. */ Builder prefix(String prefix); /** *

* ContinuationToken indicates Amazon S3 that the list is being continued on this bucket with a token. * ContinuationToken is obfuscated and is not a real key *

* * @param continuationToken * ContinuationToken indicates Amazon S3 that the list is being continued on this bucket with a token. * ContinuationToken is obfuscated and is not a real key * @return Returns a reference to this object so that method calls can be chained together. */ Builder continuationToken(String continuationToken); /** *

* The owner field is not present in listV2 by default, if you want to return owner field with each key in the * result then set the fetch owner field to true *

* * @param fetchOwner * The owner field is not present in listV2 by default, if you want to return owner field with each key * in the result then set the fetch owner field to true * @return Returns a reference to this object so that method calls can be chained together. */ Builder fetchOwner(Boolean fetchOwner); /** *

* StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this specified * key. StartAfter can be any key in the bucket *

* * @param startAfter * StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts listing after this * specified key. StartAfter can be any key in the bucket * @return Returns a reference to this object so that method calls can be chained together. */ Builder startAfter(String startAfter); /** *

* Confirms that the requester knows that she or he will be charged for the list objects request in V2 style. * Bucket owners need not specify this parameter in their requests. *

* * @param requestPayer * Confirms that the requester knows that she or he will be charged for the list objects request in V2 * style. Bucket owners need not specify this parameter in their requests. * @see RequestPayer * @return Returns a reference to this object so that method calls can be chained together. * @see RequestPayer */ Builder requestPayer(String requestPayer); /** *

* Confirms that the requester knows that she or he will be charged for the list objects request in V2 style. * Bucket owners need not specify this parameter in their requests. *

* * @param requestPayer * Confirms that the requester knows that she or he will be charged for the list objects request in V2 * style. Bucket owners need not specify this parameter in their requests. * @see RequestPayer * @return Returns a reference to this object so that method calls can be chained together. * @see RequestPayer */ Builder requestPayer(RequestPayer requestPayer); @Override Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration); @Override Builder overrideConfiguration(Consumer builderConsumer); } static final class BuilderImpl extends S3Request.BuilderImpl implements Builder { private String bucket; private String delimiter; private String encodingType; private Integer maxKeys; private String prefix; private String continuationToken; private Boolean fetchOwner; private String startAfter; private String requestPayer; private BuilderImpl() { } private BuilderImpl(ListObjectsV2Request model) { super(model); bucket(model.bucket); delimiter(model.delimiter); encodingType(model.encodingType); maxKeys(model.maxKeys); prefix(model.prefix); continuationToken(model.continuationToken); fetchOwner(model.fetchOwner); startAfter(model.startAfter); requestPayer(model.requestPayer); } public final String getBucket() { return bucket; } @Override public final Builder bucket(String bucket) { this.bucket = bucket; return this; } public final void setBucket(String bucket) { this.bucket = bucket; } public final String getDelimiter() { return delimiter; } @Override public final Builder delimiter(String delimiter) { this.delimiter = delimiter; return this; } public final void setDelimiter(String delimiter) { this.delimiter = delimiter; } public final String getEncodingTypeAsString() { return encodingType; } @Override public final Builder encodingType(String encodingType) { this.encodingType = encodingType; return this; } @Override public final Builder encodingType(EncodingType encodingType) { this.encodingType(encodingType == null ? null : encodingType.toString()); return this; } public final void setEncodingType(String encodingType) { this.encodingType = encodingType; } public final Integer getMaxKeys() { return maxKeys; } @Override public final Builder maxKeys(Integer maxKeys) { this.maxKeys = maxKeys; return this; } public final void setMaxKeys(Integer maxKeys) { this.maxKeys = maxKeys; } public final String getPrefix() { return prefix; } @Override public final Builder prefix(String prefix) { this.prefix = prefix; return this; } public final void setPrefix(String prefix) { this.prefix = prefix; } public final String getContinuationToken() { return continuationToken; } @Override public final Builder continuationToken(String continuationToken) { this.continuationToken = continuationToken; return this; } public final void setContinuationToken(String continuationToken) { this.continuationToken = continuationToken; } public final Boolean getFetchOwner() { return fetchOwner; } @Override public final Builder fetchOwner(Boolean fetchOwner) { this.fetchOwner = fetchOwner; return this; } public final void setFetchOwner(Boolean fetchOwner) { this.fetchOwner = fetchOwner; } public final String getStartAfter() { return startAfter; } @Override public final Builder startAfter(String startAfter) { this.startAfter = startAfter; return this; } public final void setStartAfter(String startAfter) { this.startAfter = startAfter; } public final String getRequestPayerAsString() { return requestPayer; } @Override public final Builder requestPayer(String requestPayer) { this.requestPayer = requestPayer; return this; } @Override public final Builder requestPayer(RequestPayer requestPayer) { this.requestPayer(requestPayer == null ? null : requestPayer.toString()); return this; } public final void setRequestPayer(String requestPayer) { this.requestPayer = requestPayer; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public ListObjectsV2Request build() { return new ListObjectsV2Request(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy