Search in sources :

Example 66 with RequestMessage

use of com.aliyun.oss.common.comm.RequestMessage in project aliyun-oss-java-sdk by aliyun.

the class OSSBucketOperation method getBucketReplicationProgress.

/**
 * Get bucket replication progress.
 */
public BucketReplicationProgress getBucketReplicationProgress(GetBucketReplicationProgressRequest getBucketReplicationProgressRequest) throws OSSException, ClientException {
    assertParameterNotNull(getBucketReplicationProgressRequest, "getBucketReplicationProgressRequest");
    assertParameterNotNull(getBucketReplicationProgressRequest.getReplicationRuleID(), "replicationRuleID");
    String bucketName = getBucketReplicationProgressRequest.getBucketName();
    assertParameterNotNull(bucketName, "bucketName");
    ensureBucketNameValid(bucketName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(RequestParameters.SUBRESOURCE_REPLICATION_PROGRESS, null);
    params.put(RequestParameters.RULE_ID, getBucketReplicationProgressRequest.getReplicationRuleID());
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.GET).setBucket(bucketName).setParameters(params).setOriginalRequest(getBucketReplicationProgressRequest).build();
    return doOperation(request, getBucketReplicationProgressResponseParser, bucketName, null, true);
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 67 with RequestMessage

use of com.aliyun.oss.common.comm.RequestMessage in project aliyun-oss-java-sdk by aliyun.

the class OSSBucketOperation method deleteImageStyle.

public void deleteImageStyle(String bucketName, String styleName, GenericRequest genericRequest) throws OSSException, ClientException {
    assertParameterNotNull(bucketName, "bucketName");
    assertParameterNotNull(styleName, "styleName");
    ensureBucketNameValid(bucketName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(SUBRESOURCE_STYLE, null);
    params.put(STYLE_NAME, styleName);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.DELETE).setBucket(bucketName).setParameters(params).setOriginalRequest(genericRequest).build();
    doOperation(request, emptyResponseParser, bucketName, null);
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 68 with RequestMessage

use of com.aliyun.oss.common.comm.RequestMessage in project aliyun-oss-java-sdk by aliyun.

the class OSSBucketOperation method deleteBucketLogging.

/**
 * Delete bucket logging.
 */
public void deleteBucketLogging(GenericRequest genericRequest) throws OSSException, ClientException {
    assertParameterNotNull(genericRequest, "genericRequest");
    String bucketName = genericRequest.getBucketName();
    assertParameterNotNull(bucketName, "bucketName");
    ensureBucketNameValid(bucketName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(SUBRESOURCE_LOGGING, null);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.DELETE).setBucket(bucketName).setParameters(params).setOriginalRequest(genericRequest).build();
    doOperation(request, emptyResponseParser, bucketName, null);
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 69 with RequestMessage

use of com.aliyun.oss.common.comm.RequestMessage in project aliyun-oss-java-sdk by aliyun.

the class OSSBucketOperation method putImageStyle.

/**
 * put image style
 */
public void putImageStyle(PutImageStyleRequest putImageStyleRequest) throws OSSException, ClientException {
    assertParameterNotNull(putImageStyleRequest, "putImageStyleRequest");
    String bucketName = putImageStyleRequest.GetBucketName();
    String styleName = putImageStyleRequest.GetStyleName();
    assertParameterNotNull(styleName, "styleName");
    assertParameterNotNull(bucketName, "bucketName");
    ensureBucketNameValid(bucketName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(SUBRESOURCE_STYLE, null);
    params.put(STYLE_NAME, styleName);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.PUT).setBucket(bucketName).setParameters(params).setOriginalRequest(putImageStyleRequest).setInputStreamWithLength(putImageStyleRequestMarshaller.marshall(putImageStyleRequest)).build();
    doOperation(request, emptyResponseParser, bucketName, null);
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 70 with RequestMessage

use of com.aliyun.oss.common.comm.RequestMessage in project aliyun-oss-java-sdk by aliyun.

the class OSSBucketOperation method deleteBucketImage.

/**
 * Delete bucket image attributes.
 */
public void deleteBucketImage(String bucketName, GenericRequest genericRequest) throws OSSException, ClientException {
    assertParameterNotNull(bucketName, "bucketName");
    ensureBucketNameValid(bucketName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(SUBRESOURCE_IMG, null);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.DELETE).setBucket(bucketName).setParameters(params).setOriginalRequest(genericRequest).build();
    doOperation(request, emptyResponseParser, bucketName, null);
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Aggregations

RequestMessage (com.aliyun.oss.common.comm.RequestMessage)98 LinkedHashMap (java.util.LinkedHashMap)88 HashMap (java.util.HashMap)78 ByteArrayInputStream (java.io.ByteArrayInputStream)23 ClientException (com.aliyun.oss.ClientException)9 ClientConfiguration (com.aliyun.oss.ClientConfiguration)6 ResponseHandler (com.aliyun.oss.common.comm.ResponseHandler)6 InputStream (java.io.InputStream)6 ResponseMessage (com.aliyun.oss.common.comm.ResponseMessage)5 IOUtils.newRepeatableInputStream (com.aliyun.oss.common.utils.IOUtils.newRepeatableInputStream)5 ProgressListener (com.aliyun.oss.event.ProgressListener)5 ArrayList (java.util.ArrayList)5 ExecutionContext (com.aliyun.oss.common.comm.ExecutionContext)4 ProgressInputStream (com.aliyun.oss.event.ProgressInputStream)4 URI (java.net.URI)4 CheckedInputStream (java.util.zip.CheckedInputStream)4 ServiceException (com.aliyun.oss.ServiceException)3 IOException (java.io.IOException)3 Test (org.junit.Test)3 Credentials (com.aliyun.oss.common.auth.Credentials)2