Search in sources :

Example 1 with CreateSchemaRequest

use of org.apache.servicecomb.service.center.client.model.CreateSchemaRequest in project java-chassis by ServiceComb.

the class ServiceCenterClient method updateServiceSchemaContext.

@Override
public boolean updateServiceSchemaContext(String serviceId, SchemaInfo schemaInfo) {
    try {
        CreateSchemaRequest request = new CreateSchemaRequest();
        request.setSchema(schemaInfo.getSchema());
        request.setSummary(schemaInfo.getSummary());
        HttpResponse response = httpClient.putHttpRequest("/registry/microservices/" + serviceId + "/schemas/" + schemaInfo.getSchemaId(), null, HttpUtils.serialize(request));
        if (response.getStatusCode() == HttpStatus.SC_OK) {
            return true;
        }
        sendUnAuthorizedEvent(response);
        throw new OperationException("update service schema fails, statusCode = " + response.getStatusCode() + "; message = " + response.getMessage() + "; content = " + response.getContent());
    } catch (IOException e) {
        throw new OperationException("update service schema fails", e);
    }
}
Also used : CreateSchemaRequest(org.apache.servicecomb.service.center.client.model.CreateSchemaRequest) HttpResponse(org.apache.servicecomb.http.client.common.HttpResponse) IOException(java.io.IOException) OperationException(org.apache.servicecomb.service.center.client.exception.OperationException)

Aggregations

IOException (java.io.IOException)1 HttpResponse (org.apache.servicecomb.http.client.common.HttpResponse)1 OperationException (org.apache.servicecomb.service.center.client.exception.OperationException)1 CreateSchemaRequest (org.apache.servicecomb.service.center.client.model.CreateSchemaRequest)1