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.openstack.beans;
23 import com.woorea.openstack.heat.model.Stack;
24 import java.util.HashMap;
28 * This Java bean class relays Heat stack status information to ActiveVOS processes.
30 * This bean is returned by all Heat-specific adapter operations (create, query, delete)
32 public class StackInfo {
33 private String name = "";
34 private String canonicalName = "";
35 private HeatStatus status;
36 private Map<String, Object> outputs = new HashMap<>();
37 private Map<String,Object> parameters = new HashMap<>();
38 static private Map<String, HeatStatus> heatStatusMap;
41 heatStatusMap = new HashMap<>();
42 heatStatusMap.put("CREATE_IN_PROGRESS", HeatStatus.BUILDING);
43 heatStatusMap.put("CREATE_COMPLETE", HeatStatus.CREATED);
44 heatStatusMap.put("CREATE_FAILED", HeatStatus.FAILED);
45 heatStatusMap.put("DELETE_IN_PROGRESS", HeatStatus.DELETING);
46 heatStatusMap.put("DELETE_COMPLETE", HeatStatus.NOTFOUND);
47 heatStatusMap.put("DELETE_FAILED", HeatStatus.FAILED);
48 heatStatusMap.put("UPDATE_IN_PROGRESS", HeatStatus.UPDATING);
49 heatStatusMap.put("UPDATE_FAILED", HeatStatus.FAILED);
50 heatStatusMap.put("UPDATE_COMPLETE", HeatStatus.UPDATED);
53 public StackInfo (String name, HeatStatus status) {
55 this.canonicalName = name; // Don't have an ID, so just use name
59 public StackInfo (Stack stack)
62 this.status = HeatStatus.NOTFOUND;
65 this.name = stack.getStackName();
66 this.canonicalName = stack.getStackName() + "/" + stack.getId();
68 if (stack.getStackStatus() == null) {
69 this.status = HeatStatus.INIT;
71 this.status = heatStatusMap.getOrDefault(stack.getStackStatus(), HeatStatus.UNKNOWN);
73 if (stack.getOutputs() != null) {
74 this.outputs = new HashMap<>();
75 stack.getOutputs().forEach(output -> outputs.put(output.getOutputKey(), output.getOutputValue()));
78 this.parameters = stack.getParameters();
81 public String getName() {
85 public void setName (String name) {
89 public String getCanonicalName() {
93 public HeatStatus getStatus() {
97 public Map<String, Object> getOutputs() {
101 public Map<String,Object> getParameters () {