software.amazon.awssdk.services.s3.model.ListObjectsRequest Maven / Gradle / Ivy
Show all versions of s3 Show documentation
/*
* 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 ListObjectsRequest extends S3Request implements
ToCopyableBuilder {
private static final SdkField BUCKET_FIELD = SdkField
. builder(MarshallingType.STRING)
.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)
.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)
.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)
.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)
.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)
.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)
.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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BUCKET_FIELD, DELIMITER_FIELD,
ENCODING_TYPE_FIELD, MARKER_FIELD, MAX_KEYS_FIELD, PREFIX_FIELD, REQUEST_PAYER_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 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;
}
/**
*
*
* @return
*/
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;
}
/**
* 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 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 String encodingTypeAsString() {
return encodingType;
}
/**
*
* Specifies the key to start with when listing objects in a bucket.
*
*
* @return Specifies the key to start with when listing objects in a bucket.
*/
public String marker() {
return marker;
}
/**
*
* 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;
}
/**
*
* 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 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 String requestPayerAsString() {
return requestPayer;
}
@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 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());
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 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());
}
/**
* 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("ListObjectsRequest").add("Bucket", bucket()).add("Delimiter", delimiter())
.add("EncodingType", encodingTypeAsString()).add("Marker", marker()).add("MaxKeys", maxKeys())
.add("Prefix", prefix()).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 "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()));
default:
return Optional.empty();
}
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
private static Function