2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.vid.model.serviceInstantiation;
23 import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
25 import com.fasterxml.jackson.annotation.JsonAlias;
26 import com.fasterxml.jackson.annotation.JsonInclude;
27 import com.fasterxml.jackson.annotation.JsonProperty;
28 import java.util.Collection;
29 import java.util.Collections;
30 import java.util.List;
32 import javax.annotation.Nullable;
33 import org.onap.vid.job.JobAdapter;
34 import org.onap.vid.job.JobType;
35 import org.onap.vid.mso.model.ModelInfo;
36 import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue;
41 @JsonInclude(NON_NULL)
42 public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest {
44 @JsonInclude(NON_NULL) @JsonProperty("volumeGroupName") private final String volumeGroupInstanceName;
45 @JsonInclude(NON_NULL) @JsonProperty("sdncPreLoad") private Boolean usePreload;
46 private List<UserParamNameAndValue> supplementaryParams;
48 @JsonInclude(NON_NULL)
49 private final Boolean retainVolumeGroups;
51 @JsonInclude(NON_NULL)
52 private final PauseInstantiation pauseInstantiation;
54 @JsonInclude(NON_NULL)
55 private Boolean retainAssignments;
57 public VfModule(@JsonProperty("modelInfo") ModelInfo modelInfo,
58 @JsonProperty("instanceName") String instanceName,
59 @JsonProperty("volumeGroupName") @JsonAlias("volumeGroupInstanceName") String volumeGroupInstanceName,
60 @JsonProperty("action") String action,
61 @JsonProperty("lcpCloudRegionId") String lcpCloudRegionId,
62 @JsonProperty("legacyRegion") String legacyRegion,
63 @JsonProperty("tenantId") String tenantId,
64 @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
65 @JsonProperty("supplementaryFileContent") List<UserParamNameAndValue> supplementaryParams,
66 @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
67 @JsonProperty("sdncPreLoad") @JsonAlias("usePreload") Boolean usePreload,
68 @JsonProperty("instanceId") String instanceId,
69 @JsonProperty("trackById") String trackById,
70 @JsonProperty("isFailed") Boolean isFailed,
71 @JsonProperty("statusMessage") String statusMessage,
72 @Nullable @JsonProperty("retainAssignments") Boolean retainAssignments,
73 @Nullable @JsonProperty("retainVolumeGroups") Boolean retainVolumeGroups,
74 @JsonProperty("position") Integer position,
75 @JsonProperty("pauseInstantiation") PauseInstantiation pauseInstantiation,
76 @JsonProperty("originalName") String originalName) {
77 super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage,
78 position, originalName);
79 this.volumeGroupInstanceName = volumeGroupInstanceName;
80 this.usePreload = usePreload;
81 this.supplementaryParams = supplementaryParams;
82 this.retainAssignments = retainAssignments;
83 this.retainVolumeGroups = retainVolumeGroups;
84 this.pauseInstantiation = pauseInstantiation;
87 public String getVolumeGroupInstanceName() {
88 return volumeGroupInstanceName;
91 public Boolean isUsePreload() {
96 public enum PauseInstantiation {
100 public List<UserParamNameAndValue> getSupplementaryParams() {
101 return supplementaryParams;
105 protected String getModelType() {
110 public Collection<BaseResource> getChildren() {
111 return Collections.emptyList();
115 public JobType getJobType() {
116 return JobType.VfmoduleInstantiation;
120 public Boolean isRetainAssignments() {
121 return retainAssignments;
125 public Boolean isRetainVolumeGroups() {
126 return retainVolumeGroups;
130 public PauseInstantiation getPauseInstantiation() {return pauseInstantiation;}
132 public VfModule cloneWith(ModelInfo modelInfo) {
135 this.getInstanceName(),
136 this.getVolumeGroupInstanceName(),
137 this.getAction().toString(),
138 this.getLcpCloudRegionId(),
139 this.getLcpCloudRegionId(),
141 this.getInstanceParams(),
142 this.getSupplementaryParams(),
143 this.isRollbackOnFailure(),
145 this.getInstanceId(),
148 this.getStatusMessage(),
149 this.isRetainAssignments(),
150 this.isRetainVolumeGroups(),
152 this.getPauseInstantiation(),
153 this.getOriginalName()
157 public VfModule cloneWith(String lcpCloudRegionId, String tenantId) {
160 this.getInstanceName(),
161 this.getVolumeGroupInstanceName(),
162 this.getAction().toString(),
166 this.getInstanceParams(),
167 this.getSupplementaryParams(),
168 this.isRollbackOnFailure(),
170 this.getInstanceId(),
173 this.getStatusMessage(),
174 this.isRetainAssignments(),
175 this.isRetainVolumeGroups(),
177 this.getPauseInstantiation(),
178 this.getOriginalName()