use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.
the class BrokerStatsImpl method getBrokerResourceAvailability.
public JsonObject getBrokerResourceAvailability(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
WebTarget admin = ns.isV2() ? adminV2BrokerStats : adminBrokerStats;
String json = request(admin.path("/broker-resource-availability").path(ns.toString())).get(String.class);
return new Gson().fromJson(json, JsonObject.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.
the class NamespacesImpl method setMaxProducersPerTopic.
@Override
public void setMaxProducersPerTopic(String namespace, int maxProducersPerTopic) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
WebTarget path = namespacePath(ns, "maxProducersPerTopic");
request(path).post(Entity.entity(maxProducersPerTopic, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.
the class NamespacesImpl method getMaxProducersPerTopic.
@Override
public int getMaxProducersPerTopic(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
WebTarget path = namespacePath(ns, "maxProducersPerTopic");
return request(path).get(Integer.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.
the class NamespacesImpl method createNamespace.
@Override
public void createNamespace(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
WebTarget path = namespacePath(ns);
request(path).put(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.
the class NamespacesImpl method grantPermissionOnNamespace.
@Override
public void grantPermissionOnNamespace(String namespace, String role, Set<AuthAction> actions) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
WebTarget path = namespacePath(ns, "permissions", role);
request(path).post(Entity.entity(actions, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
Aggregations