Fixup handling of multicloud post response
[so.git] / adapters / mso-adapter-utils / src / main / java / org / onap / so / openstack / utils / MulticloudCreateResponse.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2018 Intel Corp. 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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.onap.so.openstack.utils;
22
23 import java.io.Serializable;
24 import com.fasterxml.jackson.annotation.JsonCreator;
25 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
26 import com.fasterxml.jackson.annotation.JsonInclude;
27 import com.fasterxml.jackson.annotation.JsonProperty;
28 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
29 import com.fasterxml.jackson.databind.JsonNode;
30 import org.apache.commons.lang.builder.ToStringBuilder;
31
32 @JsonInclude(JsonInclude.Include.NON_NULL)
33 @JsonIgnoreProperties(ignoreUnknown = true)
34 @JsonPropertyOrder({"template_type", "workload_id", "template_response", "workload_status_reason", "workload_status"})
35 public class MulticloudCreateResponse implements Serializable {
36     private final static long serialVersionUID = -5215028275577848311L;
37
38     @JsonProperty("template_type")
39     private String templateType;
40     @JsonProperty("workload_id")
41     private String workloadId;
42     @JsonProperty("template_response")
43     private JsonNode templateResponse;
44     @JsonProperty("workload_status_reason")
45     private JsonNode workloadStatusReason;
46     @JsonProperty("workload_status")
47     private String workloadStatus;
48
49     @JsonCreator
50     public MulticloudCreateResponse(@JsonProperty("template_type") String templateType,
51             @JsonProperty("workload_id") String workloadId,
52             @JsonProperty("template_response") JsonNode templateResponse) {
53         this.templateType = templateType;
54         this.workloadId = workloadId;
55         this.templateResponse = templateResponse;
56     }
57
58     @JsonProperty("template_type")
59     public String getTemplateType() {
60         return templateType;
61     }
62
63     @JsonProperty("template_type")
64     public void setTemplateType(String templateType) {
65         this.templateType = templateType;
66     }
67
68     @JsonProperty("workload_id")
69     public String getWorkloadId() {
70         return workloadId;
71     }
72
73     @JsonProperty("workload_id")
74     public void setWorkloadId(String workloadId) {
75         this.workloadId = workloadId;
76     }
77
78     @JsonProperty("template_response")
79     public void setTemplateResponse(JsonNode templateResponse) {
80         this.templateResponse = templateResponse;
81     }
82
83     @JsonProperty("template_response")
84     public JsonNode getTemplateResponse() {
85         return templateResponse;
86     }
87
88     @JsonProperty("workload_status_reason")
89     public void setWorkloadStatusReason(JsonNode workloadStatusReason) {
90         this.workloadStatusReason = workloadStatusReason;
91     }
92
93     @JsonProperty("workload_status_reason")
94     public JsonNode getWorkloadStatusReason() {
95         return workloadStatusReason;
96     }
97
98     @JsonProperty("workload_status")
99     public String getWorkloadSstatus() {
100         return workloadStatus;
101     }
102
103     @JsonProperty("workload_status")
104     public void setWorkloadStatus(String workloadStatus) {
105         this.workloadStatus = workloadStatus;
106     }
107
108
109     @Override
110     public String toString() {
111         return new ToStringBuilder(this).append("templateType", templateType).append("workloadId", workloadId)
112                 .append("templateResponse", templateResponse)
113                 .append("workload_status_reason", workloadStatusReason.toString())
114                 .append("workload_status", workloadStatus).toString();
115     }
116 }