lavocatt commented on code in PR #5407:
URL: https://github.com/apache/activemq-artemis/pull/5407#discussion_r1891504644


##########
artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/TokenReview.java:
##########
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.activemq.artemis.cli.commands;
+
+import 
org.apache.activemq.artemis.spi.core.security.jaas.kubernetes.client.KubernetesClient;
+import 
org.apache.activemq.artemis.spi.core.security.jaas.kubernetes.client.KubernetesClientImpl;
+import picocli.CommandLine;
+
+@CommandLine.Command(name = "token-review", description = "Perform a 
kubernetes token review")
+public class TokenReview extends InputAbstract {
+
+   @CommandLine.Option(names = "--kube-host", description = "hostname for 
kubernetes api server")
+   protected String host;
+
+   @CommandLine.Option(names = "--kube-port", description = "port for 
kubernetes api server")
+   protected String port;
+
+   @CommandLine.Option(names = "--token-path", description = "path to the 
token to access the kubernetes api server with access to token reviews")
+   protected String tokenPath;
+
+   @CommandLine.Option(names = "--ca-path", description = "path to the 
kubernetes api server trusted CAs")
+   protected String caPath;
+
+   @CommandLine.Option(names = "--token", description = "token to review")
+   protected String token;
+
+   @Override
+   public Object execute(ActionContext context) throws Exception {
+      super.execute(context);
+
+      context.out.println();
+      if (host == null) {
+         host = input("--kube-host", "What is the cluster host?", 
System.getProperty(KubernetesClientImpl.KUBERNETES_HOST));
+      }
+      if (port == null) {
+         port = input("--kube-port", "What is the cluster port?", 
System.getProperty(KubernetesClientImpl.KUBERNETES_PORT));
+      }
+      if (tokenPath == null) {
+         tokenPath = input("--token-path", "What is the token path?", 
System.getProperty(KubernetesClientImpl.KUBERNETES_TOKEN_PATH));
+      }
+      if (caPath == null) {
+         caPath = input("--ca-path", "What is the ca path?", 
System.getProperty(KubernetesClientImpl.KUBERNETES_CA_PATH));
+      }
+      if (token == null) {
+         token = input("--token", "What is the token?", "");
+      }

Review Comment:
   I've changed the behavior so that it takes the default values when needed.



-- 
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: gitbox-unsubscr...@activemq.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org
For additional commands, e-mail: gitbox-h...@activemq.apache.org
For further information, visit: https://activemq.apache.org/contact


Reply via email to