oci_spec/runtime/
solaris.rs

1use crate::error::OciSpecError;
2use derive_builder::Builder;
3use getset::{Getters, Setters};
4use serde::{Deserialize, Serialize};
5
6#[derive(
7    Builder, Clone, Debug, Default, Deserialize, Getters, Setters, Eq, PartialEq, Serialize,
8)]
9#[serde(rename_all = "camelCase")]
10#[builder(
11    default,
12    pattern = "owned",
13    setter(into, strip_option),
14    build_fn(error = "OciSpecError")
15)]
16#[getset(get = "pub", set = "pub")]
17/// Solaris contains platform-specific configuration for Solaris application
18/// containers.
19pub struct Solaris {
20    #[serde(default, skip_serializing_if = "Option::is_none")]
21    /// SMF FMRI which should go "online" before we start the container
22    /// process.
23    milestone: Option<String>,
24
25    #[serde(default, skip_serializing_if = "Option::is_none")]
26    /// Maximum set of privileges any process in this container can obtain.
27    limitpriv: Option<String>,
28
29    #[serde(default, skip_serializing_if = "Option::is_none")]
30    /// The maximum amount of shared memory allowed for this container.
31    max_shm_memory: Option<String>,
32
33    #[serde(default, skip_serializing_if = "Option::is_none")]
34    /// Specification for automatic creation of network resources for this
35    /// container.
36    anet: Option<Vec<SolarisAnet>>,
37
38    #[serde(default, skip_serializing_if = "Option::is_none", rename = "cappedCPU")]
39    /// Set limit on the amount of CPU time that can be used by container.
40    capped_cpu: Option<SolarisCappedCPU>,
41
42    #[serde(default, skip_serializing_if = "Option::is_none")]
43    /// The physical and swap caps on the memory that can be used by this
44    /// container.
45    capped_memory: Option<SolarisCappedMemory>,
46}
47
48#[derive(
49    Builder, Clone, Debug, Default, Deserialize, Getters, Setters, Eq, PartialEq, Serialize,
50)]
51#[serde(rename_all = "camelCase")]
52#[builder(
53    default,
54    pattern = "owned",
55    setter(into, strip_option),
56    build_fn(error = "OciSpecError")
57)]
58#[getset(get = "pub", set = "pub")]
59/// SolarisAnet provides the specification for automatic creation of network
60/// resources for this container.
61pub struct SolarisAnet {
62    #[serde(default, skip_serializing_if = "Option::is_none")]
63    /// Specify a name for the automatically created VNIC datalink.
64    linkname: Option<String>,
65
66    #[serde(default, skip_serializing_if = "Option::is_none")]
67    /// Specify the link over which the VNIC will be created.
68    lower_link: Option<String>,
69
70    #[serde(default, skip_serializing_if = "Option::is_none")]
71    /// The set of IP addresses that the container can use.
72    allowed_address: Option<String>,
73
74    #[serde(default, skip_serializing_if = "Option::is_none")]
75    /// Specifies whether allowedAddress limitation is to be applied to the
76    /// VNIC.
77    configure_allowed_address: Option<String>,
78
79    #[serde(default, skip_serializing_if = "Option::is_none")]
80    /// The value of the optional default router.
81    defrouter: Option<String>,
82
83    #[serde(default, skip_serializing_if = "Option::is_none")]
84    /// Enable one or more types of link protection.
85    link_protection: Option<String>,
86
87    #[serde(default, skip_serializing_if = "Option::is_none")]
88    /// Set the VNIC's macAddress.
89    mac_address: Option<String>,
90}
91
92#[derive(
93    Builder, Clone, Debug, Default, Deserialize, Getters, Setters, Eq, PartialEq, Serialize,
94)]
95#[builder(
96    default,
97    pattern = "owned",
98    setter(into, strip_option),
99    build_fn(error = "OciSpecError")
100)]
101#[getset(get = "pub", set = "pub")]
102/// SolarisCappedCPU allows users to set limit on the amount of CPU time
103/// that can be used by container.
104pub struct SolarisCappedCPU {
105    #[serde(default, skip_serializing_if = "Option::is_none")]
106    /// The amount of CPUs.
107    ncpus: Option<String>,
108}
109
110#[derive(
111    Builder, Clone, Debug, Default, Deserialize, Getters, Setters, Eq, PartialEq, Serialize,
112)]
113#[builder(
114    default,
115    pattern = "owned",
116    setter(into, strip_option),
117    build_fn(error = "OciSpecError")
118)]
119#[getset(get = "pub", set = "pub")]
120/// SolarisCappedMemory allows users to set the physical and swap caps on
121/// the memory that can be used by this container.
122pub struct SolarisCappedMemory {
123    #[serde(default, skip_serializing_if = "Option::is_none")]
124    /// The physical caps on the memory.
125    physical: Option<String>,
126
127    #[serde(default, skip_serializing_if = "Option::is_none")]
128    /// The swap caps on the memory.
129    swap: Option<String>,
130}