5a28f65db4ef56ea51bf9fcba6e70080335deb59
[so.git] / adapters / mso-openstack-adapters / src / main / java / org / onap / so / adapters / valet / beans / HeatRequest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Modifications Copyright (C) 2018 IBM.
8  * ================================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  * 
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  * 
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=========================================================
21  */
22  
23 package org.onap.so.adapters.valet.beans;
24
25 import java.io.Serializable;
26 import java.util.HashMap;
27 import java.util.Map;
28 import java.util.Objects;
29
30 import com.fasterxml.jackson.annotation.JsonProperty;
31
32 /*
33  * This class represents the heat request as sent to OpenStack as defined in the
34  * Valet Placement Operations API
35  */
36 public class HeatRequest implements Serializable {
37         private static final long serialVersionUID = 768026109321305392L;
38         @JsonProperty("stack_name")
39         private String stackName;
40         @JsonProperty("disable_rollback")
41         private Boolean disableRollback;
42         @JsonProperty("timeout_mins")
43         private Integer timeoutMins;
44         @JsonProperty("template")
45         private String template;
46         @JsonProperty("environment")
47         private String environment;
48         @JsonProperty("files")
49         private Map<String, Object> files = new HashMap<>();
50         @JsonProperty("parameters")
51         private Map<String, Object> parameters = new HashMap<>();
52         
53         public HeatRequest(String stackName, boolean disableRollback, int timeoutMins, String template, String environment, Map<String, Object> files, Map<String, Object> parameters) {
54                 super();
55                 this.stackName = stackName;
56                 this.disableRollback = disableRollback;
57                 this.timeoutMins = timeoutMins;
58                 this.template = template;
59                 this.environment = environment;
60                 this.files = files;
61                 this.parameters = parameters;
62         }
63
64         public String getStackName() {
65                 return this.stackName;
66         }
67         public void setStackName(String stackName) {
68                 this.stackName = stackName;
69         }       
70         public Boolean getDisableRollback() {
71                 return this.disableRollback;
72         }
73         public void setDisableRollback(Boolean disableRollback) {
74                 this.disableRollback = disableRollback;
75         }       
76         public Integer getTimeoutMins() {
77                 return this.timeoutMins;
78         }
79         public void setTimeoutMins(Integer timeoutMins) {
80                 this.timeoutMins = timeoutMins;
81         }       
82         public String getTemplate() {
83                 return this.template;
84         }
85         public void setTemplate(String template) {
86                 this.template = template;
87         }       
88         public String getEnvironment() {
89                 return this.environment;
90         }
91         public void setEnvironment(String environment) {
92                 this.environment = environment;
93         }       
94         public Map<String, Object> getFiles() {
95                 return this.files;
96         }
97         public void setFiles(Map<String, Object> files) {
98                 this.files = files;
99         }       
100         public Map<String, Object> getParameters() {
101                 return this.parameters;
102         }
103         public void setParameters(Map<String, Object> parameters) {
104                 this.parameters = parameters;
105         }       
106         @Override
107         public int hashCode() {
108                 return Objects.hash(stackName, disableRollback, timeoutMins, template, environment, files, parameters);
109         }
110         @Override
111         public boolean equals(Object o) {
112                 if (o == this)
113                         return true;
114                 if (!(o instanceof HeatRequest)) {
115                         return false;
116                 }
117                 HeatRequest hr = (HeatRequest) o;
118                 return Objects.equals(stackName, hr.stackName) 
119                                 && Objects.equals(disableRollback, hr.disableRollback)
120                                 && Objects.equals(timeoutMins, hr.timeoutMins)
121                                 && Objects.equals(template, hr.template)
122                                 && Objects.equals(environment, hr.environment)
123                                 && Objects.equals(files, hr.files)
124                                 && Objects.equals(parameters, hr.parameters);
125         }
126 }