From 3d74a5add7424aa490f70e2a4453048028f5d882 Mon Sep 17 00:00:00 2001 From: Eric Multanen Date: Wed, 1 May 2019 23:07:07 -0700 Subject: Fixup handling of multicloud post response Make the handling of the multicloud post response more flexible. Add additional parameters that may come back. Change-Id: I0a5c7016f11dbfe832c81e2fcafc398a998b622b Issue-ID: SO-1833 Signed-off-by: Eric Multanen --- .../openstack/utils/MulticloudCreateResponse.java | 42 +++++++++++++--- .../utils/MulticloudCreateStackResponse.java | 57 ---------------------- 2 files changed, 36 insertions(+), 63 deletions(-) delete mode 100644 adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java (limited to 'adapters/mso-adapter-utils/src/main/java') diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java index bb15e58c88..732f9b5196 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateResponse.java @@ -22,13 +22,16 @@ package org.onap.so.openstack.utils; import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.JsonNode; import org.apache.commons.lang.builder.ToStringBuilder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"template_type", "workload_id", "template_response"}) +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonPropertyOrder({"template_type", "workload_id", "template_response", "workload_status_reason", "workload_status"}) public class MulticloudCreateResponse implements Serializable { private final static long serialVersionUID = -5215028275577848311L; @@ -37,12 +40,16 @@ public class MulticloudCreateResponse implements Serializable { @JsonProperty("workload_id") private String workloadId; @JsonProperty("template_response") - private MulticloudCreateStackResponse templateResponse; + private JsonNode templateResponse; + @JsonProperty("workload_status_reason") + private JsonNode workloadStatusReason; + @JsonProperty("workload_status") + private String workloadStatus; @JsonCreator public MulticloudCreateResponse(@JsonProperty("template_type") String templateType, @JsonProperty("workload_id") String workloadId, - @JsonProperty("template_response") MulticloudCreateStackResponse templateResponse) { + @JsonProperty("template_response") JsonNode templateResponse) { this.templateType = templateType; this.workloadId = workloadId; this.templateResponse = templateResponse; @@ -69,18 +76,41 @@ public class MulticloudCreateResponse implements Serializable { } @JsonProperty("template_response") - public void setTemplateResponse(MulticloudCreateStackResponse templateResponse) { + public void setTemplateResponse(JsonNode templateResponse) { this.templateResponse = templateResponse; } @JsonProperty("template_response") - public MulticloudCreateStackResponse getTemplateResponse() { + public JsonNode getTemplateResponse() { return templateResponse; } + @JsonProperty("workload_status_reason") + public void setWorkloadStatusReason(JsonNode workloadStatusReason) { + this.workloadStatusReason = workloadStatusReason; + } + + @JsonProperty("workload_status_reason") + public JsonNode getWorkloadStatusReason() { + return workloadStatusReason; + } + + @JsonProperty("workload_status") + public String getWorkloadSstatus() { + return workloadStatus; + } + + @JsonProperty("workload_status") + public void setWorkloadStatus(String workloadStatus) { + this.workloadStatus = workloadStatus; + } + + @Override public String toString() { return new ToStringBuilder(this).append("templateType", templateType).append("workloadId", workloadId) - .append("templateResponse", templateResponse).toString(); + .append("templateResponse", templateResponse) + .append("workload_status_reason", workloadStatusReason.toString()) + .append("workload_status", workloadStatus).toString(); } } diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java deleted file mode 100644 index 67cb73539d..0000000000 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MulticloudCreateStackResponse.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.openstack.utils; - -import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import org.apache.commons.lang.builder.ToStringBuilder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"stack"}) -public class MulticloudCreateStackResponse implements Serializable { - private final static long serialVersionUID = -5215028275577848311L; - - @JsonProperty("stack") - private MulticloudCreateHeatResponse stack; - - @JsonCreator - public MulticloudCreateStackResponse(@JsonProperty("stack") MulticloudCreateHeatResponse stack) { - this.stack = stack; - } - - @JsonProperty("stack") - public MulticloudCreateHeatResponse getStack() { - return stack; - } - - @JsonProperty("stack") - public void setStack(MulticloudCreateHeatResponse stack) { - this.stack = stack; - } - - @Override - public String toString() { - return new ToStringBuilder(this).append("stack", stack).toString(); - } -} -- cgit 1.2.3-korg