aboutsummaryrefslogtreecommitdiffstats
path: root/PolicyEngineAPI/src/main/java/org/openecomp/policy/api/PolicyParameters.java
blob: 32cd75b5f0264dfc6e7c9b165bd1a405061db09b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
/*-
 * ============LICENSE_START=======================================================
 * PolicyEngineAPI
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.policy.api;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * <code>PolicyParameters</code> defines the Policy Parameters
 *  which are required to Create/Update a Policy. 
 * 
 * @version 0.1
 */
public class PolicyParameters {
	private PolicyClass policyClass;
	private PolicyConfigType policyConfigType;
	private String policyName;
	private String policyDescription;
	private String ecompName;
	private String configName;
	private Map<AttributeType, Map<String,String>> attributes;
	private String configBody;
	private PolicyType configBodyType;
	private String actionPerformer;
	private String actionAttribute;
	private UUID requestID;
	private List<String> dynamicRuleAlgorithmLabels;
	private List<String> dynamicRuleAlgorithmFunctions;
	private List<String> dynamicRuleAlgorithmField1;
	private List<String> dynamicRuleAlgorithmField2;
	private String priority;
	private RuleProvider ruleProvider;
	private Date TTLDate;
	private boolean guard = false;
	private String riskLevel = "5";
	private String riskType = "defualt";
	
	/**
	 * Sets Config Policy Parameters.
	 * 
	 * @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
	 * @param policyName the <code>String</code> format of the Policy Name
	 * @param policyDescription the <code>String</code> format of the Policy Description
	 * @param ecompName the <code>String</code> format of the ECOMP Name
	 * @param configName the <code>String</code> format of the Config Name
	 * @param attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
	 * @param configBodyType the {@link org.openecomp.policy.api.PolicyType} Enum format of the config Body Type. 
	 * @param configBody the <code>String</code> format of the Policy Body
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 */
	public void setConfigPolicyParameters(PolicyConfigType policyConfigType, String policyName, String policyDescription, String ecompName, String configName, 
			Map<AttributeType, Map<String, String>> attributes, PolicyType configBodyType, String configBody, UUID requestID){
		this.setPolicyConfigType(policyConfigType);
		this.setPolicyName(policyName);
		this.setPolicyDescription(policyDescription);
		this.setEcompName(ecompName);
		this.setConfigName(configName);
		this.setAttributes(attributes);
		this.setConfigBody(configBody);
		this.setConfigBodyType(configBodyType);
		this.setRequestID(requestID);
	}
	
	/**
	 * Sets config Firewall Policy Parameters.
	 * 
	 * @param policyName the <code>String</code> format of the Policy Name
	 * @param firewallJson the <code>String</code> representation of the Firewall Rules List
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 * A different request ID should be passed for each request.
	 */
	public void setConfigFirewallPolicyParameters(String policyName, String firewallJson, UUID requestID){
		this.setPolicyConfigType(PolicyConfigType.Firewall);
		this.setPolicyName(policyName);
		this.setConfigBody(firewallJson);
		this.setConfigBodyType(PolicyType.JSON);
		this.setRequestID(requestID);
	}

	/**
	 * Gets the PolicyName of the Policy Parameters. 
	 * 
	 * @return policyName the <code>String</code> format of the Policy Name
	 */
	public String getPolicyName() {
		return policyName;
	}

	/**
	 * Sets the policyName of the Policy Parameters.
	 * 
	 * @param policyName the <code>String</code> format of the Policy Name
	 */
	public void setPolicyName(String policyName) {
		this.policyName = policyName;
	}

	/**
	 * Gets the policy Description. 
	 * 
	 * @return the <code>String</code> format of the Policy Description
	 */
	public String getPolicyDescription() {
		return policyDescription;
	}

	/**
	 * Sets the policy Description of the Policy Description. 
	 * 
	 * @param policyDescription the <code>String</code> format of the Policy Description
	 */
	public void setPolicyDescription(String policyDescription) {
		this.policyDescription = policyDescription;
	}

	/**
	 * Gets the ECOMP Name value of the Policy Paramters. 
	 * 
	 * @return <code>String</code> format of the ECOMP Name
	 */
	public String getEcompName() {
		return ecompName;
	}

	/**
	 * Sets the ECOMP Name field of the Policy Parameters. 
	 * 
	 * @param ecompName the <code>String</code> format of the ECOMP Name
	 */
	public void setEcompName(String ecompName) {
		this.ecompName = ecompName;
	}

	/**
	 * Gets the Config Name value of the Policy Parameters. 
	 * 
	 * @return <code>String</code> format of the Config Name
	 */
	public String getConfigName() {
		return configName;
	}

	/**
	 * Sets the Config Name field of the Policy Parameters. 
	 * 
	 * @param configName the <code>String</code> format of the Config Name
	 */
	public void setConfigName(String configName) {
		this.configName = configName;
	}

	/**
	 * Gets the Attributes of the policy Parameters. 
	 * 
	 * @return <code>List</code> the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
	 */
	public Map<AttributeType, Map<String, String>> getAttributes() {
		return attributes;
	}

