pulsarctl
pulsarctl copied to clipboard
Add `policy` resources
Motivation
Currently we have some many commands under namespace resource. It introduces a few inconveniences.
- We have too many getters and setters. It is really hard to people to find the right command, especially these policy operations are coupled with CRUD operations on namespaces.
- Each time we introduce a name field in the policy. We have to add new getter and setter in the command.
- We are introduce a topic-level policy in Pulsar. It means that we might need to add the operations under
topicresource as well. It results in duplicated code.
Proposal
I am proposing introducing a policy resource for handling operations to policies at both namespace or topic level.
The proposed command syntax is described as followings:
pulsarctl policies [policy-property] [action] [options] [resource-entity]
policy-propertyis thepropertywithin the policy, such asbacklog-quotas,subscribe-rate.actionis the operation can be applied on thepolicy-property, e.g.getandset.optionsare the options for the action.resource-entitycan be a namespace or a topic (if we support topic-level policy)
The examples of the commands using this syntax are listed as follows:
- get backlog quotas from a namespace
pulsarctl policies backlog-quota get tenant/ns
- get backlog quotas from a topic
pulsarctl policies backlog-quota get tenant/ns/topic