func (r APIV2Adapter) FetchSpecs(imageNames []string) ([]*bundle.Spec, error) {
	log.Debugf("%s - FetchSpecs", r.config.AdapterName)
	specs := []*bundle.Spec{}
	for _, imageName := range imageNames {
		log.Debugf("%v", imageName)
		spec, err := r.loadSpec(imageName)
		if err != nil {
			log.Errorf("Failed to retrieve spec data for image %s:%s - %v", imageName, r.config.Tag, err)
		}
		if spec != nil {
			specs = append(specs, spec)
		}
	}
	return specs, nil
}
FetchSpecs - retrieve the spec for the image names.
package adapters
import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"strings"
	"github.com/automationbroker/bundle-lib/bundle"
	"github.com/automationbroker/bundle-lib/registries/adapters/oauth"
	log "github.com/sirupsen/logrus"
)
const (
	apiV2ManifestURL = "%v/v2/%v/manifests/%v"
	apiV2CatalogURL  = "%v/v2/_catalog"
	schema1Ct        = "application/vnd.docker.distribution.manifest.v1+json"
	schema2Ct        = "application/vnd.docker.distribution.manifest.v2+json"
)
type OpenShiftAdapter struct {
	APIV2Adapter
}
type PartnerRhccAdapter struct {
	APIV2Adapter
}
type APIV2Adapter struct {
	config Configuration
	client *oauth.Client
}
type apiV2CatalogResponse struct {
	Repositories []string `json:"repositories"`
}
func NewOpenShiftAdapter(config Configuration) (OpenShiftAdapter, error) {
	apiV2, err := NewAPIV2Adapter(config)
	if err != nil {
		return OpenShiftAdapter{}, err
	}
	return OpenShiftAdapter{apiV2}, nil
}
func NewPartnerRhccAdapter(config Configuration) (PartnerRhccAdapter, error) {
	apiV2, err := NewAPIV2Adapter(config)
	if err != nil {
		return PartnerRhccAdapter{}, err
	}
	return PartnerRhccAdapter{apiV2}, nil
}
func NewAPIV2Adapter(config Configuration) (APIV2Adapter, error) {
	apiv2a := APIV2Adapter{
		config: config,
		client: oauth.NewClient(config.User, config.Pass, config.SkipVerifyTLS, config.URL),
	}
	err := apiv2a.client.Getv2()
	if err != nil {
		log.Errorf("Failed to GET /v2 at %s - %v", config.URL, err)
		return APIV2Adapter{}, err
	}
	if apiv2a.config.Tag == "" {
		apiv2a.config.Tag = "latest"
	}
	return apiv2a, nil
}
func (r APIV2Adapter) RegistryName() string {
	if r.config.URL.Host == "" {
		return r.config.URL.Path
	}
	return r.config.URL.Host
}
func (r APIV2Adapter) GetImageNames() ([]string, error) {
	log.Debugf("%s - GetImageNames", r.config.AdapterName)
	log.Debugf("BundleSpecLabel: %s", BundleSpecLabel)
	var imageList []string
	if len(r.config.Images) > 0 {
		log.Debugf("Configured to use images: %v", r.config.Images)
		imageList = append(imageList, r.config.Images...)
	}
	discoveredImages, err := r.discoverImages(fmt.Sprintf(apiV2CatalogURL, r.config.URL))
	if err != nil && len(imageList) == 0 {
		return nil, err
	}
	if len(discoveredImages) > 0 {
		log.Debugf("Discovered images: %v", discoveredImages)
		imageList = append(imageList, discoveredImages...)
	}
	if len(imageList) == 0 {
		log.Warn("image list is empty. No images were discovered")
		return imageList, nil
	}
	var uniqueList []string
	imageMap := make(map[string]struct{})
	for _, image := range imageList {
		imageMap[image] = struct{}{}
	}
	for key := range imageMap {
		uniqueList = append(uniqueList, key)
	}
	return uniqueList, nil
}