#[non_exhaustive]pub struct ContainerSpec {
pub image: String,
pub command: Option<Vec<String>>,
pub args: Vec<String>,
pub env: TaskEnv,
}Expand description
Specification for OCI-compatible container execution.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.image: StringContainer image (e.g. "nginx:latest", "docker.io/library/redis:7").
command: Option<Vec<String>>Override container entrypoint.
args: Vec<String>Arguments passed to the container entrypoint.
env: TaskEnvEnvironment variables for the container.
Implementations§
Source§impl ContainerSpec
impl ContainerSpec
Sourcepub fn new(
image: String,
command: Option<Vec<String>>,
args: Vec<String>,
env: TaskEnv,
) -> Self
pub fn new( image: String, command: Option<Vec<String>>, args: Vec<String>, env: TaskEnv, ) -> Self
Creates a container spec.
ContainerSpec is #[non_exhaustive].
Use this constructor outside the crate.
Validation occurs when the workload enters a crate::TaskSpec.
§Example
use solti_model::{ContainerSpec, TaskEnv};
let spec = ContainerSpec::new(
"docker.io/library/redis:7".into(),
None,
vec![],
TaskEnv::default(),
);
assert_eq!(spec.image, "docker.io/library/redis:7");Sourcepub fn validate(&self) -> ModelResult<()>
pub fn validate(&self) -> ModelResult<()>
Validates structural constraints.
§Errors
Returns ModelError::Invalid when the image is empty.
§Example
use solti_model::{ContainerSpec, TaskEnv};
let spec = ContainerSpec::new("redis:7".into(), None, vec![], TaskEnv::default());
spec.validate().unwrap();Trait Implementations§
Source§impl Clone for ContainerSpec
impl Clone for ContainerSpec
Source§fn clone(&self) -> ContainerSpec
fn clone(&self) -> ContainerSpec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ContainerSpec
impl Debug for ContainerSpec
Source§impl<'de> Deserialize<'de> for ContainerSpec
impl<'de> Deserialize<'de> for ContainerSpec
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ContainerSpec
Source§impl JsonSchema for ContainerSpec
impl JsonSchema for ContainerSpec
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for ContainerSpec
impl PartialEq for ContainerSpec
Source§impl Serialize for ContainerSpec
impl Serialize for ContainerSpec
impl StructuralPartialEq for ContainerSpec
Auto Trait Implementations§
impl Freeze for ContainerSpec
impl RefUnwindSafe for ContainerSpec
impl Send for ContainerSpec
impl Sync for ContainerSpec
impl Unpin for ContainerSpec
impl UnsafeUnpin for ContainerSpec
impl UnwindSafe for ContainerSpec
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
Mutably borrows from an owned value. Read more