Update load balancer pool

@param loadBalancerPool load balancer pool
@param config load balancer pool config
@return OperationFuture wrapper for load balancer pool
764370
public OperationFuture<LoadBalancerPool> update(LoadBalancerPool loadBalancerPool, LoadBalancerPoolConfig config) {
        LoadBalancerPoolMetadata loadBalancerPoolMetadata = findByRef(loadBalancerPool);

        loadBalancerPoolClient.update(
            loadBalancerPoolMetadata.getDataCenterId(),
            loadBalancerPoolMetadata.getLoadBalancerId(),
            loadBalancerPoolMetadata.getId(),
            new LoadBalancerPoolRequest()
                .method(config.getMethod())
                .persistence(config.getPersistence())
        );

        return new OperationFuture<>(
            loadBalancerPool,
            addLoadBalancerNodes(config, loadBalancerPool)
        );
    }
519484
public OperationFuture<List<Network>> update(List<Network> networkList, UpdateNetworkConfig config) {
        networkList.forEach(network -> update(network, config));

        return new OperationFuture<>(networkList, new NoWaitingJobFuture());
    }
927287
private void scheduleRebalancing() {
      int interval = config.autoRebalanceInterval;
      Runnable runRebalance = new Runnable() {
          @Override
          public void run() {
              try {
                  rebalance();
              } catch (Exception e) {
                  LOG.error("Error running auto-rebalance.", e);
              }
          }
      };

      autoRebalanceFuture = pool.get().scheduleAtFixedRate(runRebalance, interval, interval, TimeUnit.SECONDS);
    }
756348
public UpdateResponse updateFlowConfig(FlowId flowId, FlowConfig flowConfig) throws FlowConfigLoggedException {
    return updateFlowConfig(flowId, flowConfig, true);
  }
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;
                }
            }
        });
    }
64062
def add_pool_member(lb, name, port, pool_name):
    '''
    
    '''
    if __opts__['load_balancers'].get(lb, None):
        (username, password) = list(__opts__['load_balancers'][lb].values())
    else:
        raise Exception('Unable to find `{0}` load balancer'.format(lb))
    F5 = F5Mgmt(lb, username, password)
    F5.add_pool_member(name, port, pool_name)
    return True
9486
@Nullable
  ConfigOrError selectLoadBalancerPolicy(Map<String, ?> serviceConfig) {
    try {
      List<LbConfig> loadBalancerConfigs = null;
      if (serviceConfig != null) {
        List<Map<String, ?>> rawLbConfigs =
            ServiceConfigUtil.getLoadBalancingConfigsFromServiceConfig(serviceConfig);
        loadBalancerConfigs = ServiceConfigUtil.unwrapLoadBalancingConfigList(rawLbConfigs);
      }
      if (loadBalancerConfigs != null && !loadBalancerConfigs.isEmpty()) {
        List<String> policiesTried = new ArrayList<>();
        for (LbConfig lbConfig : loadBalancerConfigs) {
          String policy = lbConfig.getPolicyName();
          LoadBalancerProvider provider = registry.getProvider(policy);
          if (provider == null) {
            policiesTried.add(policy);
          } else {
            return ConfigOrError.fromConfig(new PolicySelection(
                provider,
                /* serverList= */ null,
                lbConfig.getRawConfigValue()));
          }
        }
        return ConfigOrError.fromError(
            Status.UNKNOWN.withDescription(
                "None of " + policiesTried + " specified by Service Config are available."));
      }
      return null;
    } catch (RuntimeException e) {
      return ConfigOrError.fromError(
          Status.UNKNOWN.withDescription("can't parse load balancer configuration").withCause(e));
    }
  }
767995
public void setLoadBalancers(java.util.Collection<LoadBalancerState> loadBalancers) {
        if (loadBalancers == null) {
            this.loadBalancers = null;
            return;
        }

        this.loadBalancers = new com.amazonaws.internal.SdkInternalList<LoadBalancerState>(loadBalancers);
    }
