Make clientAuth header optional and log request
[policy/engine.git] / PolicyEngineAPI / src / main / java / org / onap / policy / api / ConfigRequestParameters.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
4  * ================================================================================
5  * Copyright (C) 2017,2019 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.onap.policy.api;
22
23 import com.google.gson.Gson;
24 import java.util.Map;
25 import java.util.UUID;
26
27 /**
28  * <code>ConfigRequestParameters</code> defines the Config Policy Request Parameters which retrieve(s) the policy from
29  * PDP if the request parameters match with any Config Policy.
30  *
31  * @version 0.1
32  */
33 public class ConfigRequestParameters {
34     private static final Gson GSON = new Gson();
35     private String policyName;
36     private String onapName;
37     private String configName;
38     private Map<String, String> configAttributes;
39     private UUID requestID;
40     private Boolean unique = false;
41
42     /**
43      * Sets the PolicyName of the Config policy which needs to be retrieved.
44      *
45      * @param policyName the <code>String</code> format of the PolicyFile Name whose configuration is required.
46      */
47     public void setPolicyName(String policyName) {
48         this.policyName = policyName;
49     }
50
51     /**
52      * Sets the ONAP Component Name of the Config policy which needs to be retrieved.
53      *
54      * @param onapName the <code>String</code> format of the onapName whose configuration is required.
55      */
56     public void setOnapName(String onapName) {
57         this.onapName = onapName;
58     }
59
60     /**
61      * Sets the ONAP Component Name of the Config policy which needs to be retrieved.
62      *
63      * @param ecompName the <code>String</code> format of the onapName whose configuration is required.
64      * @deprecated use {@link #setOnapName(String)} instead.
65      */
66     @Deprecated
67     public void setEcompName(String ecompName) {
68         this.onapName = ecompName;
69     }
70
71     /**
72      * Sets the Config Name of the Config policy which needs to be retrieved.
73      *
74      * @param configName the <code>String</code> format of the configurationName whose configuration is required.
75      */
76     public void setConfigName(String configName) {
77         this.configName = configName;
78     }
79
80     /**
81      * Sets the ConfigAttributes of the Config policy which needs to be retrieved.
82      *
83      * @param configAttributes the <code>Map</code> of <code>String,String</code> format of the configuration attributes
84      *        which are required.
85      */
86     public void setConfigAttributes(Map<String, String> configAttributes) {
87         this.configAttributes = configAttributes;
88     }
89
90     /**
91      * Sets the Request ID of the ONAP request.
92      *
93      * @param requestID unique <code>UUID</code> requestID which will be passed throughout the ONAP components to
94      *        correlate logging messages.
95      */
96     public void setRequestID(UUID requestID) {
97         this.requestID = requestID;
98     }
99
100     /**
101      * Gets the policyName of the Request Parameters.
102      *
103      * @return <code>String</code> format of the policyName.
104      */
105     public String getPolicyName() {
106         return policyName;
107     }
108
109     /**
110      * Gets the ONAP Component Name of the Request Parameters.
111      *
112      * @return <code>String</code> format of the ONAP Component Name.
113      */
114     public String getOnapName() {
115         return onapName;
116     }
117
118     /**
119      * Gets the ONAP Component Name of the Request Parameters.
120      *
121      * @return <code>String</code> format of the ONAP Component Name.
122      * @deprecated use {@link #getOnapName()} instead.
123      */
124     @Deprecated
125     public String getEcompName() {
126         return onapName;
127     }
128
129     /**
130      * Gets the Config name of the Request Parameters.
131      *
132      * @return <code>String</code> format of the Config Name.
133      */
134     public String getConfigName() {
135         return configName;
136     }
137
138     /**
139      * Gets the Config Attributes of the Request Parameters.
140      *
141      * @return <code>Map</code> of <code>String</code>,<code>String</code> format of the config Attributes.
142      */
143     public Map<String, String> getConfigAttributes() {
144         return configAttributes;
145     }
146
147     /**
148      * Gets the Request ID of the Request Paramters.
149      *
150      * @return <code>UUID</code> format of requestID.
151      */
152     public UUID getRequestID() {
153         return requestID;
154     }
155
156     /**
157      * Makes the results Unique, priority based. If set to True. Default Value is set to False.
158      *
159      * @param unique flag which is either true or false.
160      */
161     public void makeUnique(Boolean unique) {
162         this.unique = unique;
163     }
164
165     /**
166      * Gets the Unique flag value from the Config Request Parameters.
167      *
168      * @return unique flag which is either true or false.
169      */
170     public Boolean getUnique() {
171         return this.unique;
172     }
173
174     /**
175      * Used to print the input Params for getCOnfig REST call.
176      *
177      * @return JSON String of this object.
178      */
179     @Override
180     public String toString() {
181         return GSON.toJson(this);
182     }
183
184
185 }