Search in sources :

Example 1 with SetObjectTaggingResponseHeaderHandler

use of com.amazonaws.services.s3.internal.SetObjectTaggingResponseHeaderHandler in project aws-sdk-android by aws-amplify.

the class AmazonS3Client method setObjectTagging.

@Override
public SetObjectTaggingResult setObjectTagging(SetObjectTaggingRequest setObjectTaggingRequest) {
    assertParameterNotNull(setObjectTaggingRequest, "The request parameter must be specified setting the object tags");
    final String bucketName = assertStringNotEmpty(setObjectTaggingRequest.getBucketName(), "BucketName");
    final String key = assertNotNull(setObjectTaggingRequest.getKey(), "Key");
    final ObjectTagging tagging = assertNotNull(setObjectTaggingRequest.getTagging(), "ObjectTagging");
    final Request<SetObjectTaggingRequest> request = createRequest(bucketName, key, setObjectTaggingRequest, HttpMethodName.PUT);
    request.addParameter("tagging", null);
    addParameterIfNotNull(request, "versionId", setObjectTaggingRequest.getVersionId());
    final byte[] content = new ObjectTaggingXmlFactory().convertToXmlByteArray(tagging);
    setContent(request, content, "application/xml", true);
    final ResponseHeaderHandlerChain<SetObjectTaggingResult> handlerChain = new ResponseHeaderHandlerChain<SetObjectTaggingResult>(new Unmarshallers.SetObjectTaggingResponseUnmarshaller(), new SetObjectTaggingResponseHeaderHandler());
    return invoke(request, handlerChain, bucketName, key);
}
Also used : Unmarshallers(com.amazonaws.services.s3.model.transform.Unmarshallers) SetObjectTaggingResponseHeaderHandler(com.amazonaws.services.s3.internal.SetObjectTaggingResponseHeaderHandler) ObjectTaggingXmlFactory(com.amazonaws.services.s3.model.transform.ObjectTaggingXmlFactory) ResponseHeaderHandlerChain(com.amazonaws.services.s3.internal.ResponseHeaderHandlerChain)

Aggregations

ResponseHeaderHandlerChain (com.amazonaws.services.s3.internal.ResponseHeaderHandlerChain)1 SetObjectTaggingResponseHeaderHandler (com.amazonaws.services.s3.internal.SetObjectTaggingResponseHeaderHandler)1 ObjectTaggingXmlFactory (com.amazonaws.services.s3.model.transform.ObjectTaggingXmlFactory)1 Unmarshallers (com.amazonaws.services.s3.model.transform.Unmarshallers)1