...

Source file src/github.com/docker/distribution/reference/reference_deprecated.go

Documentation: github.com/docker/distribution/reference

     1  // Package reference is deprecated, and has moved to github.com/distribution/reference.
     2  //
     3  // Deprecated: use github.com/distribution/reference instead.
     4  package reference
     5  
     6  import (
     7  	"github.com/distribution/reference"
     8  	"github.com/opencontainers/go-digest"
     9  )
    10  
    11  const (
    12  	// NameTotalLengthMax is the maximum total number of characters in a repository name.
    13  	//
    14  	// Deprecated: use [reference.NameTotalLengthMax].
    15  	NameTotalLengthMax = reference.NameTotalLengthMax
    16  )
    17  
    18  var (
    19  	// ErrReferenceInvalidFormat represents an error while trying to parse a string as a reference.
    20  	//
    21  	// Deprecated: use [reference.ErrReferenceInvalidFormat].
    22  	ErrReferenceInvalidFormat = reference.ErrReferenceInvalidFormat
    23  
    24  	// ErrTagInvalidFormat represents an error while trying to parse a string as a tag.
    25  	//
    26  	// Deprecated: use [reference.ErrTagInvalidFormat].
    27  	ErrTagInvalidFormat = reference.ErrTagInvalidFormat
    28  
    29  	// ErrDigestInvalidFormat represents an error while trying to parse a string as a tag.
    30  	//
    31  	// Deprecated: use [reference.ErrDigestInvalidFormat].
    32  	ErrDigestInvalidFormat = reference.ErrDigestInvalidFormat
    33  
    34  	// ErrNameContainsUppercase is returned for invalid repository names that contain uppercase characters.
    35  	//
    36  	// Deprecated: use [reference.ErrNameContainsUppercase].
    37  	ErrNameContainsUppercase = reference.ErrNameContainsUppercase
    38  
    39  	// ErrNameEmpty is returned for empty, invalid repository names.
    40  	//
    41  	// Deprecated: use [reference.ErrNameEmpty].
    42  	ErrNameEmpty = reference.ErrNameEmpty
    43  
    44  	// ErrNameTooLong is returned when a repository name is longer than NameTotalLengthMax.
    45  	//
    46  	// Deprecated: use [reference.ErrNameTooLong].
    47  	ErrNameTooLong = reference.ErrNameTooLong
    48  
    49  	// ErrNameNotCanonical is returned when a name is not canonical.
    50  	//
    51  	// Deprecated: use [reference.ErrNameNotCanonical].
    52  	ErrNameNotCanonical = reference.ErrNameNotCanonical
    53  )
    54  
    55  // Reference is an opaque object reference identifier that may include
    56  // modifiers such as a hostname, name, tag, and digest.
    57  //
    58  // Deprecated: use [reference.Reference].
    59  type Reference = reference.Reference
    60  
    61  // Field provides a wrapper type for resolving correct reference types when
    62  // working with encoding.
    63  //
    64  // Deprecated: use [reference.Field].
    65  type Field = reference.Field
    66  
    67  // AsField wraps a reference in a Field for encoding.
    68  //
    69  // Deprecated: use [reference.AsField].
    70  func AsField(ref reference.Reference) reference.Field {
    71  	return reference.AsField(ref)
    72  }
    73  
    74  // Named is an object with a full name
    75  //
    76  // Deprecated: use [reference.Named].
    77  type Named = reference.Named
    78  
    79  // Tagged is an object which has a tag
    80  //
    81  // Deprecated: use [reference.Tagged].
    82  type Tagged = reference.Tagged
    83  
    84  // NamedTagged is an object including a name and tag.
    85  //
    86  // Deprecated: use [reference.NamedTagged].
    87  type NamedTagged reference.NamedTagged
    88  
    89  // Digested is an object which has a digest
    90  // in which it can be referenced by
    91  //
    92  // Deprecated: use [reference.Digested].
    93  type Digested reference.Digested
    94  
    95  // Canonical reference is an object with a fully unique
    96  // name including a name with domain and digest
    97  //
    98  // Deprecated: use [reference.Canonical].
    99  type Canonical reference.Canonical
   100  
   101  // Domain returns the domain part of the [Named] reference.
   102  //
   103  // Deprecated: use [reference.Domain].
   104  func Domain(named reference.Named) string {
   105  	return reference.Domain(named)
   106  }
   107  
   108  // Path returns the name without the domain part of the [Named] reference.
   109  //
   110  // Deprecated: use [reference.Path].
   111  func Path(named reference.Named) (name string) {
   112  	return reference.Path(named)
   113  }
   114  
   115  // SplitHostname splits a named reference into a
   116  // hostname and name string. If no valid hostname is
   117  // found, the hostname is empty and the full value
   118  // is returned as name
   119  //
   120  // Deprecated: Use [reference.Domain] or [reference.Path].
   121  func SplitHostname(named reference.Named) (string, string) {
   122  	return reference.SplitHostname(named)
   123  }
   124  
   125  // Parse parses s and returns a syntactically valid Reference.
   126  // If an error was encountered it is returned, along with a nil Reference.
   127  //
   128  // Deprecated: use [reference.Parse].
   129  func Parse(s string) (reference.Reference, error) {
   130  	return reference.Parse(s)
   131  }
   132  
   133  // ParseNamed parses s and returns a syntactically valid reference implementing
   134  // the Named interface. The reference must have a name and be in the canonical
   135  // form, otherwise an error is returned.
   136  // If an error was encountered it is returned, along with a nil Reference.
   137  //
   138  // Deprecated: use [reference.ParseNamed].
   139  func ParseNamed(s string) (reference.Named, error) {
   140  	return reference.ParseNamed(s)
   141  }
   142  
   143  // WithName returns a named object representing the given string. If the input
   144  // is invalid ErrReferenceInvalidFormat will be returned.
   145  //
   146  // Deprecated: use [reference.WithName].
   147  func WithName(name string) (reference.Named, error) {
   148  	return reference.WithName(name)
   149  }
   150  
   151  // WithTag combines the name from "name" and the tag from "tag" to form a
   152  // reference incorporating both the name and the tag.
   153  //
   154  // Deprecated: use [reference.WithTag].
   155  func WithTag(name reference.Named, tag string) (reference.NamedTagged, error) {
   156  	return reference.WithTag(name, tag)
   157  }
   158  
   159  // WithDigest combines the name from "name" and the digest from "digest" to form
   160  // a reference incorporating both the name and the digest.
   161  //
   162  // Deprecated: use [reference.WithDigest].
   163  func WithDigest(name reference.Named, digest digest.Digest) (reference.Canonical, error) {
   164  	return reference.WithDigest(name, digest)
   165  }
   166  
   167  // TrimNamed removes any tag or digest from the named reference.
   168  //
   169  // Deprecated: use [reference.TrimNamed].
   170  func TrimNamed(ref reference.Named) reference.Named {
   171  	return reference.TrimNamed(ref)
   172  }
   173  

View as plain text