oci_image_spec/specs/v1/descriptor.rs
1use std::collections::HashMap;
2
3/// Descriptor describes the disposition of targeted content.
4/// This structure provides `application/vnd.oci.descriptor.v1+json` mediatype
5/// when marshalled to JSON.
6#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Default)]
7pub struct Descriptor {
8 /// MediaType is the media type of the object this schema refers to.
9 #[serde(rename = "mediaType", skip_serializing_if = "Option::is_none")]
10 pub media_type: Option<String>,
11
12 /// Digest is the digest of the targeted content.
13 #[serde(rename = "digest", skip_serializing_if = "Option::is_none")]
14 pub digest: Option<String>,
15
16 /// Size specifies the size in bytes of the blob.
17 #[serde(rename = "size")]
18 pub size: i64,
19
20 /// URLs specifies a list of URLs from which this object MAY be downloaded
21 #[serde(rename = "urls", skip_serializing_if = "Option::is_none")]
22 pub urls: Option<Vec<String>>,
23
24 /// Annotations contains arbitrary metadata relating to the targeted content.
25 #[serde(rename = "annotations", skip_serializing_if = "Option::is_none")]
26 pub annotations: Option<HashMap<String, String>>,
27
28 /// Platform describes the platform which the image in the manifest runs on.
29 /// This should only be used when referring to a manifest.
30 #[serde(rename = "platform", skip_serializing_if = "Option::is_none")]
31 pub platform: Option<Platform>,
32}
33
34/// Platform describes the platform which the image in the manifest runs on.
35#[derive(serde::Serialize, serde::Deserialize, Debug, Clone, PartialEq, Default)]
36pub struct Platform {
37 /// Architecture field specifies the CPU architecture, for example
38 /// `amd64` or `ppc64`.
39 #[serde(rename = "architecture")]
40 pub architecture: String,
41
42 /// OS specifies the operating system, for example `linux` or `windows`.
43 #[serde(rename = "os")]
44 pub os: String,
45
46 // OSVersion is an optional field specifying the operating system
47 // version, for example on Windows `10.0.14393.1066`.
48 #[serde(rename = "os.version", skip_serializing_if = "Option::is_none")]
49 pub os_version: Option<String>,
50
51 // OSFeatures is an optional field specifying an array of strings,
52 // each listing a required OS feature (for example on Windows `win32k`).
53 #[serde(rename = "os.features", skip_serializing_if = "Option::is_none")]
54 pub os_features: Option<Vec<String>>,
55
56 /// Variant is an optional field specifying a variant of the CPU, for
57 /// example `v7` to specify ARMv7 when architecture is `arm`.
58 #[serde(rename = "variant", skip_serializing_if = "Option::is_none")]
59 pub variant: Option<String>,
60}