Skip to content

Commit be762ee

Browse files
committed
Add all api changes
1 parent 33a2f67 commit be762ee

File tree

7 files changed

+46
-3
lines changed

7 files changed

+46
-3
lines changed

api/src/main/java/io/kafbat/ui/config/ClustersProperties.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public static class Cluster {
5252
Long pollingThrottleRate;
5353
TruststoreConfig ssl;
5454
AuditProperties audit;
55+
String supportUrl;
5556
}
5657

5758
@Data

api/src/main/java/io/kafbat/ui/controller/AclsController.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import io.kafbat.ui.service.acl.AclsService;
1414
import java.util.Optional;
1515
import lombok.RequiredArgsConstructor;
16+
import org.apache.kafka.common.acl.AccessControlEntryFilter;
1617
import org.apache.kafka.common.resource.PatternType;
1718
import org.apache.kafka.common.resource.ResourcePatternFilter;
1819
import org.apache.kafka.common.resource.ResourceType;
@@ -67,7 +68,9 @@ public Mono<ResponseEntity<Flux<KafkaAclDTO>>> listAcls(String clusterName,
6768
KafkaAclResourceTypeDTO resourceTypeDto,
6869
String resourceName,
6970
KafkaAclNamePatternTypeDTO namePatternTypeDto,
71+
String search,
7072
ServerWebExchange exchange) {
73+
7174
AccessContext context = AccessContext.builder()
7275
.cluster(clusterName)
7376
.aclActions(AclAction.VIEW)
@@ -87,7 +90,7 @@ public Mono<ResponseEntity<Flux<KafkaAclDTO>>> listAcls(String clusterName,
8790
return validateAccess(context).then(
8891
Mono.just(
8992
ResponseEntity.ok(
90-
aclsService.listAcls(getCluster(clusterName), filter)
93+
aclsService.listAcls(getCluster(clusterName), filter, search)
9194
.map(ClusterMapper::toKafkaAclDto)))
9295
).doOnEach(sig -> audit(context, sig));
9396
}

api/src/main/java/io/kafbat/ui/controller/ApplicationConfigController.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.springframework.http.ResponseEntity;
2929
import org.springframework.http.codec.multipart.FilePart;
3030
import org.springframework.http.codec.multipart.Part;
31+
import org.springframework.web.bind.annotation.GetMapping;
3132
import org.springframework.web.bind.annotation.RestController;
3233
import org.springframework.web.server.ServerWebExchange;
3334
import reactor.core.publisher.Flux;
@@ -80,6 +81,17 @@ public Mono<ResponseEntity<ApplicationConfigDTO>> getCurrentConfig(ServerWebExch
8081
.doOnEach(sig -> audit(context, sig));
8182
}
8283

84+
@Override
85+
public Mono<ResponseEntity<String>> getSupportUrl(ServerWebExchange exchange) {
86+
var kafkaClusters = dynamicConfigOperations.getCurrentProperties().getKafka().getClusters();
87+
88+
String supportUrl = kafkaClusters != null && !kafkaClusters.isEmpty()
89+
? kafkaClusters.get(0).getSupportUrl()
90+
: null;
91+
92+
return Mono.just(ResponseEntity.ok(supportUrl));
93+
}
94+
8395
@Override
8496
public Mono<ResponseEntity<Void>> restartWithConfig(Mono<RestartRequestDTO> restartRequestDto,
8597
ServerWebExchange exchange) {

api/src/main/java/io/kafbat/ui/model/KafkaCluster.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ public class KafkaCluster {
3131
private final ReactiveFailover<KafkaSrClientApi> schemaRegistryClient;
3232
private final Map<String, ReactiveFailover<KafkaConnectClientApi>> connectsClients;
3333
private final ReactiveFailover<KsqlApiClient> ksqlClient;
34+
private final String supportUrl;
3435
}

api/src/main/java/io/kafbat/ui/service/KafkaClusterFactory.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public KafkaCluster create(ClustersProperties properties,
5252

5353
builder.name(clusterProperties.getName());
5454
builder.bootstrapServers(clusterProperties.getBootstrapServers());
55+
builder.supportUrl(clusterProperties.getSupportUrl());
5556
builder.properties(convertProperties(clusterProperties.getProperties()));
5657
builder.readOnly(clusterProperties.isReadOnly());
5758
builder.masking(DataMasking.create(clusterProperties.getMasking()));

api/src/main/java/io/kafbat/ui/service/acl/AclsService.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import lombok.RequiredArgsConstructor;
3232
import lombok.extern.slf4j.Slf4j;
3333
import org.apache.kafka.common.acl.AccessControlEntry;
34+
import org.apache.kafka.common.acl.AccessControlEntryFilter;
3435
import org.apache.kafka.common.acl.AclBinding;
3536
import org.apache.kafka.common.acl.AclOperation;
3637
import org.apache.kafka.common.resource.Resource;
@@ -68,10 +69,13 @@ public Mono<Void> deleteAcl(KafkaCluster cluster, AclBinding aclBinding) {
6869
.doOnSuccess(v -> log.info("ACL DELETED: [{}]", aclString));
6970
}
7071

71-
public Flux<AclBinding> listAcls(KafkaCluster cluster, ResourcePatternFilter filter) {
72+
public Flux<AclBinding> listAcls(KafkaCluster cluster,
73+
ResourcePatternFilter resourceFilter,
74+
String principalSearch) {
7275
return adminClientService.get(cluster)
73-
.flatMap(c -> c.listAcls(filter))
76+
.flatMap(c -> c.listAcls(resourceFilter))
7477
.flatMapIterable(acls -> acls)
78+
.filter(acl -> principalSearch == null || acl.entry().principal().contains(principalSearch))
7579
.sort(Comparator.comparing(AclBinding::toString)); //sorting to keep stable order on different calls
7680
}
7781

contract/src/main/resources/swagger/kafbat-ui-api.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,11 @@ paths:
19171917
required: false
19181918
schema:
19191919
$ref: '#/components/schemas/KafkaAclNamePatternType'
1920+
- name: search
1921+
in: query
1922+
required: false
1923+
schema:
1924+
type: string
19201925
responses:
19211926
200:
19221927
description: OK
@@ -2161,6 +2166,20 @@ paths:
21612166
application/json:
21622167
schema:
21632168
$ref: '#/components/schemas/ApplicationConfig'
2169+
2170+
/api/config/support-url:
2171+
get:
2172+
tags:
2173+
- ApplicationConfig
2174+
summary: Gets the support URL for the first Kafka cluster
2175+
operationId: getSupportUrl
2176+
responses:
2177+
200:
2178+
description: OK
2179+
content:
2180+
application/json:
2181+
schema:
2182+
type: string
21642183
put:
21652184
tags:
21662185
- ApplicationConfig
@@ -4149,6 +4168,8 @@ components:
41494168
type: string
41504169
bootstrapServers:
41514170
type: string
4171+
supportUrl:
4172+
type: string
41524173
ssl:
41534174
type: object
41544175
properties:

0 commit comments

Comments
 (0)