use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.
the class NamespacesImpl method grantPermissionOnNamespace.
@Override
public void grantPermissionOnNamespace(String namespace, String role, Set<AuthAction> actions) throws PulsarAdminException {
try {
NamespaceName ns = new NamespaceName(namespace);
request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("permissions").path(role)).post(Entity.entity(actions, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.
the class PersistentTopicsImpl method grantPermission.
@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);
}
}
use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.
the class PersistentTopicsImpl method revokePermissions.
@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);
}
}
use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.
the class PersistentTopicsImpl method resetCursor.
@Override
public void resetCursor(String destination, String subName, long timestamp) throws PulsarAdminException {
try {
DestinationName ds = validateTopic(destination);
String encodedSubName = Codec.encode(subName);
request(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription").path(encodedSubName).path("resetcursor").path(String.valueOf(timestamp))).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.
the class NamespacesImpl method createNamespace.
@Override
public void createNamespace(String namespace, BundlesData bundlesData) throws PulsarAdminException {
try {
NamespaceName ns = new NamespaceName(namespace);
request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())).put(Entity.entity(bundlesData, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
Aggregations