Search in sources :

Example 1 with ObjectTaggingXmlFactory

use of com.qcloud.cos.model.transform.ObjectTaggingXmlFactory in project cos-java-sdk-v5 by tencentyun.

the class COSClient method setObjectTagging.

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

Aggregations

ResponseHeaderHandlerChain (com.qcloud.cos.internal.ResponseHeaderHandlerChain)1 SetObjectTaggingResponseHeaderHandler (com.qcloud.cos.internal.SetObjectTaggingResponseHeaderHandler)1 Unmarshallers (com.qcloud.cos.internal.Unmarshallers)1 ObjectTaggingXmlFactory (com.qcloud.cos.model.transform.ObjectTaggingXmlFactory)1