jdeppe-pivotal commented on a change in pull request #5226:
URL: https://github.com/apache/geode/pull/5226#discussion_r437475030



##########
File path: 
geode-redis/src/main/java/org/apache/geode/redis/internal/gfsh/RedisCommand.java
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.geode.redis.internal.gfsh;
+
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.management.cli.SingleGfshCommand;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
+import org.apache.geode.management.internal.functions.CliFunctionResult;
+
+public class RedisCommand extends SingleGfshCommand {
+  public static final String REDIS = "redis";
+  public static final String REDIS__HELP =
+      "Commands related to the Redis API for Geode.";
+  public static final String REDIS__ENABLE_UNSUPPORTED_COMMANDS = 
"enable-unsupported-commands";
+  public static final String REDIS__ENABLE_UNSUPPORTED_COMMANDS__HELP =
+      "Boolean value to determine "
+          + "whether or not to enable unsupported commands. Unsupported 
commands have not been fully tested.";
+
+  @CliCommand(value = {REDIS}, help = REDIS__HELP)
+  public ResultModel enableUnsupportedCommands(

Review comment:
       We should also add some security meta data here:
   ```
   @ResourceOperation(resource = ResourcePermission.Resource.DATA, operation = 
ResourcePermission.Operation.MANAGE);
   ```

##########
File path: 
geode-redis/src/main/java/org/apache/geode/redis/internal/gfsh/RedisCommandFunction.java
##########
@@ -0,0 +1,57 @@
+/*
+ * 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.geode.redis.internal.gfsh;
+
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.internal.functions.CliFunctionResult;
+import org.apache.geode.redis.internal.GeodeRedisService;
+
+public class RedisCommandFunction implements Function<Boolean> {

Review comment:
       For consistency with other cli-related functions we should `extend 
CliFunction` instead of `implements Function`. That class exposes an `execute` 
that just needs to return a `CliFunctionResult`. `CliFunction` also extends 
`InternalFunction` which is more secure (it cannot be user-invoked in any way - 
for example via gfsh).




----------------------------------------------------------------
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.

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


Reply via email to