Search in sources :

Example 21 with NamespaceName

use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.

the class NamespacesImpl method getMaxConsumersPerTopic.

@Override
public int getMaxConsumersPerTopic(String namespace) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns, "maxConsumersPerTopic");
        return request(path).get(Integer.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 22 with NamespaceName

use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.

the class NamespacesImpl method setBacklogQuota.

@Override
public void setBacklogQuota(String namespace, BacklogQuota backlogQuota) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns, "backlogQuota");
        request(path).post(Entity.entity(backlogQuota, MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 23 with NamespaceName

use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.

the class NamespacesImpl method deleteNamespace.

@Override
public void deleteNamespace(String namespace) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns);
        request(path).delete(ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 24 with NamespaceName

use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.

the class NamespacesImpl method setRetention.

@Override
public void setRetention(String namespace, RetentionPolicies retention) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns, "retention");
        request(path).post(Entity.entity(retention, MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 25 with NamespaceName

use of org.apache.pulsar.common.naming.NamespaceName in project incubator-pulsar by apache.

the class NamespacesImpl method setSubscriptionAuthMode.

@Override
public void setSubscriptionAuthMode(String namespace, SubscriptionAuthMode subscriptionAuthMode) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns, "subscriptionAuthMode");
        request(path).post(Entity.entity(subscriptionAuthMode, MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Aggregations

NamespaceName (org.apache.pulsar.common.naming.NamespaceName)99 WebTarget (javax.ws.rs.client.WebTarget)52 PulsarAdminException (org.apache.pulsar.client.admin.PulsarAdminException)52 Test (org.testng.annotations.Test)27 NamespaceBundle (org.apache.pulsar.common.naming.NamespaceBundle)26 List (java.util.List)15 MockedPulsarServiceBaseTest (org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)13 RestException (org.apache.pulsar.broker.web.RestException)13 TopicName (org.apache.pulsar.common.naming.TopicName)13 Field (java.lang.reflect.Field)12 URL (java.net.URL)11 NamespaceBundles (org.apache.pulsar.common.naming.NamespaceBundles)11 Policies (org.apache.pulsar.common.policies.data.Policies)10 PulsarServerException (org.apache.pulsar.broker.PulsarServerException)8 BundlesData (org.apache.pulsar.common.policies.data.BundlesData)8 KeeperException (org.apache.zookeeper.KeeperException)8 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 HashSet (java.util.HashSet)6 CompletableFuture (java.util.concurrent.CompletableFuture)6