func SeedSpecs(ctx context.Context, s RegistryImp, specs ...*rpc.ApiSpec) error {
	resources := make([]RegistryResource, 0, len(specs))
	for _, r := range specs {
		resources = append(resources, r)
	}
	return SeedRegistry(ctx, s, resources...)
}
SeedSpecs is a convenience function for calling SeedRegistry with only ApiSpec messages.
package seeder
import (
	"context"
	"crypto/sha256"
	"fmt"
	"sort"
	"github.com/apigee/registry/rpc"
	"github.com/apigee/registry/server/registry/names"
	"google.golang.org/protobuf/types/known/fieldmaskpb"
)
type RegistryImp interface {
	rpc.RegistryServer
	rpc.AdminServer
}
type RegistryResource interface {
	GetName() string
}
func SeedRegistry(ctx context.Context, s RegistryImp, resources ...RegistryResource) error {
	sort.SliceStable(resources, func(i, j int) bool {
		return resources[i].GetName() < resources[j].GetName()
	})
	h := make(map[string]bool, 5*len(resources))
	for _, resource := range resources {
		switch r := resource.(type) {
		case *rpc.Project:
			if h[r.GetName()] {
				return fmt.Errorf("cannot seed multiple projects with name %s", r.GetName())
			}
			if err := seedProject(ctx, s, r, h); err != nil {
				return err
			}
		case *rpc.Api:
			if h[r.GetName()] {
				return fmt.Errorf("cannot seed multiple apis with name %s", r.GetName())
			}
			if err := seedApi(ctx, s, r, h); err != nil {
				return err
			}
		case *rpc.ApiVersion:
			if h[r.GetName()] {
				return fmt.Errorf("cannot seed multiple versions with name %s", r.GetName())
			}
			if err := seedVersion(ctx, s, r, h); err != nil {
				return err
			}
		case *rpc.ApiSpec:
			if err := seedSpec(ctx, s, r, h); err != nil {
				return err
			}
		case *rpc.Artifact:
			if h[r.GetName()] {
				return fmt.Errorf("cannot seed multiple artifacts with name %s", r.GetName())
			}
			if err := seedArtifact(ctx, s, r, h); err != nil {
				return err
			}
		default:
			return fmt.Errorf("unsupported resource type %T", r)
		}
	}
	return nil
}
func SeedProjects(ctx context.Context, s RegistryImp, projects ...*rpc.Project) error {
	resources := make([]RegistryResource, 0, len(projects))
	for _, r := range projects {
		resources = append(resources, r)
	}
	return SeedRegistry(ctx, s, resources...)
}
func SeedApis(ctx context.Context, s RegistryImp, apis ...*rpc.Api) error {
	resources := make([]RegistryResource, 0, len(apis))
	for _, r := range apis {
		resources = append(resources, r)
	}
	return SeedRegistry(ctx, s, resources...)
}
func SeedVersions(ctx context.Context, s RegistryImp, versions ...*rpc.ApiVersion) error {
	resources := make([]RegistryResource, 0, len(versions))
	for _, r := range versions {
		resources = append(resources, r)
	}
	return SeedRegistry(ctx, s, resources...)
}