pub struct ArtifactManifest { /* private fields */ }
Expand description
The OCI Artifact manifest describes content addressable artifacts in order to store them along side container images in a registry.
Implementations§
Source§impl ArtifactManifest
impl ArtifactManifest
Sourcepub fn media_type(&self) -> &MediaType
pub fn media_type(&self) -> &MediaType
This property MUST be used and contain the media type
application/vnd.oci.artifact.manifest.v1+json
.
Sourcepub fn artifact_type(&self) -> &MediaType
pub fn artifact_type(&self) -> &MediaType
This property SHOULD be used and contain the mediaType of the referenced artifact. If defined, the value MUST comply with RFC 6838, including the naming requirements in its section 4.2, and MAY be registered with IANA.
Sourcepub fn blobs(&self) -> &Vec<Descriptor>
pub fn blobs(&self) -> &Vec<Descriptor>
This OPTIONAL property is an array of objects and each item in the array MUST be a descriptor. Each descriptor represents an artifact of any IANA mediaType. The list MAY be ordered for certain artifact types like scan results.
Sourcepub fn subject(&self) -> &Option<Descriptor>
pub fn subject(&self) -> &Option<Descriptor>
This OPTIONAL property specifies a descriptor of another manifest. This value, used by the referrers API, indicates a relationship to the specified manifest.
Sourcepub fn annotations(&self) -> &Option<HashMap<String, String>>
pub fn annotations(&self) -> &Option<HashMap<String, String>>
This OPTIONAL property contains additional metadata for the artifact manifest. This OPTIONAL property MUST use the annotation rules. See Pre-Defined Annotation Keys. Annotations MAY be used to filter the response from the referrers API.
Source§impl ArtifactManifest
impl ArtifactManifest
Sourcepub fn blobs_mut(&mut self) -> &mut Vec<Descriptor>
pub fn blobs_mut(&mut self) -> &mut Vec<Descriptor>
This OPTIONAL property is an array of objects and each item in the array MUST be a descriptor. Each descriptor represents an artifact of any IANA mediaType. The list MAY be ordered for certain artifact types like scan results.
Sourcepub fn annotations_mut(&mut self) -> &mut Option<HashMap<String, String>>
pub fn annotations_mut(&mut self) -> &mut Option<HashMap<String, String>>
This OPTIONAL property contains additional metadata for the artifact manifest. This OPTIONAL property MUST use the annotation rules. See Pre-Defined Annotation Keys. Annotations MAY be used to filter the response from the referrers API.
Source§impl ArtifactManifest
impl ArtifactManifest
Sourcepub fn set_artifact_type(&mut self, val: MediaType) -> &mut Self
pub fn set_artifact_type(&mut self, val: MediaType) -> &mut Self
This property SHOULD be used and contain the mediaType of the referenced artifact. If defined, the value MUST comply with RFC 6838, including the naming requirements in its section 4.2, and MAY be registered with IANA.
Sourcepub fn set_blobs(&mut self, val: Vec<Descriptor>) -> &mut Self
pub fn set_blobs(&mut self, val: Vec<Descriptor>) -> &mut Self
This OPTIONAL property is an array of objects and each item in the array MUST be a descriptor. Each descriptor represents an artifact of any IANA mediaType. The list MAY be ordered for certain artifact types like scan results.
Sourcepub fn set_subject(&mut self, val: Option<Descriptor>) -> &mut Self
pub fn set_subject(&mut self, val: Option<Descriptor>) -> &mut Self
This OPTIONAL property specifies a descriptor of another manifest. This value, used by the referrers API, indicates a relationship to the specified manifest.
Sourcepub fn set_annotations(
&mut self,
val: Option<HashMap<String, String>>,
) -> &mut Self
pub fn set_annotations( &mut self, val: Option<HashMap<String, String>>, ) -> &mut Self
This OPTIONAL property contains additional metadata for the artifact manifest. This OPTIONAL property MUST use the annotation rules. See Pre-Defined Annotation Keys. Annotations MAY be used to filter the response from the referrers API.
Source§impl ArtifactManifest
impl ArtifactManifest
Sourcepub fn from_file(path: impl AsRef<Path>) -> Result<Self>
pub fn from_file(path: impl AsRef<Path>) -> Result<Self>
Attempts to load an image manifest from a file.
§Errors
- OciSpecError::Io if the file does not exist
- OciSpecError::SerDe if the image manifest cannot be deserialized.
§Example
use oci_spec::image::ArtifactManifest;
let artifact_manifest = ArtifactManifest::from_file("manifest.json").unwrap();
Sourcepub fn from_reader<R: Read>(reader: R) -> Result<Self>
pub fn from_reader<R: Read>(reader: R) -> Result<Self>
Attempts to load an image manifest from a stream.
§Errors
- OciSpecError::SerDe if the manifest cannot be deserialized.
§Example
use oci_spec::image::ArtifactManifest;
use std::fs::File;
let reader = File::open("manifest.json").unwrap();
let artifact_manifest = ArtifactManifest::from_reader(reader).unwrap();
Sourcepub fn to_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn to_file<P: AsRef<Path>>(&self, path: P) -> Result<()>
Attempts to write an image manifest to a file as JSON. If the file already exists, it will be overwritten.
§Errors
- OciSpecError::SerDe if the image manifest cannot be serialized.
§Example
use oci_spec::image::ArtifactManifest;
let artifact_manifest = ArtifactManifest::from_file("manifest.json").unwrap();
artifact_manifest.to_file("my-manifest.json").unwrap();
Sourcepub fn to_file_pretty<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn to_file_pretty<P: AsRef<Path>>(&self, path: P) -> Result<()>
Attempts to write an image manifest to a file as pretty printed JSON. If the file already exists, it will be overwritten.
§Errors
- OciSpecError::SerDe if the image manifest cannot be serialized.
§Example
use oci_spec::image::ArtifactManifest;
let artifact_manifest = ArtifactManifest::from_file("manifest.json").unwrap();
artifact_manifest.to_file_pretty("my-manifest.json").unwrap();
Sourcepub fn to_writer<W: Write>(&self, writer: &mut W) -> Result<()>
pub fn to_writer<W: Write>(&self, writer: &mut W) -> Result<()>
Attempts to write an image manifest to a stream as JSON.
§Errors
- OciSpecError::SerDe if the image manifest cannot be serialized.
§Example
use oci_spec::image::ArtifactManifest;
let artifact_manifest = ArtifactManifest::from_file("manifest.json").unwrap();
let mut writer = Vec::new();
artifact_manifest.to_writer(&mut writer);
Sourcepub fn to_writer_pretty<W: Write>(&self, writer: &mut W) -> Result<()>
pub fn to_writer_pretty<W: Write>(&self, writer: &mut W) -> Result<()>
Attempts to write an image manifest to a stream as pretty printed JSON.
§Errors
- OciSpecError::SerDe if the image manifest cannot be serialized.
§Example
use oci_spec::image::ArtifactManifest;
let artifact_manifest = ArtifactManifest::from_file("manifest.json").unwrap();
let mut writer = Vec::new();
artifact_manifest.to_writer_pretty(&mut writer);
Sourcepub fn to_string(&self) -> Result<String>
pub fn to_string(&self) -> Result<String>
Attempts to write an image manifest to a string as JSON.
§Errors
- OciSpecError::SerDe if the image configuration cannot be serialized.
§Example
use oci_spec::image::ArtifactManifest;
let artifact_manifest = ArtifactManifest::from_file("manifest.json").unwrap();
let json_str = artifact_manifest.to_string().unwrap();
Sourcepub fn to_string_pretty(&self) -> Result<String>
pub fn to_string_pretty(&self) -> Result<String>
Attempts to write an image manifest to a string as pretty printed JSON.
§Errors
- OciSpecError::SerDe if the image configuration cannot be serialized.
§Example
use oci_spec::image::ArtifactManifest;
let artifact_manifest = ArtifactManifest::from_file("manifest.json").unwrap();
let json_str = artifact_manifest.to_string_pretty().unwrap();
Trait Implementations§
Source§impl Clone for ArtifactManifest
impl Clone for ArtifactManifest
Source§fn clone(&self) -> ArtifactManifest
fn clone(&self) -> ArtifactManifest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ArtifactManifest
impl Debug for ArtifactManifest
Source§impl<'de> Deserialize<'de> for ArtifactManifest
impl<'de> Deserialize<'de> for ArtifactManifest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ArtifactManifest
impl PartialEq for ArtifactManifest
Source§impl Serialize for ArtifactManifest
impl Serialize for ArtifactManifest
impl Eq for ArtifactManifest
impl StructuralPartialEq for ArtifactManifest
Auto Trait Implementations§
impl Freeze for ArtifactManifest
impl RefUnwindSafe for ArtifactManifest
impl Send for ArtifactManifest
impl Sync for ArtifactManifest
impl Unpin for ArtifactManifest
impl UnwindSafe for ArtifactManifest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)