@@ -3761,24 +3761,26 @@ public ResponseEntity<List<ServiceDeleteResponse>> deleteClusterServices(@PathPa
37613761 @ GET
37623762 @ Path ("/policies/guid/{guid}" )
37633763 @ Produces ({ "application/json" , "application/xml" })
3764- public RangerPolicy getPolicyByGUIDAndServiceName (@ PathParam ("guid" ) String guid , @ DefaultValue ("" ) @ QueryParam ("serviceName" ) String serviceName ) {
3764+ public RangerPolicy getPolicyByGUIDAndServiceNameAndZoneName (@ PathParam ("guid" ) String guid ,
3765+ @ DefaultValue ("" ) @ QueryParam ("serviceName" ) String serviceName ,
3766+ @ DefaultValue ("" ) @ QueryParam ("zoneName" ) String zoneName ) {
37653767 if (LOG .isDebugEnabled ()) {
3766- LOG .debug ("==> ServiceREST.getPolicyByGUIDAndServiceName (" + guid + ", " + serviceName + ")" );
3768+ LOG .debug ("==> ServiceREST.getPolicyByGUIDAndServiceNameAndZoneName (" + guid + ", " + serviceName + ", " + zoneName + ")" );
37673769 }
37683770 RangerPolicy ret = null ;
37693771 RangerPerfTracer perf = null ;
37703772 try {
37713773 if (RangerPerfTracer .isPerfTraceEnabled (PERF_LOG )) {
3772- perf = RangerPerfTracer .getPerfTracer (PERF_LOG , "ServiceREST.getPolicyByGUIDAndServiceName (policyGUID=" + guid + ", serviceName=" + serviceName + ")" );
3774+ perf = RangerPerfTracer .getPerfTracer (PERF_LOG , "ServiceREST.getPolicyByGUIDAndServiceNameAndZoneName (policyGUID=" + guid + ", serviceName=" + serviceName + ", zoneName=" + zoneName + ")" );
37733775 }
3774- ret = svcStore .getPolicy (guid , serviceName );
3776+ ret = svcStore .getPolicy (guid , serviceName , zoneName );
37753777 if (ret != null ) {
37763778 ensureAdminAndAuditAccess (ret );
37773779 }
37783780 } catch (WebApplicationException excp ) {
37793781 throw excp ;
37803782 } catch (Throwable excp ) {
3781- LOG .error ("getPolicyByGUIDAndServiceName (" + guid + "," + serviceName + ") failed" , excp );
3783+ LOG .error ("getPolicyByGUIDAndServiceNameAndZoneName (" + guid + "," + serviceName + ", " + zoneName + ") failed" , excp );
37823784 throw restErrorUtil .createRESTException (excp .getMessage ());
37833785 } finally {
37843786 RangerPerfTracer .log (perf );
@@ -3787,38 +3789,40 @@ public RangerPolicy getPolicyByGUIDAndServiceName(@PathParam("guid") String guid
37873789 throw restErrorUtil .createRESTException (HttpServletResponse .SC_NOT_FOUND , "Not found" , true );
37883790 }
37893791 if (LOG .isDebugEnabled ()) {
3790- LOG .debug ("<== ServiceREST.getPolicyByGUIDAndServiceName (" + guid + ", " + serviceName + "): " + ret );
3792+ LOG .debug ("<== ServiceREST.getPolicyByGUIDAndServiceNameAndZoneName (" + guid + ", " + serviceName + ", " + zoneName + "): " + ret );
37913793 }
37923794 return ret ;
37933795 }
37943796
37953797 @ DELETE
37963798 @ Path ("/policies/guid/{guid}" )
37973799 @ Produces ({ "application/json" , "application/xml" })
3798- public void deletePolicyByGUIDAndServiceName (@ PathParam ("guid" ) String guid , @ DefaultValue ("" ) @ QueryParam ("serviceName" ) String serviceName ) {
3800+ public void deletePolicyByGUIDAndServiceNameAndZoneName (@ PathParam ("guid" ) String guid ,
3801+ @ DefaultValue ("" ) @ QueryParam ("serviceName" ) String serviceName ,
3802+ @ DefaultValue ("" ) @ QueryParam ("zoneName" ) String zoneName ) {
37993803 if (LOG .isDebugEnabled ()) {
3800- LOG .debug ("==> ServiceREST.deletePolicyByGUIDAndServiceName (" + guid + ", " + serviceName + ")" );
3804+ LOG .debug ("==> ServiceREST.deletePolicyByGUIDAndServiceNameAndZoneName (" + guid + ", " + serviceName + ", " + zoneName + ")" );
38013805 }
38023806 RangerPolicy ret = null ;
38033807 RangerPerfTracer perf = null ;
38043808 try {
38053809 if (RangerPerfTracer .isPerfTraceEnabled (PERF_LOG )) {
3806- perf = RangerPerfTracer .getPerfTracer (PERF_LOG , "ServiceREST.deletePolicyByGUIDAndServiceName (policyGUID=" + guid + ", serviceName=" + serviceName + ")" );
3810+ perf = RangerPerfTracer .getPerfTracer (PERF_LOG , "ServiceREST.deletePolicyByGUIDAndServiceNameAndZoneName (policyGUID=" + guid + ", serviceName=" + serviceName + ", zoneName=" + zoneName + ")" );
38073811 }
3808- ret = getPolicyByGUIDAndServiceName (guid , serviceName );
3812+ ret = getPolicyByGUIDAndServiceNameAndZoneName (guid , serviceName , zoneName );
38093813 if (ret != null ) {
38103814 deletePolicy (ret .getId ());
38113815 }
38123816 } catch (WebApplicationException excp ) {
38133817 throw excp ;
38143818 } catch (Throwable excp ) {
3815- LOG .error ("deletePolicyByGUIDAndServiceName (" + guid + "," + serviceName + ") failed" , excp );
3819+ LOG .error ("deletePolicyByGUIDAndServiceNameAndZoneName (" + guid + "," + serviceName + ", " + zoneName + ") failed" , excp );
38163820 throw restErrorUtil .createRESTException (excp .getMessage ());
38173821 } finally {
38183822 RangerPerfTracer .log (perf );
38193823 }
38203824 if (LOG .isDebugEnabled ()) {
3821- LOG .debug ("<== ServiceREST.deletePolicyByGUIDAndServiceName (" + guid + ", " + serviceName + ")" );
3825+ LOG .debug ("<== ServiceREST.deletePolicyByGUIDAndServiceNameAndZoneName (" + guid + ", " + serviceName + ", " + zoneName + ")" );
38223826 }
38233827 }
38243828
0 commit comments