// getResourceNamesForGroup is a private method for getting the canonical names for each resource to build in an api group
355485
func getResourceNamesForGroup(apiPrefix string, apiGroupInfo *APIGroupInfo, pathsToIgnore openapiutil.Trie) ([]string, error) {
	// Get the canonical names of every resource we need to build in this api group
	resourceNames := make([]string, 0)
	for _, groupVersion := range apiGroupInfo.PrioritizedVersions {
		for resource, storage := range apiGroupInfo.VersionedResourcesStorageMap[groupVersion.Version] {
			path := gpath.Join(apiPrefix, groupVersion.Group, groupVersion.Version, resource)
			if !pathsToIgnore.HasPrefix(path) {
				kind, err := genericapi.GetResourceKind(groupVersion, storage, apiGroupInfo.Scheme)
				if err != nil {
					return nil, err
				}
				sampleObject, err := apiGroupInfo.Scheme.New(kind)
				if err != nil {
					return nil, err
				}
				name := openapiutil.GetCanonicalTypeName(sampleObject)
				resourceNames = append(resourceNames, name)
			}
		}
	}

	return resourceNames, nil
}
486446
func (t *Template) GetAllAWSEMRInstanceGroupConfigResources() map[string]*resources.AWSEMRInstanceGroupConfig {
	results := map[string]*resources.AWSEMRInstanceGroupConfig{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSEMRInstanceGroupConfig:
			results[name] = resource
		}
	}
	return results
}
635393
func (t *Template) GetAllAWSRedshiftClusterSubnetGroupResources() map[string]*resources.AWSRedshiftClusterSubnetGroup {
	results := map[string]*resources.AWSRedshiftClusterSubnetGroup{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSRedshiftClusterSubnetGroup:
			results[name] = resource
		}
	}
	return results
}
975999
func (t *Template) GetAllAWSAutoScalingAutoScalingGroupResources() map[string]*resources.AWSAutoScalingAutoScalingGroup {
	results := map[string]*resources.AWSAutoScalingAutoScalingGroup{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSAutoScalingAutoScalingGroup:
			results[name] = resource
		}
	}
	return results
}
769736
func SortedResourceNames(list corev1.ResourceList) []corev1.ResourceName {
	resources := make([]corev1.ResourceName, 0, len(list))
	for res := range list {
		resources = append(resources, res)
	}
	sort.Sort(SortableResourceNames(resources))
	return resources
}
729782
func (d *DiscoveryClient) ServerResourcesForGroupVersion(groupVersion string) (resources *unversioned.APIResourceList, err error) {
	url := url.URL{}
	if groupVersion == "v1" {
		url.Path = "/api/" + groupVersion
	} else {
		url.Path = "/apis/" + groupVersion
	}
	resources = &unversioned.APIResourceList{}
	err = d.Get().AbsPath(url.String()).Do().Into(resources)
	if err != nil {
		// ignore 403 or 404 error to be compatible with an v1.0 server.
		if groupVersion == "v1" && (errors.IsNotFound(err) || errors.IsForbidden(err)) {
			return resources, nil
		} else {
			return nil, err
		}
	}
	return resources, nil
}
1110211
func (t *Template) GetAllAWSElastiCacheParameterGroupResources() map[string]*resources.AWSElastiCacheParameterGroup {
	results := map[string]*resources.AWSElastiCacheParameterGroup{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSElastiCacheParameterGroup:
			results[name] = resource
		}
	}
	return results
}
543584
func (t *Template) GetAllAWSIAMGroupResources() map[string]*resources.AWSIAMGroup {
	results := map[string]*resources.AWSIAMGroup{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSIAMGroup:
			results[name] = resource
		}
	}
	return results
}
708517
func (kubemarkController *KubemarkController) GetNodeNamesForNodeGroup(nodeGroup string) ([]string, error) {
	selector := labels.SelectorFromSet(labels.Set{nodeGroupLabel: nodeGroup})
	pods, err := kubemarkController.externalCluster.podLister.List(selector)
	if err != nil {
		return nil, err
	}
	result := make([]string, 0, len(pods))
	for _, pod := range pods {
		result = append(result, pod.ObjectMeta.Name)
	}
	return result, nil
}
117063
func GetResourceKind(groupVersion schema.GroupVersion, storage rest.Storage, typer runtime.ObjectTyper) (schema.GroupVersionKind, error) {
	// Let the storage tell us exactly what GVK it has
	if gvkProvider, ok := storage.(rest.GroupVersionKindProvider); ok {
		return gvkProvider.GroupVersionKind(groupVersion), nil
	}

	object := storage.New()
	fqKinds, _, err := typer.ObjectKinds(object)
	if err != nil {
		return schema.GroupVersionKind{}, err
	}

	// a given go type can have multiple potential fully qualified kinds.  Find the one that corresponds with the group
	// we're trying to register here
	fqKindToRegister := schema.GroupVersionKind{}
	for _, fqKind := range fqKinds {
		if fqKind.Group == groupVersion.Group {
			fqKindToRegister = groupVersion.WithKind(fqKind.Kind)
			break
		}
	}
	if fqKindToRegister.Empty() {
		return schema.GroupVersionKind{}, fmt.Errorf("unable to locate fully qualified kind for %v: found %v when registering for %v", reflect.TypeOf(object), fqKinds, groupVersion)
	}

	// group is guaranteed to match based on the check above
	return fqKindToRegister, nil
}
450205
func (t *Template) GetAllAWSRDSDBParameterGroupResources() map[string]*resources.AWSRDSDBParameterGroup {
	results := map[string]*resources.AWSRDSDBParameterGroup{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSRDSDBParameterGroup:
			results[name] = resource
		}
	}
	return results
}
436997
func (t *Template) GetAllAWSRedshiftClusterResources() map[string]*resources.AWSRedshiftCluster {
	results := map[string]*resources.AWSRedshiftCluster{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSRedshiftCluster:
			results[name] = resource
		}
	}
	return results
}
145062
func IsScalarResourceName(name v1.ResourceName) bool {
	return IsExtendedResourceName(name) || IsHugePageResourceName(name) ||
		IsPrefixedNativeResource(name) || IsAttachableVolumeResourceName(name)
}
259440
func (a *aks) listResourceGroups(clusters []cluster) ([]resourceGroupDetails, error) {
	usedRG := set.Strings{}
	for _, c := range clusters {
		usedRG.Add(c.resourceGroup)
	}

	// It seems that any resource group that has a non-null 'managedBy' is a
	// generated RG i.e. via the creation of the cluster itself.
	cmd := []string{
		"az", "group", "list",
		"--output", "json",
		"--query", `"[?properties.provisioningState=='Succeeded']"`,
	}
	result, err := runCommand(a, cmd, "")
	err = collapseRunError(result, err)
	if err != nil {
		return nil, errors.Trace(err)
	}
	var groups []resourceGroupDetails
	if err := json.Unmarshal(result.Stdout, &groups); err != nil {
		return nil, errors.Trace(err)
	}

	var filteredGroups []resourceGroupDetails
	for _, group := range groups {
		if usedRG.Contains(group.Name) {
			filteredGroups = append(filteredGroups, group)
		}
	}

	return filteredGroups, nil
}
79670
func formatResourceName(kind schema.GroupKind, name string, withKind bool) string {
	if !withKind || kind.Empty() {
		return name
	}

	return strings.ToLower(kind.String()) + "/" + name
}
985343
func (t *Template) GetAllAWSNeptuneDBSubnetGroupResources() map[string]*resources.AWSNeptuneDBSubnetGroup {
	results := map[string]*resources.AWSNeptuneDBSubnetGroup{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSNeptuneDBSubnetGroup:
			results[name] = resource
		}
	}
	return results
}
1115630
func (t *Template) GetAWSEC2SecurityGroupWithName(name string) (*resources.AWSEC2SecurityGroup, error) {
	if untyped, ok := t.Resources[name]; ok {
		switch resource := untyped.(type) {
		case *resources.AWSEC2SecurityGroup:
			return resource, nil
		}
	}
	return nil, fmt.Errorf("resource %q of type AWSEC2SecurityGroup not found", name)
}