Support HTTPS service registration
[msb/java-sdk.git] / src / main / java / org / onap / msb / sdk / discovery / entity / Service.java
1 /*******************************************************************************
2  * Copyright 2017-2018 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.sdk.discovery.entity;
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 @JsonIgnoreProperties(ignoreUnknown = true)
23 public class Service<T> implements Serializable {
24     private static final long serialVersionUID = 1L;
25
26     private String serviceName;
27
28     private String version = "";
29
30     private String url = "";
31
32     // REST、UI
33     private String protocol = "";
34     // 0: External 1: Internal
35     private String visualRange = "1";
36
37     private String lb_policy = "";
38
39     private String path = "";
40
41     private Set<T> nodes;
42
43     private List<KeyVaulePair> metadata;
44
45     private boolean enable_ssl = false;
46
47     /**
48      * @return the enable_ssl
49      */
50     public boolean isEnable_ssl() {
51         return enable_ssl;
52     }
53
54     /**
55      * @param enable_ssl the enable_ssl to set
56      */
57     public void setEnable_ssl(boolean enable_ssl) {
58         this.enable_ssl = enable_ssl;
59     }
60
61     public String getPath() {
62         return path;
63     }
64
65     /**
66      * The customized publish path of this service. If this parameter is specified when registering
67      * the service, the service will be published to api gateway under this path. Otherwise, the
68      * service will be published to api gateway using a fixed format: api/{serviceName} /{version}.
69      * Do not specific a path unless you know what you're doing.
70      * 
71      * @param path
72      */
73     public void setPath(String path) {
74         this.path = path;
75     }
76
77     /**
78      * Load balancing method used when MSB routes the service requests. Currently, Round robin and
79      * IP hash are supported.
80      * 
81      * @return
82      */
83     public String getLb_policy() {
84         return lb_policy;
85     }
86
87     /**
88      * Load balancing method used when MSB routes the service requests. Currently, Round robin and
89      * IP hash are supported.
90      * 
91      * @param lb_policy (round-robin,ip_hash)
92      * @return void
93      */
94     public void setLb_policy(String lb_policy) {
95         this.lb_policy = lb_policy;
96     }
97
98     public List<KeyVaulePair> getMetadata() {
99         return metadata;
100     }
101
102     public void setMetadata(List<KeyVaulePair> metadata) {
103         this.metadata = metadata;
104     }
105
106     /**
107      * The service instance nodes
108      */
109     public Set<T> getNodes() {
110         return nodes;
111     }
112
113     /**
114      * The service instance nodes
115      * 
116      * @param nodes
117      * @return void
118      */
119     public void setNodes(Set<T> nodes) {
120         this.nodes = nodes;
121     }
122
123     /**
124      * An unique name of the service, it should be constant so the service consumer can access the
125      * service.
126      */
127     public String getServiceName() {
128         return serviceName;
129     }
130
131     /**
132      * An unique name of the service, it should be constant so the service consumer can access the
133      * service.
134      * 
135      * @param serviceName
136      */
137     public void setServiceName(String serviceName) {
138         this.serviceName = serviceName;
139     }
140
141     /**
142      * Service version. Only the major version of service is used in the URI.
143      * 
144      * @return
145      */
146     public String getVersion() {
147         return version;
148     }
149
150     /**
151      * Service version. Only the major version of service is used in the URI.
152      * 
153      * @param version
154      */
155     public void setVersion(String version) {
156         this.version = version;
157     }
158
159     /**
160      * The actual URL of the service to be registered.
161      * 
162      * @return
163      */
164     public String getUrl() {
165         return url;
166     }
167
168     /**
169      * The actual URL of the service to be registered.
170      * 
171      * @param url
172      * @return void
173      */
174     public void setUrl(String url) {
175         this.url = url;
176     }
177
178     /**
179      * supported protocols: 'REST', 'UI'
180      * 
181      * @return
182      */
183     public String getProtocol() {
184         return protocol;
185     }
186
187     /**
188      * supported protocols: 'REST', 'UI'
189      * 
190      * @param protocol
191      */
192     public void setProtocol(String protocol) {
193         this.protocol = protocol;
194     }
195
196     /**
197      * Visibility of the service. External(can be accessed by external systems):0 Internal(can only
198      * be accessed by ONAP microservices):1
199      */
200     public String getVisualRange() {
201         return visualRange;
202     }
203
204     /**
205      * Visibility of the service. External(can be accessed by external systems):0 Internal(can only
206      * be accessed by ONAP microservices):1
207      * 
208      * @param visualRange
209      */
210     public void setVisualRange(String visualRange) {
211         this.visualRange = visualRange;
212     }
213
214 }