-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix quota manager integration (#581)
* Fix: Quota manager is not called in main Julie Ops plan update * Fix: Bump main docker compose testing file to 7.5.0 and manage Mac M1 testing * Feat/Fix: use Actions for quotas instead of direct processing for dryRun process and implement quota deletion.
- Loading branch information
1 parent
b665808
commit f1fe064
Showing
14 changed files
with
472 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/com/purbon/kafka/topology/actions/quotas/CreateQuotasAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.purbon.kafka.topology.actions.quotas; | ||
|
||
import com.purbon.kafka.topology.actions.BaseAction; | ||
import com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient; | ||
import com.purbon.kafka.topology.model.users.Quota; | ||
import java.io.IOException; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class CreateQuotasAction extends BaseAction { | ||
private final TopologyBuilderAdminClient adminClient; | ||
private final List<Quota> quotas; | ||
|
||
public CreateQuotasAction(TopologyBuilderAdminClient adminClient, List<Quota> quotas) { | ||
this.adminClient = adminClient; | ||
this.quotas = quotas; | ||
} | ||
|
||
@Override | ||
public void run() throws IOException { | ||
adminClient.assignQuotasPrincipal(quotas); | ||
} | ||
|
||
@Override | ||
protected Map<String, Object> props() { | ||
Map<String, Object> map = new LinkedHashMap<>(); | ||
map.put("Operation", getClass().getName()); | ||
map.put("Quotas", quotas); | ||
map.put("Action", "create"); | ||
return map; | ||
} | ||
|
||
@Override | ||
protected List<Map<String, Object>> detailedProps() { | ||
return List.of(props()); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/purbon/kafka/topology/actions/quotas/DeleteQuotasAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.purbon.kafka.topology.actions.quotas; | ||
|
||
import com.purbon.kafka.topology.actions.BaseAction; | ||
import com.purbon.kafka.topology.api.adminclient.TopologyBuilderAdminClient; | ||
import com.purbon.kafka.topology.model.User; | ||
import java.io.IOException; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
public class DeleteQuotasAction extends BaseAction { | ||
private final TopologyBuilderAdminClient adminClient; | ||
private final List<User> users; | ||
|
||
public DeleteQuotasAction(TopologyBuilderAdminClient adminClient, List<String> users) { | ||
this.adminClient = adminClient; | ||
this.users = users.stream().map(User::new).collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public void run() throws IOException { | ||
adminClient.removeQuotasPrincipal(users); | ||
} | ||
|
||
@Override | ||
protected Map<String, Object> props() { | ||
Map<String, Object> map = new LinkedHashMap<>(); | ||
map.put("Operation", getClass().getName()); | ||
map.put("Users", users); | ||
map.put("Action", "delete"); | ||
return map; | ||
} | ||
|
||
@Override | ||
protected List<Map<String, Object>> detailedProps() { | ||
return List.of(props()); | ||
} | ||
} |
Oops, something went wrong.