0bb6f741394775b642cdc0a7e106604191a111c1
[ccsdk/dashboard.git] /
1 /*******************************************************************************
2  * =============LICENSE_START=========================================================
3  *
4  * =================================================================================
5  *  Copyright (c) 2019 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
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  *  ECOMP is a trademark and service mark of AT&T Intellectual Property.
21  *******************************************************************************/
22 package org.onap.ccsdk.dashboard.model.deploymenthandler;
23
24 import java.util.ArrayList;
25 import java.util.Collection;
26 import java.util.LinkedList;
27 import java.util.Map;
28 import java.util.Optional;
29
30 import com.fasterxml.jackson.annotation.JsonCreator;
31 import com.fasterxml.jackson.annotation.JsonProperty;
32
33 /**
34  * Model for message POST-ed to controller to create a Deployment via the
35  * Deployment Handler API:
36  * 
37  * <pre>
38         { 
39                 "serviceTypeId" : "serviceTypeId",
40                 "type" : "install/update",
41                 "inputs" :
42                         {
43                                 "input1" : "parameter1"
44                                 "input2" : "parameter2"
45                                                 ...
46                                 "inputn" : "parametern"
47                         }       
48         }
49  * </pre>
50  * 
51  * THIS OBJECT INCLUDES THE DEPLOYMENTID CREATED BY THE USER!
52  */
53 public class DeploymentRequestObject {
54
55     /** Unique deployment identifier assigned by the API client. */
56     private final String deploymentId;
57
58     /** type of deployment request */
59     private final String method;
60
61     /**
62      * The service type identifier (a unique ID assigned by DCAE inventory) for the
63      * service to be deployed.
64      */
65     private final String serviceTypeId;
66
67     /** The cloudify tenant name for the deployment */
68     private final String tenant;
69     /**
70      * Object containing inputs needed by the service blueprint to create an
71      * instance of the service. Content of the object depends on the service being
72      * deployed.
73      */
74     private final Map<String, Object> inputs;
75
76     private final Collection<String> reinstall_list;
77     
78     private final boolean skip_install;
79     
80     private final boolean skip_uninstall;
81     
82     private final boolean skip_reinstall;
83
84     private final boolean force;
85     
86     private final boolean ignore_failure;
87     
88     private final boolean install_first;
89     
90     @JsonCreator
91     public DeploymentRequestObject(@JsonProperty("deploymentId") String deploymentId,
92             @JsonProperty("serviceTypeId") String serviceTypeId, @JsonProperty("inputs") Map<String, Object> inputs,
93             @JsonProperty("tenant") String tenant, @JsonProperty("method") String method,
94             @JsonProperty("reinstall_list") Collection<String> reinstallList, 
95             @JsonProperty("skip_install") boolean skipInstall, 
96             @JsonProperty("skip_uninstall") boolean skipUninstall, 
97             @JsonProperty("skip_reinstall") boolean skipReinstall, 
98             @JsonProperty("force") boolean force, 
99             @JsonProperty("ignore_failure") boolean ignoreFailure, 
100             @JsonProperty("install_first") boolean installFirst) {
101         this.deploymentId = deploymentId;
102         this.serviceTypeId = serviceTypeId;
103         this.inputs = inputs;
104         this.tenant = tenant;
105         this.method = method;
106         this.reinstall_list = (reinstallList == null) ? new LinkedList<String>() : reinstallList;
107         this.skip_install = skipInstall;
108         this.skip_uninstall = skipUninstall;
109         this.skip_reinstall = skipReinstall;
110         this.force = force;
111         this.ignore_failure = ignoreFailure;
112         this.install_first = installFirst;
113     }
114
115     public DeploymentRequestObject(String deploymentId, String serviceTypeId, String method, 
116         Map<String, Object> inputs, String tenant) {
117         super();
118         this.deploymentId = deploymentId;
119         this.method = method;
120         this.serviceTypeId = serviceTypeId;
121         this.tenant = tenant;
122         this.inputs = inputs;
123         this.reinstall_list = null;
124         this.skip_install = true;
125         this.skip_uninstall = true;
126         this.skip_reinstall = true;
127         this.force = false;
128         this.ignore_failure = true;
129         this.install_first = false;
130     }
131
132     public String getDeploymentId() {
133         return this.deploymentId;
134     }
135
136     public String getServiceTypeId() {
137         return this.serviceTypeId;
138     }
139
140     public Map<String, Object> getInputs() {
141         return this.inputs;
142     }
143
144     public String getTenant() {
145         return this.tenant;
146     }
147
148     public String getMethod() {
149         return method;
150     }
151
152     public Collection<String> getReinstall_list() {
153         return reinstall_list;
154     }
155
156     public boolean isSkip_install() {
157         return skip_install;
158     }
159
160     public boolean isSkip_uninstall() {
161         return skip_uninstall;
162     }
163
164     public boolean isSkip_reinstall() {
165         return skip_reinstall;
166     }
167
168     public boolean isForce() {
169         return force;
170     }
171
172     public boolean isIgnore_failure() {
173         return ignore_failure;
174     }
175
176     public boolean isInstall_first() {
177         return install_first;
178     }
179 }