//
// GET /api/bindings/{vhost}
//
// ListBindingsIn returns all bindings in a virtual host.
161167
func (c *Client) ListBindingsIn(vhost string) (rec []BindingInfo, err error) {
	return c.listBindingsVia("bindings/" + PathEscape(vhost))
}
133594
func (s roleBindingNamespaceLister) List(selector labels.Selector) (ret []*v1.RoleBinding, err error) {
	err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
		ret = append(ret, m.(*v1.RoleBinding))
	})
	return ret, err
}
1246467
func (a *Application) EndpointBindings() (map[string]string, error) {
	// We don't need the TxnRevno below.
	bindings, _, err := readEndpointBindings(a.st, a.globalKey())
	if err != nil && !errors.IsNotFound(err) {
		return nil, errors.Trace(err)
	}
	if bindings == nil {
		bindings, err = a.defaultEndpointBindings()
		if err != nil {
			return nil, errors.Trace(err)
		}
	}
	return bindings, nil
}
1154837
func (s *VPCService) ListVPCOfferings(p *ListVPCOfferingsParams) (*ListVPCOfferingsResponse, error) {
	resp, err := s.cs.newRequest("listVPCOfferings", p.toURLValues())
	if err != nil {
		return nil, err
	}

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

	return &r, nil
}
521564
func (r Network_SecurityGroup) GetOrderBindings() (resp []datatypes.Network_SecurityGroup_OrderBinding, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_SecurityGroup", "getOrderBindings", nil, &r.Options, &resp)
	return
}
1330071
func NewBindingsV1(locals *ast.ValueMap) (result []*BindingV1) {
	result = make([]*BindingV1, 0, locals.Len())
	locals.Iter(func(key, value ast.Value) bool {
		result = append(result, &BindingV1{
			Key:   &ast.Term{Value: key},
			Value: &ast.Term{Value: value},
		})
		return false
	})
	return result
}
153386
func listVLANs(c context.Context, ids map[int64]struct{}, aliases stringset.Set) ([]*crimson.VLAN, error) {
	db := database.Get(c)
	rows, err := db.QueryContext(c, `
		SELECT id, alias, state, cidr_block
		FROM vlans
	`)
	if err != nil {
		return nil, errors.Annotate(err, "failed to fetch VLANs").Err()
	}
	defer rows.Close()

	var vlans []*crimson.VLAN
	for rows.Next() {
		vlan := &crimson.VLAN{}
		if err = rows.Scan(&vlan.Id, &vlan.Alias, &vlan.State, &vlan.CidrBlock); err != nil {
			return nil, errors.Annotate(err, "failed to fetch VLAN").Err()
		}
		// VLAN may match either the given IDs or aliases.
		// If both IDs and aliases are empty, consider all VLANs to match.
		if _, ok := ids[vlan.Id]; ok || aliases.Has(vlan.Alias) || (len(ids) == 0 && aliases.Len() == 0) {
			vlans = append(vlans, vlan)
		}
	}
	return vlans, nil
}
731575
func (o *L2Domain) Applicationperformancemanagementbindings(info *bambou.FetchingInfo) (ApplicationperformancemanagementbindingsList, *bambou.Error) {

	var list ApplicationperformancemanagementbindingsList
	err := bambou.CurrentSession().FetchChildren(o, ApplicationperformancemanagementbindingIdentity, &list, info)
	return list, err
}
645705
func Convert_authorization_RoleBindingList_To_v1_RoleBindingList(in *authorization.RoleBindingList, out *v1.RoleBindingList, s conversion.Scope) error {
	return autoConvert_authorization_RoleBindingList_To_v1_RoleBindingList(in, out, s)
}
927383
func (client *Client) GetServiceBindings(filters ...Filter) ([]ServiceBinding, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetServiceBindingsRequest,
		Query:       ConvertFilterParameters(filters),
	})
	if err != nil {
		return nil, nil, err
	}

	var fullBindingsList []ServiceBinding
	warnings, err := client.paginate(request, ServiceBinding{}, func(item interface{}) error {
		if binding, ok := item.(ServiceBinding); ok {
			fullBindingsList = append(fullBindingsList, binding)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   ServiceBinding{},
				Unexpected: item,
			}
		}
		return nil
	})

	return fullBindingsList, warnings, err
}
433289
func listHosts(alias string) {
	conf, err := loadMcConfig()
	fatalIf(err.Trace(globalMCConfigVersion), "Unable to load config version `"+globalMCConfigVersion+"`.")

	// If specific alias is requested, look for it and print.
	if alias != "" {
		if v, ok := conf.Hosts[alias]; ok {
			printHosts(hostMessage{
				op:          "list",
				prettyPrint: false,
				Alias:       alias,
				URL:         v.URL,
				AccessKey:   v.AccessKey,
				SecretKey:   v.SecretKey,
				API:         v.API,
				Lookup:      v.Lookup,
			})
			return
		}
		fatalIf(errInvalidAliasedURL(alias), "No such alias `"+alias+"` found.")
	}

	var hosts []hostMessage
	for k, v := range conf.Hosts {
		hosts = append(hosts, hostMessage{
			op:          "list",
			prettyPrint: true,
			Alias:       k,
			URL:         v.URL,
			AccessKey:   v.AccessKey,
			SecretKey:   v.SecretKey,
			API:         v.API,
			Lookup:      v.Lookup,
		})
	}

	// Sort hosts by alias names lexically.
	sort.Sort(byAlias(hosts))

	// Display all the hosts.
	printHosts(hosts...)
}
289137
func ListObjectNames(mapper apimeta.RESTMapper, client dynamic.Interface, namespace string, selector labels.Selector, info provider.CustomMetricInfo) ([]string, error) {
	res, err := ResourceFor(mapper, info)
	if err != nil {
		return nil, err
	}

	var resClient dynamic.ResourceInterface
	if info.Namespaced {
		resClient = client.Resource(res).Namespace(namespace)
	} else {
		resClient = client.Resource(res)
	}

	matchingObjectsRaw, err := resClient.List(metav1.ListOptions{LabelSelector: selector.String()})
	if err != nil {
		return nil, err
	}

	if !apimeta.IsListType(matchingObjectsRaw) {
		return nil, fmt.Errorf("result of label selector list operation was not a list")
	}

	var names []string
	err = apimeta.EachListItem(matchingObjectsRaw, func(item runtime.Object) error {
		objName := item.(*unstructured.Unstructured).GetName()
		names = append(names, objName)
		return nil
	})
	if err != nil {
		return nil, err
	}

	return names, nil
}
585888
func (vm VirtualMachine) ListRequest() (ListCommand, error) {
	// XXX: AffinityGroupID, SecurityGroupID

	req := &ListVirtualMachines{
		GroupID:    vm.GroupID,
		ID:         vm.ID,
		Name:       vm.Name,
		State:      vm.State,
		TemplateID: vm.TemplateID,
		ZoneID:     vm.ZoneID,
	}

	nic := vm.DefaultNic()
	if nic != nil {
		req.IPAddress = nic.IPAddress
	}

	for i := range vm.Tags {
		req.Tags = append(req.Tags, vm.Tags[i])
	}

	return req, nil
}
1031643
func (h *Hostlist) FilterByDomain(domain string) (hostnames []*Hostname) {
	for _, hostname := range *h {
		if hostname.Domain == domain {
			hostnames = append(hostnames, hostname)
		}
	}
	return
}
675925
func (r Network_Component) GetIpAddressBindings() (resp []datatypes.Network_Component_IpAddress, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Component", "getIpAddressBindings", nil, &r.Options, &resp)
	return
}
204389
func (client *Client) GetServiceBinding(guid string) (ServiceBinding, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetServiceBindingRequest,
		URIParams:   Params{"service_binding_guid": guid},
	})
	if err != nil {
		return ServiceBinding{}, nil, err
	}

	var serviceBinding ServiceBinding
	response := cloudcontroller.Response{
		DecodeJSONResponseInto: &serviceBinding,
	}

	err = client.connection.Make(request, &response)
	return serviceBinding, response.Warnings, err
}
170386
func (_class VMApplianceClass) GetAll(sessionID SessionRef) (_retval []VMApplianceRef, _err error) {
	_method := "VM_appliance.get_all"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertVMApplianceRefSetToGo(_method + " -> ", _result.Value)
	return
}