Skip to content

Commit 9430d0d

Browse files
authored
Merge pull request #347 from aiven/byashimov-NEX-1845-add-kafka-topic-list-v2
feat: `ServiceKafkaTopicListV2` endpoint
2 parents d5a2ad8 + 7f7d273 commit 9430d0d

File tree

6 files changed

+106
-42
lines changed

6 files changed

+106
-42
lines changed

config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ KafkaTopic:
191191
- ServiceKafkaTopicDelete
192192
- ServiceKafkaTopicGet
193193
- ServiceKafkaTopicList
194+
- ServiceKafkaTopicListV2
194195
- ServiceKafkaTopicMessageList
195196
- ServiceKafkaTopicMessageProduce
196197
- ServiceKafkaTopicUpdate

generator/models.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,11 @@ func (p *Path) Comment() *jen.Statement {
109109
c := jen.Comment(s)
110110
c.Line().Comment(fmt.Sprintf("%s %s", p.Method, p.Path))
111111

112-
if p.Tags[0] == "" {
112+
switch {
113+
case p.Tags == nil:
114+
case p.Tags[0] == "":
113115
c.Line().Comment(fmt.Sprintf("%s/#operation/%s", docSite, p.OperationID))
114-
} else {
116+
default:
115117
c.Line().Comment(fmt.Sprintf("%s/#tag/%s/operation/%s", docSite, p.Tags[0], p.OperationID))
116118
}
117119

@@ -579,7 +581,7 @@ func getEnumName(s *Schema) string {
579581
return s.name
580582
}
581583

582-
var camelFinder = regexp.MustCompile("[A-Z]+[a-z]+")
584+
var camelFinder = regexp.MustCompile("[A-Z]+[0-9a-z]+")
583585

584586
// dedupCamelName removes duplicates: KafkaAclKafkaAcl -> KafkaAcl
585587
func dedupCamelName(src string) string {

handler/kafkatopic/kafkatopic.go

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

handler/project/project.go

Lines changed: 18 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

handler/service/service.go

Lines changed: 22 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

openapi_patch.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,27 @@ paths:
1212
- $ref: "#/components/parameters/service_name"
1313
- $ref: "#/components/parameters/service_kafka_quota_user"
1414
- $ref: "#/components/parameters/service_kafka_quota_client_id"
15-
15+
/v2/project/{project}/service/{service_name}/topic:
16+
post:
17+
summary: List Kafka topics V2
18+
description: Retrieves a list of Kafka topics for a specific service. Experimental endpoint.
19+
operationId: ServiceKafkaTopicListV2
20+
parameters:
21+
- $ref: "#/components/parameters/project"
22+
- $ref: "#/components/parameters/service_name"
23+
requestBody:
24+
required: true
25+
content:
26+
application/json:
27+
schema:
28+
$ref: "#/components/schemas/ServiceKafkaTopicListV2Request"
29+
responses:
30+
"200":
31+
description: Successful response
32+
content:
33+
application/json:
34+
schema:
35+
$ref: "#/components/schemas/ServiceKafkaTopicListV2Response"
1636
components:
1737
schemas:
1838
ServiceKafkaConnectCreateConnectorRequestBody:
@@ -339,6 +359,22 @@ components:
339359
properties:
340360
project_vpc_id:
341361
nullable: true
362+
ServiceKafkaTopicListV2Request:
363+
type: object
364+
required:
365+
- topic_names
366+
properties:
367+
topic_names:
368+
type: array
369+
items:
370+
type: string
371+
ServiceKafkaTopicListV2Response:
372+
type: object
373+
properties:
374+
topics:
375+
type: array
376+
items:
377+
$ref: "#/components/schemas/ServiceKafkaTopicGetResponse/properties/topic"
342378
parameters:
343379
service_kafka_quota_user:
344380
in: query

0 commit comments

Comments
 (0)