Skip to content

Commit

Permalink
make role and operation be an alias
Browse files Browse the repository at this point in the history
  • Loading branch information
purbon committed Sep 30, 2021
1 parent 1436300 commit 7aa1bf7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ protected void execute() throws IOException {
acl.getPatternType(),
acl.getHost(),
acl.getOperation(),
acl.getPermissionType(),
acl.getRole());
acl.getPermissionType());
})
.collect(Collectors.toList());
var instanceBindings =
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/com/purbon/kafka/topology/model/JulieRoleAcl.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.purbon.kafka.topology.model;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class JulieRoleAcl {

private String role;
private String resourceType;
private String resourceName;
private String patternType;
Expand All @@ -19,16 +19,14 @@ public JulieRoleAcl(
@JsonProperty("resourceName") String resourceName,
@JsonProperty("patternType") String patternType,
@JsonProperty("host") String host,
@JsonProperty("operation") String operation,
@JsonProperty("permissionType") String permissionType,
@JsonProperty("role") String role) {
@JsonProperty("operation") @JsonAlias("role") String operation,
@JsonProperty("permissionType") String permissionType) {
this.resourceType = resourceType;
this.resourceName = resourceName;
this.patternType = patternType;
this.host = host;
this.operation = operation;
this.permissionType = permissionType;
this.role = role;
}

public String getResourceType() {
Expand Down Expand Up @@ -56,6 +54,6 @@ public String getPermissionType() {
}

public String getRole() {
return role;
return getOperation();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void testSerdes() throws IOException {
assertThat(resources).contains("Topic", "Group");
assertThat(role.getName()).isEqualTo("app");
assertThat(role.getAcls()).hasSize(4);
assertThat(role.getAcls().get(0).getRole()).isEqualTo("RBAC");
assertThat(role.getAcls().get(0).getRole()).isEqualTo("ALL");

role = roles.get("other");
resources =
Expand Down
1 change: 0 additions & 1 deletion src/test/resources/roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ roles:
host: "*"
operation: "ALL"
permissionType: "ALLOW"
role: "RBAC"
- resourceType: "Topic"
resourceName: "sourceTopic"
patternType: "LITERAL"
Expand Down

0 comments on commit 7aa1bf7

Please sign in to comment.