You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/11/10 12:55:03 UTC

[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #4141: [New feature] Load balancer customization (haproxy-based)

sureshanaparti commented on a change in pull request #4141:
URL: https://github.com/apache/cloudstack/pull/4141#discussion_r520539831



##########
File path: api/src/main/java/org/apache/cloudstack/api/command/user/loadbalancer/ReplaceLoadBalancerConfigsCmd.java
##########
@@ -0,0 +1,182 @@
+// 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.cloudstack.api.command.user.loadbalancer;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.FirewallRuleResponse;
+import org.apache.cloudstack.api.response.NetworkResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.VpcResponse;
+import org.apache.cloudstack.network.lb.LoadBalancerConfig;
+import org.apache.commons.collections.MapUtils;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.network.Network;
+import com.cloud.network.vpc.Vpc;
+
+@APICommand(name = "replaceLoadBalancerConfigs", description = "Replaces load balancer configs of vpc/network/rule",
+        responseObject = SuccessResponse.class,
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        since = "4.15",
+        authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User})
+public class ReplaceLoadBalancerConfigsCmd extends BaseAsyncCmd {
+    public static final Logger LOGGER = Logger.getLogger(ReplaceLoadBalancerConfigsCmd.class.getName());
+    private static final String s_name = "replaceloadbalancerconfigsresponse";
+
+    /////////////////////////////////////////////////////
+    //////////////// API parameters /////////////////////
+    /////////////////////////////////////////////////////
+
+    @Parameter(name = ApiConstants.SCOPE,
+               type = CommandType.STRING,
+               required = true,
+               description = "the scope of the config: network, vpc or rule")
+    private String scope;
+
+    @Parameter(name = ApiConstants.NETWORK_ID,
+               type = CommandType.UUID,
+               entityType = NetworkResponse.class,
+               description = "the ID of network to update")
+    private Long networkId;
+
+    @Parameter(name = ApiConstants.VPC_ID,
+               type = CommandType.UUID,
+               entityType = VpcResponse.class,
+               description = "the ID of vpc to update")
+    private Long vpcId;
+
+    @Parameter(name = ApiConstants.LOAD_BALANCER_ID,
+               type = CommandType.UUID,
+               entityType = FirewallRuleResponse.class,
+               description = "the ID of the load balancer rule to update")
+    private Long loadBalancerId;
+
+    @Parameter(name = ApiConstants.CONFIG,
+               type = CommandType.MAP,
+               description = "configs list, Example: config[0].name=timout&config[0].value=60000")

Review comment:
       Map here can take key and value inputs, for example config[0].timeout=60000. no need to explicitly mark name/key & value.




----------------------------------------------------------------
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:
users@infra.apache.org