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