Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8a03bfd
Use typespec contracts
germanosin Jun 9, 2025
7d5af90
Merge branch 'main' into typespec
germanosin Jun 9, 2025
b8b91fc
Fixed styling
germanosin Jun 10, 2025
155b038
Merge remote-tracking branch 'origin/typespec' into typespec
germanosin Jun 10, 2025
a2175a1
Fixed styling
germanosin Jun 10, 2025
5d4f419
enable typespec by default
germanosin Jun 11, 2025
8cd0a0a
Added info
germanosin Jun 11, 2025
6ce97f8
Frontend use new contracts
germanosin Jun 11, 2025
a7a59d8
Fixes in contracts for backward compatibility
germanosin Jun 11, 2025
d0ef634
use typespec build
germanosin Jun 12, 2025
c29091f
Install pnpm dependencies
germanosin Jun 12, 2025
d67068c
Merged main
germanosin Aug 7, 2025
f114d44
Actualize typespec
germanosin Aug 7, 2025
4279d6c
Actualize typespec
germanosin Aug 7, 2025
a1c261b
fixed frontend build
germanosin Aug 7, 2025
ea75152
fixed frontend build
germanosin Aug 7, 2025
5341c20
fixed frontend build
germanosin Aug 7, 2025
c61da13
fixed frontend build
germanosin Aug 7, 2025
2c670f6
fixed frontend build
germanosin Aug 7, 2025
4bf3779
fixed frontend build
germanosin Aug 7, 2025
fa8b03b
fixed frontend build
germanosin Aug 7, 2025
bcae096
Enabled contract validation
germanosin Aug 7, 2025
db746fa
Removed frontend test report
germanosin Aug 7, 2025
a42e81e
Merge branch 'main' into typespec
germanosin Aug 12, 2025
38ee6c9
Synced with main
germanosin Aug 12, 2025
0474fd7
Synced with main
germanosin Aug 12, 2025
ed63a5f
Merge branch 'main' into typespec
germanosin Aug 14, 2025
84e3d07
Merge branch 'main' into typespec
germanosin Aug 15, 2025
279a09a
Added comment
germanosin Aug 15, 2025
6ea8e2d
Merge branch 'main' into typespec
germanosin Aug 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.kafbat.ui.mapper;

