Search in sources :

Example 11 with HttpResponse

use of com.aliyuncs.fc.http.HttpResponse in project fc-java-sdk by aliyun.

the class FunctionComputeClient method deleteService.

public DeleteServiceResponse deleteService(DeleteServiceRequest request) throws ClientException, ServerException {
    HttpResponse response = client.doAction(request, CONTENT_TYPE_APPLICATION_JSON, "DELETE");
    DeleteServiceResponse deleteServiceResponse = new DeleteServiceResponse();
    deleteServiceResponse.setHeaders(response.getHeaders());
    deleteServiceResponse.setStatus(response.getStatus());
    return deleteServiceResponse;
}
Also used : HttpResponse(com.aliyuncs.fc.http.HttpResponse)

Example 12 with HttpResponse

use of com.aliyuncs.fc.http.HttpResponse in project fc-java-sdk by aliyun.

the class FunctionComputeClient method invokeFunction.

public InvokeFunctionResponse invokeFunction(InvokeFunctionRequest request) throws ClientException, ServerException {
    HttpResponse response = client.doAction(request, CONTENT_TYPE_APPLICATION_STREAM, "POST");
    InvokeFunctionResponse invokeFunctionResponse = new InvokeFunctionResponse();
    invokeFunctionResponse.setContent(response.getContent());
    invokeFunctionResponse.setHeader(response.getHeaders());
    invokeFunctionResponse.setStatus(response.getStatus());
    return invokeFunctionResponse;
}
Also used : HttpResponse(com.aliyuncs.fc.http.HttpResponse)

Example 13 with HttpResponse

use of com.aliyuncs.fc.http.HttpResponse in project fc-java-sdk by aliyun.

the class FunctionComputeClient method deleteFunction.

public DeleteFunctionResponse deleteFunction(DeleteFunctionRequest request) throws ClientException, ServerException {
    HttpResponse response = client.doAction(request, CONTENT_TYPE_APPLICATION_JSON, "DELETE");
    DeleteFunctionResponse deleteFunctionResponse = new DeleteFunctionResponse();
    deleteFunctionResponse.setHeader(response.getHeaders());
    deleteFunctionResponse.setStatus(response.getStatus());
    return deleteFunctionResponse;
}
Also used : HttpResponse(com.aliyuncs.fc.http.HttpResponse)

Example 14 with HttpResponse

use of com.aliyuncs.fc.http.HttpResponse in project fc-java-sdk by aliyun.

the class FunctionComputeClient method updateService.

public UpdateServiceResponse updateService(UpdateServiceRequest request) throws ClientException, ServerException {
    HttpResponse response = client.doAction(request, CONTENT_TYPE_APPLICATION_JSON, "PUT");
    ServiceMetadata serviceMetadata = GSON.fromJson(new String(response.getContent()), ServiceMetadata.class);
    UpdateServiceResponse updateServiceResponse = new UpdateServiceResponse();
    updateServiceResponse.setServiceMetadata(serviceMetadata);
    updateServiceResponse.setHeader(response.getHeaders());
    updateServiceResponse.setContent(response.getContent());
    updateServiceResponse.setStatus(response.getStatus());
    return updateServiceResponse;
}
Also used : HttpResponse(com.aliyuncs.fc.http.HttpResponse) ServiceMetadata(com.aliyuncs.fc.model.ServiceMetadata)

Example 15 with HttpResponse

use of com.aliyuncs.fc.http.HttpResponse in project fc-java-sdk by aliyun.

the class FunctionComputeClient method createTrigger.

public CreateTriggerResponse createTrigger(CreateTriggerRequest request) throws ClientException, ServerException {
    HttpResponse response = client.doAction(request, CONTENT_TYPE_APPLICATION_JSON, "POST");
    TriggerMetadata triggerMetadata = GSON.fromJson(new String(response.getContent()), TriggerMetadata.class);
    CreateTriggerResponse createTriggerResponse = new CreateTriggerResponse();
    createTriggerResponse.setTriggerMetadata(triggerMetadata);
    createTriggerResponse.setHeader(response.getHeaders());
    createTriggerResponse.setContent(response.getContent());
    createTriggerResponse.setStatus(response.getStatus());
    return createTriggerResponse;
}
Also used : HttpResponse(com.aliyuncs.fc.http.HttpResponse) TriggerMetadata(com.aliyuncs.fc.model.TriggerMetadata)

Aggregations

HttpResponse (com.aliyuncs.fc.http.HttpResponse)18 FunctionMetadata (com.aliyuncs.fc.model.FunctionMetadata)3 ServiceMetadata (com.aliyuncs.fc.model.ServiceMetadata)3 TriggerMetadata (com.aliyuncs.fc.model.TriggerMetadata)3 ClientException (com.aliyuncs.fc.exceptions.ClientException)1 ServerException (com.aliyuncs.fc.exceptions.ServerException)1 FunctionCodeMetadata (com.aliyuncs.fc.model.FunctionCodeMetadata)1 PrepareUrl (com.aliyuncs.fc.model.PrepareUrl)1 Gson (com.google.gson.Gson)1 JsonParseException (com.google.gson.JsonParseException)1 IOException (java.io.IOException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 InvalidKeyException (java.security.InvalidKeyException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1