[ 
https://issues.apache.org/jira/browse/GEODE-8272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17139904#comment-17139904
 ] 

ASF GitHub Bot commented on GEODE-8272:
---------------------------------------

jinmeiliao commented on a change in pull request #5249:
URL: https://github.com/apache/geode/pull/5249#discussion_r442418701



##########
File path: 
geode-management/src/main/java/org/apache/geode/management/operation/RestoreRedundancyRequest.java
##########
@@ -0,0 +1,123 @@
+/*
+ * 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.management.operation;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+import org.apache.geode.annotations.Experimental;
+import org.apache.geode.management.api.ClusterManagementOperation;
+import org.apache.geode.management.runtime.RestoreRedundancyResults;
+
+/**
+ * Defines a distributed system request to optimize bucket allocation across 
members.
+ */
+@Experimental
+public class RestoreRedundancyRequest
+    implements ClusterManagementOperation<RestoreRedundancyResults> {
+
+  /**
+   * see {@link #getEndpoint()}
+   */
+  public static final String RESTORE_REDUNDANCY_REBALANCE_ENDPOINT =
+      "/operations/restoreRedundancy";
+  // null means all regions included
+  private List<String> includeRegions;
+  // null means don't exclude any regions
+  private List<String> excludeRegions;
+  private boolean reassignPrimaries = true;
+  private String operator;
+
+  /**
+   * by default, requests all partitioned regions to be rebalanced
+   */
+  public RestoreRedundancyRequest() {}
+
+  /**
+   * copy constructor
+   */
+  public RestoreRedundancyRequest(
+      RestoreRedundancyRequest other) {
+    this.setExcludeRegions(other.getExcludeRegions());
+    this.setIncludeRegions(other.getIncludeRegions());
+    this.setReassignPrimaries(other.getReassignPrimaries());
+    this.operator = other.getOperator();
+  }
+
+  /***
+   * Returns the list of regions to be rebalanced (or an empty list for 
all-except-excluded)
+   */
+  public List<String> getIncludeRegions() {
+    return includeRegions;
+  }
+
+  /**
+   * requests rebalance of the specified region(s) only. When at least one 
region is specified, this
+   * takes precedence over any excluded regions.
+   */
+  public void setIncludeRegions(List<String> includeRegions) {
+    this.includeRegions = includeRegions;
+  }
+
+  /***
+   * Returns the list of regions NOT to be rebalanced (iff {@link 
#getIncludeRegions()} is empty)
+   */
+  public List<String> getExcludeRegions() {
+    return excludeRegions;
+  }
+
+  /**
+   * excludes specific regions from the rebalance, if {@link 
#getIncludeRegions()} is empty,
+   * otherwise has no effect
+   * default: no regions are excluded
+   */
+  public void setExcludeRegions(List<String> excludeRegions) {
+    this.excludeRegions = excludeRegions;
+  }
+
+  public void setReassignPrimaries(boolean reassignPrimaries) {
+    this.reassignPrimaries = reassignPrimaries;
+  }
+
+  public boolean getReassignPrimaries() {
+    return reassignPrimaries;
+  }
+
+  @Override
+  @JsonIgnore
+  public String getEndpoint() {
+    return RESTORE_REDUNDANCY_REBALANCE_ENDPOINT;
+  }
+
+  @Override
+  public String getOperator() {
+    return operator;
+  }
+
+  public void setOperator(String operator) {

Review comment:
       I believe you will need to set the operator in the controller, just like 
what the rebalance did




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


> Refactor GFSH Restore Redundancy Command code to allow for REST API
> -------------------------------------------------------------------
>
>                 Key: GEODE-8272
>                 URL: https://issues.apache.org/jira/browse/GEODE-8272
>             Project: Geode
>          Issue Type: Bug
>          Components: gfsh
>            Reporter: Mark Hanson
>            Assignee: Mark Hanson
>            Priority: Major
>
> Refactor GFSH Restore Redundancy Command code to allow for REST API
>  
> The core code path is specific to GFSH right now and needs a few changes to 
> support the REST API command.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to