b7b859838098c16c1cc0f1b92a50ce74bf5c4e72
[so/adapters/so-cnf-adapter.git] /
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2023 Nordix Foundation.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * SPDX-License-Identifier: Apache-2.0
18  * ============LICENSE_END=========================================================
19  */
20 package org.onap.so.cnfm.lcm.bpmn.flows.tasks;
21
22 import static org.onap.so.cnfm.lcm.database.beans.utils.Utils.toIndentedString;
23 import java.io.Serializable;
24 import java.util.Comparator;
25 import java.util.Map;
26 import java.util.Objects;
27
28 /**
29  *
30  * @author Waqas Ikram (waqas.ikram@est.tech)
31  *
32  */
33 public class InstantiateDeploymentItemRequest implements Serializable, Comparable<InstantiateDeploymentItemRequest> {
34     private static final long serialVersionUID = 6972854424933379019L;
35
36     private String asInstId;
37     private String asDeploymentItemInstId;
38     private String asDeploymentItemName;
39     private String helmArtifactFilePath;
40     private String kubeConfigFile;
41     private Integer deploymentOrder;
42     private Map<String, String> lifeCycleParameters;
43     private String releaseName;
44
45     private static final Comparator<Integer> COMPARATOR = Comparator.nullsFirst(Integer::compare);
46
47     public String getAsInstId() {
48         return asInstId;
49     }
50
51     public void setAsInstId(final String asInstId) {
52         this.asInstId = asInstId;
53     }
54
55     public InstantiateDeploymentItemRequest asInstId(final String asInstId) {
56         this.asInstId = asInstId;
57         return this;
58     }
59
60     public String getAsDeploymentItemInstId() {
61         return asDeploymentItemInstId;
62     }
63
64     public void setAsDeploymentItemInstId(final String asDeploymentItemInstId) {
65         this.asDeploymentItemInstId = asDeploymentItemInstId;
66     }
67
68     public InstantiateDeploymentItemRequest asDeploymentItemInstId(final String asDeploymentItemInstId) {
69         this.asDeploymentItemInstId = asDeploymentItemInstId;
70         return this;
71     }
72
73     public String getAsDeploymentItemName() {
74         return asDeploymentItemName;
75     }
76
77     public void setAsDeploymentItemName(final String asDeploymentItemName) {
78         this.asDeploymentItemName = asDeploymentItemName;
79     }
80
81     public InstantiateDeploymentItemRequest asDeploymentItemName(final String asDeploymentItemName) {
82         this.asDeploymentItemName = asDeploymentItemName;
83         return this;
84     }
85
86     public String getHelmArtifactFilePath() {
87         return helmArtifactFilePath;
88     }
89
90     public void setHelmArtifactFilePath(final String helmArtifactFilePath) {
91         this.helmArtifactFilePath = helmArtifactFilePath;
92     }
93
94     public InstantiateDeploymentItemRequest helmArtifactFilePath(final String helmArtifactFilePath) {
95         this.helmArtifactFilePath = helmArtifactFilePath;
96         return this;
97     }
98
99     public Integer getDeploymentOrder() {
100         return deploymentOrder;
101     }
102
103     public void setDeploymentOrder(final Integer deploymentOrder) {
104         this.deploymentOrder = deploymentOrder;
105     }
106
107     public InstantiateDeploymentItemRequest deploymentOrder(final Integer deploymentOrder) {
108         this.deploymentOrder = deploymentOrder;
109         return this;
110     }
111
112     public String getReleaseName() {
113         return releaseName;
114     }
115
116     public void setReleaseName(final String releaseName) {
117         this.releaseName = releaseName;
118     }
119
120     public InstantiateDeploymentItemRequest releaseName(final String releaseName) {
121         this.releaseName = releaseName;
122         return this;
123     }
124
125     public String getKubeConfigFile() {
126         return kubeConfigFile;
127     }
128
129     public void setKubeConfigFile(final String kubeConfigFile) {
130         this.kubeConfigFile = kubeConfigFile;
131     }
132
133     public InstantiateDeploymentItemRequest kubeConfigFile(final String kubeConfigFile) {
134         this.kubeConfigFile = kubeConfigFile;
135         return this;
136     }
137
138     public Map<String, String> getLifeCycleParameters() {
139         return lifeCycleParameters;
140     }
141
142     public void setLifeCycleParameters(final Map<String, String> lifeCycleParameters) {
143         this.lifeCycleParameters = lifeCycleParameters;
144     }
145
146     public InstantiateDeploymentItemRequest lifeCycleParameters(final Map<String, String> lifeCycleParameters) {
147         this.lifeCycleParameters = lifeCycleParameters;
148         return this;
149     }
150
151     @Override
152     public int hashCode() {
153         return Objects.hash(asInstId, asDeploymentItemInstId, asDeploymentItemName, helmArtifactFilePath,
154                 deploymentOrder, kubeConfigFile, lifeCycleParameters, releaseName);
155     }
156
157     @Override
158     public int compareTo(final InstantiateDeploymentItemRequest other) {
159         return COMPARATOR.compare(this.getDeploymentOrder(), other.getDeploymentOrder());
160     }
161
162     @Override
163     public boolean equals(final Object obj) {
164         if (obj instanceof InstantiateDeploymentItemRequest) {
165             final InstantiateDeploymentItemRequest other = (InstantiateDeploymentItemRequest) obj;
166             return Objects.equals(asInstId, other.asInstId)
167                     && Objects.equals(asDeploymentItemInstId, other.asDeploymentItemInstId)
168                     && Objects.equals(asDeploymentItemName, other.asDeploymentItemName)
169                     && Objects.equals(helmArtifactFilePath, other.helmArtifactFilePath)
170                     && Objects.equals(deploymentOrder, other.deploymentOrder)
171                     && Objects.equals(kubeConfigFile, other.kubeConfigFile)
172                     && Objects.equals(lifeCycleParameters, other.lifeCycleParameters)
173                     && Objects.equals(releaseName, other.releaseName);
174         }
175         return false;
176     }
177
178     @Override
179     public String toString() {
180         final StringBuilder sb = new StringBuilder();
181         sb.append("class InstantiateDeploymentItemRequest {\n");
182         sb.append("    asInstId: ").append(toIndentedString(asInstId)).append("\n");
183         sb.append("    asDeploymentItemInstId: ").append(toIndentedString(asDeploymentItemInstId)).append("\n");
184         sb.append("    asDeploymentItemName: ").append(toIndentedString(asDeploymentItemName)).append("\n");
185         sb.append("    helmArtifactFilePath: ").append(toIndentedString(helmArtifactFilePath)).append("\n");
186         sb.append("    deploymentOrder: ").append(toIndentedString(deploymentOrder)).append("\n");
187         sb.append("    kubeConfigFile: ").append(toIndentedString(kubeConfigFile)).append("\n");
188         sb.append("    LifeCycleParameters: ").append(toIndentedString(lifeCycleParameters)).append("\n");
189         sb.append("    releaseName: ").append(toIndentedString(releaseName)).append("\n");
190         sb.append("}");
191         return sb.toString();
192     }
193 }