// ServerGroupsAndResources returns the supported groups and resources for all groups and versions.
490867
func (c *FakeDiscovery) ServerGroupsAndResources() ([]*metav1.APIGroup, []*metav1.APIResourceList, error) {
	sgs, err := c.ServerGroups()
	if err != nil {
		return nil, nil, err
	}
	resultGroups := []*metav1.APIGroup{}
	for i := range sgs.Groups {
		resultGroups = append(resultGroups, &sgs.Groups[i])
	}

	action := testing.ActionImpl{
		Verb:     "get",
		Resource: schema.GroupVersionResource{Resource: "resource"},
	}
	c.Invokes(action, nil)
	return resultGroups, c.Resources, nil
}
527264
func (t *Template) GetAWSRDSDBSecurityGroupWithName(name string) (*resources.AWSRDSDBSecurityGroup, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSRDSDBSecurityGroup:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSRDSDBSecurityGroup not found", name)
}
1011141
func (t *Template) GetAWSRDSDBClusterParameterGroupWithName(name string) (*resources.AWSRDSDBClusterParameterGroup, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSRDSDBClusterParameterGroup:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSRDSDBClusterParameterGroup not found", name)
}
1343279
func (t *Template) GetAllAWSEC2SecurityGroupEgressResources() map[string]*resources.AWSEC2SecurityGroupEgress {
	results := map[string]*resources.AWSEC2SecurityGroupEgress{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSEC2SecurityGroupEgress:
			results[name] = resource
		}
	}
	return results
}
247433
func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource {
	source := &tokenSource{
		ctx:  ctx,
		conf: c,
	}
	return oauth2.ReuseTokenSource(nil, source)
}
456810
func (c *FakeDiscovery) ServerGroups() (*metav1.APIGroupList, error) {
	action := testing.ActionImpl{
		Verb:     "get",
		Resource: schema.GroupVersionResource{Resource: "group"},
	}
	c.Invokes(action, nil)

	groups := map[string]*metav1.APIGroup{}

	for _, res := range c.Resources {
		gv, err := schema.ParseGroupVersion(res.GroupVersion)
		if err != nil {
			return nil, err
		}
		group := groups[gv.Group]
		if group == nil {
			group = &metav1.APIGroup{
				Name: gv.Group,
				PreferredVersion: metav1.GroupVersionForDiscovery{
					GroupVersion: res.GroupVersion,
					Version:      gv.Version,
				},
			}
			groups[gv.Group] = group
		}

		group.Versions = append(group.Versions, metav1.GroupVersionForDiscovery{
			GroupVersion: res.GroupVersion,
			Version:      gv.Version,
		})
	}

	list := &metav1.APIGroupList{}
	for _, apiGroup := range groups {
		list.Groups = append(list.Groups, *apiGroup)
	}

	return list, nil

}
860063
func GroupVersionResources(rls []*metav1.APIResourceList) (map[schema.GroupVersionResource]struct{}, error) {
	gvrs := map[schema.GroupVersionResource]struct{}{}
	for _, rl := range rls {
		gv, err := schema.ParseGroupVersion(rl.GroupVersion)
		if err != nil {
			return nil, err
		}
		for i := range rl.APIResources {
			gvrs[schema.GroupVersionResource{Group: gv.Group, Version: gv.Version, Resource: rl.APIResources[i].Name}] = struct{}{}
		}
	}
	return gvrs, nil
}
643599
func (c *Client) ComputeResources(ctx context.Context) ([]*mo.ComputeResource, error) {
	_, datacenter, err := c.finder(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	folders, err := datacenter.Folders(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}

	es, err := c.lister(folders.HostFolder.Reference()).List(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}

	var cprs []*mo.ComputeResource
	for _, e := range es {
		switch o := e.Object.(type) {
		case mo.ClusterComputeResource:
			cprs = append(cprs, &o.ComputeResource)
		case mo.ComputeResource:
			cprs = append(cprs, &o)
		}
	}
	return cprs, nil
}
1253824
func (s *Server) generateServerResources(dir string) ([]*goResource, error) {
	var serverResources []*goResource

	resources := s.apiDef.Resources

	// sort the keys, so we have resource sorted by keys.
	// the generated code actually don't need it to be sorted.
	// but test fixture need it
	var keys []string
	for k := range resources {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	// create resource def
	var err error
	for _, endpoint := range keys {
		r := resources[endpoint]
		rd := resource.New(s.apiDef, &r, endpoint, true)
		pkgName := strings.ToLower(commons.NormalizeIdentifier(rd.Name))
		gr := newGoResource(&rd, pkgName)
		err = gr.generate(&r, endpoint, dir, s.libsRootURLs)
		if err != nil {
			return nil, err
		}
		serverResources = append(serverResources, gr)
	}
	return serverResources, nil
}
349352
func (t *Template) GetAllAWSDAXClusterResources() map[string]*resources.AWSDAXCluster {
	results := map[string]*resources.AWSDAXCluster{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSDAXCluster:
			results[name] = resource
		}
	}
	return results
}
776340
func validateResources(hc *container.HostConfig, si *sysinfo.SysInfo) error {
	// We may not be passed a host config, such as in the case of docker commit
	if hc == nil {
		return nil
	}
	if hc.Resources.CPURealtimePeriod != 0 {
		return fmt.Errorf("Windows does not support CPU real-time period")
	}
	if hc.Resources.CPURealtimeRuntime != 0 {
		return fmt.Errorf("Windows does not support CPU real-time runtime")
	}
	return nil
}
860229
func (t *Template) GetAllAWSRDSDBSubnetGroupResources() map[string]*resources.AWSRDSDBSubnetGroup {
	results := map[string]*resources.AWSRDSDBSubnetGroup{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSRDSDBSubnetGroup:
			results[name] = resource
		}
	}
	return results
}
638097
func (pages Pages) ToResources() resource.Resources {
	r := make(resource.Resources, len(pages))
	for i, p := range pages {
		r[i] = p
	}
	return r
}
485899
func (d *CachedDiscoveryClient) ServerResources() ([]*metav1.APIResourceList, error) {
	_, rs, err := discovery.ServerGroupsAndResources(d)
	return rs, err
}
1277165
func (t *Template) GetAllAWSElastiCacheSecurityGroupResources() map[string]*resources.AWSElastiCacheSecurityGroup {
	results := map[string]*resources.AWSElastiCacheSecurityGroup{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSElastiCacheSecurityGroup:
			results[name] = resource
		}
	}
	return results
}
1275375
func (e *environ) securityGroupsByNameOrID(groupName string) (*ec2.SecurityGroupsResp, error) {
	if chosenVPCID := e.ecfg().vpcID(); isVPCIDSet(chosenVPCID) {
		// AWS VPC API requires both of these filters (and no
		// group names/ids set) for non-default EC2-VPC groups:
		filter := ec2.NewFilter()
		filter.Add("vpc-id", chosenVPCID)
		filter.Add("group-name", groupName)
		return e.ec2.SecurityGroups(nil, filter)
	}

	// EC2-Classic or EC2-VPC with implicit default VPC need to use the
	// GroupName.X arguments instead of the filters.
	groups := ec2.SecurityGroupNames(groupName)
	return e.ec2.SecurityGroups(groups, nil)
}
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
}