Provides a way to modify the following attributes of a load balancer:
            - name
            - algorithm
            - protocol
            - halfClosed
            - port
            - timeout
            - httpsRedirect
778233
def update(self, name=None, algorithm=None, protocol=None, halfClosed=None,
            port=None, timeout=None, httpsRedirect=None):
        
        return self.manager.update(self, name=name, algorithm=algorithm,
                protocol=protocol, halfClosed=halfClosed, port=port,
                timeout=timeout, httpsRedirect=httpsRedirect)
1038559
def _modify(self, **patch):
        """"""
        if 'state' in patch:
            if patch['state'] not in ['user-up', 'user-down', 'unchecked', 'fqdn-up']:
                msg = "The node resource does not support a modify with the " \
                      "value of the 'state' attribute as %s. The accepted " \
                      "values are 'user-up', 'user-down', 'unchecked', or 'fqdn-up'" \
                      % patch['state']
                raise NodeStateModifyUnsupported(msg)
        if 'session' in patch:
            if patch['session'] not in ['user-enabled', 'user-disabled']:
                msg = "The node resource does not support a modify with the " \
                      "value of the 'session' attribute as %s. " \
                      "The accepted values are 'user-enabled' or " \
                      "'user-disabled'" % patch['session']
                raise NodeStateModifyUnsupported(msg)
        super(Node, self)._modify(**patch)
863639
def cli(env):
    """"""
    mgr = SoftLayer.LoadBalancerManager(env.client)

    routing_methods = mgr.get_routing_methods()
    table = formatting.KeyValueTable(['ID', 'Name'])
    table.align['ID'] = 'l'
    table.align['Name'] = 'l'
    table.sortby = 'ID'
    for routing_method in routing_methods:
        table.add_row([routing_method['id'], routing_method['name']])

    env.fout(table)
1140042
@Override
    public String serviceToUrl(String protocol, String serviceId, String tag, String requestKey) {
        URL url = loadBalance.select(discovery(protocol, serviceId, tag), requestKey);
        if(logger.isDebugEnabled()) logger.debug("final url after load balance = " + url);
        // construct a url in string
        return protocol + "://" + url.getHost() + ":" + url.getPort();
    }
1119584
function() {
    this.cantWebsocket = vAPI.cantWebsocket;
    this.reBadDomainOptChars = /[*+?^${}()[\]\\]/;
    this.reHostnameRule1 = /^[0-9a-z][0-9a-z.-]*[0-9a-z]$/i;
    this.reHostnameRule2 = /^[0-9a-z][0-9a-z.-]*[0-9a-z]\^?$/i;
    this.reCleanupHostnameRule2 = /\^$/g;
    this.reCanTrimCarets1 = /^[^*]*$/;
    this.reCanTrimCarets2 = /^\^?[^^]+[^^][^^]+\^?$/;
    this.reHasUppercase = /[A-Z]/;
    this.reIsolateHostname = /^(\*?\.)?([^\x00-\x24\x26-\x2C\x2F\x3A-\x5E\x60\x7B-\x7F]+)(.*)/;
    this.reHasUnicode = /[^\x00-\x7F]/;
    this.reWebsocketAny = /^ws[s*]?(?::\/?\/?)?\*?$/;
    this.reBadCSP = /(?:^|;)\s*report-(?:to|uri)\b/;
    this.domainOpt = '';
    this.noTokenHash = µb.urlTokenizer.noTokenHash;
    this.unsupportedTypeBit = this.bitFromType('unsupported');
    // All network request types to bitmap
    //   bring origin to 0 (from 4 -- see typeNameToTypeValue)
    //   left-shift 1 by the above-calculated value
    //   subtract 1 to set all type bits
    this.allNetRequestTypeBits = (1 << (otherTypeBitValue >>> 4)) - 1;
    this.reset();
}
510445
def p_ExtendedAttributeNamedArgList(p):
  
  p[0] = model.ExtendedAttribute(
    name=p[1],
    value=model.ExtendedAttributeValue(name=p[3], arguments=p[5]))
