Search in sources :

Example 1 with HttpClientFactory

use of org.onap.so.client.HttpClientFactory in project so by onap.

the class ResourceRequestBuilder method getServiceInstnace.

public static Map<String, Object> getServiceInstnace(String uuid) throws Exception {
    String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint");
    HttpClient client = new HttpClientFactory().newJsonClient(UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(), ONAPComponents.CATALOG_DB);
    client.addAdditionalHeader("Accept", "application/json");
    client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth"));
    Response apiResponse = client.get();
    String value = apiResponse.readEntity(String.class);
    ObjectMapper objectMapper = new ObjectMapper();
    HashMap<String, Object> map = objectMapper.readValue(value, HashMap.class);
    return map;
}
Also used : Response(javax.ws.rs.core.Response) HttpClient(org.onap.so.client.HttpClient) HttpClientFactory(org.onap.so.client.HttpClientFactory) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Response (javax.ws.rs.core.Response)1 HttpClient (org.onap.so.client.HttpClient)1 HttpClientFactory (org.onap.so.client.HttpClientFactory)1