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