Add https service registration support
[msb/discovery.git] / sdclient / discovery-service / src / main / java / org / onap / msb / sdclient / core / Service.java
1 /**
2  * Copyright 2016-2017 ZTE, Inc. and others.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5  * in compliance with the License. You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the License
10  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11  * or implied. See the License for the specific language governing permissions and limitations under
12  * the License.
13  */
14 package org.onap.msb.sdclient.core;
15
16 import java.io.Serializable;
17 import java.util.List;
18 import java.util.Set;
19
20 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
21
22 import io.swagger.annotations.ApiModelProperty;
23
24
25 @JsonIgnoreProperties(ignoreUnknown = true)
26 public class Service<T> implements Serializable {
27     private static final long serialVersionUID = 1L;
28     // 服务名
29     @ApiModelProperty(example = "test", required = true)
30     private String serviceName = "";
31     // 版本号
32     @ApiModelProperty(example = "v1", required = true)
33     private String version = "";
34     // 服务url
35     @ApiModelProperty(value = "Target Service URL,start with /", example = "/api/serviceName/v1", required = true)
36     private String url = "";
37
38     // 服务对应协议,比如REST、UI、MQ、FTP、SNMP、TCP、UDP
39     @ApiModelProperty(value = "Service Protocol", allowableValues = "REST,UI, HTTP, TCP,UDP", example = "HTTP",
40                     required = true)
41     private String protocol = "";
42
43     // 服务的可见范围 0:系统间 1:系统内 ,可配置多个,以 |分隔
44     @ApiModelProperty(value = "[visual Range]interSystem:0,inSystem:1", allowableValues = "0,1", example = "1")
45     private String visualRange = "1";
46
47     // 负载均衡策略类型
48     @ApiModelProperty(value = "lb policy", allowableValues = "round-robin,ip_hash", example = "ip_hash")
49     private String lb_policy;
50
51     // TCP/UDP协议监听端口
52     @ApiModelProperty(hidden = true)
53     private String publish_port;
54
55     // 命名空间
56     private String namespace = "";
57
58     // 网络平面
59     @ApiModelProperty(hidden = true)
60     private String network_plane_type;
61
62     @ApiModelProperty(hidden = true)
63     private String host = "";
64
65     @ApiModelProperty(hidden = true)
66     private String path = "";
67
68     @ApiModelProperty(value = "enable ssl", allowableValues = "true,false", example = "false")
69     private boolean enable_ssl = false; // true:https:开启SSL加密, false:http
70
71
72     @ApiModelProperty(required = true)
73     private Set<T> nodes;
74
75     // 服务自身属性的键值对
76     private List<KeyVaulePair> metadata;
77
78     // 自定义标签
79     @ApiModelProperty(value = "custom labels", example = "key1:value1")
80     private List<String> labels;
81
82
83
84     public String getHost() {
85         return host;
86     }
87
88     public void setHost(String host) {
89         this.host = host;
90     }
91
92     public String getPath() {
93         return path;
94     }
95
96     public void setPath(String path) {
97         this.path = path;
98     }
99
100     public List<String> getLabels() {
101         return labels;
102     }
103
104     public void setLabels(List<String> labels) {
105         this.labels = labels;
106     }
107
108     public Set<T> getNodes() {
109         return nodes;
110     }
111
112     public void setNodes(Set<T> nodes) {
113         this.nodes = nodes;
114     }
115
116     public String getServiceName() {
117         return serviceName;
118     }
119
120     public void setServiceName(String serviceName) {
121         this.serviceName = serviceName;
122     }
123
124     public String getVersion() {
125         return version;
126     }
127
128     public void setVersion(String version) {
129         this.version = version;
130     }
131
132     public String getUrl() {
133         return url;
134     }
135
136     public void setUrl(String url) {
137         this.url = url;
138     }
139
140     public String getProtocol() {
141         return protocol;
142     }
143
144     public void setProtocol(String protocol) {
145         this.protocol = protocol;
146     }
147
148
149
150     public List<KeyVaulePair> getMetadata() {
151         return metadata;
152     }
153
154     public void setMetadata(List<KeyVaulePair> metadata) {
155         this.metadata = metadata;
156     }
157
158
159     public String getVisualRange() {
160         return visualRange;
161     }
162
163     public void setVisualRange(String visualRange) {
164         this.visualRange = visualRange;
165     }
166
167     public String getLb_policy() {
168         return lb_policy;
169     }
170
171     public void setLb_policy(String lb_policy) {
172         this.lb_policy = lb_policy;
173     }
174
175     public String getPublish_port() {
176         return publish_port;
177     }
178
179     public void setPublish_port(String publish_port) {
180         this.publish_port = publish_port;
181     }
182
183     public String getNamespace() {
184         return namespace;
185     }
186
187     public void setNamespace(String namespace) {
188         this.namespace = namespace;
189     }
190
191     public String getNetwork_plane_type() {
192         return network_plane_type;
193     }
194
195     public void setNetwork_plane_type(String network_plane_type) {
196         this.network_plane_type = network_plane_type;
197     }
198
199     public boolean isEnable_ssl() {
200         return enable_ssl;
201     }
202
203     public void setEnable_ssl(boolean enable_ssl) {
204         this.enable_ssl = enable_ssl;
205     }
206 }