func (r DockerHubAdapter) FetchSpecs(imageNames []string) ([]*bundle.Spec, error) {
	specs := []*bundle.Spec{}
	for _, imageName := range imageNames {
		spec, err := r.loadSpec(imageName)
		if err != nil {
			log.Errorf("Failed to retrieve spec data for image %s - %v", imageName, err)
		}
		if spec != nil {
			specs = append(specs, spec)
		}
	}
	return specs, nil
}
FetchSpecs - retrieve the spec for the image names.
package adapters
import (
	"bytes"
	"context"
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"github.com/automationbroker/bundle-lib/bundle"
	log "github.com/sirupsen/logrus"
)
var (
	dockerhubName        = "docker.io"
	dockerHubLoginURL    = "https://hub.docker.com/v2/users/login/"
	dockerHubRepoImages  = "https://hub.docker.com/v2/repositories/%v/?page_size=100"
	dockerHubManifestURL = "https://registry.hub.docker.com/v2/%v/manifests/%v"
	dockerBearerTokenURL = "https://auth.docker.io/token"
)
type DockerHubAdapter struct {
	Config Configuration
}
type DockerHubImage struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
}
type DockerHubImageResponse struct {
	Count   int               `json:"count"`
	Results []*DockerHubImage `json:"results"`
	Next    string            `json:"next"`
}
func (r DockerHubAdapter) RegistryName() string {
	return dockerhubName
}
func (r DockerHubAdapter) GetImageNames() ([]string, error) {
	log.Debug("DockerHubAdapter::GetImages")
	log.Debugf("BundleSpecLabel: %s", BundleSpecLabel)
	log.Debugf("Loading image list for org: [ %s ]", r.Config.Org)
	token, err := r.getDockerHubToken()
	if err != nil {
		log.Errorf("unable to generate docker hub token - %v", err)
		return nil, err
	}
	channel := make(chan string)
	ctx, cancelFunc := context.WithCancel(context.Background())
	defer cancelFunc()
	imageResp, err := r.getNextImages(ctx, r.Config.Org, token,
		fmt.Sprintf(dockerHubRepoImages, r.Config.Org),
		channel, cancelFunc)
	if err != nil {
		return nil, err
	}
	if len(imageResp.Results) == 0 {
		log.Info("canceled retrieval as no items in org")
		close(channel)
	}
	var bundleData []string
	counter := 1
	for imageData := range channel {
		bundleData = append(bundleData, imageData)
		if counter < imageResp.Count {
			counter++
		} else {
			close(channel)
		}
	}
	if ctx.Err() != nil {
		log.Errorf("encountered an error while loading images, we may not have all the apb in the catalog - %v", ctx.Err())
		return bundleData, ctx.Err()
	}
	return bundleData, nil
}