mattisonchao commented on a change in pull request #13534:
URL: https://github.com/apache/pulsar/pull/13534#discussion_r776210921
##########
File path:
pulsar-client-tools/src/main/java/org/apache/pulsar/admin/cli/CmdTopicPolicies.java
##########
@@ -733,6 +735,135 @@ void run() throws PulsarAdminException {
}
}
+
+ @Parameters(commandDescription = "Get the offload policies for a topic")
+ private class GetOffloadPolicies extends CliCommand {
+ @Parameter(description = "persistent://tenant/namespace/topic",
required = true)
+ private java.util.List<String> params;
+
+ @Parameter(names = { "-ap", "--applied" }, description = "Get the
applied policy of the topic")
+ private boolean applied = false;
+
+ @Parameter(names = { "--global", "-g" }, description = "Whether to get
this policy globally. "
+ + "If set to true, broker returned global topic policies")
+ private boolean isGlobal = false;
+
+ @Override
+ void run() throws PulsarAdminException {
+ String persistentTopic = validatePersistentTopic(params);
+
print(getTopicPolicies(isGlobal).getOffloadPolicies(persistentTopic, applied));
+ }
+ }
+
+ @Parameters(commandDescription = "Remove the offload policies for a topic")
+ private class RemoveOffloadPolicies extends CliCommand {
+ @Parameter(description = "persistent://tenant/namespace/topic",
required = true)
+ private java.util.List<String> params;
+
+ @Parameter(names = { "--global", "-g" }, description = "Whether to
remove this policy globally. "
+ + "If set to true, the removing operation will be replicate to
other clusters asynchronously")
+ private boolean isGlobal = false;
+
+ @Override
+ void run() throws PulsarAdminException {
+ String persistentTopic = validatePersistentTopic(params);
+ getTopicPolicies(isGlobal).removeOffloadPolicies(persistentTopic);
+ }
+ }
+
+ @Parameters(commandDescription = "Set the offload policies for a topic")
+ private class SetOffloadPolicies extends CliCommand {
+ @Parameter(description = "persistent://tenant/namespace/topic",
required = true)
+ private java.util.List<String> params;
+
+ @Parameter(names = {"-d", "--driver"}, description = "ManagedLedger
offload driver", required = true)
+ private String driver;
+
+ @Parameter(names = {"-r", "--region"}
+ , description = "ManagedLedger offload region, s3 and
google-cloud-storage requires this parameter")
+ private String region;
+
+ @Parameter(names = {"-b", "--bucket"}
+ , description = "ManagedLedger offload bucket, s3 and
google-cloud-storage requires this parameter")
+ private String bucket;
+
+ @Parameter(names = {"-e", "--endpoint"}
+ , description = "ManagedLedger offload service endpoint, only
s3 requires this parameter")
+ private String endpoint;
+
+ @Parameter(names = {"-i", "--aws-id"}
+ , description = "AWS Credential Id to use when using driver S3
or aws-s3")
+ private String awsId;
+
+ @Parameter(names = {"-s", "--aws-secret"}
+ , description = "AWS Credential Secret to use when using
driver S3 or aws-s3")
+ private String awsSecret;
Review comment:
Maybe we can interact with the user, just like entering a password?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]