| 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 |
|
| 15 |
package v1 |
| 16 |
|
| 17 |
import digest "github.com/opencontainers/go-digest" |
| 18 |
|
| 19 |
// Descriptor describes the disposition of targeted content. |
| 20 |
// This structure provides `application/vnd.oci.descriptor.v1+json` mediatype |
| 21 |
// when marshalled to JSON. |
| 22 |
type Descriptor struct { |
| 23 |
// MediaType is the media type of the object this schema refers to. |
| 24 |
MediaType string `json:"mediaType"` |
| 25 |
|
| 26 |
// Digest is the digest of the targeted content. |
| 27 |
Digest digest.Digest `json:"digest"` |
| 28 |
|
| 29 |
// Size specifies the size in bytes of the blob. |
| 30 |
Size int64 `json:"size"` |
| 31 |
|
| 32 |
// URLs specifies a list of URLs from which this object MAY be downloaded |
| 33 |
URLs []string `json:"urls,omitempty"` |
| 34 |
|
| 35 |
// Annotations contains arbitrary metadata relating to the targeted content. |
| 36 |
Annotations map[string]string `json:"annotations,omitempty"` |
| 37 |
|
| 38 |
// Data is an embedding of the targeted content. This is encoded as a base64 |
| 39 |
// string when marshalled to JSON (automatically, by encoding/json). If |
| 40 |
// present, Data can be used directly to avoid fetching the targeted content. |
| 41 |
Data []byte `json:"data,omitempty"` |
| 42 |
|
| 43 |
// Platform describes the platform which the image in the manifest runs on. |
| 44 |
// |
| 45 |
// This should only be used when referring to a manifest. |
| 46 |
Platform *Platform `json:"platform,omitempty"` |
| 47 |
|
| 48 |
// ArtifactType is the IANA media type of this artifact. |
| 49 |
ArtifactType string `json:"artifactType,omitempty"` |
| 50 |
} |
| 51 |
|
| 52 |
// Platform describes the platform which the image in the manifest runs on. |
| 53 |
type Platform struct { |
| 54 |
// Architecture field specifies the CPU architecture, for example |
| 55 |
// `amd64` or `ppc64le`. |
| 56 |
Architecture string `json:"architecture"` |
| 57 |
|
| 58 |
// OS specifies the operating system, for example `linux` or `windows`. |
| 59 |
OS string `json:"os"` |
| 60 |
|
| 61 |
// OSVersion is an optional field specifying the operating system |
| 62 |
// version, for example on Windows `10.0.14393.1066`. |
| 63 |
OSVersion string `json:"os.version,omitempty"` |
| 64 |
|
| 65 |
// OSFeatures is an optional field specifying an array of strings, |
| 66 |
// each listing a required OS feature (for example on Windows `win32k`). |
| 67 |
OSFeatures []string `json:"os.features,omitempty"` |
| 68 |
|
| 69 |
// Variant is an optional field specifying a variant of the CPU, for |
| 70 |
// example `v7` to specify ARMv7 when architecture is `arm`. |
| 71 |
Variant string `json:"variant,omitempty"` |
| 72 |
} |
| 73 |
|
| 74 |
// DescriptorEmptyJSON is the descriptor of a blob with content of `{}`. |
| 75 |
var DescriptorEmptyJSON = Descriptor{ |
| 76 |
MediaType: MediaTypeEmptyJSON, |
| 77 |
Digest: `sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a`, |
| 78 |
Size: 2, |
| 79 |
Data: []byte(`{}`), |
| 80 |
} |