Initial OpenECOMP policy/engine commit
[policy/engine.git] / PolicyEngineAPI / src / main / java / org / openecomp / policy / api / PolicyParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
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
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.openecomp.policy.api;
22
23 import java.util.Date;
24 import java.util.List;
25 import java.util.Map;
26 import java.util.UUID;
27
28 /**
29  * <code>PolicyParameters</code> defines the Policy Parameters
30  *  which are required to Create/Update a Policy. 
31  * 
32  * @version 0.1
33  */
34 public class PolicyParameters {
35         private PolicyClass policyClass;
36         private PolicyConfigType policyConfigType;
37         private String policyName;
38         private String policyDescription;
39         private String ecompName;
40         private String configName;
41         private Map<AttributeType, Map<String,String>> attributes;
42         private String configBody;
43         private PolicyType configBodyType;
44         private String actionPerformer;
45         private String actionAttribute;
46         private UUID requestID;
47         private List<String> dynamicRuleAlgorithmLabels;
48         private List<String> dynamicRuleAlgorithmFunctions;
49         private List<String> dynamicRuleAlgorithmField1;
50         private List<String> dynamicRuleAlgorithmField2;
51         private String priority;
52         private RuleProvider ruleProvider;
53         private Date TTLDate;
54         private boolean guard = false;
55         private String riskLevel = "5";
56         private String riskType = "defualt";
57         
58         /**
59          * Sets Config Policy Parameters.
60          * 
61          * @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
62          * @param policyName the <code>String</code> format of the Policy Name
63          * @param policyDescription the <code>String</code> format of the Policy Description
64          * @param ecompName the <code>String</code> format of the ECOMP Name
65          * @param configName the <code>String</code> format of the Config Name
66          * @param attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
67          * @param configBodyType the {@link org.openecomp.policy.api.PolicyType} Enum format of the config Body Type. 
68          * @param configBody the <code>String</code> format of the Policy Body
69          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
70          * A different request ID should be passed for each request.
71          */
72         public void setConfigPolicyParameters(PolicyConfigType policyConfigType, String policyName, String policyDescription, String ecompName, String configName, 
73                         Map<AttributeType, Map<String, String>> attributes, PolicyType configBodyType, String configBody, UUID requestID){
74                 this.setPolicyConfigType(policyConfigType);
75                 this.setPolicyName(policyName);
76                 this.setPolicyDescription(policyDescription);
77                 this.setEcompName(ecompName);
78                 this.setConfigName(configName);
79                 this.setAttributes(attributes);
80                 this.setConfigBody(configBody);
81                 this.setConfigBodyType(configBodyType);
82                 this.setRequestID(requestID);
83         }
84         
85         /**
86          * Sets config Firewall Policy Parameters.
87          * 
88          * @param policyName the <code>String</code> format of the Policy Name
89          * @param firewallJson the <code>String</code> representation of the Firewall Rules List
90          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
91          * A different request ID should be passed for each request.
92          */
93         public void setConfigFirewallPolicyParameters(String policyName, String firewallJson, UUID requestID){
94                 this.setPolicyConfigType(PolicyConfigType.Firewall);
95                 this.setPolicyName(policyName);
96                 this.setConfigBody(firewallJson);
97                 this.setConfigBodyType(PolicyType.JSON);
98                 this.setRequestID(requestID);
99         }
100
101         /**
102          * Gets the PolicyName of the Policy Parameters. 
103          * 
104          * @return policyName the <code>String</code> format of the Policy Name
105          */
106         public String getPolicyName() {
107                 return policyName;
108         }
109
110         /**
111          * Sets the policyName of the Policy Parameters.
112          * 
113          * @param policyName the <code>String</code> format of the Policy Name
114          */
115         public void setPolicyName(String policyName) {
116                 this.policyName = policyName;
117         }
118
119         /**
120          * Gets the policy Description. 
121          * 
122          * @return the <code>String</code> format of the Policy Description
123          */
124         public String getPolicyDescription() {
125                 return policyDescription;
126         }
127
128         /**
129          * Sets the policy Description of the Policy Description. 
130          * 
131          * @param policyDescription the <code>String</code> format of the Policy Description
132          */
133         public void setPolicyDescription(String policyDescription) {
134                 this.policyDescription = policyDescription;
135         }
136
137         /**
138          * Gets the ECOMP Name value of the Policy Paramters. 
139          * 
140          * @return <code>String</code> format of the ECOMP Name
141          */
142         public String getEcompName() {
143                 return ecompName;
144         }
145
146         /**
147          * Sets the ECOMP Name field of the Policy Parameters. 
148          * 
149          * @param ecompName the <code>String</code> format of the ECOMP Name
150          */
151         public void setEcompName(String ecompName) {
152                 this.ecompName = ecompName;
153         }
154
155         /**
156          * Gets the Config Name value of the Policy Parameters. 
157          * 
158          * @return <code>String</code> format of the Config Name
159          */
160         public String getConfigName() {
161                 return configName;
162         }
163
164         /**
165          * Sets the Config Name field of the Policy Parameters. 
166          * 
167          * @param configName the <code>String</code> format of the Config Name
168          */
169         public void setConfigName(String configName) {
170                 this.configName = configName;
171         }
172
173         /**
174          * Gets the Attributes of the policy Parameters. 
175          * 
176          * @return <code>List</code> the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
177          */
178         public Map<AttributeType, Map<String, String>> getAttributes() {
179                 return attributes;
180         }
181
182         /**
183          * Sets the Attributes of the Policy Parameters. 
184          * 
185          * @param attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
186          */
187         public void setAttributes(Map<AttributeType, Map<String, String>> attributes) {
188                 this.attributes = attributes;
189         }
190
191         /**
192          * Gets the Policy Config Type value the Policy parameters. 
193          * 
194          * @return {@link org.openecomp.policy.api.PolicyConfigType} Enum of the Config Type
195          */
196         public PolicyConfigType getPolicyConfigType() {
197                 return policyConfigType;
198         }
199
200         /**
201          * Sets the Policy Config Type field of the policy Parameters. 
202          * 
203          * @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
204          */
205         public void setPolicyConfigType(PolicyConfigType policyConfigType) {
206                 setPolicyClass(PolicyClass.Config);
207                 this.policyConfigType = policyConfigType;
208         }
209
210         /**
211          * Gets the configBody value of the Policy Parameters. 
212          * 
213          * @return the <code>String</code> format of the Policy Body
214          */
215         public String getConfigBody() {
216                 return configBody;
217         }
218
219         /**
220          * Sets the configBody field of the Policy Parameters. 
221          * 
222          * @param configBody the <code>String</code> format of the Policy Body
223          */
224         public void setConfigBody(String configBody) {
225                 this.configBody = configBody;
226         }
227
228         /**
229          * Gets the config Body Type value of the Policy Parameters.  
230          * 
231          * @return the <code>PolicyType</code> representation of the configBodyType
232          */
233         public PolicyType getConfigBodyType() {
234                 return configBodyType;
235         }
236
237         /**
238          * Sets the configBodyType field of the Policy Parameters. 
239          * 
240          * @param configBodyType the <code>PolicyType</code> representation of the config BodyType
241          */
242         public void setConfigBodyType(PolicyType configBodyType) {
243                 this.configBodyType = configBodyType;
244         }
245         
246         /**
247          * Gets the requestID of the Policy Parameters. 
248          * 
249          * @return unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
250          */
251         public UUID getRequestID() {
252                 return requestID;
253         }
254         
255         /**
256          * Sets the requestID of the Policy Parameters. 
257          * 
258          * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
259          */
260         public void setRequestID(UUID requestID) {
261                 this.requestID = requestID;
262         }
263
264         /**
265          * Gets the Policy Class of the Policy Parameters. 
266          * 
267          * @return {@link org.openecomp.policy.api.PolicyClass} of the Policy Parameters. 
268          */
269         public PolicyClass getPolicyClass() {
270                 return policyClass;
271         }
272
273         /**
274          * Sets the Policy Class of the Policy Parameters. 
275          * 
276          * @param policyClass the Enum {@link org.openecomp.policy.api.PolicyClass} to set Policy Class Type of Policy parameters. 
277          */
278         public void setPolicyClass(PolicyClass policyClass) {
279                 this.policyClass = policyClass;
280         }
281         
282         /**
283          * Gets the Action Performer value of the Policy Parameters for Action Policies. 
284          *
285          * @return the <code>String</code> value of the Action Performer for Action Policies
286          */
287         public String getActionPerformer() {
288                 return actionPerformer;
289         }
290         
291         /**
292          * Sets the Action Performer value of the Policy Parameters for Action Policies.
293          * 
294          * @param actionPerformer the <code>String</code> format of the Action Performer
295          */
296         public void setActionPerformer(String actionPerformer) {
297                 this.actionPerformer = actionPerformer;
298         }
299
300         /**
301          * Gets the Action Attribute value of the Policy Parameters for Action Policies. 
302          *
303          * @return the <code>String</code> value of the Action Attribute for Action Policies
304          */
305         public String getActionAttribute() {
306                 return actionAttribute;
307         }
308
309         /**
310          * Sets the Action Attribute value of the Policy Parameters for Action Policies.
311          * 
312          * @param actionAttribute the <code>String</code> format of the Action Attribute
313          */
314         public void setActionAttribute(String actionAttribute) {
315                 this.actionAttribute = actionAttribute;
316         }
317         
318         /**
319          * Gets the Dynamic Rule Algorithm Label of the policy Parameters. Used in conjunction with the Label, Field1,
320          * Function, and Field2 to complete the complex and simple Rule Algorithms
321          * 
322          * @return <code>List</code> the Dynamic Rule Algorithm Label that must contain the Labels in order
323          */
324         public List<String> getDynamicRuleAlgorithmLabels() {
325                 return dynamicRuleAlgorithmLabels;
326         }
327
328         /**
329          * Sets the Dynamic Rule Algorithm Labels used in conjunction with the Label, Field1,
330          * Function, and Field2 to complete the complex and simple Rule Algorithms
331          * 
332          * @param dynamicRuleAlgorithmLabels the <code>List</code> dynamicRuleAlgoritmLabels in order
333          */
334         public void setDynamicRuleAlgorithmLabels(
335                         List<String> dynamicRuleAlgorithmLabels) {
336                 this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
337         }
338
339         /**
340          * Gets the Dynamic Rule Algorithm Function of the policy Parameters. Used in conjunction with the Label, Field1,
341          * FunctionDef, and Field2 to complete the complex and simple Rule Algorithms 
342          * 
343          * @return <code>List</code> the Dynamic Rule Algorithm Functions that must contain the values in order
344          */
345         public List<String> getDynamicRuleAlgorithmFunctions() {
346                 return dynamicRuleAlgorithmFunctions;
347         }
348
349         /**
350          * Sets the Dynamic Rule Algorithm Functions used in conjunction with the Label, Field1,
351          * Function, and Field2 to complete the complex and simple Rule Algorithms
352          * 
353          * @param dynamicRuleAlgorithmFunctions the <code>List</code> dynamicRuleAlgorithmFunctions in order
354          */
355         public void setDynamicRuleAlgorithmFunctions(List<String> dynamicRuleAlgorithmFunctions) {
356                 this.dynamicRuleAlgorithmFunctions = dynamicRuleAlgorithmFunctions;
357         }
358
359         /**
360          * Gets the Dynamic Rule Algorithm Field1 of the policy Parameters. Used in conjunction with the Label, Field1,
361          * Function, and Field2 to complete the complex and simple Rule Algorithms
362          * 
363          * @return <code>List</code> the Dynamic Rule Algorithm Field1 that must contain the Field1 values in order
364          */
365         public List<String> getDynamicRuleAlgorithmField1() {
366                 return dynamicRuleAlgorithmField1;
367         }
368
369         /**
370          * Sets the Dynamic Rule Algorithm Field1 used in conjunction with the Label, Field1,
371          * Function, and Field2 to complete the complex and simple Rule Algorithms
372          * 
373          * @param dynamicRuleAlgorithmField1 the <code>List</code> dynamicRuleAlgorithmField1 in order
374          */
375         public void setDynamicRuleAlgorithmField1(
376                         List<String> dynamicRuleAlgorithmField1) {
377                 this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
378         }
379
380         /**
381          * Gets the Dynamic Rule Algorithm Field2 of the policy Parameters. Used in conjunction with the Label, Field1,
382          * Operator, and Field2 to complete the complex and simple Rule Algorithms
383          * 
384          * @return <code>List</code> the Dynamic Rule Algorithm Field2 that must contain the Field2 values in order
385          */
386         public List<String> getDynamicRuleAlgorithmField2() {
387                 return dynamicRuleAlgorithmField2;
388         }
389
390         /**
391          * Sets the Dynamic Rule Algorithm Field2 used in conjunction with the Label, Field1,
392          * Function, and Field2 to complete the complex and simple Rule Algorithms
393          * 
394          * @param dynamicRuleAlgorithmField2 the <code>List</code> dynamicRuleAlgorithmField2 in order
395          */
396         public void setDynamicRuleAlgorithmField2(
397                         List<String> dynamicRuleAlgorithmField2) {
398                 this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
399         }
400         
401         /**
402          * Gets the Priority of the Policy Parameters. 
403          * 
404          * @return priority the <code>String</code> format of the Micro Services priority
405          */
406         public String getPriority() {
407                 return priority;
408         }
409         
410         /**
411          * Sets the Priority of the Policy Parameters.
412          * 
413          * @param priority the <code>String</code> format of the Micro Services priority
414          */
415         public void setPriority(String priority) {
416                 this.priority = priority;
417         }
418
419         public RuleProvider getRuleProvider() {
420                 return ruleProvider;
421         }
422
423         public void setRuleProvider(RuleProvider ruleProvider) {
424                 this.ruleProvider = ruleProvider;
425         }       
426         /**
427          * Sets the Guard field of the Policy Parameters. 
428          * 
429          * @param guard the <code>Boolean</code> format of the guard value
430          */
431         public void setGuard(boolean guard){
432                 this.guard = guard;
433         }
434         
435         /**
436          * Gets the  guard value of the Policy Parameters for Action Policies. 
437          *
438          * @return the <code>boolean</code> value of the Guard for Config Policies
439          */
440         public boolean getGuard(){
441                 return guard;
442         }
443         
444         /**
445          * Sets the riskType field of the Policy Parameters. 
446          * 
447          * @param guard the <code>String</code> format of the riskType value
448          */
449         public void setRiskType(String riskType){
450                 this.riskType = riskType;
451         }
452         
453         /**
454          * Gets the riskType value of the Policy Parameters for Config Policies. 
455          *
456          * @return the <code>String</code> value of the riskType for Config Policies
457          */
458         public String getRiskType(){
459                 return riskType;
460         }
461         
462         /**
463          * Sets the riskLevel field of the Policy Parameters. 
464          * 
465          * @param riskLevel the <code>String</code> format of the riskType value
466          */
467         public void setRiskLevel(String riskLevel){
468                 this.riskLevel = riskLevel;
469         }
470         
471         /**
472          * Gets the riskLevel value of the Policy Parameters for Config Policies. 
473          *
474          * @return the <code>String</code> value of the riskLevel for Config Policies
475          */
476         public String getRiskLevel(){
477                 return riskLevel;
478         }
479         
480         /**
481          * Sets the TTLDate field of the Policy Parameters. 
482          * 
483          * @param TTLDate the <code>Date</code> format of the TTLDate value
484          */
485         public void setTtlDate(Date TTLDate){
486                 this.TTLDate = TTLDate;
487         }
488         
489         /**
490          * Gets the TTLDate value of the Policy Parameters for Config Policies. 
491          *
492          * @return the <code>Date</code> value of the TTLDate for Config Policies
493          */
494         public Date getTtlDate(){
495                 return TTLDate;
496         }
497 }