2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.common.rest.api;
23 import java.util.Properties;
26 * This interface describe the methods of the REST generic client. Each method
27 * will receive the destination URI and specific list of headers. With this
28 * information the REST Client will create a request to the specific REST Web
29 * server. Error from the REST Web server will be return by proprietary
35 public interface IRestClient {
38 * This method will return resource according to the given URI.
41 * Full URL path to the desire resource.
43 * - list of headers in format of name and value, to be add as
44 * part of the HTTP request.
45 * @return JSON representation of the requested resource.
47 public RestResponse doGET(String uri, Properties headers);
50 * This method will CREATE resource according to the given URI.
53 * Full URL path to the desire resource.
55 * - list of headers in format of name and value, to be add as
56 * part of the HTTP request.
57 * @param objectToCreate
58 * - JSON representation of the resource.
60 public RestResponse doPOST(String uri, Properties headers, Object objectToCreate);
63 * This method will UPDATE resource according to the given URI.
66 * Full URL path to the desire resource.
68 * - list of headers in format of name and value, to be add as
69 * part of the HTTP request.
70 * @param objectToUpdate
71 * - JSON representation of the resource.
73 public RestResponse doPUT(String uri, Properties headers, Object objectToUpdate);
76 * This method will return resource according to the given URI.
79 * Full URL path to the desire resource.
81 * - list of headers in format of name and value, to be add as
82 * part of the HTTP request.
85 public RestResponse doDELETE(String uri, Properties headers);
88 * initialize the rest client instance. The timeout is infinite.
90 public boolean init() throws Exception;
93 * initialize the rest client instance with a given timeout in milliseconds.
95 * @param restConfigurationInfo
97 public boolean init(RestConfigurationInfo restConfigurationInfo);
100 * destroy the connections
102 public void destroy();