// FindBridges will visit www.meethue.com/api/nupnp to see a list of
// bridges on the local network.
192906
func FindBridges() ([]Bridge, error) {
	bridge := Bridge{IPAddress: "www.meethue.com"}
	body, _, err := bridge.Get("/api/nupnp")
	if err != nil {
		err = errors.New("unable to locate bridge")
		return []Bridge{}, err
	}
	bridges := []Bridge{}
	err = json.Unmarshal(body, &bridges)
	if err != nil {
		return bridges, errors.New("unable to parse FindBridges response")
	}
	if len(bridges) == 0 {
		return bridges, errors.New("no bridges found")
	}
	return bridges, nil
}
1004635
func (_class NetworkSriovClass) GetAll(sessionID SessionRef) (_retval []NetworkSriovRef, _err error) {
	_method := "network_sriov.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 = convertNetworkSriovRefSetToGo(_method + " -> ", _result.Value)
	return
}
848447
func GetIPv4Addresses() (ips []string, err error) {
	ips = []string{}

	addrs, err := net.InterfaceAddrs()
	if err != nil {
		return nil, fmt.Errorf("unable to use InterfaceAddrs to find local ipv4 addresses: %v", err)
	}

	for _, a := range addrs {
		if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() && nil != ipnet.IP.To4() {
			ips = append(ips, ipnet.IP.String())
		}
	}

	if len(ips) == 0 {
		return ips, fmt.Errorf("unable to identify local ip address")
	}

	return ips, nil
}
85735
func (s *VPCRouterSetting) FindStaticNAT(globalAddress string, privateAddress string) (int, *VPCRouterStaticNATConfig) {
	for i, c := range s.StaticNAT.Config {
		if c.GlobalAddress == globalAddress && c.PrivateAddress == privateAddress {
			return i, c
		}
	}
	return -1, nil
}
603031
func (s *Server) GetConnections() []Connection {
	// first call of Range to get the total length, we don't want to use append or manually grow the list here for many reasons.
	length := s.GetTotalConnections()
	conns := make([]Connection, length, length)
	i := 0
	// second call of Range.
	s.connections.Range(func(k, v interface{}) bool {
		conn, ok := v.(*connection)
		if !ok {
			// if for some reason (should never happen), the value is not stored as *connection
			// then stop the iteration and don't continue insertion of the result connections
			// in order to avoid any issues while end-dev will try to iterate a nil entry.
			return false
		}
		conns[i] = conn
		i++
		return true
	})

	return conns
}
1041385
func NewBridgeAPI(client *Client) *BridgeAPI {
	return &BridgeAPI{
		&baseAPI{
			client: client,
			FuncGetResourceURL: func() string {
				return "bridge"
			},
		},
	}
}
1063194
func (o *VLAN) BRConnections(info *bambou.FetchingInfo) (BRConnectionsList, *bambou.Error) {

	var list BRConnectionsList
	err := bambou.CurrentSession().FetchChildren(o, BRConnectionIdentity, &list, info)
	return list, err
}
1365802
func (st *State) FindTools(v version.Number, series string, arch string) (tools.List, error) {
	args := params.FindToolsParams{
		Number:       v,
		Series:       series,
		MajorVersion: -1,
		MinorVersion: -1,
	}
	if arch != "" {
		args.Arch = arch
	}
	var result params.FindToolsResult
	if err := st.facade.FacadeCall("FindTools", args, &result); err != nil {
		return nil, err
	}
	if result.Error != nil {
		return nil, result.Error
	}
	return result.List, nil
}
880889
func (a *AuthServer) GetAllTunnelConnections(opts ...services.MarshalOption) (conns []services.TunnelConnection, err error) {
	return a.GetCache().GetAllTunnelConnections(opts...)
}
970995
func (r Hardware_Router) GetBoundSubnets() (resp []datatypes.Network_Subnet, err error) {
	err = r.Session.DoRequest("SoftLayer_Hardware_Router", "getBoundSubnets", nil, &r.Options, &resp)
	return
}
704079
func GetLocalDNS() []string {
	conf, err := dns.ClientConfigFromFile("/etc/resolv.conf")
	if err != nil {
		logging.Error.Fatalf("%v", err)
	}

	return nonLocalAddies(conf.Servers)
}
747842
func (r ServerMuxList) Find(path string) (interface{}, bool) {
	for _, p := range r {
		if p.PathPrefix == path || strings.HasPrefix(path, p.PathPrefix) {
			return p.Callback, true
		}
	}
	return nil, false
}
991748
func (bridge *Bridge) GetAllScenes() ([]Scene, error) {
	uri := fmt.Sprintf("/api/%s/scenes", bridge.Username)
	body, _, err := bridge.Get(uri)
	if err != nil {
		return []Scene{}, err
	}

	scenes := map[string]Scene{}
	err = json.Unmarshal(body, &scenes)
	if err != nil {
		return []Scene{}, err
	}
	scenesList := []Scene{}
	for key, value := range scenes {
		scene := Scene{}
		scene = value
		scene.ID = key
		scenesList = append(scenesList, scene)
	}
	return scenesList, nil
}
23726
func (c *Cache) GetAllTunnelConnections(opts ...services.MarshalOption) (conns []services.TunnelConnection, err error) {
	return c.presenceCache.GetAllTunnelConnections(opts...)
}
115757
func numOfMatchingPathComponents(pth string, matchComponents []string) int {
	pthComponents := getPathComponents(pth)
	i := 0
	for ; i < len(pthComponents) && i < len(matchComponents); i++ {
		if matchComponents[i] != pthComponents[i] {
			return i
		}
	}
	return i
}
1038328
func (c *CloudAPI) ListNetworks() ([]cloudapi.Network, error) {
	if err := c.ProcessFunctionHook(c); err != nil {
		return nil, err
	}

	return c.networks, nil
}
1081078
func (o *VPort) BGPNeighbors(info *bambou.FetchingInfo) (BGPNeighborsList, *bambou.Error) {

	var list BGPNeighborsList
	err := bambou.CurrentSession().FetchChildren(o, BGPNeighborIdentity, &list, info)
	return list, err
}