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

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

Go to download

The AWS Java SDK for Amazon S3 module holds the client classes that are used for communicating with Amazon Simple Storage Service

There is a newer version: 2.29.39
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.s3.model;

import java.beans.Transient;
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 ListObjectsRequest extends S3Request implements
        ToCopyableBuilder {
    private static final SdkField BUCKET_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("Bucket")
            .getter(getter(ListObjectsRequest::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)
            .memberName("Delimiter")
            .getter(getter(ListObjectsRequest::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)
            .memberName("EncodingType")
            .getter(getter(ListObjectsRequest::encodingTypeAsString))
            .setter(setter(Builder::encodingType))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("encoding-type")
                    .unmarshallLocationName("encoding-type").build()).build();

    private static final SdkField MARKER_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("Marker")
            .getter(getter(ListObjectsRequest::marker))
            .setter(setter(Builder::marker))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("marker")
                    .unmarshallLocationName("marker").build()).build();

    private static final SdkField MAX_KEYS_FIELD = SdkField
            . builder(MarshallingType.INTEGER)
            .memberName("MaxKeys")
            .getter(getter(ListObjectsRequest::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)
            .memberName("Prefix")
            .getter(getter(ListObjectsRequest::prefix))
            .setter(setter(Builder::prefix))
            .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("prefix")
                    .unmarshallLocationName("prefix").build()).build();

    private static final SdkField REQUEST_PAYER_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("RequestPayer")
            .getter(getter(ListObjectsRequest::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 SdkField EXPECTED_BUCKET_OWNER_FIELD = SdkField
            . builder(MarshallingType.STRING)
            .memberName("ExpectedBucketOwner")
            .getter(getter(ListObjectsRequest::expectedBucketOwner))
            .setter(setter(Builder::expectedBucketOwner))
            .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-expected-bucket-owner")
                    .unmarshallLocationName("x-amz-expected-bucket-owner").build()).build();

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

    private final String bucket;

    private final String delimiter;

    private final String encodingType;

    private final String marker;

    private final Integer maxKeys;

    private final String prefix;

    private final String requestPayer;

    private final String expectedBucketOwner;

    private ListObjectsRequest(BuilderImpl builder) {
        super(builder);
        this.bucket = builder.bucket;
        this.delimiter = builder.delimiter;
        this.encodingType = builder.encodingType;
        this.marker = builder.marker;
        this.maxKeys = builder.maxKeys;
        this.prefix = builder.prefix;
        this.requestPayer = builder.requestPayer;
        this.expectedBucketOwner = builder.expectedBucketOwner;
    }

    /**
     * 

* The name of the bucket containing the objects. *

*

* When using this action with an access point, you must direct requests to the access point hostname. The access * point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. * When using this action with an access point through the Amazon Web Services SDKs, you provide the access point * ARN in place of the bucket name. For more information about access point ARNs, see Using access points in * the Amazon S3 User Guide. *

*

* When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The * S3 on Outposts hostname takes the form * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When using this * action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts bucket ARN in place of * the bucket name. For more information about S3 on Outposts ARNs, see Using S3 on Outposts in the * Amazon S3 User Guide. *

* * @return The name of the bucket containing the objects.

*

* When using this action with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in * place of the bucket name. For more information about access point ARNs, see Using access * points in the Amazon S3 User Guide. *

*

* When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts * hostname. The S3 on Outposts hostname takes the form * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When * using this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts * bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Using S3 on Outposts * in the Amazon S3 User Guide. */ public final 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 final String delimiter() { return delimiter; } /** * Returns the value of the EncodingType property for this object. *

* 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 The value of the EncodingType property for this object. * @see EncodingType */ public final EncodingType encodingType() { return EncodingType.fromValue(encodingType); } /** * Returns the value of the EncodingType property for this object. *

* 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 The value of the EncodingType property for this object. * @see EncodingType */ public final String encodingTypeAsString() { return encodingType; } /** *

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

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

* Sets the maximum number of keys returned in the response. By default the action returns up to 1,000 key names. * The response might contain fewer keys but will never contain more. *

* * @return Sets the maximum number of keys returned in the response. By default the action returns up to 1,000 key * names. The response might contain fewer keys but will never contain more. */ public final 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 final String prefix() { return prefix; } /** *

* Confirms that the requester knows that she or he will be charged for the list objects request. 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. Bucket * owners need not specify this parameter in their requests. * @see RequestPayer */ public final RequestPayer requestPayer() { return RequestPayer.fromValue(requestPayer); } /** *

* Confirms that the requester knows that she or he will be charged for the list objects request. 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. Bucket * owners need not specify this parameter in their requests. * @see RequestPayer */ public final String requestPayerAsString() { return requestPayer; } /** *

* The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will fail * with an HTTP 403 (Access Denied) error. *

* * @return The account ID of the expected bucket owner. If the bucket is owned by a different account, the request * will fail with an HTTP 403 (Access Denied) error. */ public final String expectedBucketOwner() { return expectedBucketOwner; } @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 + 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(marker()); hashCode = 31 * hashCode + Objects.hashCode(maxKeys()); hashCode = 31 * hashCode + Objects.hashCode(prefix()); hashCode = 31 * hashCode + Objects.hashCode(requestPayerAsString()); hashCode = 31 * hashCode + Objects.hashCode(expectedBucketOwner()); return hashCode; } @Override public final boolean equals(Object obj) { return super.equals(obj) && equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ListObjectsRequest)) { return false; } ListObjectsRequest other = (ListObjectsRequest) obj; return Objects.equals(bucket(), other.bucket()) && Objects.equals(delimiter(), other.delimiter()) && Objects.equals(encodingTypeAsString(), other.encodingTypeAsString()) && Objects.equals(marker(), other.marker()) && Objects.equals(maxKeys(), other.maxKeys()) && Objects.equals(prefix(), other.prefix()) && Objects.equals(requestPayerAsString(), other.requestPayerAsString()) && Objects.equals(expectedBucketOwner(), other.expectedBucketOwner()); } /** * 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("ListObjectsRequest").add("Bucket", bucket()).add("Delimiter", delimiter()) .add("EncodingType", encodingTypeAsString()).add("Marker", marker()).add("MaxKeys", maxKeys()) .add("Prefix", prefix()).add("RequestPayer", requestPayerAsString()) .add("ExpectedBucketOwner", expectedBucketOwner()).build(); } public final 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 "Marker": return Optional.ofNullable(clazz.cast(marker())); case "MaxKeys": return Optional.ofNullable(clazz.cast(maxKeys())); case "Prefix": return Optional.ofNullable(clazz.cast(prefix())); case "RequestPayer": return Optional.ofNullable(clazz.cast(requestPayerAsString())); case "ExpectedBucketOwner": return Optional.ofNullable(clazz.cast(expectedBucketOwner())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ListObjectsRequest) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends S3Request.Builder, SdkPojo, CopyableBuilder { /** *

* The name of the bucket containing the objects. *

*

* When using this action with an access point, you must direct requests to the access point hostname. The * access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action * with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the * bucket name. For more information about access point ARNs, see Using access points * in the Amazon S3 User Guide. *

*

* When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. * The S3 on Outposts hostname takes the form * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When using * this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts bucket ARN in * place of the bucket name. For more information about S3 on Outposts ARNs, see Using S3 on Outposts in * the Amazon S3 User Guide. *

* * @param bucket * The name of the bucket containing the objects.

*

* When using this action with an access point, you must direct requests to the access point hostname. * The access point hostname takes the form * AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this * action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in * place of the bucket name. For more information about access point ARNs, see Using access * points in the Amazon S3 User Guide. *

*

* When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts * hostname. The S3 on Outposts hostname takes the form * AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When * using this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts * bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Using S3 on * Outposts in the Amazon S3 User Guide. * @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); /** * Sets the value of the EncodingType property for this object. * * @param encodingType * The new value for the EncodingType property for this object. * @see EncodingType * @return Returns a reference to this object so that method calls can be chained together. * @see EncodingType */ Builder encodingType(String encodingType); /** * Sets the value of the EncodingType property for this object. * * @param encodingType * The new value for the EncodingType property for this object. * @see EncodingType * @return Returns a reference to this object so that method calls can be chained together. * @see EncodingType */ Builder encodingType(EncodingType encodingType); /** *

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

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

* Sets the maximum number of keys returned in the response. By default the action returns up to 1,000 key * names. The response might contain fewer keys but will never contain more. *

* * @param maxKeys * Sets the maximum number of keys returned in the response. By default the action returns up to 1,000 * key names. 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); /** *

* Confirms that the requester knows that she or he will be charged for the list objects request. 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. 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. 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. 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); /** *

* The account ID of the expected bucket owner. If the bucket is owned by a different account, the request will * fail with an HTTP 403 (Access Denied) error. *

* * @param expectedBucketOwner * The account ID of the expected bucket owner. If the bucket is owned by a different account, the * request will fail with an HTTP 403 (Access Denied) error. * @return Returns a reference to this object so that method calls can be chained together. */ Builder expectedBucketOwner(String expectedBucketOwner); @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 String marker; private Integer maxKeys; private String prefix; private String requestPayer; private String expectedBucketOwner; private BuilderImpl() { } private BuilderImpl(ListObjectsRequest model) { super(model); bucket(model.bucket); delimiter(model.delimiter); encodingType(model.encodingType); marker(model.marker); maxKeys(model.maxKeys); prefix(model.prefix); requestPayer(model.requestPayer); expectedBucketOwner(model.expectedBucketOwner); } public final String getBucket() { return bucket; } public final void setBucket(String bucket) { this.bucket = bucket; } @Override @Transient public final Builder bucket(String bucket) { this.bucket = bucket; return this; } public final String getDelimiter() { return delimiter; } public final void setDelimiter(String delimiter) { this.delimiter = delimiter; } @Override @Transient public final Builder delimiter(String delimiter) { this.delimiter = delimiter; return this; } public final String getEncodingType() { return encodingType; } public final void setEncodingType(String encodingType) { this.encodingType = encodingType; } @Override @Transient public final Builder encodingType(String encodingType) { this.encodingType = encodingType; return this; } @Override @Transient public final Builder encodingType(EncodingType encodingType) { this.encodingType(encodingType == null ? null : encodingType.toString()); return this; } public final String getMarker() { return marker; } public final void setMarker(String marker) { this.marker = marker; } @Override @Transient public final Builder marker(String marker) { this.marker = marker; return this; } public final Integer getMaxKeys() { return maxKeys; } public final void setMaxKeys(Integer maxKeys) { this.maxKeys = maxKeys; } @Override @Transient public final Builder maxKeys(Integer maxKeys) { this.maxKeys = maxKeys; return this; } public final String getPrefix() { return prefix; } public final void setPrefix(String prefix) { this.prefix = prefix; } @Override @Transient public final Builder prefix(String prefix) { this.prefix = prefix; return this; } public final String getRequestPayer() { return requestPayer; } public final void setRequestPayer(String requestPayer) { this.requestPayer = requestPayer; } @Override @Transient public final Builder requestPayer(String requestPayer) { this.requestPayer = requestPayer; return this; } @Override @Transient public final Builder requestPayer(RequestPayer requestPayer) { this.requestPayer(requestPayer == null ? null : requestPayer.toString()); return this; } public final String getExpectedBucketOwner() { return expectedBucketOwner; } public final void setExpectedBucketOwner(String expectedBucketOwner) { this.expectedBucketOwner = expectedBucketOwner; } @Override @Transient public final Builder expectedBucketOwner(String expectedBucketOwner) { this.expectedBucketOwner = expectedBucketOwner; return this; } @Override public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) { super.overrideConfiguration(overrideConfiguration); return this; } @Override public Builder overrideConfiguration(Consumer builderConsumer) { super.overrideConfiguration(builderConsumer); return this; } @Override public ListObjectsRequest build() { return new ListObjectsRequest(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy