Implant vid-app-common org.onap.vid.job (main and test)
[vid.git] / vid-app-common / src / main / java / org / onap / vid / mso / model / VfModuleInstantiationRequestDetails.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 - 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
21 package org.onap.vid.mso.model;
22
23 import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
24
25 import com.fasterxml.jackson.annotation.JsonInclude;
26 import com.fasterxml.jackson.annotation.JsonProperty;
27 import java.util.HashMap;
28 import java.util.List;
29 import java.util.Map;
30
31 /* Based on this model:
32
33 {
34   "requestDetails": {
35       "modelInfo": {
36           “modelType”: “vfModule”,
37           “modelInvariantId”: “ff5256d2-5a33-55df-13ab-12abad84e7ff”,
38           “modelVersionId”: “fe6478e5-ea33-3346-ac12-ab121484a3fe”,
39           “modelCustomizationId”: “856f9806-b01a-11e6-80f5-76304dec7eb7”,
40           “modelName”: “vSAMP12..base..module-0”,
41           "modelVersion": "1"
42       },
43       “cloudConfiguration”: {
44           “lcpCloudRegionId”: “mdt1”,
45           “tenantId”: “88a6ca3ee0394ade9403f075db23167e”
46       },
47       "requestInfo": {
48           “instanceName”: “MSOTEST103a-vSAMP12_base_module-0”,
49           “source”: “VID”,
50           “suppressRollback”: true,
51           “requestorId”: “az2016”
52       },
53       "relatedInstanceList": [
54          {
55       // This related instance captures the volumeGroup to attach
56             “relatedInstance”: {
57                “instanceId”: “17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c”,
58                “instanceName”: “MSOTESTVOL103a-vSAMP12_base_module-0_vol”,
59                “modelInfo”: {
60                   “modelType”: “volumeGroup”
61                }
62             }
63          },
64          {
65             “relatedInstance”: {
66                “instanceId”: “{serviceInstanceId}”,
67                “modelInfo”: {
68                   “modelType”: “service”,
69                   “modelInvariantId”: “ff3514e3-5a33-55df-13ab-12abad84e7ff”,
70                   “modelVersionId”: “fe6985cd-ea33-3346-ac12-ab121484a3fe”,
71                   “modelName”: “{parent service model name}”,
72                   "modelVersion": "1.0"
73                }
74             }
75          },
76          {
77             “relatedInstance”: {
78                “instanceId”: “{vnfInstanceId}”,
79                "modelInfo": {
80                   “modelType”: “vnf”,
81                   “modelInvariantId”: “ff5256d1-5a33-55df-13ab-12abad84e7ff”,
82                   “modelVersionId”: “fe6478e4-ea33-3346-ac12-ab121484a3fe”,
83                   “modelName”: “vSAMP12”,
84                   "modelVersion": "1.0",
85                      “modelCustomizationName”: “vSAMP12 1”,
86                      “modelCustomizationId”: “a7f1d08e-b02d-11e6-80f5-76304dec7eb7”
87                }
88             }
89          }
90       ],
91       “requestParameters”: {
92           “usePreload”: true,
93           “userParams”: []
94       }
95   }
96 }
97
98
99  */
100
101 public class VfModuleInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails {
102
103     public VfModuleInstantiationRequestDetails(
104             @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo,
105             @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration,
106             @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo,
107             @JsonProperty(value = "relatedInstanceList", required = true) List<RelatedInstance> relatedInstanceList,
108             @JsonProperty(value = "requestParameters", required = true) RequestParametersVfModule requestParameters)
109     {
110         super(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters);
111     }
112
113     public static class RequestParametersVfModule extends BaseResourceInstantiationRequestDetails.RequestParameters {
114         @JsonInclude(NON_NULL) private final Boolean usePreload;
115
116         public RequestParametersVfModule(List<? extends UserParamTypes> userParams, Boolean usePreload, String testApi) {
117             super(userParams, testApi);
118             this.usePreload = usePreload;
119         }
120
121         public Boolean isUsePreload() {
122             return usePreload;
123         }
124     }
125
126     public static class UserParamMap<K,V> extends HashMap<K,V> implements UserParamTypes, Map<K,V>  {
127
128         public UserParamMap() {
129             super();
130         }
131     }
132 }
133