software.amazon.awssdk.services.s3.model.ListMultipartUploadsResponse Maven / Gradle / Ivy
/*
* 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.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;
/**
*/
@Generated("software.amazon.awssdk:codegen")
public final class ListMultipartUploadsResponse extends S3Response implements
ToCopyableBuilder {
private static final SdkField BUCKET_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Bucket")
.getter(getter(ListMultipartUploadsResponse::bucket))
.setter(setter(Builder::bucket))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Bucket")
.unmarshallLocationName("Bucket").build()).build();
private static final SdkField KEY_MARKER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("KeyMarker")
.getter(getter(ListMultipartUploadsResponse::keyMarker))
.setter(setter(Builder::keyMarker))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyMarker")
.unmarshallLocationName("KeyMarker").build()).build();
private static final SdkField UPLOAD_ID_MARKER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("UploadIdMarker")
.getter(getter(ListMultipartUploadsResponse::uploadIdMarker))
.setter(setter(Builder::uploadIdMarker))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("UploadIdMarker")
.unmarshallLocationName("UploadIdMarker").build()).build();
private static final SdkField NEXT_KEY_MARKER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("NextKeyMarker")
.getter(getter(ListMultipartUploadsResponse::nextKeyMarker))
.setter(setter(Builder::nextKeyMarker))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextKeyMarker")
.unmarshallLocationName("NextKeyMarker").build()).build();
private static final SdkField PREFIX_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Prefix")
.getter(getter(ListMultipartUploadsResponse::prefix))
.setter(setter(Builder::prefix))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Prefix")
.unmarshallLocationName("Prefix").build()).build();
private static final SdkField DELIMITER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("Delimiter")
.getter(getter(ListMultipartUploadsResponse::delimiter))
.setter(setter(Builder::delimiter))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Delimiter")
.unmarshallLocationName("Delimiter").build()).build();
private static final SdkField NEXT_UPLOAD_ID_MARKER_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("NextUploadIdMarker")
.getter(getter(ListMultipartUploadsResponse::nextUploadIdMarker))
.setter(setter(Builder::nextUploadIdMarker))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("NextUploadIdMarker")
.unmarshallLocationName("NextUploadIdMarker").build()).build();
private static final SdkField MAX_UPLOADS_FIELD = SdkField
. builder(MarshallingType.INTEGER)
.memberName("MaxUploads")
.getter(getter(ListMultipartUploadsResponse::maxUploads))
.setter(setter(Builder::maxUploads))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("MaxUploads")
.unmarshallLocationName("MaxUploads").build()).build();
private static final SdkField IS_TRUNCATED_FIELD = SdkField
. builder(MarshallingType.BOOLEAN)
.memberName("IsTruncated")
.getter(getter(ListMultipartUploadsResponse::isTruncated))
.setter(setter(Builder::isTruncated))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("IsTruncated")
.unmarshallLocationName("IsTruncated").build()).build();
private static final SdkField> UPLOADS_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("Uploads")
.getter(getter(ListMultipartUploadsResponse::uploads))
.setter(setter(Builder::uploads))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Upload")
.unmarshallLocationName("Upload").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(MultipartUpload::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").unmarshallLocationName("member").build()).build())
.isFlattened(true).build()).build();
private static final SdkField> COMMON_PREFIXES_FIELD = SdkField
.> builder(MarshallingType.LIST)
.memberName("CommonPrefixes")
.getter(getter(ListMultipartUploadsResponse::commonPrefixes))
.setter(setter(Builder::commonPrefixes))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CommonPrefixes")
.unmarshallLocationName("CommonPrefixes").build(),
ListTrait
.builder()
.memberLocationName(null)
.memberFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(CommonPrefix::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("member").unmarshallLocationName("member").build()).build())
.isFlattened(true).build()).build();
private static final SdkField ENCODING_TYPE_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("EncodingType")
.getter(getter(ListMultipartUploadsResponse::encodingTypeAsString))
.setter(setter(Builder::encodingType))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("EncodingType")
.unmarshallLocationName("EncodingType").build()).build();
private static final SdkField REQUEST_CHARGED_FIELD = SdkField
. builder(MarshallingType.STRING)
.memberName("RequestCharged")
.getter(getter(ListMultipartUploadsResponse::requestChargedAsString))
.setter(setter(Builder::requestCharged))
.traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-request-charged")
.unmarshallLocationName("x-amz-request-charged").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BUCKET_FIELD,
KEY_MARKER_FIELD, UPLOAD_ID_MARKER_FIELD, NEXT_KEY_MARKER_FIELD, PREFIX_FIELD, DELIMITER_FIELD,
NEXT_UPLOAD_ID_MARKER_FIELD, MAX_UPLOADS_FIELD, IS_TRUNCATED_FIELD, UPLOADS_FIELD, COMMON_PREFIXES_FIELD,
ENCODING_TYPE_FIELD, REQUEST_CHARGED_FIELD));
private final String bucket;
private final String keyMarker;
private final String uploadIdMarker;
private final String nextKeyMarker;
private final String prefix;
private final String delimiter;
private final String nextUploadIdMarker;
private final Integer maxUploads;
private final Boolean isTruncated;
private final List uploads;
private final List commonPrefixes;
private final String encodingType;
private final String requestCharged;
private ListMultipartUploadsResponse(BuilderImpl builder) {
super(builder);
this.bucket = builder.bucket;
this.keyMarker = builder.keyMarker;
this.uploadIdMarker = builder.uploadIdMarker;
this.nextKeyMarker = builder.nextKeyMarker;
this.prefix = builder.prefix;
this.delimiter = builder.delimiter;
this.nextUploadIdMarker = builder.nextUploadIdMarker;
this.maxUploads = builder.maxUploads;
this.isTruncated = builder.isTruncated;
this.uploads = builder.uploads;
this.commonPrefixes = builder.commonPrefixes;
this.encodingType = builder.encodingType;
this.requestCharged = builder.requestCharged;
}
/**
*
* The name of the bucket to which the multipart upload was initiated. Does not return the access point ARN or
* access point alias if used.
*
*
* @return The name of the bucket to which the multipart upload was initiated. Does not return the access point ARN
* or access point alias if used.
*/
public final String bucket() {
return bucket;
}
/**
*
* The key at or after which the listing began.
*
*
* @return The key at or after which the listing began.
*/
public final String keyMarker() {
return keyMarker;
}
/**
*
* Together with key-marker, specifies the multipart upload after which listing should begin. If key-marker is not
* specified, the upload-id-marker parameter is ignored. Otherwise, any multipart uploads for a key equal to the
* key-marker might be included in the list only if they have an upload ID lexicographically greater than the
* specified upload-id-marker
.
*
*
*
* This functionality is not supported for directory buckets.
*
*
*
* @return Together with key-marker, specifies the multipart upload after which listing should begin. If key-marker
* is not specified, the upload-id-marker parameter is ignored. Otherwise, any multipart uploads for a key
* equal to the key-marker might be included in the list only if they have an upload ID lexicographically
* greater than the specified upload-id-marker
.
*
* This functionality is not supported for directory buckets.
*
*/
public final String uploadIdMarker() {
return uploadIdMarker;
}
/**
*
* When a list is truncated, this element specifies the value that should be used for the key-marker request
* parameter in a subsequent request.
*
*
* @return When a list is truncated, this element specifies the value that should be used for the key-marker request
* parameter in a subsequent request.
*/
public final String nextKeyMarker() {
return nextKeyMarker;
}
/**
*
* When a prefix is provided in the request, this field contains the specified prefix. The result contains only keys
* starting with the specified prefix.
*
*
*
* Directory buckets - For directory buckets, only prefixes that end in a delimiter (/
) are
* supported.
*
*
*
* @return When a prefix is provided in the request, this field contains the specified prefix. The result contains
* only keys starting with the specified prefix.
*
* Directory buckets - For directory buckets, only prefixes that end in a delimiter (/
)
* are supported.
*
*/
public final String prefix() {
return prefix;
}
/**
*
* Contains the delimiter you specified in the request. If you don't specify a delimiter in your request, this
* element is absent from the response.
*
*
*
* Directory buckets - For directory buckets, /
is the only supported delimiter.
*
*
*
* @return Contains the delimiter you specified in the request. If you don't specify a delimiter in your request,
* this element is absent from the response.
*
* Directory buckets - For directory buckets, /
is the only supported delimiter.
*
*/
public final String delimiter() {
return delimiter;
}
/**
*
* When a list is truncated, this element specifies the value that should be used for the
* upload-id-marker
request parameter in a subsequent request.
*
*
*
* This functionality is not supported for directory buckets.
*
*
*
* @return When a list is truncated, this element specifies the value that should be used for the
* upload-id-marker
request parameter in a subsequent request.
*
* This functionality is not supported for directory buckets.
*
*/
public final String nextUploadIdMarker() {
return nextUploadIdMarker;
}
/**
*
* Maximum number of multipart uploads that could have been included in the response.
*
*
* @return Maximum number of multipart uploads that could have been included in the response.
*/
public final Integer maxUploads() {
return maxUploads;
}
/**
*
* Indicates whether the returned list of multipart uploads is truncated. A value of true indicates that the list
* was truncated. The list can be truncated if the number of multipart uploads exceeds the limit allowed or
* specified by max uploads.
*
*
* @return Indicates whether the returned list of multipart uploads is truncated. A value of true indicates that the
* list was truncated. The list can be truncated if the number of multipart uploads exceeds the limit
* allowed or specified by max uploads.
*/
public final Boolean isTruncated() {
return isTruncated;
}
/**
* For responses, this returns true if the service returned a value for the Uploads 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 hasUploads() {
return uploads != null && !(uploads instanceof SdkAutoConstructList);
}
/**
*
* Container for elements related to a particular multipart upload. A response can contain zero or more
* Upload
elements.
*
*
* 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 #hasUploads} method.
*
*
* @return Container for elements related to a particular multipart upload. A response can contain zero or more
* Upload
elements.
*/
public final List uploads() {
return uploads;
}
/**
* For responses, this returns true if the service returned a value for the CommonPrefixes 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 hasCommonPrefixes() {
return commonPrefixes != null && !(commonPrefixes instanceof SdkAutoConstructList);
}
/**
*
* If you specify a delimiter in the request, then the result returns each distinct key prefix containing the
* delimiter in a CommonPrefixes
element. The distinct key prefixes are returned in the
* Prefix
child element.
*
*
*
* Directory buckets - For directory buckets, only prefixes that end in a delimiter (/
) are
* supported.
*
*
*
* 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 #hasCommonPrefixes} method.
*
*
* @return If you specify a delimiter in the request, then the result returns each distinct key prefix containing
* the delimiter in a CommonPrefixes
element. The distinct key prefixes are returned in the
* Prefix
child element.
*
* Directory buckets - For directory buckets, only prefixes that end in a delimiter (/
)
* are supported.
*
*/
public final List commonPrefixes() {
return commonPrefixes;
}
/**
*
* Encoding type used by Amazon S3 to encode object keys in the response.
*
*
* If you specify the encoding-type
request parameter, Amazon S3 includes this element in the response,
* and returns encoded key name values in the following response elements:
*
*
* Delimiter
, KeyMarker
, Prefix
, NextKeyMarker
, Key
* .
*
*
* 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.
*
* If you specify the encoding-type
request parameter, Amazon S3 includes this element in the
* response, and returns encoded key name values in the following response elements:
*
*
* Delimiter
, KeyMarker
, Prefix
, NextKeyMarker
,
* Key
.
* @see EncodingType
*/
public final EncodingType encodingType() {
return EncodingType.fromValue(encodingType);
}
/**
*
* Encoding type used by Amazon S3 to encode object keys in the response.
*
*
* If you specify the encoding-type
request parameter, Amazon S3 includes this element in the response,
* and returns encoded key name values in the following response elements:
*
*
* Delimiter
, KeyMarker
, Prefix
, NextKeyMarker
, Key
* .
*
*
* 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.
*
* If you specify the encoding-type
request parameter, Amazon S3 includes this element in the
* response, and returns encoded key name values in the following response elements:
*
*
* Delimiter
, KeyMarker
, Prefix
, NextKeyMarker
,
* Key
.
* @see EncodingType
*/
public final String encodingTypeAsString() {
return encodingType;
}
/**
* Returns the value of the RequestCharged property for this object.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #requestCharged}
* will return {@link RequestCharged#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #requestChargedAsString}.
*
*
* @return The value of the RequestCharged property for this object.
* @see RequestCharged
*/
public final RequestCharged requestCharged() {
return RequestCharged.fromValue(requestCharged);
}
/**
* Returns the value of the RequestCharged property for this object.
*
* If the service returns an enum value that is not available in the current SDK version, {@link #requestCharged}
* will return {@link RequestCharged#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
* from {@link #requestChargedAsString}.
*
*
* @return The value of the RequestCharged property for this object.
* @see RequestCharged
*/
public final String requestChargedAsString() {
return requestCharged;
}
@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 + super.hashCode();
hashCode = 31 * hashCode + Objects.hashCode(bucket());
hashCode = 31 * hashCode + Objects.hashCode(keyMarker());
hashCode = 31 * hashCode + Objects.hashCode(uploadIdMarker());
hashCode = 31 * hashCode + Objects.hashCode(nextKeyMarker());
hashCode = 31 * hashCode + Objects.hashCode(prefix());
hashCode = 31 * hashCode + Objects.hashCode(delimiter());
hashCode = 31 * hashCode + Objects.hashCode(nextUploadIdMarker());
hashCode = 31 * hashCode + Objects.hashCode(maxUploads());
hashCode = 31 * hashCode + Objects.hashCode(isTruncated());
hashCode = 31 * hashCode + Objects.hashCode(hasUploads() ? uploads() : null);
hashCode = 31 * hashCode + Objects.hashCode(hasCommonPrefixes() ? commonPrefixes() : null);
hashCode = 31 * hashCode + Objects.hashCode(encodingTypeAsString());
hashCode = 31 * hashCode + Objects.hashCode(requestChargedAsString());
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 ListMultipartUploadsResponse)) {
return false;
}
ListMultipartUploadsResponse other = (ListMultipartUploadsResponse) obj;
return Objects.equals(bucket(), other.bucket()) && Objects.equals(keyMarker(), other.keyMarker())
&& Objects.equals(uploadIdMarker(), other.uploadIdMarker())
&& Objects.equals(nextKeyMarker(), other.nextKeyMarker()) && Objects.equals(prefix(), other.prefix())
&& Objects.equals(delimiter(), other.delimiter())
&& Objects.equals(nextUploadIdMarker(), other.nextUploadIdMarker())
&& Objects.equals(maxUploads(), other.maxUploads()) && Objects.equals(isTruncated(), other.isTruncated())
&& hasUploads() == other.hasUploads() && Objects.equals(uploads(), other.uploads())
&& hasCommonPrefixes() == other.hasCommonPrefixes() && Objects.equals(commonPrefixes(), other.commonPrefixes())
&& Objects.equals(encodingTypeAsString(), other.encodingTypeAsString())
&& Objects.equals(requestChargedAsString(), other.requestChargedAsString());
}
/**
* 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("ListMultipartUploadsResponse").add("Bucket", bucket()).add("KeyMarker", keyMarker())
.add("UploadIdMarker", uploadIdMarker()).add("NextKeyMarker", nextKeyMarker()).add("Prefix", prefix())
.add("Delimiter", delimiter()).add("NextUploadIdMarker", nextUploadIdMarker()).add("MaxUploads", maxUploads())
.add("IsTruncated", isTruncated()).add("Uploads", hasUploads() ? uploads() : null)
.add("CommonPrefixes", hasCommonPrefixes() ? commonPrefixes() : null).add("EncodingType", encodingTypeAsString())
.add("RequestCharged", requestChargedAsString()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Bucket":
return Optional.ofNullable(clazz.cast(bucket()));
case "KeyMarker":
return Optional.ofNullable(clazz.cast(keyMarker()));
case "UploadIdMarker":
return Optional.ofNullable(clazz.cast(uploadIdMarker()));
case "NextKeyMarker":
return Optional.ofNullable(clazz.cast(nextKeyMarker()));
case "Prefix":
return Optional.ofNullable(clazz.cast(prefix()));
case "Delimiter":
return Optional.ofNullable(clazz.cast(delimiter()));
case "NextUploadIdMarker":
return Optional.ofNullable(clazz.cast(nextUploadIdMarker()));
case "MaxUploads":
return Optional.ofNullable(clazz.cast(maxUploads()));
case "IsTruncated":
return Optional.ofNullable(clazz.cast(isTruncated()));
case "Uploads":
return Optional.ofNullable(clazz.cast(uploads()));
case "CommonPrefixes":
return Optional.ofNullable(clazz.cast(commonPrefixes()));
case "EncodingType":
return Optional.ofNullable(clazz.cast(encodingTypeAsString()));
case "RequestCharged":
return Optional.ofNullable(clazz.cast(requestChargedAsString()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function