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