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.openecomp.policy.api;
23 import java.util.Date;
24 import java.util.List;
26 import java.util.UUID;
29 * <code>PolicyParameters</code> defines the Policy Parameters
30 * which are required to Create/Update a Policy.
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;
54 private boolean guard = false;
55 private String riskLevel = "5";
56 private String riskType = "defualt";
59 * Sets Config Policy Parameters.
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.
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);
86 * Sets config Firewall Policy Parameters.
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.
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);
102 * Gets the PolicyName of the Policy Parameters.
104 * @return policyName the <code>String</code> format of the Policy Name
106 public String getPolicyName() {
111 * Sets the policyName of the Policy Parameters.
113 * @param policyName the <code>String</code> format of the Policy Name
115 public void setPolicyName(String policyName) {
116 this.policyName = policyName;
120 * Gets the policy Description.
122 * @return the <code>String</code> format of the Policy Description
124 public String getPolicyDescription() {
125 return policyDescription;
129 * Sets the policy Description of the Policy Description.
131 * @param policyDescription the <code>String</code> format of the Policy Description
133 public void setPolicyDescription(String policyDescription) {
134 this.policyDescription = policyDescription;
138 * Gets the ECOMP Name value of the Policy Paramters.
140 * @return <code>String</code> format of the ECOMP Name
142 public String getEcompName() {
147 * Sets the ECOMP Name field of the Policy Parameters.
149 * @param ecompName the <code>String</code> format of the ECOMP Name
151 public void setEcompName(String ecompName) {
152 this.ecompName = ecompName;
156 * Gets the Config Name value of the Policy Parameters.
158 * @return <code>String</code> format of the Config Name
160 public String getConfigName() {
165 * Sets the Config Name field of the Policy Parameters.
167 * @param configName the <code>String</code> format of the Config Name
169 public void setConfigName(String configName) {
170 this.configName = configName;
174 * Gets the Attributes of the policy Parameters.
176 * @return <code>List</code> the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
178 public Map<AttributeType, Map<String, String>> getAttributes() {
183 * Sets the Attributes of the Policy Parameters.
185 * @param attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,value pairs corresponding to it.
187 public void setAttributes(Map<AttributeType, Map<String, String>> attributes) {
188 this.attributes = attributes;
192 * Gets the Policy Config Type value the Policy parameters.
194 * @return {@link org.openecomp.policy.api.PolicyConfigType} Enum of the Config Type
196 public PolicyConfigType getPolicyConfigType() {
197 return policyConfigType;
201 * Sets the Policy Config Type field of the policy Parameters.
203 * @param policyConfigType the {@link org.openecomp.policy.api.PolicyConfigType} Enum format of the Config Type
205 public void setPolicyConfigType(PolicyConfigType policyConfigType) {
206 setPolicyClass(PolicyClass.Config);
207 this.policyConfigType = policyConfigType;
211 * Gets the configBody value of the Policy Parameters.
213 * @return the <code>String</code> format of the Policy Body
215 public String getConfigBody() {
220 * Sets the configBody field of the Policy Parameters.
222 * @param configBody the <code>String</code> format of the Policy Body
224 public void setConfigBody(String configBody) {
225 this.configBody = configBody;
229 * Gets the config Body Type value of the Policy Parameters.
231 * @return the <code>PolicyType</code> representation of the configBodyType
233 public PolicyType getConfigBodyType() {
234 return configBodyType;
238 * Sets the configBodyType field of the Policy Parameters.
240 * @param configBodyType the <code>PolicyType</code> representation of the config BodyType
242 public void setConfigBodyType(PolicyType configBodyType) {
243 this.configBodyType = configBodyType;
247 * Gets the requestID of the Policy Parameters.
249 * @return unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
251 public UUID getRequestID() {
256 * Sets the requestID of the Policy Parameters.
258 * @param requestID unique request ID which will be passed throughout the ECOMP components to correlate logging messages.
260 public void setRequestID(UUID requestID) {
261 this.requestID = requestID;
265 * Gets the Policy Class of the Policy Parameters.
267 * @return {@link org.openecomp.policy.api.PolicyClass} of the Policy Parameters.
269 public PolicyClass getPolicyClass() {
274 * Sets the Policy Class of the Policy Parameters.
276 * @param policyClass the Enum {@link org.openecomp.policy.api.PolicyClass} to set Policy Class Type of Policy parameters.
278 public void setPolicyClass(PolicyClass policyClass) {
279 this.policyClass = policyClass;
283 * Gets the Action Performer value of the Policy Parameters for Action Policies.
285 * @return the <code>String</code> value of the Action Performer for Action Policies
287 public String getActionPerformer() {
288 return actionPerformer;
292 * Sets the Action Performer value of the Policy Parameters for Action Policies.
294 * @param actionPerformer the <code>String</code> format of the Action Performer
296 public void setActionPerformer(String actionPerformer) {
297 this.actionPerformer = actionPerformer;
301 * Gets the Action Attribute value of the Policy Parameters for Action Policies.
303 * @return the <code>String</code> value of the Action Attribute for Action Policies
305 public String getActionAttribute() {
306 return actionAttribute;
310 * Sets the Action Attribute value of the Policy Parameters for Action Policies.
312 * @param actionAttribute the <code>String</code> format of the Action Attribute
314 public void setActionAttribute(String actionAttribute) {
315 this.actionAttribute = actionAttribute;
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
322 * @return <code>List</code> the Dynamic Rule Algorithm Label that must contain the Labels in order
324 public List<String> getDynamicRuleAlgorithmLabels() {
325 return dynamicRuleAlgorithmLabels;
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
332 * @param dynamicRuleAlgorithmLabels the <code>List</code> dynamicRuleAlgoritmLabels in order
334 public void setDynamicRuleAlgorithmLabels(
335 List<String> dynamicRuleAlgorithmLabels) {
336 this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
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
343 * @return <code>List</code> the Dynamic Rule Algorithm Functions that must contain the values in order
345 public List<String> getDynamicRuleAlgorithmFunctions() {
346 return dynamicRuleAlgorithmFunctions;
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
353 * @param dynamicRuleAlgorithmFunctions the <code>List</code> dynamicRuleAlgorithmFunctions in order
355 public void setDynamicRuleAlgorithmFunctions(List<String> dynamicRuleAlgorithmFunctions) {
356 this.dynamicRuleAlgorithmFunctions = dynamicRuleAlgorithmFunctions;
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
363 * @return <code>List</code> the Dynamic Rule Algorithm Field1 that must contain the Field1 values in order
365 public List<String> getDynamicRuleAlgorithmField1() {
366 return dynamicRuleAlgorithmField1;
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
373 * @param dynamicRuleAlgorithmField1 the <code>List</code> dynamicRuleAlgorithmField1 in order
375 public void setDynamicRuleAlgorithmField1(
376 List<String> dynamicRuleAlgorithmField1) {
377 this.dynamicRuleAlgorithmField1 = dynamicRuleAlgorithmField1;
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
384 * @return <code>List</code> the Dynamic Rule Algorithm Field2 that must contain the Field2 values in order
386 public List<String> getDynamicRuleAlgorithmField2() {
387 return dynamicRuleAlgorithmField2;
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
394 * @param dynamicRuleAlgorithmField2 the <code>List</code> dynamicRuleAlgorithmField2 in order
396 public void setDynamicRuleAlgorithmField2(
397 List<String> dynamicRuleAlgorithmField2) {
398 this.dynamicRuleAlgorithmField2 = dynamicRuleAlgorithmField2;
402 * Gets the Priority of the Policy Parameters.
404 * @return priority the <code>String</code> format of the Micro Services priority
406 public String getPriority() {
411 * Sets the Priority of the Policy Parameters.
413 * @param priority the <code>String</code> format of the Micro Services priority
415 public void setPriority(String priority) {
416 this.priority = priority;
419 public RuleProvider getRuleProvider() {
423 public void setRuleProvider(RuleProvider ruleProvider) {
424 this.ruleProvider = ruleProvider;
427 * Sets the Guard field of the Policy Parameters.
429 * @param guard the <code>Boolean</code> format of the guard value
431 public void setGuard(boolean guard){
436 * Gets the guard value of the Policy Parameters for Action Policies.
438 * @return the <code>boolean</code> value of the Guard for Config Policies
440 public boolean getGuard(){
445 * Sets the riskType field of the Policy Parameters.
447 * @param guard the <code>String</code> format of the riskType value
449 public void setRiskType(String riskType){
450 this.riskType = riskType;
454 * Gets the riskType value of the Policy Parameters for Config Policies.
456 * @return the <code>String</code> value of the riskType for Config Policies
458 public String getRiskType(){
463 * Sets the riskLevel field of the Policy Parameters.
465 * @param riskLevel the <code>String</code> format of the riskType value
467 public void setRiskLevel(String riskLevel){
468 this.riskLevel = riskLevel;
472 * Gets the riskLevel value of the Policy Parameters for Config Policies.
474 * @return the <code>String</code> value of the riskLevel for Config Policies
476 public String getRiskLevel(){
481 * Sets the TTLDate field of the Policy Parameters.
483 * @param TTLDate the <code>Date</code> format of the TTLDate value
485 public void setTtlDate(Date TTLDate){
486 this.TTLDate = TTLDate;
490 * Gets the TTLDate value of the Policy Parameters for Config Policies.
492 * @return the <code>Date</code> value of the TTLDate for Config Policies
494 public Date getTtlDate(){