	/**
	 * Sets the Attributes of the Policy Parameters. 
	 * 
	 * @param attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
	 */
	public void setAttributes(Map<AttributeType, Map<String, String>> attributes) {
		this.attributes = attributes;
	}

	/**
	 * Gets the Policy Config Type value the Policy parameters. 
	 * 
	 * @return {@link org.openecomp.policy.api.PolicyConfigType} Enum of the Config Type
	 */
	public PolicyConfigType getPolicyConfigType() {
		return policyConfigType;
	}

	/**
	 * Sets the Policy Config Type field of the policy Parameters. 
	 * 
	 * @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
	 */
	public void setPolicyConfigType(PolicyConfigType policyConfigType) {
		setPolicyClass(PolicyClass.Config);
		this.policyConfigType = policyConfigType;
	}

	/**
	 * Gets the configBody value of the Policy Parameters. 
	 * 
	 * @return the <code>String</code> format of the Policy Body
	 */
	public String getConfigBody() {
		return configBody;
	}

	/**
	 * Sets the configBody field of the Policy Parameters. 
	 * 
	 * @param configBody the <code>String</code> format of the Policy Body
	 */
	public void setConfigBody(String configBody) {
		this.configBody = configBody;
	}

	/**
	 * Gets the config Body Type value of the Policy Parameters.  
	 * 
	 * @return the <code>PolicyType</code> representation of the configBodyType
	 */
	public PolicyType getConfigBodyType() {
		return configBodyType;
	}

	/**
	 * Sets the configBodyType field of the Policy Parameters. 
	 * 
	 * @param configBodyType the <code>PolicyType</code> representation of the config BodyType
	 */
	public void setConfigBodyType(PolicyType configBodyType) {
		this.configBodyType = configBodyType;
	}
	
	/**
	 * Gets the requestID of the Policy Parameters. 
	 * 
	 * @return unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 */
	public UUID getRequestID() {
		return requestID;
	}
	
	/**
	 * Sets the requestID of the Policy Parameters. 
	 * 
	 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
	 */
	public void setRequestID(UUID requestID) {
		this.requestID = requestID;
	}

	/**
	 * Gets the Policy Class of the Policy Parameters. 
	 * 
	 * @return {@link org.openecomp.policy.api.PolicyClass} of the Policy Parameters. 
	 */
	public PolicyClass getPolicyClass() {
		return policyClass;
	}

	/**
	 * Sets the Policy Class of the Policy Parameters. 
	 * 
	 * @param policyClass the Enum {@link org.openecomp.policy.api.PolicyClass} to set Policy Class Type of Policy parameters. 
	 */
	public void setPolicyClass(PolicyClass policyClass) {
		this.policyClass = policyClass;
	}
	
	/**
	 * Gets the Action Performer value of the Policy Parameters for Action Policies. 
	 *
	 * @return the <code>String</code> value of the Action Performer for Action Policies
	 */
	public String getActionPerformer() {
		return actionPerformer;
	}
	
	/**
	 * Sets the Action Performer value of the Policy Parameters for Action Policies.
	 * 
	 * @param actionPerformer the <code>String</code> format of the Action Performer
	 */
	public void setActionPerformer(String actionPerformer) {
		this.actionPerformer = actionPerformer;
	}

	/**
	 * Gets the Action Attribute value of the Policy Parameters for Action Policies. 
	 *
	 * @return the <code>String</code> value of the Action Attribute for Action Policies
	 */
	public String getActionAttribute() {
		return actionAttribute;
	}

	/**
	 * Sets the Action Attribute value of the Policy Parameters for Action Policies.
	 * 
	 * @param actionAttribute the <code>String</code> format of the Action Attribute
	 */
	public void setActionAttribute(String actionAttribute) {
		this.actionAttribute = actionAttribute;
	}
	
	/**
	 * Gets the Dynamic Rule Algorithm Label of the policy Parameters. Used in conjunction with the Label, Field1,
	 * Function, and Field2 to complete the complex and simple Rule Algorithms
	 * 
	 * @return <code>List</code> the Dynamic Rule Algorithm Label that must contain the Labels in order
	 */
	public List<String> getDynamicRuleAlgorithmLabels() {
		return dynamicRuleAlgorithmLabels;
	}

	/**
	 * Sets the Dynamic Rule Algorithm Labels used in conjunction with the Label, Field1,
	 * Function, and Field2 to complete the complex and simple Rule Algorithms
	 * 
	 * @param dynamicRuleAlgorithmLabels the <code>List</code> dynamicRuleAlgoritmLabels in order
	 */
	public void setDynamicRuleAlgorithmLabels(
			List<String> dynamicRuleAlgorithmLabels) {
		this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
	}

	/**
	 * Gets the Dynamic Rule Algorithm Function of the policy Parameters. Used in conjunction with the Label, Field1,
	 * FunctionDef, and Field2 to complete the complex and simple Rule Algorithms 
	 * 
	 * @return <code>List</code> the Dynamic Rule Algorithm Functions that must contain the values in order
	 */
	public List<String> getDynamicRuleAlgorithmFunctions() {
		return dynamicRuleAlgorithmFunctions;
	}

