@Override public void grantPermission(String destination, String role, Set<AuthAction> actions) throws PulsarAdminException { try { DestinationName ds = DestinationName.get(destination); request(persistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions").path(role)) .post(Entity.entity(actions, MediaType.APPLICATION_JSON), ErrorData.class); } catch (Exception e) { throw getApiException(e); } }
@Override public Map<String, Set<AuthAction>> getPermissions(String destination) throws PulsarAdminException { try { DestinationName ds = DestinationName.get(destination); return request(persistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions")).get( new GenericType<Map<String, Set<AuthAction>>>() { }); } catch (Exception e) { throw getApiException(e); } }
@Override public void revokePermissions(String destination, String role) throws PulsarAdminException { try { DestinationName ds = DestinationName.get(destination); request(persistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions").path(role)) .delete(ErrorData.class); } catch (Exception e) { throw getApiException(e); } }