@Description(value = "This REST API is used to append auths to a bucket for several policies.")
public Response appendBucket(final BulkPolicyQuotaRLBucketType request, final @PathParam("BUCKET_ID") String bucketID) throws ProvisionException {
checkCreate(request);
AuthIdsNoIdType authIds = request.getQuotaRLBucket();
if (authIds.getId() != null) {
if(!authIds.getId().equals(bucketID)){
throw new WebApplicationException(new ProvisionException(ApplicationCodeConstants.INVALID_XML, "Bucket ID not the same in payload as in URL:" + authIds.getId() +" >> " + bucketID));
}
}
Action appendBucket = new Action() {
protected Object doAction(Object... params) {
PolicyIdsType policies = request.getPolicies();
AuthIdsNoIdType authIds = request.getQuotaRLBucket();
if(LOG.isDebugEnabled()) {
LOG.debug("Add auths to policies:" + policies + " on bucket:" + authIds);
}
com.alu.e3.data.model.sub.QuotaRLBucket authIdsDataModel = BeanConverterUtil.toDataModel(authIds);
dataManager.appendAuthsToBucket(policies.getId(), authIds.getId(), authIdsDataModel);
return new PolicyResponse(PolicyResponse.SUCCESS, authIds.getId());
}
};
return execute(appendBucket, request);
}