2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.cloud;
24 import com.fasterxml.jackson.annotation.JsonProperty;
27 * JavaBean JSON class for a CloudSite. This bean represents a cloud location
28 * (i.e. and LCP node) in the NVP/AIC cloud. It will be loaded via CloudConfig
29 * object, of which it is a component (a CloudConfig JSON configuration file
30 * will contain multiple CloudSite definitions).
32 * Note that this is only used to access Cloud Configurations loaded from a
33 * JSON config file, so there are no explicit setters.
36 public class CloudSite {
39 @JsonProperty("region_id")
40 private String regionId;
41 @JsonProperty("identity_service_id")
42 private String identityServiceId;
43 @JsonProperty("aic_version")
44 private String aic_version;
47 @JsonProperty("cloudify_id")
48 private String cloudifyId;
49 @JsonProperty("platform")
50 private String platform;
51 @JsonProperty("orchestrator")
52 private String orchestrator;
54 // Derived property (set by CloudConfig loader based on identityServiceId)
55 private CloudIdentity identityService;
56 // Derived property (set by CloudConfig loader based on cloudifyId)
57 private CloudifyManager cloudifyManager;
61 public String getId() {
64 public void setId(String id) {
68 public String getRegionId() {
72 public void setRegionId(String regionId) {
73 this.regionId = regionId;
76 public String getIdentityServiceId() {
77 return identityServiceId;
80 public CloudIdentity getIdentityService () {
81 return identityService;
84 public void setIdentityService (CloudIdentity identity) {
85 this.identityService = identity;
88 public String getAic_version() {
92 public void setAic_version(String aic_version) {
93 this.aic_version = aic_version;
96 public String getClli() {
100 public void setClli(String clli) {
104 public String getCloudifyId() {
108 public void setCloudifyId (String id) {
109 this.cloudifyId = id;
112 public CloudifyManager getCloudifyManager () {
113 return cloudifyManager;
116 public void setCloudifyManager (CloudifyManager cloudify) {
117 this.cloudifyManager = cloudify;
120 public String getPlatform() {
124 public void setPlatform(String platform) {
125 this.platform = platform;
128 public String getOrchestrator() {
132 public void setOrchestrator(String orchestrator) {
133 this.orchestrator = orchestrator;
137 public String toString() {
138 return "CloudSite: id=" + id +
139 ", regionId=" + regionId +
140 ", identityServiceId=" + identityServiceId +
141 ", aic_version=" + aic_version +
143 ", cloudifyId=" + cloudifyId +
144 ", platform=" + platform +
145 ", orchestrator=" + orchestrator;
149 public CloudSite clone() {
150 CloudSite cloudSiteCopy = new CloudSite();
151 cloudSiteCopy.id = this.id;
152 cloudSiteCopy.regionId = this.regionId;
153 cloudSiteCopy.identityServiceId = this.identityServiceId;
154 cloudSiteCopy.aic_version = this.aic_version;
155 cloudSiteCopy.clli = this.clli;
156 cloudSiteCopy.identityService = this.identityService.clone();
157 cloudSiteCopy.cloudifyId = this.cloudifyId;
158 if (this.cloudifyManager != null) cloudSiteCopy.cloudifyManager = this.cloudifyManager.clone();
159 cloudSiteCopy.platform = this.platform;
160 cloudSiteCopy.orchestrator = this.orchestrator;
162 return cloudSiteCopy;
166 public int hashCode() {
167 final int prime = 31;
169 result = prime * result + ((id == null) ? 0 : id.hashCode());
170 result = prime * result + ((identityService == null) ? 0 : identityService.hashCode());
171 result = prime * result + ((identityServiceId == null) ? 0 : identityServiceId.hashCode());
172 result = prime * result + ((regionId == null) ? 0 : regionId.hashCode());
173 result = prime * result + ((aic_version == null) ? 0 : aic_version.hashCode());
174 result = prime * result + ((clli == null) ? 0 : clli.hashCode());
179 public boolean equals(Object obj) {
184 if (getClass() != obj.getClass())
186 CloudSite other = (CloudSite) obj;
187 if (!cmp(id, other.id))
189 if (!cmp(regionId, other.regionId))
191 if (!cmp(identityServiceId, other.identityServiceId))
193 if (!cmp(aic_version, other.aic_version))
195 if (!cmp(clli, other.clli))
197 if (!cmp(identityService, other.identityService))
201 private boolean cmp(Object a, Object b) {