MCPcopy Create free account
hub / github.com/containers/image / ParseReference

Function ParseReference

openshift/openshift_transport.go:59–69  ·  view source on GitHub ↗

ParseReference converts a string, which should not start with the ImageTransport.Name prefix, into an OpenShift ImageReference.

(ref string)

Source from the content-addressed store, hash-verified

57
58// ParseReference converts a string, which should not start with the ImageTransport.Name prefix, into an OpenShift ImageReference.
59func ParseReference(ref string) (types.ImageReference, error) {
60 r, err := reference.ParseNormalizedNamed(ref)
61 if err != nil {
62 return nil, fmt.Errorf("failed to parse image reference %q: %w", ref, err)
63 }
64 tagged, ok := r.(reference.NamedTagged)
65 if !ok {
66 return nil, fmt.Errorf("invalid image reference %s, expected format: 'hostname/namespace/stream:tag'", ref)
67 }
68 return NewReference(tagged)
69}
70
71// NewReference returns an OpenShift reference for a reference.NamedTagged
72func NewReference(dockerRef reference.NamedTagged) (types.ImageReference, error) {

Calls 2

ParseNormalizedNamedFunction · 0.92
NewReferenceFunction · 0.70

Used in the wild real call sites across dependent graphs

searching dependent graphs…