77 lines
3.5 KiB
Rust
77 lines
3.5 KiB
Rust
/**
|
|
* The models module contains all the serde structs for the Docker registry
|
|
* requests and responses that we care about
|
|
*/
|
|
|
|
extern crate serde;
|
|
extern crate serde_json;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
/**
|
|
* Manifest format, retrieved from: /v2/alpine/manifests/latest
|
|
|
|
{
|
|
"schemaVersion": 1,
|
|
"name": "alpine",
|
|
"tag": "latest",
|
|
"architecture": "amd64",
|
|
"fsLayers": [
|
|
{
|
|
"blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
|
|
},
|
|
{
|
|
"blobSum": "sha256:6c40cc604d8e4c121adcb6b0bfe8bb038815c350980090e74aa5a6423f8f82c0"
|
|
}
|
|
],
|
|
"history": [
|
|
{
|
|
"v1Compatibility": "{\"architecture\":\"amd64\",\"config\":{\"Hostname\":\"\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"/bin/sh\"],\"ArgsEscaped\":true,\"Image\":\"sha256:ce244ca5cf823254a1dff4ea35589dcdbe540266820f401a86b7b8dc9eda8f19\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":null},\"container\":\"35bf94cc91dd11f6bd36502cefc82fd4515b20e0181b49e7c316bd78ff7c75d6\",\"container_config\":{\"Hostname\":\"35bf94cc91dd\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"/bin/sh\",\"-c\",\"#(nop) \",\"CMD [\\\"/bin/sh\\\"]\"],\"ArgsEscaped\":true,\"Image\":\"sha256:ce244ca5cf823254a1dff4ea35589dcdbe540266820f401a86b7b8dc9eda8f19\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":{}},\"created\":\"2019-01-30T22:19:52.734509838Z\",\"docker_version\":\"18.06.1-ce\",\"id\":\"02f7a7ef96f88a71b565eae4fd329ae31942b036f9deec4489c53540c2a18b6d\",\"os\":\"linux\",\"parent\":\"92bdbc97504bab151c3cf7451f2664797538d1fbe2fa0c8b92a218a97cc079df\",\"throwaway\":true}"
|
|
},
|
|
{
|
|
"v1Compatibility": "{\"id\":\"92bdbc97504bab151c3cf7451f2664797538d1fbe2fa0c8b92a218a97cc079df\",\"created\":\"2019-01-30T22:19:52.585366638Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) ADD file:2a1fc9351afe35698918545b2d466d9805c2e8afcec52f916785ee65bbafeced in / \"]}}"
|
|
}
|
|
],
|
|
"signatures": [
|
|
{
|
|
"header": {
|
|
"jwk": {
|
|
"crv": "P-256",
|
|
"kid": "GNNE:U4EY:Q2RK:62PO:3FIP:TAHB:XHLQ:IMOC:LYHD:HRH3:QJ2I:VJVZ",
|
|
"kty": "EC",
|
|
"x": "8q3mDSgd7V3wjnwTlGpsuS4f7XVGRwcWJBGkfTj5C2g",
|
|
"y": "E2wP8yAe8iLLuVF3_QbGndah-9_O9FkhXOE1nuzvAPE"
|
|
},
|
|
"alg": "ES256"
|
|
},
|
|
"signature": "ZZdKYM_K9PWoMZ1EZQwiRg7J1dYWPNYmy7gxIX37eDErZ-8E6gfvibcxVIzsvTpV6a2v-kKOLwl_qmAAif-_FA",
|
|
"protected": "eyJmb3JtYXRMZW5ndGgiOjIxMzMsImZvcm1hdFRhaWwiOiJDbjAiLCJ0aW1lIjoiMjAyMC0wMi0wMVQxNjozODo1OFoifQ"
|
|
}
|
|
]
|
|
}
|
|
*/
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Manifest {
|
|
#[serde(rename = "schemaVersion")]
|
|
schema_version: u16,
|
|
name: String,
|
|
tag: String,
|
|
architecture: String,
|
|
#[serde(rename = "fsLayers")]
|
|
fs_layers: Vec<Layer>,
|
|
signatures: Vec<Signature>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Layer {
|
|
#[serde(rename = "blobSum")]
|
|
blob_sum: String,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Signature {
|
|
signature: String,
|
|
protected: String,
|
|
}
|
|
|