1213355
def format_load_balancer_configuration(result):
    '''
    
    '''
    from collections import OrderedDict
    # Only display parameters that have content
    order_dict = OrderedDict()
    if result.private_ip_address is not None:
        order_dict['privateIpAddress'] = format_private_ip_address(result.private_ip_address)
    if result.public_ip_address_resource_id is not None:
        order_dict['publicIpAddressResourceId'] = result.public_ip_address_resource_id
    if result.load_balancer_resource_id is not None:
        order_dict['loadBalancerResourceId'] = result.load_balancer_resource_id
    if result.probe_port is not None:
        order_dict['probePort'] = result.probe_port
    if result.sql_virtual_machine_instances is not None:
        order_dict['sqlVirtualMachineInstances'] = result.sql_virtual_machine_instances

    return order_dict
816833
def configure_attributes(self, json_data):
        
        env = boto3.session.Session(profile_name=self.env, region_name=self.region)
        elbclient = env.client('elb')

        elb_settings = self.properties['elb']
        LOG.debug('Block ELB Settings Pre Configure Load Balancer Attributes:\n%s', pformat(elb_settings))

        # FIXME: Determine why 'job' is not being used
        # pylint: disable=unused-variable
        for job in json.loads(json_data)['job']:
            load_balancer_attributes = {
                'CrossZoneLoadBalancing': {
                    'Enabled': True
                },
                'AccessLog': {
                    'Enabled': False,
                },
                'ConnectionDraining': {
                    'Enabled': False,
                },
                'ConnectionSettings': {
                    'IdleTimeout': 60
                }
            }
            if elb_settings.get('connection_draining_timeout'):
                connection_draining_timeout = int(elb_settings['connection_draining_timeout'])
                LOG.info('Applying Custom Load Balancer Connection Draining Timeout: %d', connection_draining_timeout)
                load_balancer_attributes['ConnectionDraining'] = {
                    'Enabled': True,
                    'Timeout': connection_draining_timeout
                }
            if elb_settings.get('idle_timeout'):
                idle_timeout = int(elb_settings['idle_timeout'])
                LOG.info('Applying Custom Load Balancer Idle Timeout: %d', idle_timeout)
                load_balancer_attributes['ConnectionSettings'] = {'IdleTimeout': idle_timeout}
            if elb_settings.get('access_log'):
                access_log_bucket_name = elb_settings['access_log']['bucket_name']
                access_log_bucket_prefix = elb_settings['access_log']['bucket_prefix']
                access_log_emit_interval = int(elb_settings['access_log']['emit_interval'])
                LOG.info('Applying Custom Load Balancer Access Log: %s/%s every %d minutes', access_log_bucket_name,
                         access_log_bucket_prefix, access_log_emit_interval)
                load_balancer_attributes['AccessLog'] = {
                    'Enabled': True,
                    'S3BucketName': access_log_bucket_name,
                    'EmitInterval': access_log_emit_interval,
                    'S3BucketPrefix': access_log_bucket_prefix
                }

            LOG.info('Applying Load Balancer Attributes')
            LOG.debug('Load Balancer Attributes:\n%s', pformat(load_balancer_attributes))
            elbclient.modify_load_balancer_attributes(
                LoadBalancerName=self.app, LoadBalancerAttributes=load_balancer_attributes)
1295839
function (options, callback) {
    var self = this,
        requestOptions = {
          path: _urlPrefix
    };

    if (typeof options === 'function') {
      callback = options;
      options = {};
    }

    self._request(requestOptions, function (err, body) {
      if (err) {
        return callback(err);
      }

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

      else {
        return callback(null, body.loadBalancers.map(function (loadBalancer) {
          return new lb.LoadBalancer(self, loadBalancer);
        }));
      }
    });
  }
274293
def add_conditional_headers(req, opts)

      # if path is cached send since and/or match

      e = @cache[opts[:c_uri]]

      return unless e # not cached

      req['If-Modified-Since'] = e.lastmod if e.lastmod
      req['If-None-Match'] = e.etag if e.etag

      opts[:c_cached] = e
    end
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
911366
def Modify(self, user_type=None, password=None):
    """"""

    args = user_management_pb2.ApiModifyGrrUserArgs(
        username=self.username, user_type=user_type)

    if user_type is not None:
      args.user_type = user_type

    if password is not None:
      args.password = password

    data = self._context.SendRequest("ModifyGrrUser", args)
    return GrrUser(data=data, context=self._context)
