1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright © 2021 Orange.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 *******************************************************************************/
25 package org.onap.dmaap.mr.client;
27 import com.att.nsa.apiClient.http.HttpException;
28 import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
30 import java.io.IOException;
35 * A client for working with topic metadata.
39 public interface MRTopicManager extends MRClient {
41 * Get the topics available in the cluster.
43 * @return a set of topic names
46 Set<String> getTopics() throws IOException;
49 * Information about a topic.
53 * Get the owner of the topic.
55 * @return the owner, or null if no entry
60 * Get the description for this topic.
62 * @return the description, or null if no entry
64 String getDescription();
67 * Get the set of allowed producers (as API keys) on this topic.
69 * @return the set of allowed producers, null of no ACL exists/enabled
71 Set<String> getAllowedProducers();
74 * Get the set of allowed consumers (as API keys) on this topic.
76 * @return the set of allowed consumers, null of no ACL exists/enabled
78 Set<String> getAllowedConsumers();
82 * Get information about a topic.
85 * @return topic information
87 * @throws HttpObjectNotFoundException
89 TopicInfo getTopicMetadata(String topic) throws HttpObjectNotFoundException, IOException;
95 * @param topicDescription
96 * @param partitionCount
97 * @param replicationCount
98 * @throws HttpException
101 void createTopic(String topicName, String topicDescription, int partitionCount, int replicationCount) throws HttpException, IOException;
104 * Delete the topic. This call must be authenticated and the API key listed as owner on the topic.
105 * NOTE: The MR (UEB) API server does not support topic deletion at this time (mid 2015)
108 * @throws HttpException
109 * @throws IOException
110 * @deprecated If/when the Kafka system supports topic delete, or the implementation changes, this will be restored.
113 void deleteTopic(String topic) throws HttpException, IOException;
116 * Can any client produce events into this topic without authentication?
119 * @return true if the topic is open for producing
120 * @throws IOException
121 * @throws HttpObjectNotFoundException
123 boolean isOpenForProducing(String topic) throws HttpObjectNotFoundException, IOException;
126 * Get the set of allowed producers. If the topic is open, the result is null.
129 * @return a set of allowed producers or null
130 * @throws IOException
131 * @throws HttpObjectNotFoundException
133 Set<String> getAllowedProducers(String topic) throws HttpObjectNotFoundException, IOException;
136 * Allow the given API key to produce messages on the given topic. The caller must
141 * @throws HttpException
142 * @throws HttpObjectNotFoundException
143 * @throws IOException
145 void allowProducer(String topic, String apiKey) throws HttpObjectNotFoundException, HttpException, IOException;
148 * Revoke the given API key's authorization to produce messages on the given topic.
149 * The caller must own this topic.
153 * @throws HttpException
154 * @throws IOException
156 void revokeProducer(String topic, String apiKey) throws HttpException, IOException;
159 * Can any client consume events from this topic without authentication?
162 * @return true if the topic is open for consuming
163 * @throws IOException
164 * @throws HttpObjectNotFoundException
166 boolean isOpenForConsuming(String topic) throws HttpObjectNotFoundException, IOException;
169 * Get the set of allowed consumers. If the topic is open, the result is null.
172 * @return a set of allowed consumers or null
173 * @throws IOException
174 * @throws HttpObjectNotFoundException
176 Set<String> getAllowedConsumers(String topic) throws HttpObjectNotFoundException, IOException;
179 * Allow the given API key to consume messages on the given topic. The caller must
184 * @throws HttpException
185 * @throws HttpObjectNotFoundException
186 * @throws IOException
188 void allowConsumer(String topic, String apiKey) throws HttpObjectNotFoundException, HttpException, IOException;
191 * Revoke the given API key's authorization to consume messages on the given topic.
192 * The caller must own this topic.
196 * @throws HttpException
197 * @throws IOException
199 void revokeConsumer(String topic, String apiKey) throws HttpException, IOException;