749174
public OperationFuture<Server> modify(Server server, ModifyServerConfig modifyServerConfig) {
        List<ModifyServerRequest> request = serverConverter.buildModifyServerRequest(modifyServerConfig,
            modifyServerConfig.getCustomFields().isEmpty() ? null : client.getCustomFields());

        Link response = client.modify(idByRef(server), request);

        OperationFuture<Server> modifyServerFuture;

        if (response == null) {
            modifyServerFuture = new OperationFuture<>(
                server,
                new NoWaitingJobFuture()
            );
        } else {
            modifyServerFuture = new OperationFuture<>(
                server,
                response.getId(),
                queueClient
            );
        }

        if (modifyServerConfig.getMachineConfig() != null &&
            modifyServerConfig.getMachineConfig().getAutoscalePolicy() != null) {

            return new OperationFuture<>(
                server,
                new ParallelJobsFuture(
                    modifyServerFuture.jobFuture(),
                    autoscalePolicyServiceSupplier.get().setAutoscalePolicyOnServer(
                        modifyServerConfig.getMachineConfig().getAutoscalePolicy(), server
                    ).jobFuture()
                )
            );
        }

        return modifyServerFuture;
    }
1181407
private List<LoadBalancer> findLoadBalancers(@Nullable String loadBalancerId) throws CloudException, InternalException {
        APITrace.begin(getProvider(), "LB.listLoadBalancers");
        try {
            // get all vips, optionally filtered by lbId
            List<JSONObject> listeners = findAllVips(loadBalancerId);

            // get all members, optionally filtered by lbId
            List<JSONObject> members = findAllMembers(loadBalancerId);

            NovaMethod method = new NovaMethod(getProvider());
            // Unlike Horizon the OS LB API returns all tenants' load balancers, so we must filter
            JSONObject result = method.getNetworks(getLoadBalancersResource(), loadBalancerId, false, "?tenant_id="+getContext().getAccountNumber());
            List<LoadBalancer> results = new ArrayList<LoadBalancer>();
            if( loadBalancerId == null && result != null && result.has("pools") ) {
                try {
                    JSONArray loadbalancers = result.getJSONArray("pools");
                    for( int i = 0; i < loadbalancers.length(); i++ ) {
                        JSONObject lb = loadbalancers.getJSONObject(i);
                        results.add(toLoadBalancer(lb, listeners, members));
                    }
                }
                catch( JSONException e ) {
                    logger.error("Unable to understand listPools response: " + e.getMessage());
                    throw new CloudException(e);
                }
            }
            else if( result != null && result.has("pool")) {
                try {
                    return Collections.singletonList(toLoadBalancer(result.getJSONObject("pool"), listeners, members));
                }
                catch( JSONException e ) {
                    logger.error("Unable to understand getPool response: " + e.getMessage());
                    throw new CloudException(e);
                }
            }

            return results;
        }
        finally {
            APITrace.end();
        }
    }
830052
public OperationFuture<List<LoadBalancer>> delete(List<LoadBalancer> loadBalancerList) {
        List<JobFuture> jobs =
            loadBalancerList
                .stream()
                .map(reference -> delete(reference).jobFuture())
                .collect(toList());

        return new OperationFuture<>(
            loadBalancerList,
            new ParallelJobsFuture(jobs)
        );
    }
1195223
@SuppressWarnings("deprecation")
	OperationalConfig buildOperationalConfig() {
		return new OperationalConfigImpl(isAsync(), getProperties(), getSessionTimeout(), getThreadPoolSize(), isTransportModeLoggingOnly(), isDebugLogging(),
				getSslHostsToTrust(), isTrustAllSSLHost());
	}
