descriptor.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // Copyright 2016-2022 The Linux Foundation
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package v1
  15. import digest "github.com/opencontainers/go-digest"
  16. // Descriptor describes the disposition of targeted content.
  17. // This structure provides `application/vnd.oci.descriptor.v1+json` mediatype
  18. // when marshalled to JSON.
  19. type Descriptor struct {
  20. // MediaType is the media type of the object this schema refers to.
  21. MediaType string `json:"mediaType,omitempty"`
  22. // Digest is the digest of the targeted content.
  23. Digest digest.Digest `json:"digest"`
  24. // Size specifies the size in bytes of the blob.
  25. Size int64 `json:"size"`
  26. // URLs specifies a list of URLs from which this object MAY be downloaded
  27. URLs []string `json:"urls,omitempty"`
  28. // Annotations contains arbitrary metadata relating to the targeted content.
  29. Annotations map[string]string `json:"annotations,omitempty"`
  30. // Data is an embedding of the targeted content. This is encoded as a base64
  31. // string when marshalled to JSON (automatically, by encoding/json). If
  32. // present, Data can be used directly to avoid fetching the targeted content.
  33. Data []byte `json:"data,omitempty"`
  34. // Platform describes the platform which the image in the manifest runs on.
  35. //
  36. // This should only be used when referring to a manifest.
  37. Platform *Platform `json:"platform,omitempty"`
  38. // ArtifactType is the IANA media type of this artifact.
  39. ArtifactType string `json:"artifactType,omitempty"`
  40. }
  41. // Platform describes the platform which the image in the manifest runs on.
  42. type Platform struct {
  43. // Architecture field specifies the CPU architecture, for example
  44. // `amd64` or `ppc64`.
  45. Architecture string `json:"architecture"`
  46. // OS specifies the operating system, for example `linux` or `windows`.
  47. OS string `json:"os"`
  48. // OSVersion is an optional field specifying the operating system
  49. // version, for example on Windows `10.0.14393.1066`.
  50. OSVersion string `json:"os.version,omitempty"`
  51. // OSFeatures is an optional field specifying an array of strings,
  52. // each listing a required OS feature (for example on Windows `win32k`).
  53. OSFeatures []string `json:"os.features,omitempty"`
  54. // Variant is an optional field specifying a variant of the CPU, for
  55. // example `v7` to specify ARMv7 when architecture is `arm`.
  56. Variant string `json:"variant,omitempty"`
  57. }