org.apache.pulsar.client.admin.Clusters Maven / Gradle / Ivy
/*
* 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.ClusterData.ClusterUrl;
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);
/**
* Update the configuration for a cluster migration.
*
* This operation requires Pulsar super-user privileges.
*
* @param cluster
* Cluster name
* @param migrated
* is cluster migrated
* @param clusterUrl
* the cluster url object
*
* @throws NotAuthorizedException
* You don't have admin permission to create the cluster
* @throws NotFoundException
* Cluster doesn't exist
* @throws PulsarAdminException
* Unexpected error
*/
void updateClusterMigration(String cluster, boolean migrated, ClusterUrl clusterUrl) throws PulsarAdminException;
/**
* Update the configuration for a cluster migration asynchronously.
*
* This operation requires Pulsar super-user privileges.
*
* @param cluster
* Cluster name
* @param migrated
* is cluster migrated
* @param clusterUrl
* the cluster url object
*
*/
CompletableFuture updateClusterMigrationAsync(String cluster, boolean migrated, ClusterUrl clusterUrl);
/**
* 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
© 2015 - 2025 Weber Informatics LLC | Privacy Policy