All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.pulsar.client.admin.Clusters Maven / Gradle / Ivy

There is a newer version: 1.12.0
Show newest version
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
package org.apache.pulsar.client.admin;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import org.apache.pulsar.client.admin.PulsarAdminException.ConflictException;
import org.apache.pulsar.client.admin.PulsarAdminException.NotAuthorizedException;
import org.apache.pulsar.client.admin.PulsarAdminException.NotFoundException;
import org.apache.pulsar.client.admin.PulsarAdminException.PreconditionFailedException;
import org.apache.pulsar.common.policies.data.BrokerNamespaceIsolationData;
import org.apache.pulsar.common.policies.data.ClusterData;
import org.apache.pulsar.common.policies.data.FailureDomain;
import org.apache.pulsar.common.policies.data.NamespaceIsolationData;

/**
 * Admin interface for clusters management.
 */
public interface Clusters {
    /**
     * Get the list of clusters.
     * 

* Get the list of all the Pulsar clusters. *

* Response Example: * *

     * ["c1", "c2", "c3"]
     * 
* * @throws NotAuthorizedException * Don't have admin permission * @throws PulsarAdminException * Unexpected error */ List getClusters() throws PulsarAdminException; /** * Get the list of clusters asynchronously. *

* Get the list of all the Pulsar clusters. *

* Response Example: * *

     * ["c1", "c2", "c3"]
     * 
* */ CompletableFuture> getClustersAsync(); /** * Get the configuration data for the specified cluster. *

* Response Example: * *

     * { serviceUrl : "http://my-broker.example.com:8080/" }
     * 
* * @param cluster * Cluster name * * @return the cluster configuration * * @throws NotAuthorizedException * You don't have admin permission to get the configuration of the cluster * @throws NotFoundException * Cluster doesn't exist * @throws PulsarAdminException * Unexpected error */ ClusterData getCluster(String cluster) throws PulsarAdminException; /** * Get the configuration data for the specified cluster asynchronously. *

* Response Example: * *

     * { serviceUrl : "http://my-broker.example.com:8080/" }
     * 
* * @param cluster * Cluster name * * @return the cluster configuration * */ CompletableFuture getClusterAsync(String cluster); /** * Create a new cluster. *

* Provisions a new cluster. This operation requires Pulsar super-user privileges. *

* The name cannot contain '/' characters. * * @param cluster * Cluster name * @param clusterData * the cluster configuration object * * @throws NotAuthorizedException * You don't have admin permission to create the cluster * @throws ConflictException * Cluster already exists * @throws PulsarAdminException * Unexpected error */ void createCluster(String cluster, ClusterData clusterData) throws PulsarAdminException; /** * Create a new cluster asynchronously. *

* Provisions a new cluster. This operation requires Pulsar super-user privileges. *

* The name cannot contain '/' characters. * * @param cluster * Cluster name * @param clusterData * the cluster configuration object * */ CompletableFuture createClusterAsync(String cluster, ClusterData clusterData); /** * Update the configuration for a cluster. *

* This operation requires Pulsar super-user privileges. * * @param cluster * Cluster name * @param clusterData * the cluster configuration object * * @throws NotAuthorizedException * You don't have admin permission to create the cluster * @throws NotFoundException * Cluster doesn't exist * @throws PulsarAdminException * Unexpected error */ void updateCluster(String cluster, ClusterData clusterData) throws PulsarAdminException; /** * Update the configuration for a cluster asynchronously. *

* This operation requires Pulsar super-user privileges. * * @param cluster * Cluster name * @param clusterData * the cluster configuration object * */ CompletableFuture updateClusterAsync(String cluster, ClusterData clusterData); /** * Update peer cluster names. *

* This operation requires Pulsar super-user privileges. * * @param cluster * Cluster name * @param peerClusterNames * list of peer cluster names * * @throws NotAuthorizedException * You don't have admin permission to create the cluster * @throws NotFoundException * Cluster doesn't exist * @throws PulsarAdminException * Unexpected error */ void updatePeerClusterNames(String cluster, LinkedHashSet peerClusterNames) throws PulsarAdminException; /** * Update peer cluster names asynchronously. *

* This operation requires Pulsar super-user privileges. * * @param cluster * Cluster name * @param peerClusterNames * list of peer cluster names * */ CompletableFuture updatePeerClusterNamesAsync(String cluster, LinkedHashSet peerClusterNames); /** * Get peer-cluster names. *

* * @param cluster * Cluster name * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Domain doesn't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ Set getPeerClusterNames(String cluster) throws PulsarAdminException; /** * Get peer-cluster names asynchronously. *

* * @param cluster * Cluster name * @return * */ CompletableFuture> getPeerClusterNamesAsync(String cluster); /** * Delete an existing cluster. *

* Delete a cluster * * @param cluster * Cluster name * * @throws NotAuthorizedException * You don't have admin permission * @throws NotFoundException * Cluster does not exist * @throws PreconditionFailedException * Cluster is not empty * @throws PulsarAdminException * Unexpected error */ void deleteCluster(String cluster) throws PulsarAdminException; /** * Delete an existing cluster asynchronously. *

* Delete a cluster * * @param cluster * Cluster name * */ CompletableFuture deleteClusterAsync(String cluster); /** * Get the namespace isolation policies of a cluster. *

* * @param cluster * Cluster name * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Policies don't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ Map getNamespaceIsolationPolicies(String cluster) throws PulsarAdminException; /** * Get the namespace isolation policies of a cluster asynchronously. *

* * @param cluster * Cluster name * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Policies don't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ CompletableFuture> getNamespaceIsolationPoliciesAsync(String cluster); /** * Create a namespace isolation policy for a cluster. *

* * @param cluster * Cluster name * * @param policyName * Policy name * * @param namespaceIsolationData * Namespace isolation policy configuration * * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Cluster doesn't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ void createNamespaceIsolationPolicy( String cluster, String policyName, NamespaceIsolationData namespaceIsolationData) throws PulsarAdminException; /** * Create a namespace isolation policy for a cluster asynchronously. *

* * @param cluster * Cluster name * * @param policyName * Policy name * * @param namespaceIsolationData * Namespace isolation policy configuration * * @return */ CompletableFuture createNamespaceIsolationPolicyAsync( String cluster, String policyName, NamespaceIsolationData namespaceIsolationData); /** * Returns list of active brokers with namespace-isolation policies attached to it. * * @param cluster * @return * @throws PulsarAdminException */ List getBrokersWithNamespaceIsolationPolicy(String cluster) throws PulsarAdminException; /** * Returns list of active brokers with namespace-isolation policies attached to it asynchronously. * * @param cluster * @return */ CompletableFuture> getBrokersWithNamespaceIsolationPolicyAsync( String cluster); /** * Returns active broker with namespace-isolation policies attached to it. * * @param cluster * @param broker * @return * @throws PulsarAdminException */ BrokerNamespaceIsolationData getBrokerWithNamespaceIsolationPolicy(String cluster, String broker) throws PulsarAdminException; /** * Returns active broker with namespace-isolation policies attached to it asynchronously. * * @param cluster * @param broker * @return */ CompletableFuture getBrokerWithNamespaceIsolationPolicyAsync( String cluster, String broker); /** * Update a namespace isolation policy for a cluster. *

* * @param cluster * Cluster name * * @param policyName * Policy name * * @param namespaceIsolationData * Namespace isolation policy configuration * * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Cluster doesn't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ void updateNamespaceIsolationPolicy( String cluster, String policyName, NamespaceIsolationData namespaceIsolationData) throws PulsarAdminException; /** * Update a namespace isolation policy for a cluster asynchronously. *

* * @param cluster * Cluster name * * @param policyName * Policy name * * @param namespaceIsolationData * Namespace isolation policy configuration * * @return * */ CompletableFuture updateNamespaceIsolationPolicyAsync( String cluster, String policyName, NamespaceIsolationData namespaceIsolationData); /** * Delete a namespace isolation policy for a cluster. *

* * @param cluster * Cluster name * * @param policyName * Policy name * * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Cluster doesn't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ void deleteNamespaceIsolationPolicy(String cluster, String policyName) throws PulsarAdminException; /** * Delete a namespace isolation policy for a cluster asynchronously. *

* * @param cluster * Cluster name * * @param policyName * Policy name * * @return */ CompletableFuture deleteNamespaceIsolationPolicyAsync(String cluster, String policyName); /** * Get a single namespace isolation policy for a cluster. *

* * @param cluster * Cluster name * * @param policyName * Policy name * * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Policy doesn't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ NamespaceIsolationData getNamespaceIsolationPolicy(String cluster, String policyName) throws PulsarAdminException; /** * Get a single namespace isolation policy for a cluster asynchronously. *

* * @param cluster * Cluster name * * @param policyName * Policy name * */ CompletableFuture getNamespaceIsolationPolicyAsync(String cluster, String policyName); /** * Create a domain into cluster. *

* * @param cluster * Cluster name * * @param domainName * domain name * * @param domain * Domain configurations * * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws ConflictException * Broker already exist into other domain * * @throws NotFoundException * Cluster doesn't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ void createFailureDomain(String cluster, String domainName, FailureDomain domain) throws PulsarAdminException; /** * Create a domain into cluster asynchronously. *

* * @param cluster * Cluster name * * @param domainName * domain name * * @param domain * Domain configurations * * @return * */ CompletableFuture createFailureDomainAsync(String cluster, String domainName, FailureDomain domain); /** * Update a domain into cluster. *

* * @param cluster * Cluster name * * @param domainName * domain name * * @param domain * Domain configurations * * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws ConflictException * Broker already exist into other domain * * @throws NotFoundException * Cluster doesn't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ void updateFailureDomain(String cluster, String domainName, FailureDomain domain) throws PulsarAdminException; /** * Update a domain into cluster asynchronously. *

* * @param cluster * Cluster name * * @param domainName * domain name * * @param domain * Domain configurations * * @return * */ CompletableFuture updateFailureDomainAsync(String cluster, String domainName, FailureDomain domain); /** * Delete a domain in cluster. *

* * @param cluster * Cluster name * * @param domainName * Domain name * * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Cluster doesn't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ void deleteFailureDomain(String cluster, String domainName) throws PulsarAdminException; /** * Delete a domain in cluster asynchronously. *

* * @param cluster * Cluster name * * @param domainName * Domain name * * @return * */ CompletableFuture deleteFailureDomainAsync(String cluster, String domainName); /** * Get all registered domains in cluster. *

* * @param cluster * Cluster name * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Cluster don't exist * * @throws PulsarAdminException * Unexpected error */ Map getFailureDomains(String cluster) throws PulsarAdminException; /** * Get all registered domains in cluster asynchronously. *

* * @param cluster * Cluster name * @return * */ CompletableFuture> getFailureDomainsAsync(String cluster); /** * Get the domain registered into a cluster. *

* * @param cluster * Cluster name * @return * @throws NotAuthorizedException * You don't have admin permission to create the cluster * * @throws NotFoundException * Domain doesn't exist * * @throws PreconditionFailedException * Cluster doesn't exist * * @throws PulsarAdminException * Unexpected error */ FailureDomain getFailureDomain(String cluster, String domainName) throws PulsarAdminException; /** * Get the domain registered into a cluster asynchronously. *

* * @param cluster * Cluster name * @return * */ CompletableFuture getFailureDomainAsync(String cluster, String domainName); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy