1 /*******************************************************************************
2 * Copyright 2017 ZTE, Inc. and others.
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
7 * http://www.apache.org/licenses/LICENSE-2.0
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
13 ******************************************************************************/
14 package org.onap.msb.sdk.discovery.entity;
16 import java.io.Serializable;
17 import java.util.List;
20 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
22 @JsonIgnoreProperties(ignoreUnknown = true)
23 public class Service<T> implements Serializable {
24 private static final long serialVersionUID = 1L;
26 private String serviceName;
28 private String version = "";
30 private String url = "";
33 private String protocol = "";
34 //0: External 1: Internal
35 private String visualRange = "1";
37 private String lb_policy = "";
39 private String path = "";
43 private List<KeyVaulePair> metadata;
45 public String getPath() {
50 * The customized publish path of this service.
51 * If this parameter is specified when registering the service, the service will be published to api gateway under this path.
52 * Otherwise, the service will be published to api gateway using a fixed format: api/{serviceName} /{version}.
53 * Do not specific a path unless you know what you're doing.
56 public void setPath(String path) {
61 * Load balancing method used when MSB routes the service requests. Currently, Round robin and IP hash are supported.
64 public String getLb_policy() {
69 * Load balancing method used when MSB routes the service requests. Currently, Round robin and IP hash are supported.
70 * @param lb_policy (round-robin,ip_hash)
73 public void setLb_policy(String lb_policy) {
74 this.lb_policy = lb_policy;
77 public List<KeyVaulePair> getMetadata() {
81 public void setMetadata(List<KeyVaulePair> metadata) {
82 this.metadata = metadata;
86 * The service instance nodes
88 public Set<T> getNodes() {
93 * The service instance nodes
97 public void setNodes(Set<T> nodes) {
102 * An unique name of the service, it should be constant so the service consumer can access the service.
104 public String getServiceName() {
109 * An unique name of the service, it should be constant so the service consumer can access the service.
112 public void setServiceName(String serviceName) {
113 this.serviceName = serviceName;
117 * Service version. Only the major version of service is used in the URI.
120 public String getVersion() {
125 * Service version. Only the major version of service is used in the URI.
128 public void setVersion(String version) {
129 this.version = version;
133 * The actual URL of the service to be registered.
136 public String getUrl() {
141 * The actual URL of the service to be registered.
145 public void setUrl(String url) {
150 * supported protocols: 'REST', 'UI'
153 public String getProtocol() {
158 * supported protocols: 'REST', 'UI'
161 public void setProtocol(String protocol) {
162 this.protocol = protocol;
166 * Visibility of the service.
167 * External(can be accessed by external systems):0
168 * Internal(can only be accessed by ONAP microservices):1
170 public String getVisualRange() {
175 * Visibility of the service.
176 * External(can be accessed by external systems):0
177 * Internal(can only be accessed by ONAP microservices):1
180 public void setVisualRange(String visualRange) {
181 this.visualRange = visualRange;