165924
private void reloadPoolsConfig()
      throws IOException, SAXException, ParserConfigurationException {
    if (poolsConfigFileName == null) {
      return;
    }
    Set<String> newPoolGroupNameSet = new HashSet<String>();
    Set<PoolInfo> newPoolInfoSet = new HashSet<PoolInfo>();
    TypePoolGroupNameMap<Integer> newTypePoolNameGroupToMax =
        new TypePoolGroupNameMap<Integer>();
    TypePoolGroupNameMap<Integer> newTypePoolNameGroupToMin =
        new TypePoolGroupNameMap<Integer>();
    TypePoolInfoMap<Integer> newTypePoolInfoToMax =
        new TypePoolInfoMap<Integer>();
    TypePoolInfoMap<Integer> newTypePoolInfoToMin =
        new TypePoolInfoMap<Integer>();
    Map<PoolInfo, ScheduleComparator> newPoolInfoToComparator =
        new HashMap<PoolInfo, ScheduleComparator>();
    Map<PoolInfo, Double> newPoolInfoToWeight =
        new HashMap<PoolInfo, Double>();
    Map<PoolInfo, Integer> newPoolInfoToPriority =
        new HashMap<PoolInfo, Integer>();
    Map<PoolInfo, String> newPoolInfoToWhitelist = 
        new HashMap<PoolInfo, String>();

    Map<PoolInfo, PoolInfo> newJobExceedsLimitPoolRedirect = new HashMap<PoolInfo, PoolInfo>();
    Map<PoolInfo, Long> newPoolJobSizeLimit = new HashMap<PoolInfo, Long>();

    Element root = getRootElement(poolsConfigFileName);
    NodeList elements = root.getChildNodes();
    for (int i = 0; i < elements.getLength(); ++i) {
      Node node = elements.item(i);
      if (!(node instanceof Element)) {
        continue;
      }
      Element element = (Element) node;
      if (matched(element, GROUP_TAG_NAME)) {
        String groupName = element.getAttribute(NAME_ATTRIBUTE);
        if (!newPoolGroupNameSet.add(groupName)) {
          LOG.debug("Already added group " + groupName);
        }
        NodeList groupFields = element.getChildNodes();
        for (int j = 0; j < groupFields.getLength(); ++j) {
          Node groupNode = groupFields.item(j);
          if (!(groupNode instanceof Element)) {
            continue;
          }
          Element field = (Element) groupNode;
          for (ResourceType type : TYPES) {
            if (matched(field, MIN_TAG_NAME_PREFIX + type)) {
              int val = Integer.parseInt(getText(field));
              newTypePoolNameGroupToMin.put(type, groupName, val);
            }
            if (matched(field, MAX_TAG_NAME_PREFIX + type)) {
              int val = Integer.parseInt(getText(field));
              newTypePoolNameGroupToMax.put(type, groupName, val);
            }
          }
          if (matched(field,REDIRECT_JOB_WITH_LIMIT)){
            loadPoolInfoToRedirect(groupName,
                                  field.getAttribute(SOURCE_ATTRIBUTE),
                                  field.getAttribute(DESTINATION_ATTRIBUTE),
                                  field.getAttribute(JOB_INPUT_SIZE_LIMIT_ATTRIBUTE),
                                  newJobExceedsLimitPoolRedirect,
                                  newPoolJobSizeLimit);
          }
          if (matched(field, POOL_TAG_NAME)) {
            PoolInfo poolInfo = new PoolInfo(groupName,
                                             field.getAttribute("name"));
            if (!newPoolInfoSet.add(poolInfo)) {
              LOG.warn("Already added pool info " + poolInfo);
            }
            NodeList poolFields = field.getChildNodes();
            for (int k = 0; k < poolFields.getLength(); ++k) {
              Node poolNode = poolFields.item(k);
              if (!(poolNode instanceof Element)) {
                continue;
              }
              Element poolField = (Element) poolNode;
              for (ResourceType type : TYPES) {
                if (matched(poolField, MIN_TAG_NAME_PREFIX + type)) {
                  int val = Integer.parseInt(getText(poolField));
                  newTypePoolInfoToMin.put(type, poolInfo, val);
                }
                if (matched(poolField, MAX_TAG_NAME_PREFIX + type)) {
                  int val = Integer.parseInt(getText(poolField));
                  newTypePoolInfoToMax.put(type, poolInfo, val);
                }
              }
              if (matched(poolField, PREEMPTABILITY_MODE_TAG_NAME)) {
                boolean val = Boolean.parseBoolean(getText(poolField));
                if (!val) {
                  nonPreemptablePools.add(poolInfo);
                }
              }
              if (matched(poolField, REQUEST_MAX_MODE_TAG_NAME)) {
                boolean val = Boolean.parseBoolean(getText(poolField));
                if (val) {
                  requestMaxPools.add(poolInfo);
                }
              }
              if (matched(poolField, SCHEDULING_MODE_TAG_NAME)) {
                ScheduleComparator val =
                    ScheduleComparator.valueOf(getText(poolField));
                newPoolInfoToComparator.put(poolInfo, val);
              }
              if (matched(poolField, WEIGHT_TAG_NAME)) {
                double val = Double.parseDouble(getText(poolField));
                newPoolInfoToWeight.put(poolInfo, val);
              }
              if (matched(poolField, PRIORITY_TAG_NAME)) {
                int val = Integer.parseInt(getText(poolField));
                newPoolInfoToPriority.put(poolInfo, val);
              }
              if (matched(poolField, WHITELIST_TAG_NAME)) {
                newPoolInfoToWhitelist.put(poolInfo, getText(poolField));
              }
            }
          }
        }
      }
    }
    synchronized (this) {
      this.poolGroupNameSet = newPoolGroupNameSet;
      this.poolInfoSet = Collections.unmodifiableSet(newPoolInfoSet);
      this.typePoolGroupNameToMax = newTypePoolNameGroupToMax;
      this.typePoolGroupNameToMin = newTypePoolNameGroupToMin;
      this.typePoolInfoToMax = newTypePoolInfoToMax;
      this.typePoolInfoToMin = newTypePoolInfoToMin;
      this.poolInfoToComparator = newPoolInfoToComparator;
      this.poolInfoToWeight = newPoolInfoToWeight;
      this.poolInfoToPriority = newPoolInfoToPriority;
      this.poolInfoToWhitelist = newPoolInfoToWhitelist;
      this.jobExceedsLimitPoolRedirect = newJobExceedsLimitPoolRedirect;
      this.poolJobSizeLimit = newPoolJobSizeLimit;
    }
  }
