33dfb6a6263487fedb61b8f8f31c1b4b09830af2
[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.Collection;
25 import java.util.LinkedList;
26 import java.util.Map;
27 import java.util.Optional;
28
29 import com.fasterxml.jackson.annotation.JsonCreator;
30 import com.fasterxml.jackson.annotation.JsonProperty;
31
32 /**
33  * Model for message POST-ed to controller to create a Deployment via the
34  * Deployment Handler API:
35  * 
36  * <pre>
37         { 
38                 "component" : "comp",
39                 "deploymentTag" : "tag",
40                 "blueprintName" : "name",
41                 "blueprintVersion" : "version",
42                 "blueprintId" : "bp_id",
43                 "inputs" :
44                         {
45                                 "input1" : "parameter1",
46                                 "input2" : "parameter2",
47                                                 ...
48                                 "inputn" : "parametern"
49                         },
50                 "tenant" : "tenant_name"        
51         }
52  * </pre>
53  * 
54  * THIS OBJECT INCLUDES THE DEPLOYMENTID CREATED BY THE USER!
55  */
56 public class DeploymentInput {
57
58     /** component or namespace for the service */
59     private final String component;
60
61     /** tag to identify the deployment */
62     private final String tag;
63
64     /** The blueprint name for the service to be deployed. */
65     private final String blueprintName;
66
67     /** blueprint version for the service to be deployed */
68     private final Optional<Integer> blueprintVersion;
69
70     /** blueprint typeId from inventory */
71     private final Optional<String> blueprintId;
72
73     /** The cloudify tenant name for the deployment */
74     private final String tenant;
75     /**
76      * Object containing inputs needed by the service blueprint to create an
77      * instance of the service. Content of the object depends on the service being
78      * deployed.
79      */
80     private final Map<String, Object> inputs;
81
82     private final Collection<String> reinstall_list;
83     
84     private final boolean skip_install;
85     
86     private final boolean skip_uninstall;
87     
88     private final boolean skip_reinstall;
89
90     private final boolean force;
91     
92     private final boolean ignore_failure;
93     
94     private final boolean install_first;
95     
96     @JsonCreator
97     public DeploymentInput(@JsonProperty("component") String component, @JsonProperty("tag") String tag,
98             @JsonProperty("blueprintName") String blueprintName,
99             @JsonProperty("blueprintVersion") Integer blueprintVersion, @JsonProperty("blueprintId") String blueprintId,
100             @JsonProperty("inputs") Map<String, Object> inputs, @JsonProperty("tenant") String tenant,
101             @JsonProperty("reinstall_list") Collection<String> reinstallList, 
102             @JsonProperty("skip_install") boolean skipInstall, 
103             @JsonProperty("skip_uninstall") boolean skipUninstall, 
104             @JsonProperty("skip_reinstall") boolean skipReinstall, 
105             @JsonProperty("force") boolean force, 
106             @JsonProperty("ignore_failure") boolean ignoreFailure, 
107             @JsonProperty("install_first") boolean installFirst) {
108         this.component = component;
109         this.tag = tag;
110         this.blueprintName = blueprintName;
111         this.blueprintVersion = Optional.ofNullable(blueprintVersion);
112         this.blueprintId = Optional.ofNullable(blueprintId);
113         this.inputs = inputs;
114         this.tenant = tenant;
115         this.reinstall_list = (reinstallList == null) ? new LinkedList<String>() : reinstallList;
116         this.skip_install = skipInstall;
117         this.skip_uninstall = skipUninstall;
118         this.skip_reinstall = skipReinstall;
119         this.force = force;
120         this.ignore_failure = ignoreFailure;
121         this.install_first = installFirst;
122     }
123
124     public String getBlueprintName() {
125         return this.blueprintName;
126     }
127
128     public Map<String, Object> getInputs() {
129         return this.inputs;
130     }
131
132     public String getTenant() {
133         return this.tenant;
134     }
135
136     public Optional<Integer> getBlueprintVersion() {
137         return blueprintVersion;
138     }
139
140     public String getTag() {
141         return tag;
142     }
143
144     public String getComponent() {
145         return component;
146     }
147
148     public Optional<String> getBlueprintId() {
149         return blueprintId;
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 }