pub struct ImageConfiguration { /* private fields */ }
Expand description
The image configuration is associated with an image and describes some basic information about the image such as date created, author, as well as execution/runtime configuration like its entrypoint, default arguments, networking, and volumes.
Implementations§
Source§impl ImageConfiguration
impl ImageConfiguration
Sourcepub fn created(&self) -> &Option<String>
pub fn created(&self) -> &Option<String>
An combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6.
Gives the name and/or email address of the person or entity which created and is responsible for maintaining the image.
Sourcepub fn architecture(&self) -> &Arch
pub fn architecture(&self) -> &Arch
The CPU architecture which the binaries in this image are built to run on. Configurations SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for GOARCH.
Sourcepub fn os(&self) -> &Os
pub fn os(&self) -> &Os
The name of the operating system which the image is built to run on. Configurations SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for GOOS.
Sourcepub fn os_version(&self) -> &Option<String>
pub fn os_version(&self) -> &Option<String>
This OPTIONAL property specifies the version of the operating system targeted by the referenced blob. Implementations MAY refuse to use manifests where os.version is not known to work with the host OS version. Valid values are implementation-defined. e.g. 10.0.14393.1066 on windows.
Sourcepub fn os_features(&self) -> &Option<Vec<String>>
pub fn os_features(&self) -> &Option<Vec<String>>
This OPTIONAL property specifies an array of strings, each specifying a mandatory OS feature. When os is windows, image indexes SHOULD use, and implementations SHOULD understand the following values:
- win32k: image requires win32k.sys on the host (Note: win32k.sys is missing on Nano Server)
Sourcepub fn variant(&self) -> &Option<String>
pub fn variant(&self) -> &Option<String>
The variant of the specified CPU architecture. Configurations SHOULD use, and implementations SHOULD understand, variant values listed in the Platform Variants table.
Sourcepub fn config(&self) -> &Option<Config>
pub fn config(&self) -> &Option<Config>
The execution parameters which SHOULD be used as a base when running a container using the image. This field can be None, in which case any execution parameters should be specified at creation of the container.
Source§impl ImageConfiguration
impl ImageConfiguration
Sourcepub fn rootfs_mut(&mut self) -> &mut RootFs
pub fn rootfs_mut(&mut self) -> &mut RootFs
The rootfs key references the layer content addresses used by the image. This makes the image config hash depend on the filesystem hash.
Sourcepub fn history_mut(&mut self) -> &mut Vec<History>
pub fn history_mut(&mut self) -> &mut Vec<History>
Describes the history of each layer. The array is ordered from first to last.
Source§impl ImageConfiguration
impl ImageConfiguration
Sourcepub fn set_created(&mut self, val: Option<String>) -> &mut Self
pub fn set_created(&mut self, val: Option<String>) -> &mut Self
An combined date and time at which the image was created, formatted as defined by RFC 3339, section 5.6.
Gives the name and/or email address of the person or entity which created and is responsible for maintaining the image.
Sourcepub fn set_architecture(&mut self, val: Arch) -> &mut Self
pub fn set_architecture(&mut self, val: Arch) -> &mut Self
The CPU architecture which the binaries in this image are built to run on. Configurations SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for GOARCH.
Sourcepub fn set_os(&mut self, val: Os) -> &mut Self
pub fn set_os(&mut self, val: Os) -> &mut Self
The name of the operating system which the image is built to run on. Configurations SHOULD use, and implementations SHOULD understand, values listed in the Go Language document for GOOS.
Sourcepub fn set_os_version(&mut self, val: Option<String>) -> &mut Self
pub fn set_os_version(&mut self, val: Option<String>) -> &mut Self
This OPTIONAL property specifies the version of the operating system targeted by the referenced blob. Implementations MAY refuse to use manifests where os.version is not known to work with the host OS version. Valid values are implementation-defined. e.g. 10.0.14393.1066 on windows.
Sourcepub fn set_os_features(&mut self, val: Option<Vec<String>>) -> &mut Self
pub fn set_os_features(&mut self, val: Option<Vec<String>>) -> &mut Self
This OPTIONAL property specifies an array of strings, each specifying a mandatory OS feature. When os is windows, image indexes SHOULD use, and implementations SHOULD understand the following values:
- win32k: image requires win32k.sys on the host (Note: win32k.sys is missing on Nano Server)
Sourcepub fn set_variant(&mut self, val: Option<String>) -> &mut Self
pub fn set_variant(&mut self, val: Option<String>) -> &mut Self
The variant of the specified CPU architecture. Configurations SHOULD use, and implementations SHOULD understand, variant values listed in the Platform Variants table.
Sourcepub fn set_config(&mut self, val: Option<Config>) -> &mut Self
pub fn set_config(&mut self, val: Option<Config>) -> &mut Self
The execution parameters which SHOULD be used as a base when running a container using the image. This field can be None, in which case any execution parameters should be specified at creation of the container.
Sourcepub fn set_rootfs(&mut self, val: RootFs) -> &mut Self
pub fn set_rootfs(&mut self, val: RootFs) -> &mut Self
The rootfs key references the layer content addresses used by the image. This makes the image config hash depend on the filesystem hash.
Sourcepub fn set_history(&mut self, val: Vec<History>) -> &mut Self
pub fn set_history(&mut self, val: Vec<History>) -> &mut Self
Describes the history of each layer. The array is ordered from first to last.
Source§impl ImageConfiguration
impl ImageConfiguration
Sourcepub fn from_file<P: AsRef<Path>>(path: P) -> Result<ImageConfiguration>
pub fn from_file<P: AsRef<Path>>(path: P) -> Result<ImageConfiguration>
Attempts to load an image configuration from a file.
§Errors
This function will return an OciSpecError::Io if the file does not exist or an OciSpecError::SerDe if the image configuration cannot be deserialized.
§Example
use oci_spec::image::ImageConfiguration;
let image_index = ImageConfiguration::from_file("config.json").unwrap();
Sourcepub fn from_reader<R: Read>(reader: R) -> Result<ImageConfiguration>
pub fn from_reader<R: Read>(reader: R) -> Result<ImageConfiguration>
Attempts to load an image configuration from a stream.
§Errors
This function will return an OciSpecError::SerDe if the image configuration cannot be deserialized.
§Example
use oci_spec::image::ImageConfiguration;
use std::fs::File;
let reader = File::open("config.json").unwrap();
let image_index = ImageConfiguration::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 configuration to a file as JSON. If the file already exists, it will be overwritten.
§Errors
This function will return an OciSpecError::SerDe if the image configuration cannot be serialized.
§Example
use oci_spec::image::ImageConfiguration;
let image_index = ImageConfiguration::from_file("config.json").unwrap();
image_index.to_file("my-config.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 configuration to a file as pretty printed JSON. If the file already exists, it will be overwritten.
§Errors
This function will return an OciSpecError::SerDe if the image configuration cannot be serialized.
§Example
use oci_spec::image::ImageConfiguration;
let image_index = ImageConfiguration::from_file("config.json").unwrap();
image_index.to_file_pretty("my-config.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 configuration to a stream as JSON.
§Errors
This function will return an OciSpecError::SerDe if the image configuration cannot be serialized.
§Example
use oci_spec::image::ImageConfiguration;
let image_index = ImageConfiguration::from_file("config.json").unwrap();
let mut writer = Vec::new();
image_index.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 configuration to a stream as pretty printed JSON.
§Errors
This function will return an OciSpecError::SerDe if the image configuration cannot be serialized.
§Example
use oci_spec::image::ImageConfiguration;
let image_index = ImageConfiguration::from_file("config.json").unwrap();
let mut writer = Vec::new();
image_index.to_writer_pretty(&mut writer);
Sourcepub fn to_string(&self) -> Result<String>
pub fn to_string(&self) -> Result<String>
Attempts to write an image configuration to a string as JSON.
§Errors
This function will return an OciSpecError::SerDe if the image configuration cannot be serialized.
§Example
use oci_spec::image::ImageConfiguration;
let image_configuration = ImageConfiguration::from_file("config.json").unwrap();
let json_str = image_configuration.to_string().unwrap();
Sourcepub fn to_string_pretty(&self) -> Result<String>
pub fn to_string_pretty(&self) -> Result<String>
Attempts to write an image configuration to a string as pretty printed JSON.
§Errors
This function will return an OciSpecError::SerDe if the image configuration cannot be serialized.
§Example
use oci_spec::image::ImageConfiguration;
let image_configuration = ImageConfiguration::from_file("config.json").unwrap();
let json_str = image_configuration.to_string_pretty().unwrap();
Sourcepub fn labels_of_config(&self) -> Option<&HashMap<String, String>>
pub fn labels_of_config(&self) -> Option<&HashMap<String, String>>
Extract the labels of the configuration, if present.
Sourcepub fn version(&self) -> Option<&str>
pub fn version(&self) -> Option<&str>
Retrieve the version number associated with this configuration. This will try to use several well-known label keys.
Sourcepub fn get_config_annotation(&self, key: &str) -> Option<&str>
pub fn get_config_annotation(&self, key: &str) -> Option<&str>
Extract the value of a given annotation on the configuration, if present.
Trait Implementations§
Source§impl Clone for ImageConfiguration
impl Clone for ImageConfiguration
Source§fn clone(&self) -> ImageConfiguration
fn clone(&self) -> ImageConfiguration
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ImageConfiguration
impl Debug for ImageConfiguration
Source§impl Default for ImageConfiguration
impl Default for ImageConfiguration
Source§fn default() -> ImageConfiguration
fn default() -> ImageConfiguration
Source§impl<'de> Deserialize<'de> for ImageConfiguration
impl<'de> Deserialize<'de> for ImageConfiguration
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 Display for ImageConfiguration
impl Display for ImageConfiguration
This ToString trait is automatically implemented for any type which implements the Display trait. As such, ToString shouldn’t be implemented directly: Display should be implemented instead, and you get the ToString implementation for free.
Source§impl PartialEq for ImageConfiguration
impl PartialEq for ImageConfiguration
Source§impl Serialize for ImageConfiguration
impl Serialize for ImageConfiguration
impl Eq for ImageConfiguration
impl StructuralPartialEq for ImageConfiguration
Auto Trait Implementations§
impl Freeze for ImageConfiguration
impl RefUnwindSafe for ImageConfiguration
impl Send for ImageConfiguration
impl Sync for ImageConfiguration
impl Unpin for ImageConfiguration
impl UnwindSafe for ImageConfiguration
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
)