Update load balancer

@param loadBalancer load balancer
@param config load balancer config
@return OperationFuture wrapper for load balancer
325418
public OperationFuture<LoadBalancer> update(LoadBalancer loadBalancer, LoadBalancerConfig config) {
        LoadBalancerMetadata loadBalancerMetadata = findByRef(loadBalancer);

        loadBalancerClient.update(
            loadBalancerMetadata.getDataCenterId(),
            loadBalancerMetadata.getId(),
            new LoadBalancerRequest()
                .name(config.getName())
                .description(config.getDescription())
                .status(config.getStatus())
        );

        return new OperationFuture<>(
            loadBalancer,
            updateLoadBalancerPools(
                config,
                LoadBalancer.refById(
                    loadBalancerMetadata.getId(),
                    DataCenter.refById(loadBalancerMetadata.getDataCenterId())
                )
            )
        );
    }
184458
func (lbaas *LbaasV2) UpdateLoadBalancer(ctx context.Context, clusterName string, service *v1.Service, nodes []*v1.Node) error {
	loadBalancerName := lbaas.GetLoadBalancerName(ctx, clusterName, service)
	klog.V(4).Infof("UpdateLoadBalancer(%v, %v, %v)", clusterName, loadBalancerName, nodes)

	lbaas.opts.SubnetID = getStringFromServiceAnnotation(service, ServiceAnnotationLoadBalancerSubnetID, lbaas.opts.SubnetID)
	if len(lbaas.opts.SubnetID) == 0 && len(nodes) > 0 {
		// Get SubnetID automatically.
		// The LB needs to be configured with instance addresses on the same subnet, so get SubnetID by one node.
		subnetID, err := getSubnetIDForLB(lbaas.compute, *nodes[0])
		if err != nil {
			klog.Warningf("Failed to find subnet-id for loadbalancer service %s/%s: %v", service.Namespace, service.Name, err)
			return fmt.Errorf("no subnet-id for service %s/%s : subnet-id not set in cloud provider config, "+
				"and failed to find subnet-id from OpenStack: %v", service.Namespace, service.Name, err)
		}
		lbaas.opts.SubnetID = subnetID
	}

	ports := service.Spec.Ports
	if len(ports) == 0 {
		return fmt.Errorf("no ports provided to openstack load balancer")
	}

	loadbalancer, err := getLoadbalancerByName(lbaas.lb, loadBalancerName)
	if err != nil {
		return err
	}
	if loadbalancer == nil {
		return fmt.Errorf("loadbalancer %s does not exist", loadBalancerName)
	}

	// Get all listeners for this loadbalancer, by "port key".
	type portKey struct {
		Protocol listeners.Protocol
		Port     int
	}
	var listenerIDs []string
	lbListeners := make(map[portKey]listeners.Listener)
	allListeners, err := getListenersByLoadBalancerID(lbaas.lb, loadbalancer.ID)
	if err != nil {
		return fmt.Errorf("error getting listeners for LB %s: %v", loadBalancerName, err)
	}
	for _, l := range allListeners {
		key := portKey{Protocol: listeners.Protocol(l.Protocol), Port: l.ProtocolPort}
		lbListeners[key] = l
		listenerIDs = append(listenerIDs, l.ID)
	}

	// Get all pools for this loadbalancer, by listener ID.
	lbPools := make(map[string]v2pools.Pool)
	for _, listenerID := range listenerIDs {
		pool, err := getPoolByListenerID(lbaas.lb, loadbalancer.ID, listenerID)
		if err != nil {
			return fmt.Errorf("error getting pool for listener %s: %v", listenerID, err)
		}
		lbPools[listenerID] = *pool
	}

	// Compose Set of member (addresses) that _should_ exist
	addrs := make(map[string]*v1.Node)
	for _, node := range nodes {
		addr, err := nodeAddressForLB(node)
		if err != nil {
			return err
		}
		addrs[addr] = node
	}

	// Check for adding/removing members associated with each port
	for portIndex, port := range ports {
		// Get listener associated with this port
		listener, ok := lbListeners[portKey{
			Protocol: toListenersProtocol(port.Protocol),
			Port:     int(port.Port),
		}]
		if !ok {
			return fmt.Errorf("loadbalancer %s does not contain required listener for port %d and protocol %s", loadBalancerName, port.Port, port.Protocol)
		}

		// Get pool associated with this listener
		pool, ok := lbPools[listener.ID]
		if !ok {
			return fmt.Errorf("loadbalancer %s does not contain required pool for listener %s", loadBalancerName, listener.ID)
		}

		// Find existing pool members (by address) for this port
		getMembers, err := getMembersByPoolID(lbaas.lb, pool.ID)
		if err != nil {
			return fmt.Errorf("error getting pool members %s: %v", pool.ID, err)
		}
		members := make(map[string]v2pools.Member)
		for _, member := range getMembers {
			members[member.Address] = member
		}

		// Add any new members for this port
		for addr, node := range addrs {
			if _, ok := members[addr]; ok && members[addr].ProtocolPort == int(port.NodePort) {
				// Already exists, do not create member
				continue
			}
			_, err := v2pools.CreateMember(lbaas.lb, pool.ID, v2pools.CreateMemberOpts{
				Name:         fmt.Sprintf("member_%s_%d_%s", loadbalancer.Name, portIndex, node.Name),
				Address:      addr,
				ProtocolPort: int(port.NodePort),
				SubnetID:     lbaas.opts.SubnetID,
			}).Extract()
			if err != nil {
				return err
			}
			provisioningStatus, err := waitLoadbalancerActiveProvisioningStatus(lbaas.lb, loadbalancer.ID)
			if err != nil {
				return fmt.Errorf("failed to loadbalance ACTIVE provisioning status %v: %v", provisioningStatus, err)
			}
		}

		// Remove any old members for this port
		for _, member := range members {
			if _, ok := addrs[member.Address]; ok && member.ProtocolPort == int(port.NodePort) {
				// Still present, do not delete member
				continue
			}
			err = v2pools.DeleteMember(lbaas.lb, pool.ID, member.ID).ExtractErr()
			if err != nil && !isNotFound(err) {
				return err
			}
			provisioningStatus, err := waitLoadbalancerActiveProvisioningStatus(lbaas.lb, loadbalancer.ID)
			if err != nil {
				return fmt.Errorf("failed to loadbalance ACTIVE provisioning status %v: %v", provisioningStatus, err)
			}
		}
	}

	if lbaas.opts.ManageSecurityGroups {
		err := lbaas.updateSecurityGroup(clusterName, service, nodes, loadbalancer)
		if err != nil {
			return fmt.Errorf("failed to update Security Group for loadbalancer service %s/%s: %v", service.Namespace, service.Name, err)
		}
	}

	return nil
}
617316
def update_ssl_termination(self, loadbalancer, securePort=None, enabled=None,
            secureTrafficOnly=None):
        
        ssl_info = self.get_ssl_termination(loadbalancer)
        if not ssl_info:
            raise exc.NoSSLTerminationConfiguration("You must configure SSL "
                    "termination on this load balancer before attempting "
                    "to update it.")
        if securePort is None:
            securePort = ssl_info["securePort"]
        if enabled is None:
            enabled = ssl_info["enabled"]
        if secureTrafficOnly is None:
            secureTrafficOnly = ssl_info["secureTrafficOnly"]
        uri = "/loadbalancers/%s/ssltermination" % utils.get_id(loadbalancer)
        req_body = {"sslTermination": {
                "enabled": enabled,
                "secureTrafficOnly": secureTrafficOnly,
                "securePort": securePort,
                }}
        resp, body = self.api.method_put(uri, body=req_body)
        return body
