Search in sources :

Example 91 with RequestMessage

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

the class OSSUdfOperation method resizeUdfApplication.

public void resizeUdfApplication(ResizeUdfApplicationRequest resizeUdfApplicationRequest) throws OSSException, ClientException {
    assertParameterNotNull(resizeUdfApplicationRequest, "resizeUdfApplicationRequest");
    String udfName = resizeUdfApplicationRequest.getName();
    assertParameterNotNull(udfName, "udfName");
    ensureBucketNameValid(udfName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(RequestParameters.SUBRESOURCE_UDF_APPLICATION, null);
    params.put(RequestParameters.SUBRESOURCE_UDF_NAME, udfName);
    params.put(RequestParameters.SUBRESOURCE_COMP, RequestParameters.COMP_RESIZE);
    byte[] rawContent = RequestMarshallers.resizeUdfApplicationRequestMarshaller.marshall(resizeUdfApplicationRequest);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.POST).setParameters(params).setInputSize(rawContent.length).setInputStream(new ByteArrayInputStream(rawContent)).setOriginalRequest(resizeUdfApplicationRequest).build();
    doOperation(request, emptyResponseParser, null, null);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ByteArrayInputStream(java.io.ByteArrayInputStream) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 92 with RequestMessage

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

the class OSSUdfOperation method deleteUdfImage.

public void deleteUdfImage(UdfGenericRequest genericRequest) throws OSSException, ClientException {
    assertParameterNotNull(genericRequest, "genericRequest");
    String udfName = genericRequest.getName();
    assertParameterNotNull(udfName, "udfName");
    ensureBucketNameValid(udfName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(RequestParameters.SUBRESOURCE_UDF_IMAGE, null);
    params.put(RequestParameters.SUBRESOURCE_UDF_NAME, udfName);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.DELETE).setParameters(params).setOriginalRequest(genericRequest).build();
    doOperation(request, emptyResponseParser, null, null, true);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 93 with RequestMessage

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

the class OSSUdfOperation method listUdfs.

public List<UdfInfo> listUdfs() throws OSSException, ClientException {
    Map<String, String> params = new HashMap<String, String>();
    params.put(RequestParameters.SUBRESOURCE_UDF, null);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.GET).setParameters(params).build();
    return doOperation(request, ResponseParsers.listUdfResponseParser, null, null, true);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 94 with RequestMessage

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

the class OSSUdfOperation method listUdfApplication.

public List<UdfApplicationInfo> listUdfApplication() throws OSSException, ClientException {
    Map<String, String> params = new HashMap<String, String>();
    params.put(RequestParameters.SUBRESOURCE_UDF_APPLICATION, null);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.GET).setParameters(params).build();
    return doOperation(request, ResponseParsers.listUdfApplicationInfoResponseParser, null, null, true);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) RequestMessage(com.aliyun.oss.common.comm.RequestMessage)

Example 95 with RequestMessage

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

the class OSSUdfOperation method createUdfApplication.

/**
 * UDF Application
 */
public void createUdfApplication(CreateUdfApplicationRequest createUdfApplicationRequest) throws OSSException, ClientException {
    assertParameterNotNull(createUdfApplicationRequest, "createUdfApplicationRequest");
    String udfName = createUdfApplicationRequest.getName();
    assertParameterNotNull(udfName, "udfName");
    ensureBucketNameValid(udfName);
    Map<String, String> params = new HashMap<String, String>();
    params.put(RequestParameters.SUBRESOURCE_UDF_APPLICATION, null);
    params.put(RequestParameters.SUBRESOURCE_UDF_NAME, udfName);
    params.put(RequestParameters.SUBRESOURCE_COMP, RequestParameters.COMP_CREATE);
    byte[] rawContent = RequestMarshallers.createUdfApplicationRequestMarshaller.marshall(createUdfApplicationRequest);
    RequestMessage request = new OSSRequestMessageBuilder(getInnerClient()).setEndpoint(getEndpoint()).setMethod(HttpMethod.POST).setParameters(params).setInputSize(rawContent.length).setInputStream(new ByteArrayInputStream(rawContent)).setOriginalRequest(createUdfApplicationRequest).build();
    doOperation(request, emptyResponseParser, null, null);
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) ByteArrayInputStream(java.io.ByteArrayInputStream) 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