func CollectARMSpecAndStatusDefinitions(definitions Types) TypeNameSet {
	findARMType := func(t Type) (TypeName, error) {
		name, ok := t.(TypeName)
		if !ok {
			return TypeName{}, errors.Errorf("Type was not of type TypeName, instead %T", t)
		}
		armName := CreateARMTypeName(name)
		if _, ok = definitions[armName]; !ok {
			return TypeName{}, errors.Errorf("Couldn't find ARM type %q", armName)
		}
		return armName, nil
	}
	armSpecAndStatus := make(TypeNameSet)
	for _, def := range definitions {
		if resourceType, ok := definitions.ResolveResourceType(def.Type()); ok {
			armSpecName, err := findARMType(resourceType.spec)
			if err != nil {
				continue  
			}
			armSpecAndStatus.Add(armSpecName)
			statusType := IgnoringErrors(resourceType.status)
			if statusType != nil {
				armStatusName, err := findARMType(statusType)
				if err != nil {
					continue  
				}
				armSpecAndStatus.Add(armStatusName)
			}
		}
	}
	return armSpecAndStatus
}
CollectARMSpecAndStatusDefinitions returns a TypeNameSet of all of the ARM spec definitions
passed in.
package astmodel
import (
	"github.com/pkg/errors"
)
type ReferenceGraph struct {
	roots      TypeNameSet
	references map[TypeName]TypeNameSet
}
func CollectResourceDefinitions(definitions Types) TypeNameSet {
	resources := make(TypeNameSet)
	for _, def := range definitions {
		if _, ok := def.Type().(*ResourceType); ok {
			resources.Add(def.Name())
		}
	}
	return resources
}