Search in sources :

Example 11 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method revokePermissionsOnNamespace.

@Override
public void revokePermissionsOnNamespace(String namespace, String role) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("permissions").path(role)).delete(ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 12 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method deleteNamespace.

@Override
public void deleteNamespace(String namespace) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())).delete(ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 13 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method clearNamespaceBundleBacklog.

@Override
public void clearNamespaceBundleBacklog(String namespace, String bundle) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.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);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 14 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method setNamespaceReplicationClusters.

@Override
public void setNamespaceReplicationClusters(String namespace, List<String> clusterIds) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.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);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 15 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method clearNamespaceBacklogForSubscription.

@Override
public void clearNamespaceBacklogForSubscription(String namespace, String subscription) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.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);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Aggregations

PulsarAdminException (com.yahoo.pulsar.client.admin.PulsarAdminException)45 NamespaceName (com.yahoo.pulsar.common.naming.NamespaceName)30 Test (org.testng.annotations.Test)12 PulsarServerException (com.yahoo.pulsar.broker.PulsarServerException)7 MockedPulsarServiceBaseTest (com.yahoo.pulsar.broker.auth.MockedPulsarServiceBaseTest)7 NotFoundException (com.yahoo.pulsar.client.admin.PulsarAdminException.NotFoundException)7 NamespaceBundle (com.yahoo.pulsar.common.naming.NamespaceBundle)7 ClusterData (com.yahoo.pulsar.common.policies.data.ClusterData)7 WebApplicationException (javax.ws.rs.WebApplicationException)7 PreconditionFailedException (com.yahoo.pulsar.client.admin.PulsarAdminException.PreconditionFailedException)6 RestException (com.yahoo.pulsar.broker.web.RestException)5 ApiOperation (io.swagger.annotations.ApiOperation)5 ApiResponses (io.swagger.annotations.ApiResponses)5 Path (javax.ws.rs.Path)5 SubscriptionBusyException (com.yahoo.pulsar.broker.service.BrokerServiceException.SubscriptionBusyException)4 Consumer (com.yahoo.pulsar.client.api.Consumer)4 Producer (com.yahoo.pulsar.client.api.Producer)4 NamespaceBundles (com.yahoo.pulsar.common.naming.NamespaceBundles)4 PropertyAdmin (com.yahoo.pulsar.common.policies.data.PropertyAdmin)4 ClientErrorException (javax.ws.rs.ClientErrorException)4