// SharedNetworkResources retrieves the list of child SharedNetworkResources of the Enterprise
333086
func (o *Enterprise) SharedNetworkResources(info *bambou.FetchingInfo) (SharedNetworkResourcesList, *bambou.Error) {

	var list SharedNetworkResourcesList
	err := bambou.CurrentSession().FetchChildren(o, SharedNetworkResourceIdentity, &list, info)
	return list, err
}
1043298
func (r Hardware_Server) GetResourceGroups() (resp []datatypes.Resource_Group, err error) {
	err = r.Session.DoRequest("SoftLayer_Hardware_Server", "getResourceGroups", nil, &r.Options, &resp)
	return
}
281163
func (api *ProjectsAPI) GetNetworks(projectID string, options *NetworkGetOptions) (result *Networks, err error) {
	uri := api.client.Endpoint + projectUrl + projectID + "/networks"
	if options != nil {
		uri += getQueryString(options)
	}
	res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions)
	if err != nil {
		return
	}

	result = &Networks{}
	err = json.Unmarshal(res, result)
	return
}
127858
func (t *Template) GetAllAWSEC2NetworkAclResources() map[string]*resources.AWSEC2NetworkAcl {
	results := map[string]*resources.AWSEC2NetworkAcl{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSEC2NetworkAcl:
			results[name] = resource
		}
	}
	return results
}
805020
func (n *Node) ComparableResources() *ComparableResources {
	// Node already has 0.9+ behavior
	if n.NodeResources != nil {
		return n.NodeResources.Comparable()
	}

	// Upgrade path
	return &ComparableResources{
		Flattened: AllocatedTaskResources{
			Cpu: AllocatedCpuResources{
				CpuShares: int64(n.Resources.CPU),
			},
			Memory: AllocatedMemoryResources{
				MemoryMB: int64(n.Resources.MemoryMB),
			},
		},
		Shared: AllocatedSharedResources{
			DiskMB: int64(n.Resources.DiskMB),
		},
	}
}
769448
func (st resourceState) ListResources(applicationID string) (resource.ApplicationResources, error) {
	resources, err := st.persist.ListResources(applicationID)
	if err != nil {
		if err := st.raw.VerifyApplication(applicationID); err != nil {
			return resource.ApplicationResources{}, errors.Trace(err)
		}
		return resource.ApplicationResources{}, errors.Trace(err)
	}

	unitIDs, err := st.raw.Units(applicationID)
	if err != nil {
		return resource.ApplicationResources{}, errors.Trace(err)
	}
	for _, unitID := range unitIDs {
		found := false
		for _, unitRes := range resources.UnitResources {
			if unitID.String() == unitRes.Tag.String() {
				found = true
				break
			}
		}
		if !found {
			unitRes := resource.UnitResources{
				Tag: unitID,
			}
			resources.UnitResources = append(resources.UnitResources, unitRes)
		}
	}

	return resources, nil
}
619337
func (e *podEnv) loadNets() ([]activeNet, error) {
	if e.netsLoadList.None() {
		stderr.Printf("networking namespace with loopback only")
		return nil, nil
	}

	nets, err := e.newNetLoader().loadNets(e.netsLoadList)
	if err != nil {
		return nil, err
	}
	netSlice := make([]activeNet, 0, len(nets))
	for _, net := range nets {
		netSlice = append(netSlice, net)
	}
	sort.Sort(byFilename(netSlice))

	missing := missingNets(e.netsLoadList, netSlice)
	if len(missing) > 0 {
		return nil, fmt.Errorf("networks not found: %v", strings.Join(missing, ", "))
	}

	// Add the runtime args to the network instances.
	// We don't do this earlier because we also load networks in other contexts
	for _, n := range nets {
		n.runtime.Args = e.netsLoadList.SpecificArgs(n.conf.Name)
	}
	return netSlice, nil
}
66550
func ListResources(cloud openstack.OpenstackCloud, clusterName string) (map[string]*resources.Resource, error) {
	resources := make(map[string]*resources.Resource)

	os := &clusterDiscoveryOS{
		cloud:       cloud,
		osCloud:     cloud,
		clusterName: clusterName,
	}

	listFunctions := []openstackListFn{
		os.ListKeypairs,
		os.ListInstances,
		os.ListServerGroups,
		os.ListVolumes,
		os.ListLBListener,
		os.ListLBPools,
		os.ListLB,
		os.ListPorts,
		os.ListSecurityGroups,
		os.ListNetwork,
		os.ListDNSRecordsets,
	}
	for _, fn := range listFunctions {
		resourceTrackers, err := fn()
		if err != nil {
			return nil, err
		}
		for _, t := range resourceTrackers {
			resources[t.Type+":"+t.ID] = t
		}
	}
	return resources, nil
}
970166
func (_m *Cluster) ListNetworks(ctx context.Context, podname string, driver string) ([]*enginetypes.Network, error) {
	ret := _m.Called(ctx, podname, driver)

	var r0 []*enginetypes.Network
	if rf, ok := ret.Get(0).(func(context.Context, string, string) []*enginetypes.Network); ok {
		r0 = rf(ctx, podname, driver)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]*enginetypes.Network)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok {
		r1 = rf(ctx, podname, driver)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
166949
func (s *NetworkService) NewListNetworkServiceProvidersParams() *ListNetworkServiceProvidersParams {
	p := &ListNetworkServiceProvidersParams{}
	p.p = make(map[string]interface{})
	return p
}
1230041
func (r *Resources) NetIndex(n *NetworkResource) int {
	return r.Networks.NetIndex(n)
}
1227727
func (c *Client) ListNetworks() ([]Network, error) {
	var resp []Network
	req := request{
		method: client.GET,
		url:    apiNetworks,
		resp:   &resp,
	}
	if _, err := c.sendRequest(req); err != nil {
		return nil, errors.Newf(err, "failed to get list of networks")
	}
	return resp, nil
}
99961
func listSubnetworksOfNetwork(svc *compute.Service, networkProjectID, networkID, region string) ([]*compute.Subnetwork, error) {
	var subnets []*compute.Subnetwork
	err := svc.Subnetworks.List(networkProjectID, region).Filter(fmt.Sprintf("network eq .*/%v$", networkID)).Pages(context.Background(), func(res *compute.SubnetworkList) error {
		subnets = append(subnets, res.Items...)
		return nil
	})
	return subnets, err
}
342509
func (daemon *Daemon) getAllNetworks() []libnetwork.Network {
	c := daemon.netController
	if c == nil {
		return nil
	}
	return c.Networks()
}
492898
func (gce Connection) Subnetworks(region string) ([]*compute.Subnetwork, error) {
	results, err := gce.raw.ListSubnetworks(gce.projectID, region)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return results, nil
}
819714
func (p ResourcePersistence) ListPendingResources(applicationID string) ([]resource.Resource, error) {
	docs, err := p.resources(applicationID)
	if err != nil {
		return nil, errors.Trace(err)
	}

	var resources []resource.Resource
	for _, doc := range docs {
		if doc.PendingID == "" {
			continue
		}
		// doc.UnitID will always be empty here.

		res, err := doc2basicResource(doc)
		if err != nil {
			return nil, errors.Trace(err)
		}
		resources = append(resources, res)
	}
	return resources, nil
}
1202544
func (c *Cluster) GetNetworks(filter filters.Args) ([]apitypes.NetworkResource, error) {
	var f *swarmapi.ListNetworksRequest_Filters

	if filter.Len() > 0 {
		f = &swarmapi.ListNetworksRequest_Filters{}

		if filter.Contains("name") {
			f.Names = filter.Get("name")
			f.NamePrefixes = filter.Get("name")
		}

		if filter.Contains("id") {
			f.IDPrefixes = filter.Get("id")
		}
	}

	list, err := c.getNetworks(f)
	if err != nil {
		return nil, err
	}
	filterPredefinedNetworks(&list)

	return internalnetwork.FilterNetworks(list, filter)
}