ea1a1236074cdfa12ba9f9571511cf9b894b729b
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * ONAP : ccsdk features
4  * ================================================================================
5  * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property.
6  * All rights reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  */
22 package org.onap.ccsdk.features.sdnr.wt.common.database.responses;
23
24 import org.elasticsearch.client.Response;
25 import org.json.JSONObject;
26 import org.onap.ccsdk.features.sdnr.wt.common.database.data.DatabaseVersion;
27
28 @Deprecated
29 public class GetInfoResponse extends BaseResponse {
30
31     /**
32      * { "name" : "kpOdXt-", "cluster_name" : "docker-cluster", "cluster_uuid" : "qags6CGGTrS75iBhrAdsgg", "version" : {
33      * "number" : "6.4.3", "build_flavor" : "default", "build_type" : "tar", "build_hash" : "fe40335", "build_date" :
34      * "2018-10-30T23:17:19.084789Z", "build_snapshot" : false, "lucene_version" : "7.4.0",
35      * "minimum_wire_compatibility_version" : "5.6.0", "minimum_index_compatibility_version" : "5.0.0" }, "tagline" :
36      * "You Know, for Search" }
37      */
38     private final String clusterName;
39     private final String name;
40
41     private final DatabaseVersion version;
42
43     public GetInfoResponse(Response response) throws Exception {
44         super(response);
45         JSONObject o = this.getJson(response);
46         if (o == null) {
47             throw new Exception("unable to read response");
48         }
49         this.name = o.getString("name");
50         this.clusterName = o.getString("cluster_name");
51         this.version = new DatabaseVersion(o.getJSONObject("version").getString("number"));
52     }
53
54     public String getClusterName() {
55         return clusterName;
56     }
57
58     public String getName() {
59         return name;
60     }
61
62     public DatabaseVersion getVersion() {
63         return version;
64     }
65
66
67
68 }