You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by si...@apache.org on 2018/03/15 07:11:02 UTC
[incubator-pulsar] branch master updated: Prepare admin client to
support v2 api. (#1384)
This is an automated email from the ASF dual-hosted git repository.
sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new cad2039 Prepare admin client to support v2 api. (#1384)
cad2039 is described below
commit cad20399f410eb274029614e571fd543975e3656
Author: cckellogg <cc...@gmail.com>
AuthorDate: Thu Mar 15 00:10:59 2018 -0700
Prepare admin client to support v2 api. (#1384)
* Prepare admin client to support v2 api.
* Fix admin with functions.
---
.../apache/pulsar/broker/admin/AdminApiTest.java | 2 +-
.../apache/pulsar/client/admin/PulsarAdmin.java | 25 ++---
.../client/admin/internal/BrokerStatsImpl.java | 18 ++--
.../pulsar/client/admin/internal/BrokersImpl.java | 16 ++--
.../pulsar/client/admin/internal/ClustersImpl.java | 37 ++++----
.../client/admin/internal/NamespacesImpl.java | 105 +++++++++++----------
.../admin/internal/NonPersistentTopicsImpl.java | 18 ++--
.../admin/internal/PersistentTopicsImpl.java | 62 ++++++------
.../client/admin/internal/PropertiesImpl.java | 18 ++--
.../client/admin/internal/ResourceQuotasImpl.java | 14 +--
.../client/admin/PulsarAdminWithFunctions.java | 2 +-
.../client/admin/internal/FunctionsImpl.java | 2 +-
12 files changed, 166 insertions(+), 153 deletions(-)
diff --git a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java
index 90d6691..fe89a32 100644
--- a/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java
+++ b/pulsar-broker/src/test/java/org/apache/pulsar/broker/admin/AdminApiTest.java
@@ -1649,7 +1649,7 @@ public class AdminApiTest extends MockedPulsarServiceBaseTest {
pulsarClient.newConsumer().topic(topic1).subscriptionName("my-subscriber-name").subscribe();
PersistentTopicsImpl persistent = (PersistentTopicsImpl) admin.persistentTopics();
- Field field = PersistentTopicsImpl.class.getDeclaredField("persistentTopics");
+ Field field = PersistentTopicsImpl.class.getDeclaredField("adminPersistentTopics");
field.setAccessible(true);
WebTarget persistentTopics = (WebTarget) field.get(persistent);
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/PulsarAdmin.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/PulsarAdmin.java
index 547ea79..4355480 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/PulsarAdmin.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/PulsarAdmin.java
@@ -73,10 +73,12 @@ public class PulsarAdmin implements Closeable {
private final Client client;
private final URL serviceUrl;
- protected final WebTarget web;
private final Lookup lookups;
+ protected final WebTarget root;
protected final Authentication auth;
+
+
static {
/**
* The presence of slf4j-jdk14.jar, that is the jul binding for SLF4J, will force SLF4J calls to be delegated to
@@ -169,17 +171,16 @@ public class PulsarAdmin implements Closeable {
this.client = clientBuilder.build();
this.serviceUrl = serviceUrl;
- WebTarget root = client.target(serviceUrl.toString());
- web = root.path("/admin");
-
- this.clusters = new ClustersImpl(web, auth);
- this.brokers = new BrokersImpl(web, auth);
- this.brokerStats = new BrokerStatsImpl(web, auth);
- this.properties = new PropertiesImpl(web, auth);
- this.namespaces = new NamespacesImpl(web, auth);
- this.persistentTopics = new PersistentTopicsImpl(web, auth);
- this.nonPersistentTopics = new NonPersistentTopicsImpl(web, auth);
- this.resourceQuotas = new ResourceQuotasImpl(web, auth);
+ root = client.target(serviceUrl.toString());
+
+ this.clusters = new ClustersImpl(root, auth);
+ this.brokers = new BrokersImpl(root, auth);
+ this.brokerStats = new BrokerStatsImpl(root, auth);
+ this.properties = new PropertiesImpl(root, auth);
+ this.namespaces = new NamespacesImpl(root, auth);
+ this.persistentTopics = new PersistentTopicsImpl(root, auth);
+ this.nonPersistentTopics = new NonPersistentTopicsImpl(root, auth);
+ this.resourceQuotas = new ResourceQuotasImpl(root, auth);
this.lookups = new LookupImpl(root, auth, pulsarConfig.isUseTls());
}
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BrokerStatsImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BrokerStatsImpl.java
index 82e1722..6dbe20e 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BrokerStatsImpl.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BrokerStatsImpl.java
@@ -38,17 +38,17 @@ import com.google.gson.JsonObject;
*/
public class BrokerStatsImpl extends BaseResource implements BrokerStats {
- private final WebTarget brokerStats;
+ private final WebTarget adminBrokerStats;
public BrokerStatsImpl(WebTarget target, Authentication auth) {
super(auth);
- brokerStats = target.path("/broker-stats");
+ adminBrokerStats = target.path("/admin/broker-stats");
}
@Override
public JsonArray getMetrics() throws PulsarAdminException {
try {
- String json = request(brokerStats.path("/metrics")).get(String.class);
+ String json = request(adminBrokerStats.path("/metrics")).get(String.class);
return new Gson().fromJson(json, JsonArray.class);
} catch (Exception e) {
throw getApiException(e);
@@ -58,7 +58,7 @@ public class BrokerStatsImpl extends BaseResource implements BrokerStats {
@Override
public AllocatorStats getAllocatorStats(String allocatorName) throws PulsarAdminException {
try {
- return request(brokerStats.path("/allocator-stats").path(allocatorName)).get(AllocatorStats.class);
+ return request(adminBrokerStats.path("/allocator-stats").path(allocatorName)).get(AllocatorStats.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -67,7 +67,7 @@ public class BrokerStatsImpl extends BaseResource implements BrokerStats {
@Override
public JsonArray getMBeans() throws PulsarAdminException {
try {
- String json = request(brokerStats.path("/mbeans")).get(String.class);
+ String json = request(adminBrokerStats.path("/mbeans")).get(String.class);
return new Gson().fromJson(json, JsonArray.class);
} catch (Exception e) {
throw getApiException(e);
@@ -77,7 +77,7 @@ public class BrokerStatsImpl extends BaseResource implements BrokerStats {
@Override
public JsonObject getTopics() throws PulsarAdminException {
try {
- String json = request(brokerStats.path("/destinations")).get(String.class);
+ String json = request(adminBrokerStats.path("/destinations")).get(String.class);
return new Gson().fromJson(json, JsonObject.class);
} catch (Exception e) {
throw getApiException(e);
@@ -87,7 +87,7 @@ public class BrokerStatsImpl extends BaseResource implements BrokerStats {
@Override
public LoadManagerReport getLoadReport() throws PulsarAdminException {
try {
- return request(brokerStats.path("/load-report")).get(LocalBrokerData.class);
+ return request(adminBrokerStats.path("/load-report")).get(LocalBrokerData.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -96,7 +96,7 @@ public class BrokerStatsImpl extends BaseResource implements BrokerStats {
@Override
public JsonObject getPendingBookieOpsStats() throws PulsarAdminException {
try {
- String json = request(brokerStats.path("/bookieops")).get(String.class);
+ String json = request(adminBrokerStats.path("/bookieops")).get(String.class);
return new Gson().fromJson(json, JsonObject.class);
} catch (Exception e) {
throw getApiException(e);
@@ -107,7 +107,7 @@ public class BrokerStatsImpl extends BaseResource implements BrokerStats {
throws PulsarAdminException {
try {
String json = request(
- brokerStats.path("/broker-resource-availability").path(property).path(cluster).path(namespace))
+ adminBrokerStats.path("/broker-resource-availability").path(property).path(cluster).path(namespace))
.get(String.class);
return new Gson().fromJson(json, JsonObject.class);
} catch (Exception e) {
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BrokersImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BrokersImpl.java
index 096666b..f5c5b3d 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BrokersImpl.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/BrokersImpl.java
@@ -33,17 +33,17 @@ import org.apache.pulsar.common.policies.data.ErrorData;
import org.apache.pulsar.common.policies.data.NamespaceOwnershipStatus;
public class BrokersImpl extends BaseResource implements Brokers {
- private final WebTarget brokers;
+ private final WebTarget adminBrokers;
public BrokersImpl(WebTarget web, Authentication auth) {
super(auth);
- brokers = web.path("/brokers");
+ adminBrokers = web.path("/admin/brokers");
}
@Override
public List<String> getActiveBrokers(String cluster) throws PulsarAdminException {
try {
- return request(brokers.path(cluster)).get(new GenericType<List<String>>() {
+ return request(adminBrokers.path(cluster)).get(new GenericType<List<String>>() {
});
} catch (Exception e) {
throw getApiException(e);
@@ -54,7 +54,7 @@ public class BrokersImpl extends BaseResource implements Brokers {
public Map<String, NamespaceOwnershipStatus> getOwnedNamespaces(String cluster, String brokerUrl)
throws PulsarAdminException {
try {
- return request(brokers.path(cluster).path(brokerUrl).path("ownedNamespaces")).get(
+ return request(adminBrokers.path(cluster).path(brokerUrl).path("ownedNamespaces")).get(
new GenericType<Map<String, NamespaceOwnershipStatus>>() {
});
} catch (Exception e) {
@@ -65,7 +65,7 @@ public class BrokersImpl extends BaseResource implements Brokers {
@Override
public void updateDynamicConfiguration(String configName, String configValue) throws PulsarAdminException {
try {
- request(brokers.path("/configuration/").path(configName).path(configValue)).post(Entity.json(""),
+ request(adminBrokers.path("/configuration/").path(configName).path(configValue)).post(Entity.json(""),
ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -75,7 +75,7 @@ public class BrokersImpl extends BaseResource implements Brokers {
@Override
public Map<String, String> getAllDynamicConfigurations() throws PulsarAdminException {
try {
- return request(brokers.path("/configuration/").path("values")).get(new GenericType<Map<String, String>>() {
+ return request(adminBrokers.path("/configuration/").path("values")).get(new GenericType<Map<String, String>>() {
});
} catch (Exception e) {
throw getApiException(e);
@@ -85,7 +85,7 @@ public class BrokersImpl extends BaseResource implements Brokers {
@Override
public List<String> getDynamicConfigurationNames() throws PulsarAdminException {
try {
- return request(brokers.path("/configuration")).get(new GenericType<List<String>>() {
+ return request(adminBrokers.path("/configuration")).get(new GenericType<List<String>>() {
});
} catch (Exception e) {
throw getApiException(e);
@@ -95,7 +95,7 @@ public class BrokersImpl extends BaseResource implements Brokers {
@Override
public InternalConfigurationData getInternalConfigurationData() throws PulsarAdminException {
try {
- return request(brokers.path("/internal-configuration")).get(InternalConfigurationData.class);
+ return request(adminBrokers.path("/internal-configuration")).get(InternalConfigurationData.class);
} catch (Exception e) {
throw getApiException(e);
}
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/ClustersImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/ClustersImpl.java
index fcbf012..9bf8e6b 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/ClustersImpl.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/ClustersImpl.java
@@ -38,17 +38,18 @@ import org.apache.pulsar.common.policies.data.NamespaceIsolationData;
public class ClustersImpl extends BaseResource implements Clusters {
- private final WebTarget clusters;
+ private final WebTarget adminClusters;
+ //private final WebTarget clusters;
public ClustersImpl(WebTarget web, Authentication auth) {
super(auth);
- clusters = web.path("/clusters");
+ adminClusters = web.path("/admin/clusters");
}
@Override
public List<String> getClusters() throws PulsarAdminException {
try {
- return request(clusters).get(new GenericType<List<String>>() {
+ return request(adminClusters).get(new GenericType<List<String>>() {
});
} catch (Exception e) {
throw getApiException(e);
@@ -58,7 +59,7 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public ClusterData getCluster(String cluster) throws PulsarAdminException {
try {
- return request(clusters.path(cluster)).get(ClusterData.class);
+ return request(adminClusters.path(cluster)).get(ClusterData.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -67,7 +68,7 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public void createCluster(String cluster, ClusterData clusterData) throws PulsarAdminException {
try {
- request(clusters.path(cluster))
+ request(adminClusters.path(cluster))
.put(Entity.entity(clusterData, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -77,7 +78,7 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public void updateCluster(String cluster, ClusterData clusterData) throws PulsarAdminException {
try {
- request(clusters.path(cluster)).post(Entity.entity(clusterData, MediaType.APPLICATION_JSON),
+ request(adminClusters.path(cluster)).post(Entity.entity(clusterData, MediaType.APPLICATION_JSON),
ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -87,7 +88,7 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public void updatePeerClusterNames(String cluster, LinkedHashSet<String> peerClusterNames) throws PulsarAdminException {
try {
- request(clusters.path(cluster).path("peers")).post(Entity.entity(peerClusterNames, MediaType.APPLICATION_JSON),
+ request(adminClusters.path(cluster).path("peers")).post(Entity.entity(peerClusterNames, MediaType.APPLICATION_JSON),
ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -98,7 +99,7 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public Set<String> getPeerClusterNames(String cluster) throws PulsarAdminException {
try {
- return request(clusters.path(cluster).path("peers")).get(LinkedHashSet.class);
+ return request(adminClusters.path(cluster).path("peers")).get(LinkedHashSet.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -107,7 +108,7 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public void deleteCluster(String cluster) throws PulsarAdminException {
try {
- request(clusters.path(cluster)).delete(ErrorData.class);
+ request(adminClusters.path(cluster)).delete(ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -116,7 +117,7 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public Map<String, NamespaceIsolationData> getNamespaceIsolationPolicies(String cluster) throws PulsarAdminException {
try {
- return request(clusters.path(cluster).path("namespaceIsolationPolicies")).get(
+ return request(adminClusters.path(cluster).path("namespaceIsolationPolicies")).get(
new GenericType<Map<String, NamespaceIsolationData>>() {
});
} catch (Exception e) {
@@ -138,13 +139,14 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public void deleteNamespaceIsolationPolicy(String cluster, String policyName) throws PulsarAdminException {
- request(clusters.path(cluster).path("namespaceIsolationPolicies").path(policyName)).delete(ErrorData.class);
+ request(adminClusters.path(cluster)
+ .path("namespaceIsolationPolicies").path(policyName)).delete(ErrorData.class);
}
private void setNamespaceIsolationPolicy(String cluster, String policyName,
NamespaceIsolationData namespaceIsolationData) throws PulsarAdminException {
try {
- request(clusters.path(cluster).path("namespaceIsolationPolicies").path(policyName)).post(
+ request(adminClusters.path(cluster).path("namespaceIsolationPolicies").path(policyName)).post(
Entity.entity(namespaceIsolationData, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -155,7 +157,7 @@ public class ClustersImpl extends BaseResource implements Clusters {
public NamespaceIsolationData getNamespaceIsolationPolicy(String cluster, String policyName)
throws PulsarAdminException {
try {
- return request(clusters.path(cluster).path("namespaceIsolationPolicies").path(policyName)).get(
+ return request(adminClusters.path(cluster).path("namespaceIsolationPolicies").path(policyName)).get(
NamespaceIsolationData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -174,13 +176,13 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public void deleteFailureDomain(String cluster, String domainName) throws PulsarAdminException {
- request(clusters.path(cluster).path("failureDomains").path(domainName)).delete(ErrorData.class);
+ request(adminClusters.path(cluster).path("failureDomains").path(domainName)).delete(ErrorData.class);
}
@Override
public Map<String, FailureDomain> getFailureDomains(String cluster) throws PulsarAdminException {
try {
- return request(clusters.path(cluster).path("failureDomains"))
+ return request(adminClusters.path(cluster).path("failureDomains"))
.get(new GenericType<Map<String, FailureDomain>>() {
});
} catch (Exception e) {
@@ -191,7 +193,8 @@ public class ClustersImpl extends BaseResource implements Clusters {
@Override
public FailureDomain getFailureDomain(String cluster, String domainName) throws PulsarAdminException {
try {
- return request(clusters.path(cluster).path("failureDomains").path(domainName)).get(FailureDomain.class);
+ return request(adminClusters.path(cluster).path("failureDomains")
+ .path(domainName)).get(FailureDomain.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -200,7 +203,7 @@ public class ClustersImpl extends BaseResource implements Clusters {
private void setDomain(String cluster, String domainName,
FailureDomain domain) throws PulsarAdminException {
try {
- request(clusters.path(cluster).path("failureDomains").path(domainName)).post(
+ request(adminClusters.path(cluster).path("failureDomains").path(domainName)).post(
Entity.entity(domain, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java
index 6d3ff3d..06586ad 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NamespacesImpl.java
@@ -44,17 +44,17 @@ import org.apache.pulsar.common.policies.data.SubscriptionAuthMode;
public class NamespacesImpl extends BaseResource implements Namespaces {
- private final WebTarget namespaces;
+ private final WebTarget adminNamespaces;
public NamespacesImpl(WebTarget web, Authentication auth) {
super(auth);
- this.namespaces = web.path("/namespaces");
+ this.adminNamespaces = web.path("/admin/namespaces");
}
@Override
public List<String> getNamespaces(String property) throws PulsarAdminException {
try {
- return request(namespaces.path(property)).get(new GenericType<List<String>>() {
+ return request(adminNamespaces.path(property)).get(new GenericType<List<String>>() {
});
} catch (Exception e) {
throw getApiException(e);
@@ -64,7 +64,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
@Override
public List<String> getNamespaces(String property, String cluster) throws PulsarAdminException {
try {
- return request(namespaces.path(property).path(cluster)).get(new GenericType<List<String>>() {
+ return request(adminNamespaces.path(property).path(cluster)).get(new GenericType<List<String>>() {
});
} catch (Exception e) {
throw getApiException(e);
@@ -75,7 +75,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public List<String> getTopics(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- return request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ return request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("destinations")).get(new GenericType<List<String>>() {
});
} catch (Exception e) {
@@ -87,7 +87,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public Policies getPolicies(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- return request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()))
+ return request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()))
.get(Policies.class);
} catch (Exception e) {
throw getApiException(e);
@@ -103,7 +103,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void createNamespace(String namespace, BundlesData bundlesData) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()))
.put(Entity.entity(bundlesData, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -114,7 +114,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void createNamespace(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()))
.put(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -125,7 +125,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void deleteNamespace(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()))
.delete(ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -136,7 +136,8 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void deleteNamespaceBundle(String namespace, String bundleRange) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundleRange))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ .path(bundleRange))
.delete(ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -148,7 +149,8 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
try {
NamespaceName ns = NamespaceName.get(namespace);
return request(
- namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("permissions"))
+ adminNamespaces.path(ns.getProperty()).path(ns.getCluster())
+ .path(ns.getLocalName()).path("permissions"))
.get(new GenericType<Map<String, Set<AuthAction>>>() {
});
} catch (Exception e) {
@@ -161,7 +163,8 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("permissions")
+ request(adminNamespaces.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);
@@ -172,7 +175,8 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void revokePermissionsOnNamespace(String namespace, String role) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("permissions")
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ .path("permissions")
.path(role)).delete(ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -184,7 +188,8 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
try {
NamespaceName ns = NamespaceName.get(namespace);
return request(
- namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("replication"))
+ adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ .path("replication"))
.get(new GenericType<List<String>>() {
});
} catch (Exception e) {
@@ -196,7 +201,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setNamespaceReplicationClusters(String namespace, List<String> clusterIds) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("replication"))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("replication"))
.post(Entity.entity(clusterIds, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -208,7 +213,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
try {
NamespaceName ns = NamespaceName.get(namespace);
return request(
- namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("messageTTL"))
+ adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("messageTTL"))
.get(new GenericType<Integer>() {
});
@@ -221,7 +226,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setNamespaceMessageTTL(String namespace, int ttlInSeconds) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("messageTTL"))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("messageTTL"))
.post(Entity.entity(ttlInSeconds, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -233,7 +238,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("antiAffinity")).post(Entity.entity(namespaceAntiAffinityGroup, MediaType.APPLICATION_JSON),
ErrorData.class);
} catch (Exception e) {
@@ -245,7 +250,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public String getNamespaceAntiAffinityGroup(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- return request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ return request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("antiAffinity")).get(new GenericType<String>() {
});
@@ -258,7 +263,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public List<String> getAntiAffinityNamespaces(String property, String cluster, String namespaceAntiAffinityGroup)
throws PulsarAdminException {
try {
- return request(namespaces.path(cluster).path("antiAffinity").path(namespaceAntiAffinityGroup)
+ return request(adminNamespaces.path(cluster).path("antiAffinity").path(namespaceAntiAffinityGroup)
.queryParam("property", property)).get(new GenericType<List<String>>() {
});
} catch (Exception e) {
@@ -270,7 +275,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void deleteNamespaceAntiAffinityGroup(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("antiAffinity")).delete(ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -281,7 +286,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setDeduplicationStatus(String namespace, boolean enableDeduplication) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("deduplication"))
.post(Entity.entity(enableDeduplication, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
@@ -293,7 +298,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public Map<BacklogQuotaType, BacklogQuota> getBacklogQuotaMap(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- return request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ return request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("backlogQuotaMap")).get(new GenericType<Map<BacklogQuotaType, BacklogQuota>>() {
});
} catch (Exception e) {
@@ -305,7 +310,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setBacklogQuota(String namespace, BacklogQuota backlogQuota) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("backlogQuota"))
.post(Entity.entity(backlogQuota, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
@@ -317,7 +322,8 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void removeBacklogQuota(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("backlogQuota")
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ .path("backlogQuota")
.queryParam("backlogQuotaType", BacklogQuotaType.destination_storage.toString()))
.delete(ErrorData.class);
} catch (Exception e) {
@@ -329,7 +335,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setPersistence(String namespace, PersistencePolicies persistence) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("persistence"))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("persistence"))
.post(Entity.entity(persistence, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -341,7 +347,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
try {
NamespaceName ns = NamespaceName.get(namespace);
return request(
- namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("persistence"))
+ adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("persistence"))
.get(PersistencePolicies.class);
} catch (Exception e) {
throw getApiException(e);
@@ -352,7 +358,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setRetention(String namespace, RetentionPolicies retention) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("retention"))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("retention"))
.post(Entity.entity(retention, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -365,7 +371,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
try {
NamespaceName ns = NamespaceName.get(namespace);
return request(
- namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("retention"))
+ adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("retention"))
.get(RetentionPolicies.class);
} catch (Exception e) {
throw getApiException(e);
@@ -376,7 +382,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void unload(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("unload"))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("unload"))
.put(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -387,7 +393,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public String getReplicationConfigVersion(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- return request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ return request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("configversion")).get(String.class);
} catch (Exception e) {
throw getApiException(e);
@@ -398,7 +404,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void unloadNamespaceBundle(String namespace, String bundle) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
.path("unload")).put(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -410,7 +416,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
.path("split").queryParam("unload", Boolean.toString(unloadSplitBundles)))
.put(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
@@ -422,7 +428,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setDispatchRate(String namespace, DispatchRate dispatchRate) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("dispatchRate"))
.post(Entity.entity(dispatchRate, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
@@ -434,7 +440,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public DispatchRate getDispatchRate(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- return request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ return request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("dispatchRate")).get(DispatchRate.class);
} catch (Exception e) {
throw getApiException(e);
@@ -445,7 +451,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void clearNamespaceBacklog(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("clearBacklog")).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -457,7 +463,8 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("clearBacklog")
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).
+ path("clearBacklog")
.path(subscription)).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -468,7 +475,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void clearNamespaceBundleBacklog(String namespace, String bundle) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
.path("clearBacklog")).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -480,7 +487,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
.path("clearBacklog").path(subscription))
.post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
@@ -492,7 +499,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void unsubscribeNamespace(String namespace, String subscription) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("unsubscribe")
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("unsubscribe")
.path(subscription)).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -504,7 +511,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle)
.path("unsubscribe").path(subscription))
.post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
@@ -516,7 +523,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setSubscriptionAuthMode(String namespace, SubscriptionAuthMode subscriptionAuthMode) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path("subscriptionAuthMode"))
.post(Entity.entity(subscriptionAuthMode, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
@@ -528,7 +535,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setEncryptionRequiredStatus(String namespace, boolean encryptionRequired) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("encryptionRequired"))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("encryptionRequired"))
.post(Entity.entity(encryptionRequired, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -540,7 +547,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
try {
NamespaceName ns = NamespaceName.get(namespace);
return request(
- namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxProducersPerTopic"))
+ adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxProducersPerTopic"))
.get(Integer.class);
} catch (Exception e) {
throw getApiException(e);
@@ -551,7 +558,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setMaxProducersPerTopic(String namespace, int maxProducersPerTopic) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxProducersPerTopic"))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxProducersPerTopic"))
.post(Entity.entity(maxProducersPerTopic, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -563,7 +570,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
try {
NamespaceName ns = NamespaceName.get(namespace);
return request(
- namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxConsumersPerTopic"))
+ adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxConsumersPerTopic"))
.get(Integer.class);
} catch (Exception e) {
throw getApiException(e);
@@ -574,7 +581,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setMaxConsumersPerTopic(String namespace, int maxConsumersPerTopic) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxConsumersPerTopic"))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxConsumersPerTopic"))
.post(Entity.entity(maxConsumersPerTopic, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -586,7 +593,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
try {
NamespaceName ns = NamespaceName.get(namespace);
return request(
- namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxConsumersPerSubscription"))
+ adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxConsumersPerSubscription"))
.get(Integer.class);
} catch (Exception e) {
throw getApiException(e);
@@ -597,7 +604,7 @@ public class NamespacesImpl extends BaseResource implements Namespaces {
public void setMaxConsumersPerSubscription(String namespace, int maxConsumersPerSubscription) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxConsumersPerSubscription"))
+ request(adminNamespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("maxConsumersPerSubscription"))
.post(Entity.entity(maxConsumersPerSubscription, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NonPersistentTopicsImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NonPersistentTopicsImpl.java
index 48bfd09..d71a4de 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NonPersistentTopicsImpl.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/NonPersistentTopicsImpl.java
@@ -41,11 +41,11 @@ import org.apache.pulsar.common.policies.data.PersistentTopicInternalStats;
public class NonPersistentTopicsImpl extends BaseResource implements NonPersistentTopics {
- private final WebTarget nonPersistentTopics;
+ private final WebTarget adminNonPersistentTopics;
public NonPersistentTopicsImpl(WebTarget web, Authentication auth) {
super(auth);
- this.nonPersistentTopics = web.path("/non-persistent");
+ adminNonPersistentTopics = web.path("/admin/non-persistent");
}
@Override
@@ -65,7 +65,7 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
checkArgument(numPartitions > 1, "Number of partitions should be more than 1");
TopicName ds = validateTopic(topic);
return asyncPutRequest(
- nonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
+ adminNonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
Entity.entity(numPartitions, MediaType.APPLICATION_JSON));
}
@@ -85,7 +85,7 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
public CompletableFuture<PartitionedTopicMetadata> getPartitionedTopicMetadataAsync(String topic) {
TopicName ds = validateTopic(topic);
final CompletableFuture<PartitionedTopicMetadata> future = new CompletableFuture<>();
- asyncGetRequest(nonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
+ asyncGetRequest(adminNonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
new InvocationCallback<PartitionedTopicMetadata>() {
@Override
@@ -117,7 +117,7 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
public CompletableFuture<NonPersistentTopicStats> getStatsAsync(String topic) {
TopicName ds = validateTopic(topic);
final CompletableFuture<NonPersistentTopicStats> future = new CompletableFuture<>();
- asyncGetRequest(nonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("stats"),
+ asyncGetRequest(adminNonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("stats"),
new InvocationCallback<NonPersistentTopicStats>() {
@Override
@@ -149,7 +149,7 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
public CompletableFuture<PersistentTopicInternalStats> getInternalStatsAsync(String topic) {
TopicName ds = validateTopic(topic);
final CompletableFuture<PersistentTopicInternalStats> future = new CompletableFuture<>();
- asyncGetRequest(nonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("internalStats"),
+ asyncGetRequest(adminNonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("internalStats"),
new InvocationCallback<PersistentTopicInternalStats>() {
@Override
@@ -180,7 +180,7 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
@Override
public CompletableFuture<Void> unloadAsync(String topic) {
TopicName ds = validateTopic(topic);
- return asyncPutRequest(nonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("unload"),
+ return asyncPutRequest(adminNonPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("unload"),
Entity.entity("", MediaType.APPLICATION_JSON));
}
@@ -200,7 +200,7 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
public CompletableFuture<List<String>> getListInBundleAsync(String namespace, String bundleRange) {
NamespaceName ns = NamespaceName.get(namespace);
final CompletableFuture<List<String>> future = new CompletableFuture<>();
- asyncGetRequest(nonPersistentTopics.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
+ asyncGetRequest(adminNonPersistentTopics.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())
.path(bundleRange), new InvocationCallback<List<String>>() {
@Override
public void completed(List<String> response) {
@@ -230,7 +230,7 @@ public class NonPersistentTopicsImpl extends BaseResource implements NonPersiste
public CompletableFuture<List<String>> getListAsync(String namespace) {
NamespaceName ns = NamespaceName.get(namespace);
final CompletableFuture<List<String>> future = new CompletableFuture<>();
- asyncGetRequest(nonPersistentTopics.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()),
+ asyncGetRequest(adminNonPersistentTopics.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()),
new InvocationCallback<List<String>>() {
@Override
public void completed(List<String> response) {
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PersistentTopicsImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PersistentTopicsImpl.java
index fb28776..523cf53 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PersistentTopicsImpl.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PersistentTopicsImpl.java
@@ -75,11 +75,11 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
public class PersistentTopicsImpl extends BaseResource implements PersistentTopics {
- private final WebTarget persistentTopics;
+ private final WebTarget adminPersistentTopics;
private final String BATCH_HEADER = "X-Pulsar-num-batch-message";
public PersistentTopicsImpl(WebTarget web, Authentication auth) {
super(auth);
- this.persistentTopics = web.path("/persistent");
+ adminPersistentTopics = web.path("/admin/persistent");
}
@@ -87,7 +87,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public List<String> getList(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- return request(persistentTopics.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())).get(
+ return request(adminPersistentTopics.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())).get(
new GenericType<List<String>>() {
});
} catch (Exception e) {
@@ -99,7 +99,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public List<String> getPartitionedTopicList(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
- return request(persistentTopics.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("partitioned")).get(
+ return request(adminPersistentTopics.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("partitioned")).get(
new GenericType<List<String>>() {
});
} catch (Exception e) {
@@ -111,7 +111,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public Map<String, Set<AuthAction>> getPermissions(String topic) throws PulsarAdminException {
try {
TopicName ds = TopicName.get(topic);
- return request(persistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions")).get(
+ return request(adminPersistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions")).get(
new GenericType<Map<String, Set<AuthAction>>>() {
});
} catch (Exception e) {
@@ -123,7 +123,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public void grantPermission(String topic, String role, Set<AuthAction> actions) throws PulsarAdminException {
try {
TopicName ds = TopicName.get(topic);
- request(persistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions").path(role))
+ request(adminPersistentTopics.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);
@@ -134,7 +134,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public void revokePermissions(String topic, String role) throws PulsarAdminException {
try {
TopicName ds = TopicName.get(topic);
- request(persistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions").path(role))
+ request(adminPersistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions").path(role))
.delete(ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -158,7 +158,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
checkArgument(numPartitions > 1, "Number of partitions should be more than 1");
TopicName ds = validateTopic(topic);
return asyncPutRequest(
- persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
+ adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
Entity.entity(numPartitions, MediaType.APPLICATION_JSON));
}
@@ -179,7 +179,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
checkArgument(numPartitions > 1, "Number of partitions must be more than 1");
TopicName ds = validateTopic(topic);
return asyncPostRequest(
- persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
+ adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
Entity.entity(numPartitions, MediaType.APPLICATION_JSON));
}
@@ -199,7 +199,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public CompletableFuture<PartitionedTopicMetadata> getPartitionedTopicMetadataAsync(String topic) {
TopicName ds = validateTopic(topic);
final CompletableFuture<PartitionedTopicMetadata> future = new CompletableFuture<>();
- asyncGetRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
+ asyncGetRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitions"),
new InvocationCallback<PartitionedTopicMetadata>() {
@Override
@@ -230,7 +230,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
@Override
public CompletableFuture<Void> deletePartitionedTopicAsync(String topic) {
TopicName ds = validateTopic(topic);
- return asyncDeleteRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
+ return asyncDeleteRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
.path("partitions"));
}
@@ -249,7 +249,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
@Override
public CompletableFuture<Void> deleteAsync(String topic) {
TopicName ds = validateTopic(topic);
- return asyncDeleteRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()));
+ return asyncDeleteRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()));
}
@Override
@@ -267,7 +267,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
@Override
public CompletableFuture<Void> unloadAsync(String topic) {
TopicName ds = validateTopic(topic);
- return asyncPutRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("unload"),
+ return asyncPutRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("unload"),
Entity.entity("", MediaType.APPLICATION_JSON));
}
@@ -287,7 +287,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public CompletableFuture<List<String>> getSubscriptionsAsync(String topic) {
TopicName ds = validateTopic(topic);
final CompletableFuture<List<String>> future = new CompletableFuture<>();
- asyncGetRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscriptions"),
+ asyncGetRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscriptions"),
new InvocationCallback<List<String>>() {
@Override
@@ -319,7 +319,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public CompletableFuture<PersistentTopicStats> getStatsAsync(String topic) {
TopicName ds = validateTopic(topic);
final CompletableFuture<PersistentTopicStats> future = new CompletableFuture<>();
- asyncGetRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("stats"),
+ asyncGetRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("stats"),
new InvocationCallback<PersistentTopicStats>() {
@Override
@@ -351,7 +351,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public CompletableFuture<PersistentTopicInternalStats> getInternalStatsAsync(String topic) {
TopicName ds = validateTopic(topic);
final CompletableFuture<PersistentTopicInternalStats> future = new CompletableFuture<>();
- asyncGetRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("internalStats"),
+ asyncGetRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("internalStats"),
new InvocationCallback<PersistentTopicInternalStats>() {
@Override
@@ -383,7 +383,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public CompletableFuture<JsonObject> getInternalInfoAsync(String topic) {
TopicName ds = validateTopic(topic);
final CompletableFuture<JsonObject> future = new CompletableFuture<>();
- asyncGetRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("internal-info"),
+ asyncGetRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("internal-info"),
new InvocationCallback<String>() {
@Override
public void completed(String response) {
@@ -418,7 +418,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
TopicName ds = validateTopic(topic);
final CompletableFuture<PartitionedTopicStats> future = new CompletableFuture<>();
asyncGetRequest(
- persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitioned-stats"),
+ adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("partitioned-stats"),
new InvocationCallback<PartitionedTopicStats>() {
@Override
@@ -453,7 +453,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public CompletableFuture<Void> deleteSubscriptionAsync(String topic, String subName) {
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
- return asyncDeleteRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
+ return asyncDeleteRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
.path("subscription").path(encodedSubName));
}
@@ -474,7 +474,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
return asyncPostRequest(
- persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
+ adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
.path(encodedSubName).path("skip_all"), Entity.entity("", MediaType.APPLICATION_JSON));
}
@@ -495,7 +495,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
return asyncPostRequest(
- persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
+ adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
.path(encodedSubName).path("skip").path(String.valueOf(numMessages)),
Entity.entity("", MediaType.APPLICATION_JSON));
}
@@ -517,7 +517,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
return asyncPostRequest(
- persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
+ adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
.path(encodedSubName).path("expireMessages").path(String.valueOf(expireTimeInSeconds)),
Entity.entity("", MediaType.APPLICATION_JSON));
}
@@ -538,7 +538,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public CompletableFuture<Void> expireMessagesForAllSubscriptionsAsync(String topic, long expireTimeInSeconds) {
TopicName ds = validateTopic(topic);
return asyncPostRequest(
- persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("all_subscription")
+ adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("all_subscription")
.path("expireMessages").path(String.valueOf(expireTimeInSeconds)),
Entity.entity("", MediaType.APPLICATION_JSON));
}
@@ -547,7 +547,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
final CompletableFuture<List<Message<byte[]>>> future = new CompletableFuture<>();
- asyncGetRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
+ asyncGetRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
.path(encodedSubName).path("position").path(String.valueOf(messagePosition)),
new InvocationCallback<Response>() {
@@ -624,7 +624,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
try {
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subscriptionName);
- request(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
+ request(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
.path(encodedSubName)).put(Entity.entity(messageId, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -636,7 +636,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
MessageId messageId) {
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subscriptionName);
- return asyncPutRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
+ return asyncPutRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
.path("subscription").path(encodedSubName), Entity.entity(messageId, MediaType.APPLICATION_JSON));
}
@@ -646,7 +646,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
request(
- persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
+ adminPersistentTopics.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) {
@@ -659,7 +659,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
return asyncPostRequest(
- persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
+ adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
.path(encodedSubName).path("resetcursor").path(String.valueOf(timestamp)),
Entity.entity("", MediaType.APPLICATION_JSON));
}
@@ -669,7 +669,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
try {
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
- request(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
+ request(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription")
.path(encodedSubName).path("resetcursor")).post(Entity.entity(messageId, MediaType.APPLICATION_JSON),
ErrorData.class);
} catch (Exception e) {
@@ -681,7 +681,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
public CompletableFuture<Void> resetCursorAsync(String topic, String subName, MessageId messageId) {
TopicName ds = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
- return asyncPostRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
+ return asyncPostRequest(adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
.path("subscription").path(encodedSubName).path("resetcursor"),
Entity.entity(messageId, MediaType.APPLICATION_JSON));
}
@@ -692,7 +692,7 @@ public class PersistentTopicsImpl extends BaseResource implements PersistentTopi
final CompletableFuture<MessageId> future = new CompletableFuture<>();
try {
- WebTarget target = persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
+ WebTarget target = adminPersistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName())
.path("terminate");
request(target).async().post(Entity.entity("", MediaType.APPLICATION_JSON),
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PropertiesImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PropertiesImpl.java
index bea1411..1bfab3c 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PropertiesImpl.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/PropertiesImpl.java
@@ -32,17 +32,17 @@ import org.apache.pulsar.common.policies.data.ErrorData;
import org.apache.pulsar.common.policies.data.PropertyAdmin;
public class PropertiesImpl extends BaseResource implements Properties {
- private final WebTarget properties;
+ private final WebTarget adminProperties;
public PropertiesImpl(WebTarget web, Authentication auth) {
super(auth);
- properties = web.path("/properties");
+ adminProperties = web.path("/admin/properties");
}
@Override
public List<String> getProperties() throws PulsarAdminException {
try {
- return request(properties).get(new GenericType<List<String>>() {
+ return request(adminProperties).get(new GenericType<List<String>>() {
});
} catch (Exception e) {
throw getApiException(e);
@@ -52,7 +52,7 @@ public class PropertiesImpl extends BaseResource implements Properties {
@Override
public PropertyAdmin getPropertyAdmin(String property) throws PulsarAdminException {
try {
- return request(properties.path(property)).get(PropertyAdmin.class);
+ return request(adminProperties.path(property)).get(PropertyAdmin.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -61,7 +61,8 @@ public class PropertiesImpl extends BaseResource implements Properties {
@Override
public void createProperty(String property, PropertyAdmin config) throws PulsarAdminException {
try {
- request(properties.path(property)).put(Entity.entity(config, MediaType.APPLICATION_JSON), ErrorData.class);
+ request(adminProperties.path(property))
+ .put(Entity.entity(config, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -70,7 +71,8 @@ public class PropertiesImpl extends BaseResource implements Properties {
@Override
public void updateProperty(String property, PropertyAdmin config) throws PulsarAdminException {
try {
- request(properties.path(property)).post(Entity.entity(config, MediaType.APPLICATION_JSON), ErrorData.class);
+ request(adminProperties.path(property))
+ .post(Entity.entity(config, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -79,13 +81,13 @@ public class PropertiesImpl extends BaseResource implements Properties {
@Override
public void deleteProperty(String property) throws PulsarAdminException {
try {
- request(properties.path(property)).delete(ErrorData.class);
+ request(adminProperties.path(property)).delete(ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
public WebTarget getWebTarget() {
- return properties;
+ return adminProperties;
}
}
diff --git a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/ResourceQuotasImpl.java b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/ResourceQuotasImpl.java
index f75afb3..bd53694 100644
--- a/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/ResourceQuotasImpl.java
+++ b/pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/ResourceQuotasImpl.java
@@ -31,16 +31,16 @@ import org.apache.pulsar.common.policies.data.ResourceQuota;
public class ResourceQuotasImpl extends BaseResource implements ResourceQuotas {
- private final WebTarget quotas;
+ private final WebTarget adminQuotas;
public ResourceQuotasImpl(WebTarget web, Authentication auth) {
super(auth);
- this.quotas = web.path("/resource-quotas");
+ adminQuotas = web.path("/admin/resource-quotas");
}
public ResourceQuota getDefaultResourceQuota() throws PulsarAdminException {
try {
- return request(quotas).get(ResourceQuota.class);
+ return request(adminQuotas).get(ResourceQuota.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -48,7 +48,7 @@ public class ResourceQuotasImpl extends BaseResource implements ResourceQuotas {
public void setDefaultResourceQuota(ResourceQuota quota) throws PulsarAdminException {
try {
- request(quotas).post(Entity.entity(quota, MediaType.APPLICATION_JSON), ErrorData.class);
+ request(adminQuotas).post(Entity.entity(quota, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
@@ -58,7 +58,7 @@ public class ResourceQuotasImpl extends BaseResource implements ResourceQuotas {
try {
NamespaceName ns = NamespaceName.get(namespace);
return request(
- quotas.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle))
+ adminQuotas.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle))
.get(ResourceQuota.class);
} catch (Exception e) {
throw getApiException(e);
@@ -70,7 +70,7 @@ public class ResourceQuotasImpl extends BaseResource implements ResourceQuotas {
try {
NamespaceName ns = NamespaceName.get(namespace);
request(
- quotas.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle))
+ adminQuotas.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle))
.post(Entity.entity(quota, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
@@ -81,7 +81,7 @@ public class ResourceQuotasImpl extends BaseResource implements ResourceQuotas {
try {
NamespaceName ns = NamespaceName.get(namespace);
request(
- quotas.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle))
+ adminQuotas.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle))
.delete();
} catch (Exception e) {
throw getApiException(e);
diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/client/admin/PulsarAdminWithFunctions.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/client/admin/PulsarAdminWithFunctions.java
index 29b767f..5c1a805 100644
--- a/pulsar-client-tools/src/main/java/org/apache/pulsar/client/admin/PulsarAdminWithFunctions.java
+++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/client/admin/PulsarAdminWithFunctions.java
@@ -49,7 +49,7 @@ public class PulsarAdminWithFunctions extends PulsarAdmin {
*/
public PulsarAdminWithFunctions(URL serviceUrl, ClientConfigurationData pulsarConfig) throws PulsarClientException {
super(serviceUrl, pulsarConfig);
- this.functions = new FunctionsImpl(web, auth);
+ this.functions = new FunctionsImpl(root, auth);
this.clientConf = pulsarConfig;
}
diff --git a/pulsar-client-tools/src/main/java/org/apache/pulsar/client/admin/internal/FunctionsImpl.java b/pulsar-client-tools/src/main/java/org/apache/pulsar/client/admin/internal/FunctionsImpl.java
index ae21694..f184ea2 100644
--- a/pulsar-client-tools/src/main/java/org/apache/pulsar/client/admin/internal/FunctionsImpl.java
+++ b/pulsar-client-tools/src/main/java/org/apache/pulsar/client/admin/internal/FunctionsImpl.java
@@ -46,7 +46,7 @@ public class FunctionsImpl extends BaseResource implements Functions {
public FunctionsImpl(WebTarget web, Authentication auth) {
super(auth);
- this.functions = web.path("/functions");
+ this.functions = web.path("/admin/functions");
}
@Override
--
To stop receiving notification emails like this one, please contact
sijie@apache.org.