From 30954ba5bed014a22ef16f3e22cbcf81e9920c78 Mon Sep 17 00:00:00 2001 From: Oleg Shuralev Date: Sun, 12 Jan 2020 02:45:19 +0300 Subject: [PATCH] [API] Add Topic Config Mock --- api/mocks/topicConfig.js | 132 +++++++++++++++++++++++++++++++++++++++ api/services/topics.js | 4 ++ 2 files changed, 136 insertions(+) create mode 100644 api/mocks/topicConfig.js diff --git a/api/mocks/topicConfig.js b/api/mocks/topicConfig.js new file mode 100644 index 0000000000..d64e9e562f --- /dev/null +++ b/api/mocks/topicConfig.js @@ -0,0 +1,132 @@ +module.exports = [ + { + key: 'compression.type', + value: 'producer', + defaultValue: 'producer', + }, + { + key: 'leader.replication.throttled.replicas', + value: '', + defaultValue: '', + }, + { + key: 'message.downconversion.enable', + value: 'true', + defaultValue: 'true', + }, + { + key: 'min.insync.replicas', + value: '1', + defaultValue: '1', + }, + { + key: 'segment.jitter.ms', + value: '0', + defaultValue: '0', + }, + { + key: 'cleanup.policy', + value: 'delete', + defaultValue: 'delete', + }, + { + key: 'flush.ms', + value: '9223372036854775807', + defaultValue: '9223372036854775807', + }, + { + key: 'follower.replication.throttled.replicas', + value: '', + defaultValue: '', + }, + { + key: 'segment.bytes', + value: '1073741824', + defaultValue: '1073741824', + }, + { + key: 'retention.ms', + value: '43200000', + defaultValue: '43200000', + }, + { + key: 'flush.messages', + value: '9223372036854775807', + defaultValue: '9223372036854775807', + }, + { + key: 'message.format.version', + value: '2.3-IV1', + defaultValue: '2.3-IV1', + }, + { + key: 'file.delete.delay.ms', + value: '60000', + defaultValue: '60000', + }, + { + key: 'max.compaction.lag.ms', + value: '9223372036854775807', + defaultValue: '9223372036854775807', + }, + { + key: 'max.message.bytes', + value: '1000012', + defaultValue: '1000012', + }, + { + key: 'min.compaction.lag.ms', + value: '0', + defaultValue: '0', + }, + { + key: 'message.timestamp.type', + value: 'CreateTime', + defaultValue: 'CreateTime', + }, + { + key: 'preallocate', + value: 'false', + defaultValue: 'false', + }, + { + key: 'min.cleanable.dirty.ratio', + value: '0.5', + defaultValue: '0.5', + }, + { + key: 'index.interval.bytes', + value: '4096', + defaultValue: '4096', + }, + { + key: 'unclean.leader.election.enable', + value: 'true', + defaultValue: 'true', + }, + { + key: 'retention.bytes', + value: '-1', + defaultValue: '-1', + }, + { + key: 'delete.retention.ms', + value: '86400000', + defaultValue: '86400000', + }, + { + key: 'segment.ms', + value: '604800000', + defaultValue: '604800000', + }, + { + key: 'message.timestamp.difference.max.ms', + value: '9223372036854775807', + defaultValue: '9223372036854775807', + }, + { + key: 'segment.index.bytes', + value: '10485760', + defaultValue: '10485760', + } +] diff --git a/api/services/topics.js b/api/services/topics.js index 0d0aa12021..201b7e283c 100644 --- a/api/services/topics.js +++ b/api/services/topics.js @@ -2,6 +2,7 @@ const topics = require('../mocks/topics'); const topicDetails = require('../mocks/topicDetails'); +const topicConfig = require('../mocks/topicConfig'); module.exports = function (fastify, opts, next) { fastify @@ -10,6 +11,9 @@ module.exports = function (fastify, opts, next) { }) .get('/clusters/:clusterId/topics/:topicId', function (request, reply) { reply.send(topicDetails); + }) + .get('/clusters/:clusterId/topics/:topicId/config', function (request, reply) { + reply.send(topicConfig); }); next();