com.amazonaws.services.s3.model.transform.Unmarshallers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aws-java-sdk-s3 Show documentation
Show all versions of aws-java-sdk-s3 Show documentation
The AWS Java SDK for Amazon S3 module holds the client classes that are used for communicating with Amazon Simple Storage Service
/*
* Copyright 2010-2024 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 com.amazonaws.services.s3.model.transform;
import com.amazonaws.services.s3.internal.DeleteObjectsResponse;
import com.amazonaws.services.s3.model.AccessControlList;
import com.amazonaws.services.s3.model.Bucket;
import com.amazonaws.services.s3.model.BucketAccelerateConfiguration;
import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration;
import com.amazonaws.services.s3.model.BucketLifecycleConfiguration;
import com.amazonaws.services.s3.model.BucketLoggingConfiguration;
import com.amazonaws.services.s3.model.BucketReplicationConfiguration;
import com.amazonaws.services.s3.model.BucketTaggingConfiguration;
import com.amazonaws.services.s3.model.BucketVersioningConfiguration;
import com.amazonaws.services.s3.model.BucketWebsiteConfiguration;
import com.amazonaws.services.s3.model.DeleteBucketAnalyticsConfigurationResult;
import com.amazonaws.services.s3.model.DeleteBucketEncryptionResult;
import com.amazonaws.services.s3.model.DeleteBucketIntelligentTieringConfigurationResult;
import com.amazonaws.services.s3.model.DeleteBucketInventoryConfigurationResult;
import com.amazonaws.services.s3.model.DeleteBucketMetricsConfigurationResult;
import com.amazonaws.services.s3.model.DeleteBucketOwnershipControlsResult;
import com.amazonaws.services.s3.model.DeleteObjectTaggingResult;
import com.amazonaws.services.s3.model.DeletePublicAccessBlockResult;
import com.amazonaws.services.s3.model.GetBucketAnalyticsConfigurationResult;
import com.amazonaws.services.s3.model.GetBucketIntelligentTieringConfigurationResult;
import com.amazonaws.services.s3.model.GetBucketInventoryConfigurationResult;
import com.amazonaws.services.s3.model.GetBucketMetricsConfigurationResult;
import com.amazonaws.services.s3.model.GetBucketOwnershipControlsResult;
import com.amazonaws.services.s3.model.GetObjectLegalHoldResult;
import com.amazonaws.services.s3.model.GetObjectLockConfigurationResult;
import com.amazonaws.services.s3.model.GetObjectRetentionResult;
import com.amazonaws.services.s3.model.GetObjectTaggingResult;
import com.amazonaws.services.s3.model.InitiateMultipartUploadResult;
import com.amazonaws.services.s3.model.ListBucketAnalyticsConfigurationsResult;
import com.amazonaws.services.s3.model.ListBucketIntelligentTieringConfigurationsResult;
import com.amazonaws.services.s3.model.ListBucketInventoryConfigurationsResult;
import com.amazonaws.services.s3.model.ListBucketMetricsConfigurationsResult;
import com.amazonaws.services.s3.model.ListObjectsV2Result;
import com.amazonaws.services.s3.model.MultipartUploadListing;
import com.amazonaws.services.s3.model.ObjectListing;
import com.amazonaws.services.s3.model.Owner;
import com.amazonaws.services.s3.model.PartListing;
import com.amazonaws.services.s3.model.RequestPaymentConfiguration;
import com.amazonaws.services.s3.model.RestoreObjectResult;
import com.amazonaws.services.s3.model.SetBucketAnalyticsConfigurationResult;
import com.amazonaws.services.s3.model.SetBucketEncryptionResult;
import com.amazonaws.services.s3.model.SetBucketIntelligentTieringConfigurationResult;
import com.amazonaws.services.s3.model.SetBucketInventoryConfigurationResult;
import com.amazonaws.services.s3.model.SetBucketMetricsConfigurationResult;
import com.amazonaws.services.s3.model.SetBucketOwnershipControlsResult;
import com.amazonaws.services.s3.model.SetObjectLegalHoldResult;
import com.amazonaws.services.s3.model.SetObjectLockConfigurationResult;
import com.amazonaws.services.s3.model.SetObjectRetentionResult;
import com.amazonaws.services.s3.model.SetObjectTaggingResult;
import com.amazonaws.services.s3.model.SetPublicAccessBlockResult;
import com.amazonaws.services.s3.model.VersionListing;
import com.amazonaws.services.s3.model.WriteGetObjectResponseResult;
import com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.CompleteMultipartUploadHandler;
import com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.CopyObjectResultHandler;
import com.amazonaws.transform.Unmarshaller;
import java.io.InputStream;
import java.util.List;
/**
* Collection of unmarshallers for S3 XML responses.
*/
public class Unmarshallers {
/**
* Unmarshaller for the ListBuckets XML response.
*/
public static final class ListBucketsUnmarshaller implements
Unmarshaller, InputStream> {
public List unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseListMyBucketsResponse(in).getBuckets();
}
}
/**
* Unmarshaller for the ListBuckets XML response, parsing out the owner
* even if the list is empty.
*/
public static final class ListBucketsOwnerUnmarshaller implements
Unmarshaller {
public Owner unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseListMyBucketsResponse(in).getOwner();
}
}
/**
* Unmarshaller for the ListObjects XML response.
*/
public static final class ListObjectsUnmarshaller implements
Unmarshaller {
private final boolean shouldSDKDecodeResponse;
public ListObjectsUnmarshaller(final boolean shouldSDKDecodeResponse) {
this.shouldSDKDecodeResponse = shouldSDKDecodeResponse;
}
public ObjectListing unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseListBucketObjectsResponse(in, shouldSDKDecodeResponse).getObjectListing();
}
}
/**
* Unmarshaller for the ListObjectsV2 XML response.
*/
public static final class ListObjectsV2Unmarshaller implements
Unmarshaller {
private final boolean shouldSDKDecodeResponse;
public ListObjectsV2Unmarshaller(final boolean shouldSDKDecodeResponse) {
this.shouldSDKDecodeResponse = shouldSDKDecodeResponse;
}
public ListObjectsV2Result unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseListObjectsV2Response(in, shouldSDKDecodeResponse).getResult();
}
}
/**
* Unmarshaller for the ListVersions XML response.
*/
public static final class VersionListUnmarshaller implements
Unmarshaller {
private final boolean shouldSDKDecodeResponse;
public VersionListUnmarshaller(final boolean shouldSDKDecodeResponse) {
this.shouldSDKDecodeResponse = shouldSDKDecodeResponse;
}
public VersionListing unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseListVersionsResponse(in, shouldSDKDecodeResponse).getListing();
}
}
/**
* Unmarshaller for the AccessControlList XML response.
*/
public static final class AccessControlListUnmarshaller implements
Unmarshaller {
public AccessControlList unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseAccessControlListResponse(in).getAccessControlList();
}
}
/**
* Unmarshaller for the BucketLoggingStatus XML response.
*/
public static final class BucketLoggingConfigurationnmarshaller implements
Unmarshaller {
public BucketLoggingConfiguration unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseLoggingStatusResponse(in).getBucketLoggingConfiguration();
}
}
/**
* Unmarshaller for the BucketLocation XML response.
*/
public static final class BucketLocationUnmarshaller implements
Unmarshaller {
public String unmarshall(InputStream in) throws Exception {
String location = new XmlResponsesSaxParser()
.parseBucketLocationResponse(in);
/*
* S3 treats the US location differently, and assumes that if the
* reported location is null, then it's a US bucket.
*/
if (location == null) location = "US";
return location;
}
}
/**
* Unmarshaller for the BucketVersionConfiguration XML response.
*/
public static final class BucketVersioningConfigurationUnmarshaller implements
Unmarshaller {
public BucketVersioningConfiguration unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseVersioningConfigurationResponse(in).getConfiguration();
}
}
/**
* Unmarshaller for the BucketWebsiteConfiguration XML response.
*/
public static final class BucketWebsiteConfigurationUnmarshaller implements
Unmarshaller {
public BucketWebsiteConfiguration unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseWebsiteConfigurationResponse(in).getConfiguration();
}
}
/**
* Unmarshaller for the BucketNotificationConfiguration XML response.
*/
public static final class BucketReplicationConfigurationUnmarshaller implements
Unmarshaller {
public BucketReplicationConfiguration unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseReplicationConfigurationResponse(in).getConfiguration();
}
}
/**
* Unmarshaller for the BucketTaggingConfiguration XML response.
*/
public static final class BucketTaggingConfigurationUnmarshaller implements
Unmarshaller {
public BucketTaggingConfiguration unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseTaggingConfigurationResponse(in).getConfiguration();
}
}
/**
* Unmarshaller for the BucketAccelerateConfiguration XML response.
*/
public static final class BucketAccelerateConfigurationUnmarshaller implements
Unmarshaller {
public BucketAccelerateConfiguration unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseAccelerateConfigurationResponse(in).getConfiguration();
}
}
/**
* Unmarshaller for the DeleteBucketEncryption XML response.
*/
public static final class DeleteBucketEncryptionUnmarshaller
implements Unmarshaller {
public DeleteBucketEncryptionResult unmarshall(InputStream in) {
// DeleteBucketEncryption has no output shape
return new DeleteBucketEncryptionResult();
}
}
/**
* Unmarshaller for the SetBucketEncryption XML response.
*/
public static final class SetBucketEncryptionUnmarshaller
implements Unmarshaller {
public SetBucketEncryptionResult unmarshall(InputStream in) {
// SetBucketEncryption has no output shape
return new SetBucketEncryptionResult();
}
}
public static final class SetPublicAccessBlockUnmarshaller
implements Unmarshaller {
public SetPublicAccessBlockResult unmarshall(InputStream in) {
// SetPublicAccessBlock has no output shape
return new SetPublicAccessBlockResult();
}
}
public static final class DeletePublicAccessBlockUnmarshaller
implements Unmarshaller {
public DeletePublicAccessBlockResult unmarshall(InputStream in) {
// DeletePublicAccessBlock has no output shape
return new DeletePublicAccessBlockResult();
}
}
/**
* Unmarshaller for the a direct InputStream response.
*/
public static final class InputStreamUnmarshaller implements
Unmarshaller {
public InputStream unmarshall(InputStream in) throws Exception {
return in;
}
}
/**
* Unmarshaller for the CopyObject XML response.
*/
public static final class CopyObjectUnmarshaller implements
Unmarshaller {
public CopyObjectResultHandler unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseCopyObjectResponse(in);
}
}
public static final class CompleteMultipartUploadResultUnmarshaller implements
Unmarshaller {
public CompleteMultipartUploadHandler unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseCompleteMultipartUploadResponse(in);
}
}
public static final class InitiateMultipartUploadResultUnmarshaller implements
Unmarshaller {
public InitiateMultipartUploadResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseInitiateMultipartUploadResponse(in)
.getInitiateMultipartUploadResult();
}
}
public static final class ListMultipartUploadsResultUnmarshaller implements
Unmarshaller {
public MultipartUploadListing unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseListMultipartUploadsResponse(in)
.getListMultipartUploadsResult();
}
}
public static final class ListPartsResultUnmarshaller implements
Unmarshaller {
public PartListing unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseListPartsResponse(in)
.getListPartsResult();
}
}
public static final class DeleteObjectsResultUnmarshaller implements
Unmarshaller {
public DeleteObjectsResponse unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseDeletedObjectsResult(in).getDeleteObjectResult();
}
}
public static final class BucketLifecycleConfigurationUnmarshaller implements
Unmarshaller {
public BucketLifecycleConfiguration unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseBucketLifecycleConfigurationResponse(in).getConfiguration();
}
}
public static final class BucketCrossOriginConfigurationUnmarshaller implements
Unmarshaller {
public BucketCrossOriginConfiguration unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseBucketCrossOriginConfigurationResponse(in).getConfiguration();
}
}
/**
* Unmarshaller for the RequestPaymentConfiguration XML response.
*/
public static final class RequestPaymentConfigurationUnmarshaller implements
Unmarshaller {
public RequestPaymentConfiguration unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser()
.parseRequestPaymentConfigurationResponse(in).getConfiguration();
}
}
public static final class GetObjectTaggingResponseUnmarshaller implements Unmarshaller {
@Override
public GetObjectTaggingResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseObjectTaggingResponse(in).getResult();
}
}
public static final class SetObjectTaggingResponseUnmarshaller implements Unmarshaller {
@Override
public SetObjectTaggingResult unmarshall(InputStream in) throws Exception {
return new SetObjectTaggingResult();
}
}
public static final class DeleteObjectTaggingResponseUnmarshaller implements Unmarshaller {
@Override
public DeleteObjectTaggingResult unmarshall(InputStream in) throws Exception {
return new DeleteObjectTaggingResult();
}
}
/**
* Unmarshaller for the GetBucketAnalyticsConfiguration XML response.
*/
public static final class GetBucketAnalyticsConfigurationUnmarshaller implements
Unmarshaller {
public GetBucketAnalyticsConfigurationResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseGetBucketAnalyticsConfigurationResponse(in).getResult();
}
}
/**
* Unmarshaller for the ListBucketAnalyticsConfigurations XML response.
*/
public static final class ListBucketAnalyticsConfigurationUnmarshaller implements
Unmarshaller {
public ListBucketAnalyticsConfigurationsResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseListBucketAnalyticsConfigurationResponse(in).getResult();
}
}
/**
* Unmarshaller for the DeleteBucketAnalyticsConfiguration XML response.
*/
public static final class DeleteBucketAnalyticsConfigurationUnmarshaller implements
Unmarshaller {
public DeleteBucketAnalyticsConfigurationResult unmarshall(InputStream in) throws Exception {
return new DeleteBucketAnalyticsConfigurationResult();
}
}
/**
* Unmarshaller for the SetBucketAnalyticsConfiguration XML response.
*/
public static final class SetBucketAnalyticsConfigurationUnmarshaller implements
Unmarshaller {
public SetBucketAnalyticsConfigurationResult unmarshall(InputStream in) throws Exception {
return new SetBucketAnalyticsConfigurationResult();
}
}
/**
* Unmarshaller for the GetBucketIntelligenTieringConfiguration XML response.
*/
public static final class GetBucketIntelligenTieringConfigurationUnmarshaller implements
Unmarshaller {
public GetBucketIntelligentTieringConfigurationResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseGetBucketIntelligentTieringConfigurationResponse(in).getResult();
}
}
/**
* Unmarshaller for the ListBucketIntelligenTieringConfigurations XML response.
*/
public static final class ListBucketIntelligenTieringConfigurationUnmarshaller implements
Unmarshaller {
public ListBucketIntelligentTieringConfigurationsResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseListBucketIntelligentTieringConfigurationResponse(in).getResult();
}
}
/**
* Unmarshaller for the DeleteBucketIntelligenTieringConfiguration XML response.
*/
public static final class DeleteBucketIntelligenTieringConfigurationUnmarshaller implements
Unmarshaller {
public DeleteBucketIntelligentTieringConfigurationResult unmarshall(InputStream in) throws Exception {
return new DeleteBucketIntelligentTieringConfigurationResult();
}
}
/**
* Unmarshaller for the SetBucketIntelligenTieringConfiguration XML response.
*/
public static final class SetBucketIntelligentTieringConfigurationUnmarshaller implements
Unmarshaller {
public SetBucketIntelligentTieringConfigurationResult unmarshall(InputStream in) throws Exception {
return new SetBucketIntelligentTieringConfigurationResult();
}
}
/**
* Unmarshaller for the GetBucketMetricsConfiguration XML response.
*/
public static final class GetBucketMetricsConfigurationUnmarshaller implements
Unmarshaller {
public GetBucketMetricsConfigurationResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseGetBucketMetricsConfigurationResponse(in).getResult();
}
}
/**
* Unmarshaller for the ListBucketMetricsConfigurations XML response.
*/
public static final class ListBucketMetricsConfigurationsUnmarshaller implements
Unmarshaller {
public ListBucketMetricsConfigurationsResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseListBucketMetricsConfigurationsResponse(in).getResult();
}
}
/**
* Unmarshaller for the DeleteBucketMetricsConfiguration XML response.
*/
public static final class DeleteBucketMetricsConfigurationUnmarshaller implements
Unmarshaller {
public DeleteBucketMetricsConfigurationResult unmarshall(InputStream in) throws Exception {
return new DeleteBucketMetricsConfigurationResult();
}
}
/**
* Unmarshaller for the SetBucketMetricsConfiguration XML response.
*/
public static final class SetBucketMetricsConfigurationUnmarshaller implements
Unmarshaller {
public SetBucketMetricsConfigurationResult unmarshall(InputStream in) throws Exception {
return new SetBucketMetricsConfigurationResult();
}
}
/**
* Unmarshaller for the DeleteBucketOwnershipControls XML response.
*/
public static final class DeleteBucketOwnershipControlsUnmarshaller implements
Unmarshaller {
public DeleteBucketOwnershipControlsResult unmarshall(InputStream in) throws Exception {
return new DeleteBucketOwnershipControlsResult();
}
}
/**
* Unmarshaller for the GetBucketOwnershipControls XML response.
*/
public static final class GetBucketOwnershipControlsUnmarshaller implements
Unmarshaller {
public GetBucketOwnershipControlsResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseGetBucketOwnershipControlsResponse(in).getResult();
}
}
/**
* Unmarshaller for the SetBucketOwnershipControls XML response.
*/
public static final class SetBucketOwnershipControlsUnmarshaller implements
Unmarshaller {
public SetBucketOwnershipControlsResult unmarshall(InputStream in) throws Exception {
return new SetBucketOwnershipControlsResult();
}
}
/**
* Unmarshaller for the GetBucketInventoryConfiguration XML response.
*/
public static final class GetBucketInventoryConfigurationUnmarshaller implements
Unmarshaller {
public GetBucketInventoryConfigurationResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseGetBucketInventoryConfigurationResponse(in).getResult();
}
}
/**
* Unmarshaller for the ListBucketInventoryConfigurations XML response.
*/
public static final class ListBucketInventoryConfigurationsUnmarshaller implements
Unmarshaller {
public ListBucketInventoryConfigurationsResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseBucketListInventoryConfigurationsResponse(in).getResult();
}
}
/**
* Unmarshaller for the DeleteBucketInventoryConfiguration XML response.
*/
public static final class DeleteBucketInventoryConfigurationUnmarshaller implements
Unmarshaller {
public DeleteBucketInventoryConfigurationResult unmarshall(InputStream in) throws Exception {
return new DeleteBucketInventoryConfigurationResult();
}
}
/**
* Unmarshaller for the SetBucketInventoryConfiguration XML response.
*/
public static final class SetBucketInventoryConfigurationUnmarshaller implements
Unmarshaller {
public SetBucketInventoryConfigurationResult unmarshall(InputStream in) throws Exception {
return new SetBucketInventoryConfigurationResult();
}
}
/**
* Unmarshaller for the RestoreObjectResult XML response.
*/
public static final class RestoreObjectResultUnmarshaller
implements Unmarshaller {
public RestoreObjectResult unmarshall(InputStream in) {
return new RestoreObjectResult();
}
}
public static final class GetObjectLegalHoldResultUnmarshaller implements Unmarshaller {
@Override
public GetObjectLegalHoldResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseGetObjectLegalHoldResponse(in).getResult();
}
}
public static final class SetObjectLockConfigurationResultUnmarshaller implements Unmarshaller {
@Override
public SetObjectLockConfigurationResult unmarshall(InputStream in) throws Exception {
return new SetObjectLockConfigurationResult();
}
}
public static final class SetObjectLegalHoldResultUnmarshaller implements Unmarshaller {
@Override
public SetObjectLegalHoldResult unmarshall(InputStream in) throws Exception {
return new SetObjectLegalHoldResult();
}
}
public static final class GetObjectLockConfigurationResultUnmarshaller implements Unmarshaller {
@Override
public GetObjectLockConfigurationResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseGetObjectLockConfigurationResponse(in).getResult();
}
}
public static final class SetObjectRetentionResultUnmarshaller implements Unmarshaller {
@Override
public SetObjectRetentionResult unmarshall(InputStream in) throws Exception {
return new SetObjectRetentionResult();
}
}
public static final class GetObjectRetentionResultUnmarshaller implements Unmarshaller {
@Override
public GetObjectRetentionResult unmarshall(InputStream in) throws Exception {
return new XmlResponsesSaxParser().parseGetObjectRetentionResponse(in).getResult();
}
}
public static final class WriteGetObjectResponseResultUnmarshaller implements Unmarshaller {
@Override
public WriteGetObjectResponseResult unmarshall(InputStream inputStream) throws Exception {
return new WriteGetObjectResponseResult();
}
}
}