Due to a scheduled upgrade to version 14.10, GitLab will be unavailabe on Monday 30.05., from 19:00 until 20:00.

Commit 06518f55 authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Remove kafka stuff as it is no longer necessary.

parent ed49e425
from flask_restful import Resource, reqparse
from import_api_app.helpers.Error import ImportApiError
from import_api_app.helpers.KafkaTopics import create_topics, list_topics, delete_topics
class KafkaTopics(Resource):
def get(self):
"""
Gets the list of kafka topics in the cluster
---
tags:
- Kafka Topics
responses:
200:
description: Topic list
"""
try:
topics = list_topics()
except ImportApiError as e:
return {'error': e.message}, 500
return {
"topics": list(topics)
}
def post(self):
"""
Creates the Topics from the topics parameter. \
If the topic already exists it is deleted and recreated
---
tags:
- Kafka Topics
parameters:
- in: body
name: body
schema:
properties:
topics:
type: array
example: [test1, test2]
responses:
200:
description: Topic list
"""
parser = reqparse.RequestParser()
parser.add_argument('topics', action='append')
args = parser.parse_args()
topics = args['topics']
try:
return create_topics(topics)
except ImportApiError as e:
return {'error': e.message}, 500
def delete(self):
"""
Delete the Topics from the topics parameter.
---
tags:
- Kafka Topics
parameters:
- in: body
name: body
schema:
properties:
topics:
type: array
example: [test1, test2]
responses:
200:
description: Topic list
"""
parser = reqparse.RequestParser()
parser.add_argument('topics', action='append')
args = parser.parse_args()
topics = args['topics']
try:
return delete_topics(topics)
except ImportApiError as e:
return {'error': e.message}, 500
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment