Types
use record instant
from wasi:clocks/system-clock@0.3.0
An "instant", or "exact time", is a point in time without regard to any time zone: just the time since a particular external reference point, often called an "epoch".
Here, the epoch is 1970-01-01T00:00:00Z, also known as POSIX's Seconds Since the Epoch, also known as Unix Time.
Note that even if the seconds field is negative, incrementing
nanoseconds always represents moving forwards in time.
For example, { -1 seconds, 999999999 nanoseconds } represents the
instant one nanosecond before the epoch.
For more on various different ways to represent time, see
https://tc39.es/proposal-temporal/docs/timezone.html
seconds:s64nanoseconds:u32
variant retry-after
date:instantdelay-seconds:u32
variant error-code
blob-unknown:stringblob unknown to registry (code-1
BLOB_UNKNOWN)blob-upload-invalid:stringblob upload invalid (code-2
BLOB_UPLOAD_INVALID)blob-upload-unknown:stringblob upload unknown to registry (code-3
BLOB_UPLOAD_UNKNOWN)digest-invalid:stringprovided digest did not match uploaded content (code-4
DIGEST_INVALID)manifest-blob-unknown:stringmanifest references a manifest or blob unknown to registry (code-5
MANIFEST_BLOB_UNKNOWN)manifest-invalid:stringmanifest invalid (code-6
MANIFEST_INVALID)manifest-unknown:stringmanifest unknown to registry (code-7
MANIFEST_UNKNOWN)name-invalid:stringinvalid repository name (code-8
NAME_INVALID)name-unknown:stringrepository name not known to registry (code-9
NAME_UNKNOWN)size-invalid:stringprovided length did not match content length (code-10
SIZE_INVALID)unauthorized:stringauthentication required (code-11
UNAUTHORIZED)denied:stringrequested access to the resource is denied (code-12
DENIED)unsupported:stringthe operation is unsupported (code-13
UNSUPPORTED)toomanyrequests:option<retry-after>too many requests (code-14
TOOMANYREQUESTS)other:option<string>other
variant schema-version
v2other:option<u8>
variant media-type-suffix
jsonjson encoded
gzipcompressed with gzip
zstdcompressed with zstd
other:option<string>other encoding
variant media-type
common media types for oci artifacts
application-vnd-oci-descriptor-v1:media-type-suffixcontent descriptor
application-vnd-oci-layout-header-v1:media-type-suffixoci layout
application-vnd-oci-image-index-v1:media-type-suffiximage index
application-vnd-oci-image-manifest-v1:media-type-suffiximage manifest
application-vnd-oci-image-config-v1:media-type-suffiximage config
application-vnd-oci-image-layer-v1-tar:media-type-suffixlayer, as a tar archive
application-vnd-oci-empty-v1:media-type-suffixempty for unused descriptors
application-vnd-oci-image-layer-nondistributable-v1-tar:media-type-suffixlayer, as a tar archive
application-vnd-wasm-config-v0:media-type-suffixwasm config
application-wasmwasm
other:stringother
record oci-image-index-manifest-v1-manifest-platform
architecture:stringCPU architecture which the binaries in this image are built to run on
os:stringname of the operating system which the image is built to run on
os-version:option<string>version of the operating system
os-features:option<list<string>>mandatory OS features
variant:option<string>variant of the CPU
record oci-image-config-v1-config
user:option<string>username or UID which is a platform-specific structure that allows specific control over which user the process run as
exposed-ports:option<list<string>>set of ports to expose from a container running this image
env:option<list<string>>values act as defaults and are merged with any specified when creating a container
entrypoint:option<list<string>>arguments to use as the command to execute when the container starts
cmd:option<list<string>>arguments to the entrypoint of the container
volumes:option<list<string>>directories describing where the process is likely to write data specific to a container instance
working-dir:option<string>current working directory of the entrypoint process in the container
labels:option<map<string, string>>arbitrary metadata for the container
stop-signal:option<string>system call signal that will be sent to the container to exit
args-escaped:option<bool>deprecated: present only for legacy compatibility
record oci-image-config-v1-history-entry
created:option<instant>combined date and time at which the layer was created
author:option<string>author of the build point
created-by:option<string>command which created the layer
comment:option<string>custom message set when creating the layer
empty-layer:option<bool>mark if the history item created a filesystem diff
record wasm-config-v0-component
exports:list<string>imports:list<string>target:option<string>
record digest
algorithm:stringencoded:string
record oci-descriptor-v1
media-type:media-typemedia type of the referenced content
digest:digestdigest of the targeted content
size:u64size, in bytes, of the raw content
urls:option<list<string>>list of URIs from which this object MAY be downloaded
annotations:option<map<string, string>>arbitrary metadata for this descriptor
data:option<string>embedded representation of the referenced content
artifact-type:option<media-type>type of an artifact when the descriptor points to an artifact
record oci-image-manifest-v1
schema-version:schema-versionmanifest schema version
media-type:media-typemust contain the media type 'application/vnd.oci.image.manifest.v1+json'.
artifact-type:option<media-type>type of an artifact when the manifest is used for an artifact
config:oci-descriptor-v1configuration object for a container
layers:list<oci-descriptor-v1>list of layer descriptors
subject:option<oci-descriptor-v1>weak association to another manifest
annotations:option<map<string, string>>arbitrary metadata for the image manifest
record oci-image-index-manifest-v1-manifest
media-type:media-typemedia type of the referenced content
digest:digestdigest of the targeted content
size:u64size, in bytes, of the raw content
urls:option<list<string>>list of URIs from which this object MAY be downloaded
annotations:option<map<string, string>>arbitrary metadata for this descriptor
data:option<string>embedded representation of the referenced content
artifact-type:option<media-type>type of an artifact when the descriptor points to an artifact
platform:option<oci-image-index-manifest-v1-manifest-platform>minimum runtime requirements of the image
subject:option<oci-descriptor-v1>descriptor of another manifest
record oci-image-index-manifest-v1
schema-version:schema-versionmanifest schema version
media-type:media-typemust contain the media type 'application/vnd.oci.image.index.v1+json'.
artifact-type:option<media-type>type of an artifact when the manifest is used for an artifact
manifests:list<oci-image-index-manifest-v1-manifest>manifests for specific platforms
subject:option<oci-descriptor-v1>weak association to another manifest
annotations:option<map<string, string>>arbitrary metadata for the image manifest
variant manifest
oci-image-v1:oci-image-manifest-v1oci image
oci-image-index-v1:oci-image-index-manifest-v1oci image index
other:list<u8>other
record oci-image-config-v1-content-addresses
type:stringmust be 'layers'
diff-ids:list<digest>layer content hashes, in order from first to last
record oci-image-config-v1
created:option<instant>combined date and time at which the image was created
author:option<string>name and/or email address of the person or entity which created and is responsible for maintaining the image
architecture:stringCPU architecture which the binaries in this image are built to run on
os:stringname of the operating system which the image is built to run on
os-version:option<string>version of the operating system
os-features:option<list<string>>mandatory OS features
variant:option<string>variant of the specified CPU architecture
config:option<oci-image-config-v1-config>execution parameters which should be used as a base when running a container using the image
rootfs:oci-image-config-v1-content-addresseslayer content addresses used by the image
history:option<list<oci-image-config-v1-history-entry>>history of each layer. The array is ordered from first to last
record wasm-config-v0
created:option<instant>combined date and time at which the image was created
author:option<string>name and/or email address of the person or entity which created and is responsible for maintaining the image
architecture:stringmust match a GOARCH value
os:stringmust match a GOOS value
layer-digests:list<digest>digests of the layers in the same order
component:option<wasm-config-v0-component>component metadata
variant config
oci-image-v1:oci-image-config-v1oci iamge
wasm-v0:wasm-config-v0wasm module
other:list<u8>other
record reference
registry:stringrepository:stringtag:option<string>digest:option<digest>
Functions
parse-reference: func(
reference: string,
) -> result<reference, error-code>
resolve-digest: async func(
reference: reference,
) -> result<digest, error-code>
get-blob: async func(
reference: reference,
) -> result<list<u8>, error-code>
get-config: async func(
reference: reference,
default-media-type: option<media-type>,
) -> result<config, error-code>
get-manifest: async func(
reference: reference,
) -> result<manifest, error-code>
WIT
interface client {
use wasi:clocks/system-clock@0.3.0.{instant};
variant retry-after {
date(instant),
delay-seconds(u32),
}
variant error-code {
/// blob unknown to registry (code-1 `BLOB_UNKNOWN`)
blob-unknown(string),
/// blob upload invalid (code-2 `BLOB_UPLOAD_INVALID`)
blob-upload-invalid(string),
/// blob upload unknown to registry (code-3`BLOB_UPLOAD_UNKNOWN`)
blob-upload-unknown(string),
/// provided digest did not match uploaded content (code-4 `DIGEST_INVALID`)
digest-invalid(string),
/// manifest references a manifest or blob unknown to registry (code-5 `MANIFEST_BLOB_UNKNOWN`)
manifest-blob-unknown(string),
/// manifest invalid (code-6 `MANIFEST_INVALID`)
manifest-invalid(string),
/// manifest unknown to registry (code-7 `MANIFEST_UNKNOWN`)
manifest-unknown(string),
/// invalid repository name (code-8 `NAME_INVALID`)
name-invalid(string),
/// repository name not known to registry (code-9 `NAME_UNKNOWN`)
name-unknown(string),
/// provided length did not match content length (code-10 `SIZE_INVALID`)
size-invalid(string),
/// authentication required (code-11 `UNAUTHORIZED`)
unauthorized(string),
/// requested access to the resource is denied (code-12 `DENIED`)
denied(string),
/// the operation is unsupported (code-13 `UNSUPPORTED`)
unsupported(string),
/// too many requests (code-14 `TOOMANYREQUESTS`)
toomanyrequests(option<retry-after>),
/// other
other(option<string>),
}
variant schema-version {
v2,
other(option<u8>),
}
variant media-type-suffix {
/// json encoded
json,
/// compressed with gzip
gzip,
/// compressed with zstd
zstd,
/// other encoding
other(option<string>),
}
/// common media types for oci artifacts
variant media-type {
/// content descriptor
application-vnd-oci-descriptor-v1(media-type-suffix),
/// oci layout
application-vnd-oci-layout-header-v1(media-type-suffix),
/// image index
application-vnd-oci-image-index-v1(media-type-suffix),
/// image manifest
application-vnd-oci-image-manifest-v1(media-type-suffix),
/// image config
application-vnd-oci-image-config-v1(media-type-suffix),
/// layer, as a tar archive
application-vnd-oci-image-layer-v1-tar(media-type-suffix),
/// empty for unused descriptors
application-vnd-oci-empty-v1(media-type-suffix),
/// layer, as a tar archive
application-vnd-oci-image-layer-nondistributable-v1-tar(media-type-suffix),
/// wasm config
application-vnd-wasm-config-v0(media-type-suffix),
/// wasm
application-wasm,
/// other
other(string),
}
record oci-image-index-manifest-v1-manifest-platform {
/// CPU architecture which the binaries in this image are built to run on
architecture: string,
/// name of the operating system which the image is built to run on
os: string,
/// version of the operating system
os-version: option<string>,
/// mandatory OS features
os-features: option<list<string>>,
/// variant of the CPU
%variant: option<string>,
}
record oci-image-config-v1-config {
/// username or UID which is a platform-specific structure that allows specific control over which user the process run as
user: option<string>,
/// set of ports to expose from a container running this image
exposed-ports: option<list<string>>,
/// values act as defaults and are merged with any specified when creating a container
env: option<list<string>>,
/// arguments to use as the command to execute when the container starts
entrypoint: option<list<string>>,
/// arguments to the entrypoint of the container
cmd: option<list<string>>,
/// directories describing where the process is likely to write data specific to a container instance
volumes: option<list<string>>,
/// current working directory of the entrypoint process in the container
working-dir: option<string>,
/// arbitrary metadata for the container
labels: option<map<string, string>>,
/// system call signal that will be sent to the container to exit
stop-signal: option<string>,
/// deprecated: present only for legacy compatibility
args-escaped: option<bool>,
}
record oci-image-config-v1-history-entry {
/// combined date and time at which the layer was created
created: option<instant>,
/// author of the build point
author: option<string>,
/// command which created the layer
created-by: option<string>,
/// custom message set when creating the layer
comment: option<string>,
/// mark if the history item created a filesystem diff
empty-layer: option<bool>,
}
record wasm-config-v0-component {
exports: list<string>,
imports: list<string>,
target: option<string>,
}
record digest {
algorithm: string,
encoded: string,
}
record oci-descriptor-v1 {
/// media type of the referenced content
media-type: media-type,
/// digest of the targeted content
digest: digest,
/// size, in bytes, of the raw content
size: u64,
/// list of URIs from which this object MAY be downloaded
urls: option<list<string>>,
/// arbitrary metadata for this descriptor
annotations: option<map<string, string>>,
/// embedded representation of the referenced content
data: option<string>,
/// type of an artifact when the descriptor points to an artifact
artifact-type: option<media-type>,
}
record oci-image-manifest-v1 {
/// manifest schema version
schema-version: schema-version,
/// must contain the media type 'application/vnd.oci.image.manifest.v1+json'.
media-type: media-type,
/// type of an artifact when the manifest is used for an artifact
artifact-type: option<media-type>,
/// configuration object for a container
config: oci-descriptor-v1,
/// list of layer descriptors
layers: list<oci-descriptor-v1>,
/// weak association to another manifest
subject: option<oci-descriptor-v1>,
/// arbitrary metadata for the image manifest
annotations: option<map<string, string>>,
}
record oci-image-index-manifest-v1-manifest {
/// media type of the referenced content
media-type: media-type,
/// digest of the targeted content
digest: digest,
/// size, in bytes, of the raw content
size: u64,
/// list of URIs from which this object MAY be downloaded
urls: option<list<string>>,
/// arbitrary metadata for this descriptor
annotations: option<map<string, string>>,
/// embedded representation of the referenced content
data: option<string>,
/// type of an artifact when the descriptor points to an artifact
artifact-type: option<media-type>,
/// minimum runtime requirements of the image
platform: option<oci-image-index-manifest-v1-manifest-platform>,
/// descriptor of another manifest
subject: option<oci-descriptor-v1>,
}
record oci-image-index-manifest-v1 {
/// manifest schema version
schema-version: schema-version,
/// must contain the media type 'application/vnd.oci.image.index.v1+json'.
media-type: media-type,
/// type of an artifact when the manifest is used for an artifact
artifact-type: option<media-type>,
/// manifests for specific platforms
manifests: list<oci-image-index-manifest-v1-manifest>,
/// weak association to another manifest
subject: option<oci-descriptor-v1>,
/// arbitrary metadata for the image manifest
annotations: option<map<string, string>>,
}
variant manifest {
/// oci image
oci-image-v1(oci-image-manifest-v1),
/// oci image index
oci-image-index-v1(oci-image-index-manifest-v1),
/// other
other(list<u8>),
}
record oci-image-config-v1-content-addresses {
/// must be 'layers'
%type: string,
/// layer content hashes, in order from first to last
diff-ids: list<digest>,
}
record oci-image-config-v1 {
/// combined date and time at which the image was created
created: option<instant>,
/// name and/or email address of the person or entity which created and is responsible for maintaining the image
author: option<string>,
/// CPU architecture which the binaries in this image are built to run on
architecture: string,
/// name of the operating system which the image is built to run on
os: string,
/// version of the operating system
os-version: option<string>,
/// mandatory OS features
os-features: option<list<string>>,
/// variant of the specified CPU architecture
%variant: option<string>,
/// execution parameters which should be used as a base when running a container using the image
config: option<oci-image-config-v1-config>,
/// layer content addresses used by the image
rootfs: oci-image-config-v1-content-addresses,
/// history of each layer. The array is ordered from first to last
history: option<list<oci-image-config-v1-history-entry>>,
}
record wasm-config-v0 {
/// combined date and time at which the image was created
created: option<instant>,
/// name and/or email address of the person or entity which created and is responsible for maintaining the image
author: option<string>,
/// must match a GOARCH value
architecture: string,
/// must match a GOOS value
os: string,
/// digests of the layers in the same order
layer-digests: list<digest>,
/// component metadata
component: option<wasm-config-v0-component>,
}
variant config {
/// oci iamge
oci-image-v1(oci-image-config-v1),
/// wasm module
wasm-v0(wasm-config-v0),
/// other
other(list<u8>),
}
record reference {
registry: string,
repository: string,
tag: option<string>,
digest: option<digest>,
}
parse-reference: func(reference: string) -> result<reference, error-code>;
resolve-digest: async func(reference: reference) -> result<digest, error-code>;
get-blob: async func(reference: reference) -> result<list<u8>, error-code>;
get-config: async func(reference: reference, default-media-type: option<media-type>) -> result<config, error-code>;
get-manifest: async func(reference: reference) -> result<manifest, error-code>;
}