oci_spec::runtime

Struct SpecBuilder

Source
pub struct SpecBuilder { /* private fields */ }
Expand description

Builder for Spec.

Implementations§

Source§

impl SpecBuilder

Source

pub fn version<VALUE: Into<String>>(self, value: VALUE) -> Self

MUST be in SemVer v2.0.0 format and specifies the version of the Open Container Initiative Runtime Specification with which the bundle complies. The Open Container Initiative Runtime Specification follows semantic versioning and retains forward and backward compatibility within major versions. For example, if a configuration is compliant with version 1.1 of this specification, it is compatible with all runtimes that support any 1.1 or later release of this specification, but is not compatible with a runtime that supports 1.0 and not 1.1.

Source

pub fn root<VALUE: Into<Root>>(self, value: VALUE) -> Self

Specifies the container’s root filesystem. On Windows, for Windows Server Containers, this field is REQUIRED. For Hyper-V Containers, this field MUST NOT be set.

On all other platforms, this field is REQUIRED.

Source

pub fn mounts<VALUE: Into<Vec<Mount>>>(self, value: VALUE) -> Self

Specifies additional mounts beyond root. The runtime MUST mount entries in the listed order.

For Linux, the parameters are as documented in mount(2) system call man page. For Solaris, the mount entry corresponds to the ‘fs’ resource in the zonecfg(1M) man page.

Source

pub fn process<VALUE: Into<Process>>(self, value: VALUE) -> Self

Specifies the container process. This property is REQUIRED when start is called.

Source

pub fn hostname<VALUE: Into<String>>(self, value: VALUE) -> Self

Specifies the container’s hostname as seen by processes running inside the container. On Linux, for example, this will change the hostname in the container UTS namespace. Depending on your namespace configuration, the container UTS namespace may be the runtime UTS namespace.

Source

pub fn domainname<VALUE: Into<String>>(self, value: VALUE) -> Self

Specifies the container’s domainame as seen by processes running inside the container. On Linux, for example, this will change the domainame in the container UTS namespace. Depending on your namespace configuration, the container UTS namespace may be the runtime UTS namespace.

Source

pub fn hooks<VALUE: Into<Hooks>>(self, value: VALUE) -> Self

Hooks allow users to specify programs to run before or after various lifecycle events. Hooks MUST be called in the listed order. The state of the container MUST be passed to hooks over stdin so that they may do work appropriate to the current state of the container.

Source

pub fn annotations<VALUE: Into<HashMap<String, String>>>( self, value: VALUE, ) -> Self

Annotations contains arbitrary metadata for the container. This information MAY be structured or unstructured. Annotations MUST be a key-value map. If there are no annotations then this property MAY either be absent or an empty map.

Keys MUST be strings. Keys MUST NOT be an empty string. Keys SHOULD be named using a reverse domain notation - e.g. com.example.myKey. Keys using the org.opencontainers namespace are reserved and MUST NOT be used by subsequent specifications. Runtimes MUST handle unknown annotation keys like any other unknown property.

Values MUST be strings. Values MAY be an empty string.

Source

pub fn linux<VALUE: Into<Linux>>(self, value: VALUE) -> Self

Linux is platform-specific configuration for Linux based containers.

Source

pub fn solaris<VALUE: Into<Solaris>>(self, value: VALUE) -> Self

Solaris is platform-specific configuration for Solaris based containers.

Source

pub fn windows<VALUE: Into<Windows>>(self, value: VALUE) -> Self

Windows is platform-specific configuration for Windows based containers.

Source

pub fn vm<VALUE: Into<VM>>(self, value: VALUE) -> Self

VM specifies configuration for Virtual Machine based containers.

Source

pub fn uid_mappings<VALUE: Into<Vec<LinuxIdMapping>>>( self, value: VALUE, ) -> Self

UID mappings used for changing file owners w/o calling chown, fs should support it. Every mount point could have its own mapping.

Source

pub fn gid_mappings<VALUE: Into<Vec<LinuxIdMapping>>>( self, value: VALUE, ) -> Self

GID mappings used for changing file owners w/o calling chown, fs should support it. Every mount point could have its own mapping.

Source

pub fn build(self) -> Result<Spec, OciSpecError>

Builds a new Spec.

§Errors

If a required field has not been initialized.

Trait Implementations§

Source§

impl Default for SpecBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.