504541
private OperationFuture<Group> createServers(GroupHierarchyConfig config, String rootGroupId) {
        List<CreateServerConfig> configs = config.getServerConfigs();

        List<JobFuture> futures = configs.stream()
            .map(serverConfig -> serverService().create(serverConfig).jobFuture())
            .collect(toList());

        return new OperationFuture<>(Group.refById(rootGroupId), new ParallelJobsFuture(futures));
    }
901628
public synchronized void updateFromConfiguration(CmsUgcConfiguration config) {

        m_enabled = config.needsQueue();
        m_interval = config.getQueueInterval().isPresent() ? config.getQueueInterval().get().longValue() : 0;
        m_maxLength = config.getMaxQueueLength().isPresent()
        ? config.getMaxQueueLength().get().intValue()
        : Integer.MAX_VALUE;
    }
1372490
func (s *LoadBalancerService) UpdateLoadBalancer(p *UpdateLoadBalancerParams) (*UpdateLoadBalancerResponse, error) {
	resp, err := s.cs.newRequest("updateLoadBalancer", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r UpdateLoadBalancerResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	// If we have a async client, we need to wait for the async result
	if s.cs.async {
		b, err := s.cs.GetAsyncJobResult(r.JobID, s.cs.timeout)
		if err != nil {
			if err == AsyncTimeoutErr {
				return &r, err
			}
			return nil, err
		}

		b, err = getRawValue(b)
		if err != nil {
			return nil, err
		}

		if err := json.Unmarshal(b, &r); err != nil {
			return nil, err
		}
	}

	return &r, nil
}
954988
public Future<T> doConfigurationUpdate(final ConfigurationRequest<T> configurationRequest) {
        Util.notNull(configurationRequest, "ConfigurationRequest passed to ConfigurationHandler");
        return executorService.submit(new Callable<T>() {
            public T call() throws Exception {
                try {
                    T conf = configurationRequest.invoke();
                    updateListenersWithNewConfiguration(conf);
                    return conf;
                } catch (Exception e) {
                    updateListenersWithFailure(e);
                    throw e;
                }
            }
        });
    }
784965
@Override
    public void setBypassLoadBalancer(boolean bypassLoadBalancer) {
    	if(logger.isDebugEnabled()) {
			logger.debug("setting bypassLoadBalancer: " + bypassLoadBalancer + " on the sip session " + key);
		}
        this.bypassLoadBalancer = bypassLoadBalancer;
    }
619076
@Deprecated
   public Class<? extends org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy> balancingStrategyClass() {
      FailoverRequestBalancingStrategy strategy = balancingStrategyFactory.get();
      if (org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy.class.isInstance(strategy)) {
         return (Class<? extends org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy>) strategy.getClass();
      } else {
         return org.infinispan.client.hotrod.impl.transport.tcp.FailoverRequestBalancingStrategy.class;
      }
   }
754823
public OperationFuture<Network> release(Network network, DataCenter dataCenter) {
        DataCenterMetadata dataCenterMetadata = dataCenterService.findByRef(dataCenter);
        NetworkMetadata networkMetadata = findByRef(network);

        networkClient.release(
            networkMetadata.getId(),
            dataCenterMetadata.getId()
        );

        return new OperationFuture<>(network, new NoWaitingJobFuture());
    }
1301803
def cli(env, identifier, allocation, port, routing_type, routing_method):
    """"""

    mgr = SoftLayer.LoadBalancerManager(env.client)

    _, loadbal_id = loadbal.parse_id(identifier)

    mgr.add_service_group(loadbal_id,
                          allocation=allocation,
                          port=port,
                          routing_type=routing_type,
                          routing_method=routing_method)

    env.fout('Load balancer service group is being added!')
824151
public OperationFuture<LoadBalancer> update(
        LoadBalancer loadBalancer, List<LoadBalancerPoolConfig> configs) {

        List<LoadBalancerPoolMetadata> poolsForGroup = find(
            new LoadBalancerPoolFilter().loadBalancers(loadBalancer)
        );

        return new OperationFuture<>(
            loadBalancer,
            new ParallelJobsFuture(
                configs.stream()
                    .map(poolConfig -> createOrUpdate(poolConfig, loadBalancer, poolsForGroup))
                    .map(OperationFuture::jobFuture)
                    .collect(toList())
            )
        );
    }
376417
public OperationFuture<ServerMetadata> create(CreateServerConfig config) {
        BaseServerResponse response = client.create(
            serverConverter.buildCreateServerRequest(
                config,
                config.getCustomFields().isEmpty() ?
                    null :
                    client.getCustomFields())
        );

        return postProcessBuildServerResponse(response, config);
    }
1276541
def load_balancer(service)
      load_balancer = service.load_balancers.first
      return unless load_balancer

      resp = elb.describe_target_groups(
        target_group_arns: [load_balancer.target_group_arn]
      )
      target_group = resp.target_groups.first
      load_balancer_arn = target_group.load_balancer_arns.first # assume first only

      resp = elb.describe_load_balancers(load_balancer_arns: [load_balancer_arn])
      resp.load_balancers.first
    end
524120
function (loadBalancer, callback) {
    var self = this,
        loadBalancerId =
          loadBalancer instanceof lb.LoadBalancer ? loadBalancer.id : loadBalancer;

    self._request({
      path: urlJoin(_urlPrefix, loadBalancerId, 'nodes')
    }, function (err, body, res) {
      if (err) {
        return callback(err);
      }

      else if (!body || !body.nodes) {
        return callback(new Error('Unexpected empty response'));
      }

      else {
        return callback(null, body.nodes.map(function (node) {
          return new lb.Node(self,
            _.extend(node, { loadBalancerId: loadBalancerId }));
        }), res);
      }
    });
  }
519484
public OperationFuture<List<Network>> update(List<Network> networkList, UpdateNetworkConfig config) {
        networkList.forEach(network -> update(network, config));

        return new OperationFuture<>(networkList, new NoWaitingJobFuture());
    }
725906
public OperationFuture<Group> modify(Group groupRef, GroupConfig groupConfig) {
        checkNotNull(groupConfig, "GroupConfig must be not null");
        checkNotNull(groupRef, "Group reference must be not null");
        updateGroup(idByRef(groupRef), groupConfig);

        return new OperationFuture<>(
            groupRef,
            new NoWaitingJobFuture()
        );
    }