Skip to content

Commit

Permalink
https://github.com/wso2/product-apim/issues/10943
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarangan0219 committed Apr 11, 2021
1 parent a718033 commit d1b45fc
Showing 1 changed file with 41 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class ThrottlingApiServiceImpl implements ThrottlingApiService {
/**
* Retrieves all Advanced level policies
*
* @param accept Accept header value
* @param accept Accept header value
* @return All matched Advanced Throttle policies to the given request
*/
@Override
Expand Down Expand Up @@ -96,7 +96,7 @@ public Response throttlingPoliciesAdvancedGet(String accept, MessageContext mess
*/
@Override
public Response throttlingPoliciesAdvancedPost(String contentType, AdvancedThrottlePolicyDTO body,
MessageContext messageContext) throws APIManagementException {
MessageContext messageContext) throws APIManagementException {

RestApiAdminUtils.validateThrottlePolicyNameProperty(body.getPolicyName());

Expand Down Expand Up @@ -133,7 +133,8 @@ public Response throttlingPoliciesAdvancedPost(String contentType, AdvancedThrot

/**
* Validate whether the limiting options are greater than 1 or not
* @param policy Policy
*
* @param policy Policy
*/
public void validateQuotaPolicy(Policy policy) throws APIManagementException {
String apiPolicyName = policy.getPolicyName();
Expand Down Expand Up @@ -165,7 +166,7 @@ public void validateQuotaPolicy(Policy policy) throws APIManagementException {
/**
* Get a specific Advanced Level Policy
*
* @param policyId uuid of the policy
* @param policyId uuid of the policy
* @return Required policy specified by name
*/
@Override
Expand Down Expand Up @@ -195,14 +196,14 @@ public Response throttlingPoliciesAdvancedPolicyIdGet(String policyId, MessageCo
/**
* Updates a given Advanced level policy specified by uuid
*
* @param policyId uuid of the policy
* @param body DTO of policy to be updated
* @param contentType Content-Type header
* @param policyId uuid of the policy
* @param body DTO of policy to be updated
* @param contentType Content-Type header
* @return Updated policy
*/
@Override
public Response throttlingPoliciesAdvancedPolicyIdPut(String policyId, String contentType,
AdvancedThrottlePolicyDTO body, MessageContext messageContext) {
AdvancedThrottlePolicyDTO body, MessageContext messageContext) {
try {
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
String username = RestApiCommonUtil.getLoggedInUsername();
Expand Down Expand Up @@ -241,7 +242,7 @@ public Response throttlingPoliciesAdvancedPolicyIdPut(String policyId, String co
/**
* Delete an Advanced level policy specified by uuid
*
* @param policyId uuid of the policy
* @param policyId uuid of the policy
* @return 200 OK response if successfully deleted the policy
*/
@Override
Expand Down Expand Up @@ -277,7 +278,7 @@ public Response throttlingPoliciesAdvancedPolicyIdDelete(String policyId, Messag
/**
* Retrieves all Application Throttle Policies
*
* @param accept Accept header value
* @param accept Accept header value
* @return Retrieves all Application Throttle Policies
*/
@Override
Expand Down Expand Up @@ -352,7 +353,7 @@ public Response throttlingPoliciesApplicationPost(String contentType, Applicatio
/**
* Get a specific Application Policy by its uuid
*
* @param policyId uuid of the policy
* @param policyId uuid of the policy
* @return Matched Application Throttle Policy by the given name
*/
@Override
Expand Down Expand Up @@ -383,14 +384,14 @@ public Response throttlingPoliciesApplicationPolicyIdGet(String policyId, Messag
/**
* Updates a given Application level policy specified by uuid
*
* @param policyId uuid of the policy
* @param body DTO of policy to be updated
* @param contentType Content-Type header
* @param policyId uuid of the policy
* @param body DTO of policy to be updated
* @param contentType Content-Type header
* @return Updated policy
*/
@Override
public Response throttlingPoliciesApplicationPolicyIdPut(String policyId, String contentType,
ApplicationThrottlePolicyDTO body, MessageContext messageContext) {
ApplicationThrottlePolicyDTO body, MessageContext messageContext) {
try {
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
String username = RestApiCommonUtil.getLoggedInUsername();
Expand Down Expand Up @@ -428,7 +429,7 @@ public Response throttlingPoliciesApplicationPolicyIdPut(String policyId, String
/**
* Delete an Application level policy specified by uuid
*
* @param policyId uuid of the policy
* @param policyId uuid of the policy
* @return 200 OK response if successfully deleted the policy
*/
@Override
Expand Down Expand Up @@ -464,7 +465,7 @@ public Response throttlingPoliciesApplicationPolicyIdDelete(String policyId, Mes
/**
* Retrieves all Subscription level policies
*
* @param accept Accept header value
* @param accept Accept header value
* @return All matched Subscription Throttle policies to the given request
*/
@Override
Expand Down Expand Up @@ -496,7 +497,7 @@ public Response throttlingPoliciesSubscriptionGet(String accept, MessageContext
*/
@Override
public Response throttlingPoliciesSubscriptionPost(String contentType, SubscriptionThrottlePolicyDTO body,
MessageContext messageContext) throws APIManagementException {
MessageContext messageContext) throws APIManagementException {

RestApiAdminUtils.validateThrottlePolicyNameProperty(body.getPolicyName());

Expand Down Expand Up @@ -605,7 +606,7 @@ private void setPolicyPermissionsToDTO(SubscriptionThrottlePolicyDTO policyDTO)
/**
* Get a specific Subscription Policy by its uuid
*
* @param policyId uuid of the policy
* @param policyId uuid of the policy
* @return Matched Subscription Throttle Policy by the given name
*/
@Override
Expand Down Expand Up @@ -640,14 +641,14 @@ public Response throttlingPoliciesSubscriptionPolicyIdGet(String policyId, Messa
/**
* Updates a given Subscription level policy specified by uuid
*
* @param policyId u
* @param body DTO of policy to be updated
* @param contentType Content-Type header
* @param policyId u
* @param body DTO of policy to be updated
* @param contentType Content-Type header
* @return Updated policy
*/
@Override
public Response throttlingPoliciesSubscriptionPolicyIdPut(String policyId, String contentType,
SubscriptionThrottlePolicyDTO body, MessageContext messageContext) throws APIManagementException{
SubscriptionThrottlePolicyDTO body, MessageContext messageContext) throws APIManagementException {
try {
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
String username = RestApiCommonUtil.getLoggedInUsername();
Expand Down Expand Up @@ -697,7 +698,7 @@ public Response throttlingPoliciesSubscriptionPolicyIdPut(String policyId, Strin
/**
* Delete a Subscription level policy specified by uuid
*
* @param policyId uuid of the policyu
* @param policyId uuid of the policyu
* @return 200 OK response if successfully deleted the policy
*/
@Override
Expand Down Expand Up @@ -734,7 +735,7 @@ public Response throttlingPoliciesSubscriptionPolicyIdDelete(String policyId, Me
/**
* Retrieves all Global level policies
*
* @param accept Accept header value
* @param accept Accept header value
* @return All matched Global Throttle policies to the given request
*/
@Override
Expand Down Expand Up @@ -770,7 +771,7 @@ public Response throttlingPoliciesCustomGet(String accept, MessageContext messag
*/
@Override
public Response throttlingPoliciesCustomPost(String contentType, CustomRuleDTO body, MessageContext messageContext)
throws APIManagementException {
throws APIManagementException {

RestApiAdminUtils
.validateCustomRuleRequiredProperties(body, (String) messageContext.get(Message.HTTP_REQUEST_METHOD));
Expand Down Expand Up @@ -813,7 +814,7 @@ public Response throttlingPoliciesCustomPost(String contentType, CustomRuleDTO b
/**
* Get a specific custom rule by its name
*
* @param ruleId uuid of the policy
* @param ruleId uuid of the policy
* @return Matched Global Throttle Policy by the given name
*/
@Override
Expand Down Expand Up @@ -846,9 +847,9 @@ public Response throttlingPoliciesCustomRuleIdGet(String ruleId, MessageContext
/**
* Updates a given Global level policy/custom rule specified by uuid
*
* @param ruleId uuid of the policy
* @param body DTO of policy to be updated
* @param contentType Content-Type header
* @param ruleId uuid of the policy
* @param body DTO of policy to be updated
* @param contentType Content-Type header
* @return Updated policy
*/
@Override
Expand Down Expand Up @@ -897,11 +898,11 @@ public Response throttlingPoliciesCustomRuleIdPut(String ruleId, String contentT
/**
* Delete a Global level policy/custom rule specified by uuid
*
* @param ruleId uuid of the policy
* @param ruleId uuid of the policy
* @return 200 OK response if successfully deleted the policy
*/
@Override
public Response throttlingPoliciesCustomRuleIdDelete(String ruleId, MessageContext messageContext) {
public Response throttlingPoliciesCustomRuleIdDelete(String ruleId, MessageContext messageContext) {
try {
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();

Expand Down Expand Up @@ -931,7 +932,7 @@ public Response throttlingPoliciesCustomRuleIdDelete(String ruleId, MessageCont
/**
* Retrieves all Block Conditions
*
* @param accept Accept header value
* @param accept Accept header value
* @return All matched block conditions to the given request
*/
@Override
Expand All @@ -958,7 +959,7 @@ public Response throttlingDenyPoliciesGet(String accept, MessageContext messageC
*/
@Override
public Response throttlingDenyPoliciesPost(String contentType, BlockingConditionDTO body,
MessageContext messageContext) {
MessageContext messageContext) {
try {
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
//Add the block condition. It will throw BlockConditionAlreadyExistsException if the condition already
Expand Down Expand Up @@ -1012,7 +1013,7 @@ public Response throttlingDenyPoliciesPost(String contentType, BlockingCondition
/**
* Get a specific Block condition by its id
*
* @param conditionId Id of the block condition
* @param conditionId Id of the block condition
* @return Matched block condition for the given Id
*/
@Override
Expand Down Expand Up @@ -1045,7 +1046,7 @@ public Response throttlingDenyPolicyConditionIdGet(String conditionId, MessageCo
/**
* Delete a block condition specified by the condition Id
*
* @param conditionId Id of the block condition
* @param conditionId Id of the block condition
* @return 200 OK response if successfully deleted the block condition
*/
@Override
Expand Down Expand Up @@ -1075,14 +1076,14 @@ public Response throttlingDenyPolicyConditionIdDelete(String conditionId, Messag
/**
* Updates an existing condition status of a blocking condition
*
* @param conditionId Id of the block condition
* @param body content to update
* @param contentType Content-Type header
* @param conditionId Id of the block condition
* @param body content to update
* @param contentType Content-Type header
* @return 200 response if successful
*/
@Override
public Response throttlingDenyPolicyConditionIdPatch(String conditionId, String contentType,
BlockingConditionStatusDTO body, MessageContext messageContext) {
BlockingConditionStatusDTO body, MessageContext messageContext) {
try {
APIProvider apiProvider = RestApiCommonUtil.getLoggedInUserProvider();
String username = RestApiCommonUtil.getLoggedInUsername();
Expand Down

0 comments on commit d1b45fc

Please sign in to comment.