// GetResourcePools returns all pools or empty array
334772
func (c *Client) GetResourcePools() ([]pool.ResourcePool, error) {
	response := make([]pool.ResourcePool, 0)
	if err := c.call("GetResourcePools", empty, &response); err != nil {
		return []pool.ResourcePool{}, err
	}
	return response, nil
}
863047
func (s *Snapshot) GetResources(typ string) map[string]Resource {
	if s == nil {
		return nil
	}
	switch typ {
	case EndpointType:
		return s.Endpoints.Items
	case ClusterType:
		return s.Clusters.Items
	case RouteType:
		return s.Routes.Items
	case ListenerType:
		return s.Listeners.Items
	case SecretType:
		return s.Secrets.Items
	}
	return nil
}
377146
func (p Protos) GetResources() (map[string]*resource.Resource, error) {

	resources := Resources{}
	resourcesReq, err := http.NewRequest("GET", p.createURL("resource/provider"), nil)
	if err != nil {
		return resources, err
	}

	payload, err := p.makeRequest(resourcesReq)
	if err != nil {
		return resources, err
	}

	err = json.Unmarshal(payload, &resources)
	if err != nil {
		return resources, err
	}

	return resources, nil
}
499925
func GetCurrentHosts(conn client.Connection, poolid string) ([]string, error) {
	logger := plog.WithField("poolid", poolid)

	onlineHosts := make([]string, 0)
	pth := path.Join("/pools", poolid, "hosts")
	ch, err := conn.Children(pth)
	if err != nil && err != client.ErrNoNode {

		logger.WithError(err).Debug("Could not look up hosts in resource pool")

		// TODO: wrap error?
		return nil, err
	}
	for _, hostid := range ch {
		isOnline, err := IsHostOnline(conn, poolid, hostid)
		if err != nil {
			return nil, err
		}

		if isOnline {
			onlineHosts = append(onlineHosts, hostid)
		}
	}

	logger.WithField("hostcount", len(onlineHosts)).Debug("Loaded online hosts")
	return onlineHosts, nil
}
664982
func (b *Bucket) GetPool() *Pool {
	b.RLock()
	defer b.RUnlock()
	ret := b.pool
	return ret
}
84622
func allResources(container *api.Container) map[api.ResourceName]bool {
	resources := map[api.ResourceName]bool{}
	for _, resource := range supportedComputeResources {
		resources[resource] = false
	}
	for resource := range container.Resources.Requests {
		resources[resource] = true
	}
	for resource := range container.Resources.Limits {
		resources[resource] = true
	}
	return resources
}
548597
func (a *api) GetResourcePools() ([]pool.ResourcePool, error) {
	client, err := a.connectMaster()
	if err != nil {
		return nil, err
	}

	return client.GetResourcePools()
}
218328
func (c *Client) GetResources(ctx context.Context, project *string, res []*primitives.Resource) ([]*manifold.Resource, error) {
	for _, r := range res {
		if !r.Valid() {
			return nil, ErrResourceInvalid
		}
	}

	pID, err := c.ProjectID(project)
	if err != nil {
		return nil, err
	}

	resourceList := c.Client.Resources.List(ctx, &manifold.ResourcesListOpts{
		ProjectID: pID,
		TeamID:    c.TeamID,
	})
	defer resourceList.Close()

	resources := []*manifold.Resource{}
	for resourceList.Next() {
		resource, err := resourceList.Current()
		if err != nil {
			return nil, err
		}

		if requestedResource(resource, res) {
			resources = append(resources, resource)
		}
	}

	if len(resources) != len(res) && len(res) != 0 {
		return nil, ErrResourceNotFound
	}

	return resources, nil
}
509616
func (f *Finder) ResourcePoolListAll(ctx context.Context, path string) ([]*object.ResourcePool, error) {
	pools, err := f.ResourcePoolList(ctx, path)
	if err != nil {
		if _, ok := err.(*NotFoundError); !ok {
			return nil, err
		}

		vapps, _ := f.VirtualAppList(ctx, path)

		if len(vapps) == 0 {
			return nil, err
		}

		for _, vapp := range vapps {
			pools = append(pools, vapp.ResourcePool)
		}
	}

	return pools, nil
}
581421
func (s *Server) AddResourcePool(pool pool.ResourcePool, _ *struct{}) error {
	return s.f.AddResourcePool(s.context(), &pool)
}
984001
func (t *Template) GetAllAWSCognitoUserPoolResources() map[string]*resources.AWSCognitoUserPool {
	results := map[string]*resources.AWSCognitoUserPool{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSCognitoUserPool:
			results[name] = resource
		}
	}
	return results
}
1222860
func (c *Connect) FindStoragePoolSources(pooltype string, srcSpec string, flags uint32) (string, error) {
	cpooltype := C.CString(pooltype)
	defer C.free(unsafe.Pointer(cpooltype))
	var csrcSpec *C.char
	if srcSpec != "" {
		csrcSpec := C.CString(srcSpec)
		defer C.free(unsafe.Pointer(csrcSpec))
	}
	var err C.virError
	ret := C.virConnectFindStoragePoolSourcesWrapper(c.ptr, cpooltype, csrcSpec, C.uint(flags), &err)
	if ret == nil {
		return "", makeError(&err)
	}

	defer C.free(unsafe.Pointer(ret))

	return C.GoString(ret), nil
}
450744
func (_class PoolUpdateClass) GetHosts(sessionID SessionRef, self PoolUpdateRef) (_retval []HostRef, _err error) {
	_method := "pool_update.get_hosts"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPoolUpdateRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertHostRefSetToGo(_method + " -> ", _result.Value)
	return
}
646813
func (s *SourceService) FindSources(ctx context.Context, opts platform.FindOptions) ([]*platform.Source, int, error) {
	return s.FindSourcesFn(ctx, opts)
}
768425
func (c *ServicedCli) pools() (data []string) {
	pools, err := c.driver.GetResourcePools()
	if err != nil || pools == nil || len(pools) == 0 {
		return
	}

	data = make([]string, len(pools))
	for i, p := range pools {
		data[i] = p.ID
	}

	return
}
729879
func (t *RedconTransport) getPool(target string) (*redis.Pool, error) {
	t.mu.Lock()
	defer t.mu.Unlock()
	if t.closed {
		return nil, errors.New("closed")
	}
	pool, ok := t.pools[target]
	if !ok {
		pool = newTargetPool(target)
		t.pools[target] = pool
	}
	return pool, nil
}
814803
func (f *Facade) RestoreResourcePools(ctx datastore.Context, pools []pool.ResourcePool) error {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.RestoreResourcePools"))
	// Do not DFSLock here, ControlPlaneDao does that
	var alog audit.Logger
	for _, pool := range pools {
		alog = f.auditLogger.Message(ctx, "Adding ResourcePool").Action(audit.Add).Entity(&pool)
		pool.DatabaseVersion = 0
		if err := f.addResourcePool(ctx, &pool); err != nil {
			if err == ErrPoolExists {
				if err := f.updateResourcePool(ctx, &pool); err != nil {
					glog.Errorf("Could not restore resource pool %s via update: %s", pool.ID, err)
					return alog.Error(err)
				}
			} else {
				glog.Errorf("Could not restore resource pool %s via add: %s", pool.ID, err)
				return alog.Error(err)
			}
		}
		alog.Succeeded()
	}
	return nil
}