Search in sources :

Example 16 with HttpResponse

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

the class FunctionComputeClient method listServices.

public ListServicesResponse listServices(ListServicesRequest request) throws ClientException, ServerException {
    HttpResponse response = client.doAction(request, CONTENT_TYPE_APPLICATION_JSON, "GET");
    ListServicesResponse listServicesResponse = GSON.fromJson(new String(response.getContent()), ListServicesResponse.class);
    listServicesResponse.setHeader(response.getHeaders());
    listServicesResponse.setContent(response.getContent());
    listServicesResponse.setStatus(response.getStatus());
    return listServicesResponse;
}
Also used : HttpResponse(com.aliyuncs.fc.http.HttpResponse)

Example 17 with HttpResponse

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

the class FunctionComputeClient method createFunction.

public CreateFunctionResponse createFunction(CreateFunctionRequest request) throws ClientException, ServerException {
    HttpResponse response = client.doAction(request, CONTENT_TYPE_APPLICATION_JSON, "POST");
    FunctionMetadata functionMetadata = GSON.fromJson(new String(response.getContent()), FunctionMetadata.class);
    CreateFunctionResponse createFunctionResponse = new CreateFunctionResponse();
    createFunctionResponse.setFunctionMetadata(functionMetadata);
    createFunctionResponse.setHeader(response.getHeaders());
    createFunctionResponse.setContent(response.getContent());
    createFunctionResponse.setStatus(response.getStatus());
    return createFunctionResponse;
}
Also used : FunctionMetadata(com.aliyuncs.fc.model.FunctionMetadata) HttpResponse(com.aliyuncs.fc.http.HttpResponse)

Example 18 with HttpResponse

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

the class FunctionComputeClient method updateTrigger.

public UpdateTriggerResponse updateTrigger(UpdateTriggerRequest request) throws ClientException, ServerException {
    HttpResponse response = client.doAction(request, CONTENT_TYPE_APPLICATION_JSON, "PUT");
    TriggerMetadata triggerMetadata = GSON.fromJson(new String(response.getContent()), TriggerMetadata.class);
    UpdateTriggerResponse updateTriggerResponse = new UpdateTriggerResponse();
    updateTriggerResponse.setTriggerMetadata(triggerMetadata);
    updateTriggerResponse.setHeader(response.getHeaders());
    updateTriggerResponse.setContent(response.getContent());
    updateTriggerResponse.setStatus(response.getStatus());
    return updateTriggerResponse;
}
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