376417
public OperationFuture<ServerMetadata> create(CreateServerConfig config) {
        BaseServerResponse response = client.create(
            serverConverter.buildCreateServerRequest(
                config,
                config.getCustomFields().isEmpty() ?
                    null :
                    client.getCustomFields())
        );

        return postProcessBuildServerResponse(response, config);
    }
504466
@Override
    public java.util.concurrent.Future<DescribeLoadBalancersResult> describeLoadBalancersAsync(
            com.amazonaws.handlers.AsyncHandler<DescribeLoadBalancersRequest, DescribeLoadBalancersResult> asyncHandler) {

        return describeLoadBalancersAsync(new DescribeLoadBalancersRequest(), asyncHandler);
    }
622451
public OperationFuture<ServerMetadata> importServer(ImportServerConfig config) {
        BaseServerResponse response = client.importServer(
            serverConverter.buildImportServerRequest(
                config,
                config.getCustomFields().isEmpty() ?
                    null :
                    client.getCustomFields()
            )
        );

        return postProcessBuildServerResponse(response, config);
    }
169832
public OperationFuture<List<Network>> update(NetworkFilter filter, UpdateNetworkConfig config) {
        checkFilter(filter);

        List<Network> networkList = findLazy(filter)
            .map(metadata -> Network.refById(metadata.getId()))
            .collect(toList());

        return update(networkList, config);
    }