import io.kafbat.ui.model.ActionDTO;
import io.kafbat.ui.model.ApplicationConfigPropertiesAuthOauth2ClientValueDTO;
import io.kafbat.ui.model.ApplicationConfigPropertiesAuthOauth2ResourceServerDTO;
import io.kafbat.ui.model.ApplicationConfigPropertiesAuthOauth2ResourceServerJwtDTO;
import io.kafbat.ui.model.ApplicationConfigPropertiesAuthOauth2ResourceServerOpaquetokenDTO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void testConvertController() {
"clusterName", Map.of("type", "string"),
"topicName", Map.of("type", "string"),
"topicUpdate", SCHEMA_GENERATOR.generateSchema(TopicUpdateDTO.class)
), List.of("clusterName", "topicName"), false, null, null)
), List.of("clusterName", "topicName", "topicUpdate"), false, null, null)
)
);
assertThat(tools).allMatch(tool ->
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ ext {
release = resolveBooleanProperty("release")
includeFrontend = resolveBooleanProperty("include-frontend", release)
buildDockerImages = resolveBooleanProperty("build-docker-images", release)
useTypeSpec = resolveBooleanProperty("typespec", false)
runE2e = resolveBooleanProperty("run-e2e")
}

Expand Down
139 changes: 139 additions & 0 deletions contract-typespec/api/acls.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
import "@typespec/openapi";

using TypeSpec.Http;
using OpenAPI;

@route("/api/clusters/{clusterName}/acls")
@tag("Acls")
interface AclApi {
@doc("listKafkaAcls")
@get
@operationId("listAcls")
listAcls(
@path clusterName: string,
@query resourceType?: KafkaAclResourceType,
@query resourceName?: string,
@query namePatternType?: KafkaAclNamePatternType,
): KafkaAcl[];

@route("/csv")
@doc("getAclAsCsv")
@get
@operationId("getAclAsCsv")
getAclAsCsv(@path clusterName: string): string;

@route("/csv")
@doc("syncAclsCsv")
@post
@operationId("syncAclsCsv")
syncAclsCsv(@path clusterName: string, @body content: string): void | ApiBadRequestResponse;

@doc("createAcl")
@post
@operationId("createAcl")
createAcl(@path clusterName: string, @body acl: KafkaAcl): void | ApiBadRequestResponse;

@doc("deleteAcl")
@delete
@operationId("deleteAcl")
deleteAcl(
@path clusterName: string,
@body acl: KafkaAcl,
): void | ApiNotFoundResponse;

@route("/consumer")
@doc("createConsumerAcl")
@post
@operationId("createConsumerAcl")
createConsumerAcl(
@path clusterName: string,
@body payload: CreateConsumerAcl,
): void | ApiBadRequestResponse;

@route("/producer")
@doc("createProducerAcl")
@operationId("createProducerAcl")
@post
createProducerAcl(
@path clusterName: string,
@body payload: CreateProducerAcl,
): void | ApiBadRequestResponse;

@route("/streamApp")
@doc("createStreamAppAcl")
@post
@operationId("createStreamAppAcl")
createStreamAppAcl(
@path clusterName: string,
@body payload: CreateStreamAppAcl,
): void | ApiBadRequestResponse;
}

model KafkaAcl {
resourceType: KafkaAclResourceType;
resourceName: string; // "*" if acl can be applied to any resource of given type
namePatternType: KafkaAclNamePatternType;
principal: string;
host: string;
operation: KafkaAclOpeations;
permission: "ALLOW" | "DENY";
}

alias KafkaAclOpeations =
"UNKNOWN"
| "ALL"
| "READ"
| "WRITE"
| "CREATE"
| "DELETE"
| "ALTER"
| "DESCRIBE"
| "CLUSTER_ACTION"
| "DESCRIBE_CONFIGS"
| "ALTER_CONFIGS"
| "IDEMPOTENT_WRITE"
| "CREATE_TOKENS"
| "DESCRIBE_TOKENS";

enum KafkaAclResourceType {
UNKNOWN,
TOPIC,
GROUP,
CLUSTER,
TRANSACTIONAL_ID,
DELEGATION_TOKEN,
USER,
}

enum KafkaAclNamePatternType {
MATCH,
LITERAL,
PREFIXED,
}

model CreateConsumerAcl {
principal: string;
host: string;
topics?: string[];
topicsPrefix?: string;
consumerGroups?: string[];
consumerGroupsPrefix?: string;
}

model CreateProducerAcl {
principal: string;
host: string;
topics?: string[];
topicsPrefix?: string;
transactionalId?: string;
transactionsIdPrefix?: string;
idempotent?: boolean = false;
}

model CreateStreamAppAcl {
principal: string;
host: string;
inputTopics: string[];
outputTopics: string[];
applicationId: string;
}
42 changes: 42 additions & 0 deletions contract-typespec/api/auth.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import "@typespec/openapi";

using TypeSpec.Http;
using OpenAPI;

@tag("Authorization")
interface AuthorizationApi {
@route("/api/authorization")
@doc("Get user authorization related info")
@operationId("getUserAuthInfo")
@get
getUserAuthInfo(): AuthenticationInfo;
}

@route("/login")
@doc("Authenticate")
@operationId("authenticate")
@post
op authenticate(@body form: LoginForm): void | Http.Response<401>;

model LoginForm {
username: string;
password: string;
}

model AuthenticationInfo {
rbacEnabled: boolean; // true if role based access control is enabled and granular permission access is required
userInfo?: UserInfo;
}

model UserInfo {
username: string;
permissions: UserPermission[];
}


model UserPermission {
clusters: string[];
resource: ResourceType;
value?: string;
actions: Action[];
}
114 changes: 114 additions & 0 deletions contract-typespec/api/brokers.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import "@typespec/openapi";

using TypeSpec.Http;
using OpenAPI;

@route("/api/clusters/{clusterName}/brokers")
@tag("Brokers")
interface BrokersApi {
@get
@operationId("getBrokers")
@doc("getBrokers")
getBrokers(@path clusterName: string): Broker[];

@get
@route("/{id}/configs")
@operationId("getBrokerConfig")
@doc("getBrokerConfig")
getBrokerConfig(@path clusterName: string, @path id: int32): BrokerConfig[];

@put
@route("/{id}/configs/{name}")
@operationId("updateBrokerConfigByName")
@doc("updateBrokerConfigByName")
updateBrokerConfigByName(
@path clusterName: string,
@path id: int32,
@path name: string,
@body config: BrokerConfigItem,
): void | ApiBadRequestResponse;

@get
@route("/{id}/metrics")
@operationId("getBrokersMetrics")
@doc("getBrokersMetrics")
getBrokersMetrics(@path clusterName: string, @path id: int32): BrokerMetrics;

@get
@route("/logdirs")
@operationId("getAllBrokersLogdirs")
@doc("getAllBrokersLogdirs")
getAllBrokersLogdirs(
@path clusterName: string,
@query broker?: int32[],
): BrokersLogdirs[];

@patch(#{implicitOptionality: true})
@route("/{id}/logdirs")
@operationId("updateBrokerTopicPartitionLogDir")
@doc("updateBrokerTopicPartitionLogDir")
updateBrokerTopicPartitionLogDir(
@path clusterName: string,
@path id: int32,
@body update: BrokerLogdirUpdate,
): void | ApiBadRequestResponse;
}

model Broker {
id: int32;
host?: string;
port?: int32;
bytesInPerSec?: float64;
bytesOutPerSec?: float64;
partitionsLeader?: int32;
partitions?: int32;
inSyncPartitions?: int32;
partitionsSkew?: float64;
leadersSkew?: float64;
}

model BrokerLogdirUpdate {
topic?: string;
partition?: int32;
logDir?: string;
}

model BrokerConfig {
name: string;
value: string;
source: ConfigSource;
isSensitive: boolean;
isReadOnly: boolean;
synonyms?: ConfigSynonym[];
}

model BrokerConfigItem {
value?: string;
}

model BrokerMetrics {
segmentSize: int64;
segmentCount: int32;
metrics: Metric[];
}

model BrokersLogdirs {
name: string;
error: string;
topics: BrokerTopicLogdirs[];
}

model BrokerTopicLogdirs {
name?: string;
partitions?: BrokerTopicPartitionLogdir[];
}

model BrokerTopicPartitionLogdir extends TopicPartitionLogdir {
broker?: int32;
}

model TopicPartitionLogdir {
partition?: int32;
size?: int64;
offsetLag?: int64;
}
Loading
Loading