pulsarctl icon indicating copy to clipboard operation
pulsarctl copied to clipboard

Add `policy` resources

Open sijie opened this issue 6 years ago • 0 comments

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 topic resource 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-property is the property within the policy, such as backlog-quotas, subscribe-rate.
  • action is the operation can be applied on the policy-property, e.g. get and set.
  • options are the options for the action.
  • resource-entity can 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

sijie avatar Oct 26 '19 04:10 sijie