Make clientAuth header optional and log request
[policy/engine.git] / PolicyEngineAPI / src / main / java / org / onap / policy / api / DecisionRequestParameters.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>DecisionRequestParameters</code> defines the Decision Policy Request Parameters which retrieve(s) the response
29  * from PDP if the request parameters match with any Decision Policy.
30  *
31  * @version 0.1
32  */
33 public class DecisionRequestParameters {
34     private static final Gson GSON = new Gson();
35     private String onapName;
36     private Map<String, String> decisionAttributes;
37     private UUID requestID;
38
39     /**
40      * Constructor with no Parameters
41      */
42     public DecisionRequestParameters() {
43         // Empty constructor
44     }
45
46     /**
47      * Constructor with Parameters
48      *
49      * @param onapName the <code>String</code> format of the onapName whose Decision is required.
50      * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes
51      *        that contain the ID and values.
52      * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging
53      *        messages.
54      */
55     public DecisionRequestParameters(String onapName, Map<String, String> decisionAttributes, UUID requestID) {
56         this.onapName = onapName;
57         this.decisionAttributes = decisionAttributes;
58         this.requestID = requestID;
59     }
60
61     /**
62      * Gets the onapName of the Decision Request Parameters.
63      *
64      * @return onapName the <code>String</code> format of the onapName of the Decision Request Parameters.
65      */
66     public String getOnapName() {
67         return onapName;
68     }
69
70     /**
71      * Gets the onapName of the Decision Request Parameters.
72      *
73      * @return onapName the <code>String</code> format of the onapName of the Decision Request Parameters.
74      * @deprecated use {@link #getOnapName()} instead.
75      */
76     @Deprecated
77     public String getECOMPComponentName() {
78         return onapName;
79     }
80
81     /**
82      * Sets the onapName of the Decision Request parameters.
83      *
84      * @param onapName the <code>String</code> format of the onapName whose Decision is required.
85      */
86     public void setOnapName(String onapName) {
87         this.onapName = onapName;
88     }
89
90     /**
91      * Sets the ecompComponentName of the Decision Request parameters.
92      *
93      * @param ecompName the <code>String</code> format of the onapName whose Decision is required.
94      * @deprecated use {@link #setOnapName(String)} instead.
95      */
96     @Deprecated
97     public void setECOMPComponentName(String ecompName) {
98         this.onapName = ecompName;
99     }
100
101     /**
102      * Gets the Decision Attributes from Decision Request Parameters.
103      *
104      * @return decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes
105      *         that contain the ID and values.
106      */
107     public Map<String, String> getDecisionAttributes() {
108         return decisionAttributes;
109     }
110
111     /**
112      * Sets the Decision Attributes which contain ID and values for obtaining Decision from PDP.
113      *
114      * @param decisionAttributes the <code>Map</code> of <code>String,String</code> format of the decisionAttributes
115      *        that must contain the ID and values.
116      */
117     public void setDecisionAttributes(Map<String, String> decisionAttributes) {
118         this.decisionAttributes = decisionAttributes;
119     }
120
121     /**
122      * Gets the request ID of Decision Request Parameters.
123      *
124      * @return the requestID unique request ID which will be passed throughout the ONAP components to correlate logging
125      *         messages.
126      */
127     public UUID getRequestID() {
128         return requestID;
129     }
130
131     /**
132      * Sets the ReqestID of Decision Request Parameters which will be passed around ONAP requests.
133      *
134      * @param requestID unique request ID which will be passed throughout the ONAP components to correlate logging
135      *        messages.
136      */
137     public void setRequestID(UUID requestID) {
138         this.requestID = requestID;
139     }
140
141     /**
142      * Used to print the input Params for getDecision REST call.
143      *
144      * @return JSON String of this object.
145      */
146     @Override
147     public String toString() {
148         return GSON.toJson(this);
149     }
150 }