	/**
	 * Sets the Dynamic Rule Algorithm Functions used in conjunction with the Label, Field1,
	 * Function, and Field2 to complete the complex and simple Rule Algorithms
	 * 
	 * @param dynamicRuleAlgorithmFunctions the <code>List</code> dynamicRuleAlgorithmFunctions in order
	 */
	public void setDynamicRuleAlgorithmFunctions(List<String> dynamicRuleAlgorithmFunctions) {
		this.dynamicRuleAlgorithmFunctions = dynamicRuleAlgorithmFunctions;
	}

	/**
	 * Gets the Dynamic Rule Algorithm Field1 of the policy Parameters. Used in conjunction with the Label, Field1,
	 * Function, and Field2 to complete the complex and simple Rule Algorithms
	 * 
	 * @return <code>List</code> the Dynamic Rule Algorithm Field1 that must contain the Field1 values in order
	 */
	public List<String> getDynamicRuleAlgorithmField1() {
		return dynamicRuleAlgorithmField1;
	}

	/**
	 * Sets the Dynamic Rule Algorithm Field1 used in conjunction with the Label, Field1,
	 * Function, and Field2 to complete the complex and simple Rule Algorithms
	 * 
	 * @param dynamicRuleAlgorithmField1 the <code>List</code> dynamicRuleAlgorithmField1 in order
	 */
	public void setDynamicRuleAlgorithmField1(
			List<String> dynamicRuleAlgorithmField1) {
		this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
	}

	/**
	 * Gets the Dynamic Rule Algorithm Field2 of the policy Parameters. Used in conjunction with the Label, Field1,
	 * Operator, and Field2 to complete the complex and simple Rule Algorithms
	 * 
	 * @return <code>List</code> the Dynamic Rule Algorithm Field2 that must contain the Field2 values in order
	 */
	public List<String> getDynamicRuleAlgorithmField2() {
		return dynamicRuleAlgorithmField2;
	}

	/**
	 * Sets the Dynamic Rule Algorithm Field2 used in conjunction with the Label, Field1,
	 * Function, and Field2 to complete the complex and simple Rule Algorithms
	 * 
	 * @param dynamicRuleAlgorithmField2 the <code>List</code> dynamicRuleAlgorithmField2 in order
	 */
	public void setDynamicRuleAlgorithmField2(
			List<String> dynamicRuleAlgorithmField2) {
		this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
	}
	
	/**
	 * Gets the Priority of the Policy Parameters. 
	 * 
	 * @return priority the <code>String</code> format of the Micro Services priority
	 */
	public String getPriority() {
		return priority;
	}
	
	/**
	 * Sets the Priority of the Policy Parameters.
	 * 
	 * @param priority the <code>String</code> format of the Micro Services priority
	 */
	public void setPriority(String priority) {
		this.priority = priority;
	}

	public RuleProvider getRuleProvider() {
		return ruleProvider;
	}

	public void setRuleProvider(RuleProvider ruleProvider) {
		this.ruleProvider = ruleProvider;
	}	
	/**
	 * Sets the Guard field of the Policy Parameters. 
	 * 
	 * @param guard the <code>Boolean</code> format of the guard value
	 */
	public void setGuard(boolean guard){
		this.guard = guard;
	}
	
	/**
	 * Gets the  guard value of the Policy Parameters for Action Policies. 
	 *
	 * @return the <code>boolean</code> value of the Guard for Config Policies
	 */
	public boolean getGuard(){
		return guard;
	}
	
	/**
	 * Sets the riskType field of the Policy Parameters. 
	 * 
	 * @param guard the <code>String</code> format of the riskType value
	 */
	public void setRiskType(String riskType){
		this.riskType = riskType;
	}
	
	/**
	 * Gets the riskType value of the Policy Parameters for Config Policies. 
	 *
	 * @return the <code>String</code> value of the riskType for Config Policies
	 */
	public String getRiskType(){
		return riskType;
	}
	
	/**
	 * Sets the riskLevel field of the Policy Parameters. 
	 * 
	 * @param riskLevel the <code>String</code> format of the riskType value
	 */
	public void setRiskLevel(String riskLevel){
		this.riskLevel = riskLevel;
	}
	
	/**
	 * Gets the riskLevel value of the Policy Parameters for Config Policies. 
	 *
	 * @return the <code>String</code> value of the riskLevel for Config Policies
	 */
	public String getRiskLevel(){
		return riskLevel;
	}
	
	/**
	 * Sets the TTLDate field of the Policy Parameters. 
	 * 
	 * @param TTLDate the <code>Date</code> format of the TTLDate value
	 */
	public void setTtlDate(Date TTLDate){
		this.TTLDate = TTLDate;
	}
	
	/**
	 * Gets the TTLDate value of the Policy Parameters for Config Policies. 
	 *
	 * @return the <code>Date</code> value of the TTLDate for Config Policies
	 */
	public Date getTtlDate(){
		return TTLDate;
	}
}