1bc43a6d077e24c91b2ae924fd253a6a737f4205
[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.EsVersion;
27
28 public class GetInfoResponse extends BaseResponse {
29
30     /**
31      * {
32      *  "name" : "kpOdXt-",
33      *  "cluster_name" : "docker-cluster",
34      *  "cluster_uuid" : "qags6CGGTrS75iBhrAdsgg",
35      *  "version" : {
36      *    "number" : "6.4.3",
37      *    "build_flavor" : "default",
38      *    "build_type" : "tar",
39      *    "build_hash" : "fe40335",
40      *    "build_date" : "2018-10-30T23:17:19.084789Z",
41      *    "build_snapshot" : false,
42      *    "lucene_version" : "7.4.0",
43      *    "minimum_wire_compatibility_version" : "5.6.0",
44      *    "minimum_index_compatibility_version" : "5.0.0"
45      *  },
46      *  "tagline" : "You Know, for Search"
47      *}
48      */
49         private final String clusterName;
50         private final String name;
51         
52         private final EsVersion version;
53     public GetInfoResponse(Response response) throws Exception  {
54         super(response);
55         JSONObject o = this.getJson(response);
56         if(o==null) {
57                 throw new Exception("unable to read response");
58         }
59         this.name = o.getString("name");
60         this.clusterName = o.getString("cluster_name");
61         this.version = new EsVersion(o.getJSONObject("version").getString("number"));
62     }
63         public String getClusterName() {
64                 return clusterName;
65         }
66         public String getName() {
67                 return name;
68         }
69         public EsVersion getVersion() {
70                 return version;
71         }
72   
73
74    
75    
76 }