1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ============LICENSE_END=========================================================
19 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
21 *******************************************************************************/
22 package org.onap.dmaap.mr.client;
24 import java.io.IOException;
27 import com.att.nsa.apiClient.http.HttpException;
28 import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
32 * A client for working with topic metadata.
35 public interface MRTopicManager extends MRClient
38 * Get the topics available in the cluster
39 * @return a set of topic names
42 Set<String> getTopics () throws IOException;
45 * Information about a topic.
47 public interface TopicInfo
50 * Get the owner of the topic
51 * @return the owner, or null if no entry
56 * Get the description for this topic
57 * @return the description, or null if no entry
59 String getDescription ();
62 * Get the set of allowed producers (as API keys) on this topic
63 * @return the set of allowed producers, null of no ACL exists/enabled
65 Set<String> getAllowedProducers ();
68 * Get the set of allowed consumers (as API keys) on this topic
69 * @return the set of allowed consumers, null of no ACL exists/enabled
71 Set<String> getAllowedConsumers ();
75 * Get information about a topic.
77 * @return topic information
79 * @throws HttpObjectNotFoundException
81 TopicInfo getTopicMetadata ( String topic ) throws HttpObjectNotFoundException, IOException;
86 * @param topicDescription
87 * @param partitionCount
88 * @param replicationCount
89 * @throws HttpException
92 void createTopic ( String topicName, String topicDescription, int partitionCount, int replicationCount ) throws HttpException, IOException;
95 * Delete the topic. This call must be authenticated and the API key listed as owner on the topic.
96 * NOTE: The MR (UEB) API server does not support topic deletion at this time (mid 2015)
98 * @throws HttpException
100 * @deprecated If/when the Kafka system supports topic delete, or the implementation changes, this will be restored.
103 void deleteTopic ( String topic ) throws HttpException, IOException;
106 * Can any client produce events into this topic without authentication?
108 * @return true if the topic is open for producing
109 * @throws IOException
110 * @throws HttpObjectNotFoundException
112 boolean isOpenForProducing ( String topic ) throws HttpObjectNotFoundException, IOException;
115 * Get the set of allowed producers. If the topic is open, the result is null.
117 * @return a set of allowed producers or null
118 * @throws IOException
119 * @throws HttpObjectNotFoundException
121 Set<String> getAllowedProducers ( String topic ) throws HttpObjectNotFoundException, IOException;
124 * Allow the given API key to produce messages on the given topic. The caller must
128 * @throws HttpException
129 * @throws HttpObjectNotFoundException
130 * @throws IOException
132 void allowProducer ( String topic, String apiKey ) throws HttpObjectNotFoundException, HttpException, IOException;
135 * Revoke the given API key's authorization to produce messages on the given topic.
136 * The caller must own this topic.
139 * @throws HttpException
140 * @throws IOException
142 void revokeProducer ( String topic, String apiKey ) throws HttpException, IOException;
145 * Can any client consume events from this topic without authentication?
147 * @return true if the topic is open for consuming
148 * @throws IOException
149 * @throws HttpObjectNotFoundException
151 boolean isOpenForConsuming ( String topic ) throws HttpObjectNotFoundException, IOException;
154 * Get the set of allowed consumers. If the topic is open, the result is null.
156 * @return a set of allowed consumers or null
157 * @throws IOException
158 * @throws HttpObjectNotFoundException
160 Set<String> getAllowedConsumers ( String topic ) throws HttpObjectNotFoundException, IOException;
163 * Allow the given API key to consume messages on the given topic. The caller must
167 * @throws HttpException
168 * @throws HttpObjectNotFoundException
169 * @throws IOException
171 void allowConsumer ( String topic, String apiKey ) throws HttpObjectNotFoundException, HttpException, IOException;
174 * Revoke the given API key's authorization to consume messages on the given topic.
175 * The caller must own this topic.
178 * @throws HttpException
179 * @throws IOException
181 void revokeConsumer ( String topic, String apiKey ) throws HttpException, IOException;