func ManifestsFromList(ctx context.Context, srcDigest digest.Digest, srcManifest distribution.Manifest, manifests distribution.ManifestService, ref imagereference.DockerImageReference) (map[digest.Digest]distribution.Manifest, *manifestlist.DeserializedManifestList, digest.Digest, error) {
	switch t := srcManifest.(type) {
	case *manifestlist.DeserializedManifestList:
		allManifests := make(map[digest.Digest]distribution.Manifest)
		manifestDigest := srcDigest
		manifestList := t

		for i, manifest := range t.Manifests {
			childManifest, err := manifests.Get(ctx, manifest.Digest, distribution.WithManifestMediaTypes([]string{manifestlist.MediaTypeManifestList, schema2.MediaTypeManifest}))
			if err != nil {
				return nil, nil, "", fmt.Errorf("unable to retrieve source image %s manifest #%d from manifest list: %v", ref, i+1, err)
			}
			allManifests[manifest.Digest] = childManifest
		}

		return allManifests, manifestList, manifestDigest, nil

	default:
		return map[digest.Digest]distribution.Manifest{srcDigest: srcManifest}, nil, "", nil
	}
}
// ManifestsFromList returns a map of all image manifests for a given manifest. It returns the ManifestList and its digest if
// srcManifest is a list, or an error.
ManifestsFromList returns a map of all image manifests for a given manifest. It returns the ManifestList and its digest if
srcManifest is a list, or an error.
// ManifestsFromList returns a map of all image manifests for a given manifest . It returns the ManifestList and its digest if // srcManifest is a list or an error .
func ManifestsFromList(ctx context.Context, srcDigest digest.Digest, srcManifest distribution.Manifest, manifests distribution.ManifestService, ref imagereference.DockerImageReference) (map[digest.Digest]distribution.Manifest, *manifestlist.DeserializedManifestList, digest.Digest, error) {
	switch t := srcManifest.(type) {
	case *manifestlist.DeserializedManifestList:
		allManifests := make(map[digest.Digest]distribution.Manifest)
		manifestDigest := srcDigest
		manifestList := t
		for i, manifest := range t.Manifests {
			childManifest, err := manifests.Get(ctx, manifest.Digest, distribution.WithManifestMediaTypes([]string{manifestlist.MediaTypeManifestList, schema2.MediaTypeManifest}))
			if err != nil {
				return nil, nil, "", fmt.Errorf("unable to retrieve source image %s manifest #%d from manifest list: %v", ref, i+1, err)
			}
			allManifests[manifest.Digest] = childManifest
		}
		return allManifests, manifestList, manifestDigest, nil
	default:
		return map[digest.Digest]distribution.Manifest{srcDigest: srcManifest}, nil, "", nil
	}
}
func ManifestsFromList ( ctx context . Context , srcDigest digest . Digest , srcManifest distribution . Manifest , manifests distribution . ManifestService , ref imagereference . DockerImageReference ) ( map [ digest . Digest ] distribution . Manifest , * manifestlist . DeserializedManifestList , digest . Digest , error ) { switch t := srcManifest . ( type ) { case * manifestlist . DeserializedManifestList : allManifests := make ( map [ digest . Digest ] distribution . Manifest ) manifestDigest := srcDigest manifestList := t for i , manifest := range t . Manifests { childManifest , err := manifests . Get ( ctx , manifest . Digest , distribution . WithManifestMediaTypes ( [ ] string { manifestlist . MediaTypeManifestList , schema2 . MediaTypeManifest } ) ) if err != nil { return nil , nil , " " , fmt . Errorf ( " " , ref , i + 1 , err ) } allManifests [ manifest . Digest ] = childManifest } return allManifests , manifestList , manifestDigest , nil default : return map [ digest . Digest ] distribution . Manifest { srcDigest : srcManifest } , nil , " " , nil } }
ManifestsFromList returns a map of all image manifests for a given manifest.
ManifestsFromList returns a map of all image manifests for a given manifest .