1048387
def set_connection_logging(self, loadbalancer, val):
        
        uri = "/loadbalancers/%s/connectionlogging" % utils.get_id(loadbalancer)
        val = str(val).lower()
        req_body = {"connectionLogging": {
                "enabled": val,
                }}
        resp, body = self.api.method_put(uri, body=req_body)
        return body
885549
def modify_network_interface
      @hosts.each do |host|
        instance = host['instance']
        host['sg_cidr_ips'] = host['sg_cidr_ips'] || '0.0.0.0/0';
        sg_cidr_ips = host['sg_cidr_ips'].split(',')

        # Define tags for the instance
        @logger.notify("aws-sdk: Update network_interface for #{host.name}")

        security_group = ensure_group(instance[:network_interfaces].first, Beaker::EC2Helper.amiports(host), sg_cidr_ips)
        ping_security_group = ensure_ping_group(instance[:network_interfaces].first, sg_cidr_ips)

        client.modify_network_interface_attribute(
          :network_interface_id => "#{instance[:network_interfaces].first[:network_interface_id]}",
          :groups => [security_group.group_id, ping_security_group.group_id],
        )
      end

      nil
    end
929160
def set_metadata(self, loadbalancer, metadata, node=None):
        
        # Delete any existing metadata
        self.delete_metadata(loadbalancer, node=node)
        # Convert the metadata dict into the list format
        metadata_list = [{"key": key, "value": val}
                for key, val in metadata.items()]
        if node:
            uri = "/loadbalancers/%s/nodes/%s/metadata" % (
                    utils.get_id(loadbalancer), utils.get_id(node))
        else:
            uri = "/loadbalancers/%s/metadata" % utils.get_id(loadbalancer)
        req_body = {"metadata": metadata_list}
        resp, body = self.api.method_post(uri, body=req_body)
        return body
1019992
def modify_network_interface_attribute(
        name=None, network_interface_id=None, attr=None,
        value=None, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    if not (name or network_interface_id):
        raise SaltInvocationError(
            'Either name or network_interface_id must be provided.'
        )
    if attr is None and value is None:
        raise SaltInvocationError(
            'attr and value must be provided.'
        )
    r = {}
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    result = _get_network_interface(conn, name, network_interface_id)
    if 'error' in result:
        return result
    eni = result['result']
    info = _describe_network_interface(eni)
    network_interface_id = info['id']
    # munge attr into what the API requires
    if attr == 'groups':
        _attr = 'groupSet'
    elif attr == 'source_dest_check':
        _attr = 'sourceDestCheck'
    elif attr == 'delete_on_termination':
        _attr = 'deleteOnTermination'
    else:
        _attr = attr
    _value = value
    if info.get('vpc_id') and _attr == 'groupSet':
        _value = __salt__['boto_secgroup.convert_to_group_ids'](
            value, vpc_id=info.get('vpc_id'), region=region, key=key,
            keyid=keyid, profile=profile
        )
        if not _value:
            r['error'] = {
                'message': ('Security groups do not map to valid security'
                            ' group ids')
            }
            return r
    _attachment_id = None
    if _attr == 'deleteOnTermination':
        try:
            _attachment_id = info['attachment']['id']
        except KeyError:
            r['error'] = {
                'message': ('No attachment id found for this ENI. The ENI must'
                            ' be attached before delete_on_termination can be'
                            ' modified')
            }
            return r
    try:
        r['result'] = conn.modify_network_interface_attribute(
            network_interface_id, _attr, _value, attachment_id=_attachment_id
        )
    except boto.exception.EC2ResponseError as e:
        r['error'] = __utils__['boto.get_error'](e)
    return r
909537
def _handle_salt_host_resource(resource):
    '''
    
    '''
    ret = {}
    attrs = resource.get('primary', {}).get('attributes', {})
    ret[MINION_ID] = attrs.get(MINION_ID)
    valid_attrs = set(attrs.keys()).intersection(TF_ROSTER_ATTRS.keys())
    for attr in valid_attrs:
        ret[attr] = _cast_output_to_type(attrs.get(attr), TF_ROSTER_ATTRS.get(attr))
    return ret