Struct zone::Config [−][src]
Entry point for zonecfg
commands.
This struct can be used to construct arguments to the underlying
zonecfg
command. It does not actually issue any commands to the
underlying utility until Config::run
is issued.
Examples
Creation of a new zone.
let mut cfg = zone::Config::create( /* zone name= */ "myzone", /* overwrite= */ true, zone::CreationOptions::Default); cfg.get_global() .set_path("/my/path") .set_autoboot(false); cfg.add_fs(&zone::Fs { ty: "lofs".to_string(), dir: "/usr/local".to_string(), special: "/opt/local".to_string(), ..Default::default() }); // Issues the previously enqueued operations to zonecfg. cfg.run().unwrap();
Selection and modification of an existing zone.
let mut cfg = zone::Config::new("myzone"); // Clear the hostid. cfg.get_global().set_hostid(None); // Select an existing attribute and modify. cfg.select_net_by_physical("eth0") .set_allowed_address(Some("127.0.0.1".to_string())); // Remove all resources relating to capped memory. cfg.remove_all_capped_memory(); // Issues the previously enqueued operations to zonecfg. cfg.run().unwrap();
Implementations
impl Config
[src]
pub fn get_global(&mut self) -> GlobalScope<'_>
[src]
Acquire a reference to the global resource scope. This scope allows callers to safely set values within the Global object.
impl Config
[src]
pub fn add_fs(&mut self, values: &Fs) -> FsScope<'_>
[src]
Creates a new scope from a Fs object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_fs(&mut self)
[src]
Deletes resources associated with the Fs object.
impl Config
[src]
pub fn select_fs_by_type(&mut self, value: impl Into<String>) -> FsScope<'_>
[src]
Generated selector for the Fs resource.
Allows the selection of an existing resource for modification with a matching value of Fs::ty.
pub fn remove_fs_by_type(&mut self, value: impl Into<String>)
[src]
impl Config
[src]
pub fn select_fs_by_dir(&mut self, value: impl Into<String>) -> FsScope<'_>
[src]
Generated selector for the Fs resource.
Allows the selection of an existing resource for modification with a matching value of Fs::dir.
pub fn remove_fs_by_dir(&mut self, value: impl Into<String>)
[src]
impl Config
[src]
pub fn select_fs_by_special(&mut self, value: impl Into<String>) -> FsScope<'_>
[src]
Generated selector for the Fs resource.
Allows the selection of an existing resource for modification with a matching value of Fs::special.
pub fn remove_fs_by_special(&mut self, value: impl Into<String>)
[src]
Generated removal function for the Fs resource
Allows the removal of all existing resources with a matching value of Fs::special.
impl Config
[src]
pub fn add_net(&mut self, values: &Net) -> NetScope<'_>
[src]
Creates a new scope from a Net object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_net(&mut self)
[src]
Deletes resources associated with the Net object.
impl Config
[src]
pub fn select_net_by_physical(
&mut self,
value: impl Into<String>
) -> NetScope<'_>
[src]
&mut self,
value: impl Into<String>
) -> NetScope<'_>
Generated selector for the Net resource.
Allows the selection of an existing resource for modification with a matching value of Net::physical.
pub fn remove_net_by_physical(&mut self, value: impl Into<String>)
[src]
Generated removal function for the Net resource
Allows the removal of all existing resources with a matching value of Net::physical.
impl Config
[src]
pub fn add_device(&mut self, values: &Device) -> DeviceScope<'_>
[src]
Creates a new scope from a Device object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_device(&mut self)
[src]
Deletes resources associated with the Device object.
impl Config
[src]
pub fn add_rctl(&mut self, values: &Rctl) -> RctlScope<'_>
[src]
Creates a new scope from a Rctl object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_rctl(&mut self)
[src]
Deletes resources associated with the Rctl object.
impl Config
[src]
pub fn select_rctl_by_name(&mut self, value: impl Into<String>) -> RctlScope<'_>
[src]
Generated selector for the Rctl resource.
Allows the selection of an existing resource for modification with a matching value of Rctl::name.
pub fn remove_rctl_by_name(&mut self, value: impl Into<String>)
[src]
Generated removal function for the Rctl resource
Allows the removal of all existing resources with a matching value of Rctl::name.
impl Config
[src]
pub fn add_attr(&mut self, values: &Attr) -> AttrScope<'_>
[src]
Creates a new scope from a Attr object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_attr(&mut self)
[src]
Deletes resources associated with the Attr object.
impl Config
[src]
pub fn select_attr_by_name(&mut self, value: impl Into<String>) -> AttrScope<'_>
[src]
Generated selector for the Attr resource.
Allows the selection of an existing resource for modification with a matching value of Attr::name.
pub fn remove_attr_by_name(&mut self, value: impl Into<String>)
[src]
Generated removal function for the Attr resource
Allows the removal of all existing resources with a matching value of Attr::name.
impl Config
[src]
pub fn add_dataset(&mut self, values: &Dataset) -> DatasetScope<'_>
[src]
Creates a new scope from a Dataset object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_dataset(&mut self)
[src]
Deletes resources associated with the Dataset object.
impl Config
[src]
pub fn add_dedicated_cpu(
&mut self,
values: &DedicatedCpu
) -> DedicatedCpuScope<'_>
[src]
&mut self,
values: &DedicatedCpu
) -> DedicatedCpuScope<'_>
Creates a new scope from a DedicatedCpu object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_dedicated_cpu(&mut self)
[src]
Deletes resources associated with the DedicatedCpu object.
impl Config
[src]
pub fn add_capped_memory(
&mut self,
values: &CappedMemory
) -> CappedMemoryScope<'_>
[src]
&mut self,
values: &CappedMemory
) -> CappedMemoryScope<'_>
Creates a new scope from a CappedMemory object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_capped_memory(&mut self)
[src]
Deletes resources associated with the CappedMemory object.
impl Config
[src]
pub fn add_capped_cpu(&mut self, values: &CappedCpu) -> CappedCpuScope<'_>
[src]
Creates a new scope from a CappedCpu object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_capped_cpu(&mut self)
[src]
Deletes resources associated with the CappedCpu object.
impl Config
[src]
pub fn add_security_flags(
&mut self,
values: &SecurityFlags
) -> SecurityFlagsScope<'_>
[src]
&mut self,
values: &SecurityFlags
) -> SecurityFlagsScope<'_>
Creates a new scope from a SecurityFlags object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_security_flags(&mut self)
[src]
Deletes resources associated with the SecurityFlags object.
impl Config
[src]
pub fn add_admin(&mut self, values: &Admin) -> AdminScope<'_>
[src]
Creates a new scope from a Admin object. This begins specification for the resource, and returns an object which represents the new scope.
pub fn remove_all_admin(&mut self)
[src]
Deletes resources associated with the Admin object.
impl Config
[src]
pub fn select_admin_by_user(
&mut self,
value: impl Into<String>
) -> AdminScope<'_>
[src]
&mut self,
value: impl Into<String>
) -> AdminScope<'_>
Generated selector for the Admin resource.
Allows the selection of an existing resource for modification with a matching value of Admin::user.
pub fn remove_admin_by_user(&mut self, value: impl Into<String>)
[src]
Generated removal function for the Admin resource
Allows the removal of all existing resources with a matching value of Admin::user.
impl Config
[src]
pub fn new(name: impl AsRef<str>) -> Self
[src]
Instantiate a zone configuration object, wrapping an existing zone.
pub fn create(
name: impl AsRef<str>,
overwrite: bool,
options: CreationOptions
) -> Self
[src]
name: impl AsRef<str>,
overwrite: bool,
options: CreationOptions
) -> Self
Creates a new zone with the provided name
.
overwrite
specifies if the new zone should overwrite any existing zone with the same name, if one exists.options
specifies background information about the zone.
This method does not execute zonecfg
until Config::run
is invoked.
pub fn export(&mut self, p: impl AsRef<Path>) -> &mut Self
[src]
Enqueues a command to export the zone configuration to a specified path.
This method does not execute zonecfg
until Config::run
is invoked.
pub fn delete(&mut self, force: bool) -> &mut Self
[src]
Enqueues a command to delete the zone configuration.
This method does not execute zonecfg
until Config::run
is invoked.
pub fn run(&mut self) -> Result<String, ZoneError>
[src]
Executes the queued commands for the zone, and clears the current queued arguments.
Auto Trait Implementations
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,