@Test public void test40createTagResourceMap() { RangerTagResourceMap oldTagResourceMap = null; RangerTagResourceMap newTagResourceMap = new RangerTagResourceMap(); newTagResourceMap.setId(id); newTagResourceMap.setGuid(gId); RangerTagResourceMap finalTagResourceMap = new RangerTagResourceMap(); finalTagResourceMap.setId(id); finalTagResourceMap.setGuid(gId); finalTagResourceMap.setVersion(5L); try { Mockito.when(tagStore.getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid)).thenReturn(oldTagResourceMap); } catch (Exception e) { } try { Mockito.when(validator.preCreateTagResourceMap(tagGuid, resourceGuid)).thenReturn(newTagResourceMap); } catch (Exception e1) { } try { Mockito.when(tagStore.createTagResourceMap(newTagResourceMap)).thenReturn(finalTagResourceMap); } catch (Exception e1) { } RangerTagResourceMap result = tagREST.createTagResourceMap(tagGuid, resourceGuid, true); Assert.assertNotNull(result.getId()); Assert.assertEquals(result.getGuid(), finalTagResourceMap.getGuid()); Assert.assertEquals(result.getId(), finalTagResourceMap.getId()); Assert.assertEquals(result.getVersion(), finalTagResourceMap.getVersion()); try { Mockito.verify(tagStore).getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid); } catch (Exception e) { } try { Mockito.verify(validator).preCreateTagResourceMap(tagGuid, resourceGuid); } catch (Exception e) { } try { Mockito.verify(tagStore).createTagResourceMap(newTagResourceMap); } catch (Exception e) { } }
@POST @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") public RangerTagResourceMap createTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid, @DefaultValue("false") @QueryParam("lenient") boolean lenient) { if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } RangerTagResourceMap tagResourceMap; try { tagResourceMap = tagStore.getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid); if (tagResourceMap == null) { tagResourceMap = validator.preCreateTagResourceMap(tagGuid, resourceGuid); tagResourceMap = tagStore.createTagResourceMap(tagResourceMap); } else if (!lenient) { throw new Exception("tagResourceMap with tag-guid=" + tagGuid + " and resource-guid=" + resourceGuid + " already exists"); } } catch(Exception excp) { LOG.error("createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ") failed", excp); throw restErrorUtil.createRESTException(HttpServletResponse.SC_BAD_REQUEST, excp.getMessage(), true); } if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } return tagResourceMap; }
TagREST { @POST @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") public RangerTagResourceMap createTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid, @DefaultValue("false") @QueryParam("lenient") boolean lenient) { if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } RangerTagResourceMap tagResourceMap; try { tagResourceMap = tagStore.getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid); if (tagResourceMap == null) { tagResourceMap = validator.preCreateTagResourceMap(tagGuid, resourceGuid); tagResourceMap = tagStore.createTagResourceMap(tagResourceMap); } else if (!lenient) { throw new Exception("tagResourceMap with tag-guid=" + tagGuid + " and resource-guid=" + resourceGuid + " already exists"); } } catch(Exception excp) { LOG.error("createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ") failed", excp); throw restErrorUtil.createRESTException(HttpServletResponse.SC_BAD_REQUEST, excp.getMessage(), true); } if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } return tagResourceMap; } }
TagREST { @POST @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") public RangerTagResourceMap createTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid, @DefaultValue("false") @QueryParam("lenient") boolean lenient) { if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } RangerTagResourceMap tagResourceMap; try { tagResourceMap = tagStore.getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid); if (tagResourceMap == null) { tagResourceMap = validator.preCreateTagResourceMap(tagGuid, resourceGuid); tagResourceMap = tagStore.createTagResourceMap(tagResourceMap); } else if (!lenient) { throw new Exception("tagResourceMap with tag-guid=" + tagGuid + " and resource-guid=" + resourceGuid + " already exists"); } } catch(Exception excp) { LOG.error("createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ") failed", excp); throw restErrorUtil.createRESTException(HttpServletResponse.SC_BAD_REQUEST, excp.getMessage(), true); } if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } return tagResourceMap; } TagREST(); }
TagREST { @POST @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") public RangerTagResourceMap createTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid, @DefaultValue("false") @QueryParam("lenient") boolean lenient) { if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } RangerTagResourceMap tagResourceMap; try { tagResourceMap = tagStore.getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid); if (tagResourceMap == null) { tagResourceMap = validator.preCreateTagResourceMap(tagGuid, resourceGuid); tagResourceMap = tagStore.createTagResourceMap(tagResourceMap); } else if (!lenient) { throw new Exception("tagResourceMap with tag-guid=" + tagGuid + " and resource-guid=" + resourceGuid + " already exists"); } } catch(Exception excp) { LOG.error("createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ") failed", excp); throw restErrorUtil.createRESTException(HttpServletResponse.SC_BAD_REQUEST, excp.getMessage(), true); } if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } return tagResourceMap; } TagREST(); @PostConstruct void initStore(); @POST @Path(TagRESTConstants.TAGDEFS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef createTagDef(RangerTagDef tagDef, @DefaultValue("true") @QueryParam("updateIfExists") boolean updateIfExists); @PUT @Path(TagRESTConstants.TAGDEF_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef updateTagDef(@PathParam("id") Long id, RangerTagDef tagDef); @DELETE @Path(TagRESTConstants.TAGDEF_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagDef(@PathParam("id") Long id); @DELETE @Path(TagRESTConstants.TAGDEF_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagDefByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAGDEF_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef getTagDef(@PathParam("id") Long id); @GET @Path(TagRESTConstants.TAGDEF_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef getTagDefByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAGDEF_RESOURCE + "name/{name}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef getTagDefByName(@PathParam("name") String name); @GET @Path(TagRESTConstants.TAGDEFS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerTagDef> getAllTagDefs(); @GET @Path(TagRESTConstants.TAGTYPES_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<String> getTagTypes(); @POST @Path(TagRESTConstants.TAGS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag createTag(RangerTag tag, @DefaultValue("true") @QueryParam("updateIfExists") boolean updateIfExists); @PUT @Path(TagRESTConstants.TAG_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag updateTag(@PathParam("id") Long id, RangerTag tag); @PUT @Path(TagRESTConstants.TAG_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag updateTagByGuid(@PathParam("guid") String guid, RangerTag tag); @DELETE @Path(TagRESTConstants.TAG_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTag(@PathParam("id") Long id); @DELETE @Path(TagRESTConstants.TAG_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAG_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag getTag(@PathParam("id") Long id); @GET @Path(TagRESTConstants.TAG_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag getTagByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAGS_RESOURCE + "type/{type}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerTag> getTagsByType(@PathParam("type") String type); @GET @Path(TagRESTConstants.TAGS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerTag> getAllTags(); @POST @Path(TagRESTConstants.RESOURCES_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource createServiceResource(RangerServiceResource resource, @DefaultValue("true") @QueryParam("updateIfExists") boolean updateIfExists); @PUT @Path(TagRESTConstants.RESOURCE_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource updateServiceResource(@PathParam("id") Long id, RangerServiceResource resource); @PUT @Path(TagRESTConstants.RESOURCE_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource updateServiceResourceByGuid(@PathParam("guid") String guid, RangerServiceResource resource); @DELETE @Path(TagRESTConstants.RESOURCE_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteServiceResource(@PathParam("id") Long id); @DELETE @Path(TagRESTConstants.RESOURCE_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteServiceResourceByGuid(@PathParam("guid") String guid, @DefaultValue("false") @QueryParam("deleteReferences") boolean deleteReferences); @GET @Path(TagRESTConstants.RESOURCE_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource getServiceResource(@PathParam("id") Long id); @GET @Path(TagRESTConstants.RESOURCE_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource getServiceResourceByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.RESOURCES_RESOURCE + "service/{serviceName}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerServiceResource> getServiceResourcesByService(@PathParam("serviceName") String serviceName); @GET @Path(TagRESTConstants.RESOURCE_RESOURCE + "service/{serviceName}/signature/{resourceSignature}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource getServiceResourceByServiceAndResourceSignature(@PathParam("serviceName") String serviceName,
                                                                       @PathParam("resourceSignature") String resourceSignature); @GET @Path(TagRESTConstants.RESOURCES_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerServiceResource> getAllServiceResources(); @POST @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagResourceMap createTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid,
                                                     @DefaultValue("false") @QueryParam("lenient") boolean lenient); @DELETE @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagResourceMap(@PathParam("id") Long id); @DELETE @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagResourceMapByGuid(@PathParam("guid") String guid); @DELETE @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid); @GET @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagResourceMap getTagResourceMap(@PathParam("id") Long id); @GET @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagResourceMap getTagResourceMapByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "tag-resource-guid") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagResourceMap getTagResourceMap(@QueryParam("tagGuid") String tagGuid, @QueryParam("resourceGuid") String resourceGuid); @GET @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerTagResourceMap> getAllTagResourceMaps(); @PUT @Path(TagRESTConstants.IMPORT_SERVICETAGS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void importServiceTags(ServiceTags serviceTags); @GET @Path(TagRESTConstants.TAGS_DOWNLOAD + "{serviceName}") @Produces({ "application/json", "application/xml" }) ServiceTags getServiceTagsIfUpdated(@PathParam("serviceName") String serviceName,
                                                   @QueryParam(TagRESTConstants.LAST_KNOWN_TAG_VERSION_PARAM) Long lastKnownVersion,
                                               @DefaultValue("0") @QueryParam(TagRESTConstants.LAST_ACTIVATION_TIME) Long lastActivationTime, @QueryParam("pluginId") String pluginId,
                                               @DefaultValue("false") @QueryParam(RangerRESTUtils.REST_PARAM_SUPPORTS_TAG_DELTAS) Boolean supportsTagDeltas,
                                               @DefaultValue("") @QueryParam(RangerRESTUtils.REST_PARAM_CAPABILITIES) String pluginCapabilities,
                                               @Context HttpServletRequest request); @GET @Path(TagRESTConstants.TAGS_SECURE_DOWNLOAD + "{serviceName}") @Produces({ "application/json", "application/xml" }) ServiceTags getSecureServiceTagsIfUpdated(@PathParam("serviceName") String serviceName,
                                                   @QueryParam(TagRESTConstants.LAST_KNOWN_TAG_VERSION_PARAM) Long lastKnownVersion,
                                                     @DefaultValue("0") @QueryParam(TagRESTConstants.LAST_ACTIVATION_TIME) Long lastActivationTime, @QueryParam("pluginId") String pluginId,
                                                     @DefaultValue("false") @QueryParam(RangerRESTUtils.REST_PARAM_SUPPORTS_TAG_DELTAS) Boolean supportsTagDeltas,
                                                     @DefaultValue("") @QueryParam(RangerRESTUtils.REST_PARAM_CAPABILITIES) String pluginCapabilities,
                                                     @Context HttpServletRequest request); @DELETE @Path("/server/tagdeltas") @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagDeltas(@DefaultValue("3") @QueryParam("days") Integer olderThan, @Context HttpServletRequest request); }
TagREST { @POST @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") public RangerTagResourceMap createTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid, @DefaultValue("false") @QueryParam("lenient") boolean lenient) { if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } RangerTagResourceMap tagResourceMap; try { tagResourceMap = tagStore.getTagResourceMapForTagAndResourceGuid(tagGuid, resourceGuid); if (tagResourceMap == null) { tagResourceMap = validator.preCreateTagResourceMap(tagGuid, resourceGuid); tagResourceMap = tagStore.createTagResourceMap(tagResourceMap); } else if (!lenient) { throw new Exception("tagResourceMap with tag-guid=" + tagGuid + " and resource-guid=" + resourceGuid + " already exists"); } } catch(Exception excp) { LOG.error("createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ") failed", excp); throw restErrorUtil.createRESTException(HttpServletResponse.SC_BAD_REQUEST, excp.getMessage(), true); } if(LOG.isDebugEnabled()) { LOG.debug("==> TagREST.createTagResourceMap(" + tagGuid + ", " + resourceGuid + ", " + lenient + ")"); } return tagResourceMap; } TagREST(); @PostConstruct void initStore(); @POST @Path(TagRESTConstants.TAGDEFS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef createTagDef(RangerTagDef tagDef, @DefaultValue("true") @QueryParam("updateIfExists") boolean updateIfExists); @PUT @Path(TagRESTConstants.TAGDEF_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef updateTagDef(@PathParam("id") Long id, RangerTagDef tagDef); @DELETE @Path(TagRESTConstants.TAGDEF_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagDef(@PathParam("id") Long id); @DELETE @Path(TagRESTConstants.TAGDEF_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagDefByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAGDEF_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef getTagDef(@PathParam("id") Long id); @GET @Path(TagRESTConstants.TAGDEF_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef getTagDefByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAGDEF_RESOURCE + "name/{name}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagDef getTagDefByName(@PathParam("name") String name); @GET @Path(TagRESTConstants.TAGDEFS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerTagDef> getAllTagDefs(); @GET @Path(TagRESTConstants.TAGTYPES_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<String> getTagTypes(); @POST @Path(TagRESTConstants.TAGS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag createTag(RangerTag tag, @DefaultValue("true") @QueryParam("updateIfExists") boolean updateIfExists); @PUT @Path(TagRESTConstants.TAG_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag updateTag(@PathParam("id") Long id, RangerTag tag); @PUT @Path(TagRESTConstants.TAG_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag updateTagByGuid(@PathParam("guid") String guid, RangerTag tag); @DELETE @Path(TagRESTConstants.TAG_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTag(@PathParam("id") Long id); @DELETE @Path(TagRESTConstants.TAG_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAG_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag getTag(@PathParam("id") Long id); @GET @Path(TagRESTConstants.TAG_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTag getTagByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAGS_RESOURCE + "type/{type}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerTag> getTagsByType(@PathParam("type") String type); @GET @Path(TagRESTConstants.TAGS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerTag> getAllTags(); @POST @Path(TagRESTConstants.RESOURCES_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource createServiceResource(RangerServiceResource resource, @DefaultValue("true") @QueryParam("updateIfExists") boolean updateIfExists); @PUT @Path(TagRESTConstants.RESOURCE_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource updateServiceResource(@PathParam("id") Long id, RangerServiceResource resource); @PUT @Path(TagRESTConstants.RESOURCE_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource updateServiceResourceByGuid(@PathParam("guid") String guid, RangerServiceResource resource); @DELETE @Path(TagRESTConstants.RESOURCE_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteServiceResource(@PathParam("id") Long id); @DELETE @Path(TagRESTConstants.RESOURCE_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteServiceResourceByGuid(@PathParam("guid") String guid, @DefaultValue("false") @QueryParam("deleteReferences") boolean deleteReferences); @GET @Path(TagRESTConstants.RESOURCE_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource getServiceResource(@PathParam("id") Long id); @GET @Path(TagRESTConstants.RESOURCE_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource getServiceResourceByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.RESOURCES_RESOURCE + "service/{serviceName}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerServiceResource> getServiceResourcesByService(@PathParam("serviceName") String serviceName); @GET @Path(TagRESTConstants.RESOURCE_RESOURCE + "service/{serviceName}/signature/{resourceSignature}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerServiceResource getServiceResourceByServiceAndResourceSignature(@PathParam("serviceName") String serviceName,
                                                                       @PathParam("resourceSignature") String resourceSignature); @GET @Path(TagRESTConstants.RESOURCES_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerServiceResource> getAllServiceResources(); @POST @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagResourceMap createTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid,
                                                     @DefaultValue("false") @QueryParam("lenient") boolean lenient); @DELETE @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagResourceMap(@PathParam("id") Long id); @DELETE @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagResourceMapByGuid(@PathParam("guid") String guid); @DELETE @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagResourceMap(@QueryParam("tag-guid") String tagGuid, @QueryParam("resource-guid") String resourceGuid); @GET @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "{id}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagResourceMap getTagResourceMap(@PathParam("id") Long id); @GET @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "guid/{guid}") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagResourceMap getTagResourceMapByGuid(@PathParam("guid") String guid); @GET @Path(TagRESTConstants.TAGRESOURCEMAP_RESOURCE + "tag-resource-guid") @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") RangerTagResourceMap getTagResourceMap(@QueryParam("tagGuid") String tagGuid, @QueryParam("resourceGuid") String resourceGuid); @GET @Path(TagRESTConstants.TAGRESOURCEMAPS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") List<RangerTagResourceMap> getAllTagResourceMaps(); @PUT @Path(TagRESTConstants.IMPORT_SERVICETAGS_RESOURCE) @Produces({ "application/json", "application/xml" }) @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void importServiceTags(ServiceTags serviceTags); @GET @Path(TagRESTConstants.TAGS_DOWNLOAD + "{serviceName}") @Produces({ "application/json", "application/xml" }) ServiceTags getServiceTagsIfUpdated(@PathParam("serviceName") String serviceName,
                                                   @QueryParam(TagRESTConstants.LAST_KNOWN_TAG_VERSION_PARAM) Long lastKnownVersion,
                                               @DefaultValue("0") @QueryParam(TagRESTConstants.LAST_ACTIVATION_TIME) Long lastActivationTime, @QueryParam("pluginId") String pluginId,
                                               @DefaultValue("false") @QueryParam(RangerRESTUtils.REST_PARAM_SUPPORTS_TAG_DELTAS) Boolean supportsTagDeltas,
                                               @DefaultValue("") @QueryParam(RangerRESTUtils.REST_PARAM_CAPABILITIES) String pluginCapabilities,
                                               @Context HttpServletRequest request); @GET @Path(TagRESTConstants.TAGS_SECURE_DOWNLOAD + "{serviceName}") @Produces({ "application/json", "application/xml" }) ServiceTags getSecureServiceTagsIfUpdated(@PathParam("serviceName") String serviceName,
                                                   @QueryParam(TagRESTConstants.LAST_KNOWN_TAG_VERSION_PARAM) Long lastKnownVersion,
                                                     @DefaultValue("0") @QueryParam(TagRESTConstants.LAST_ACTIVATION_TIME) Long lastActivationTime, @QueryParam("pluginId") String pluginId,
                                                     @DefaultValue("false") @QueryParam(RangerRESTUtils.REST_PARAM_SUPPORTS_TAG_DELTAS) Boolean supportsTagDeltas,
                                                     @DefaultValue("") @QueryParam(RangerRESTUtils.REST_PARAM_CAPABILITIES) String pluginCapabilities,
                                                     @Context HttpServletRequest request); @DELETE @Path("/server/tagdeltas") @PreAuthorize("hasRole('ROLE_SYS_ADMIN')") void deleteTagDeltas(@DefaultValue("3") @QueryParam("days") Integer olderThan, @Context HttpServletRequest request); static final String Allowed_User_List_For_Tag_Download; }