Search in sources :

Example 41 with NamespaceName

use of com.yahoo.pulsar.common.naming.NamespaceName in project pulsar by yahoo.

the class NamespacesImpl method createNamespace.

@Override
public void createNamespace(String namespace) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName())).put(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 42 with NamespaceName

use of com.yahoo.pulsar.common.naming.NamespaceName 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);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 43 with NamespaceName

use of com.yahoo.pulsar.common.naming.NamespaceName 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);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 44 with NamespaceName

use of com.yahoo.pulsar.common.naming.NamespaceName 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 45 with NamespaceName

use of com.yahoo.pulsar.common.naming.NamespaceName 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)

Aggregations

NamespaceName (com.yahoo.pulsar.common.naming.NamespaceName)93 NamespaceBundle (com.yahoo.pulsar.common.naming.NamespaceBundle)41 Test (org.testng.annotations.Test)40 PulsarAdminException (com.yahoo.pulsar.client.admin.PulsarAdminException)38 RestException (com.yahoo.pulsar.broker.web.RestException)25 Policies (com.yahoo.pulsar.common.policies.data.Policies)18 ApiOperation (io.swagger.annotations.ApiOperation)17 ApiResponses (io.swagger.annotations.ApiResponses)17 Path (javax.ws.rs.Path)17 KeeperException (org.apache.zookeeper.KeeperException)17 PulsarServerException (com.yahoo.pulsar.broker.PulsarServerException)16 MockedPulsarServiceBaseTest (com.yahoo.pulsar.broker.auth.MockedPulsarServiceBaseTest)14 RetentionPolicies (com.yahoo.pulsar.common.policies.data.RetentionPolicies)14 NamespaceBundles (com.yahoo.pulsar.common.naming.NamespaceBundles)13 Field (java.lang.reflect.Field)13 URL (java.net.URL)13 WebApplicationException (javax.ws.rs.WebApplicationException)13 PersistencePolicies (com.yahoo.pulsar.common.policies.data.PersistencePolicies)12 NoNodeException (org.apache.zookeeper.KeeperException.NoNodeException)10 SubscriptionBusyException (com.yahoo.pulsar.broker.service.BrokerServiceException.SubscriptionBusyException)9