pub struct ServiceDefinition { /* private fields */ }Expand description
One platform’s definition of the registration, as text.
Producing this is pure: no cfg, no privileges, no filesystem. That is what
lets every leg of the CI matrix assert every platform’s definition, instead
of each leg asserting only its own and the other two being reviewed by
reading.
Implementations§
Source§impl ServiceDefinition
impl ServiceDefinition
Sourcepub const fn kind(&self) -> DefinitionKind
pub const fn kind(&self) -> DefinitionKind
Which platform this is for.
Sourcepub fn install_path(&self) -> Option<&Path>
pub fn install_path(&self) -> Option<&Path>
Where the platform expects the file, when the platform reads a file.
None for DefinitionKind::WindowsService, whose “definition” is a
set of arguments to CreateServiceW, and for a Task Scheduler document,
which is handed to schtasks from a temporary file and is not stored
where it was written.
Sourcepub fn for_host(plan: &InstallPlan) -> Result<Self, ServiceError>
pub fn for_host(plan: &InstallPlan) -> Result<Self, ServiceError>
The definition this host’s own service manager would be given.
The value-level twin of host_definition_kind. Rendering needs no
privileges and no service manager, so anything that wants to see what
an install would register — f3’s service install --dry-run, a
support bundle, RecordingControls — can have it without registering
anything.
§Errors
ServiceError::Control when a Windows logon-triggered registration is
asked for and the session reports no account to register it for.
Sourcepub fn windows_service(plan: &InstallPlan) -> Self
pub fn windows_service(plan: &InstallPlan) -> Self
The Windows service parameters, as a canonical descriptor.
Sourcepub fn windows_scheduled_task(
plan: &InstallPlan,
principal: &TaskPrincipal,
) -> Self
pub fn windows_scheduled_task( plan: &InstallPlan, principal: &TaskPrincipal, ) -> Self
A Task Scheduler document for --start-at login.
Sourcepub fn launchd(plan: &InstallPlan, home: Option<&Path>) -> Self
pub fn launchd(plan: &InstallPlan, home: Option<&Path>) -> Self
A launchd property list.
home is only consulted for --start-at login, where the file belongs
in the operator’s own ~/Library/LaunchAgents.
Sourcepub fn from_text(kind: DefinitionKind, text: impl Into<String>) -> Self
pub fn from_text(kind: DefinitionKind, text: impl Into<String>) -> Self
Wraps text this module did not render.
Two callers need it and both matter. A test builds a deliberately
widened definition and watches review_least_privilege reject it —
without which the review would be a function nobody had ever seen fail.
And service status can review the definition actually on disk,
which on Linux and macOS an operator is free to edit after installation.
Sourcepub fn systemd(plan: &InstallPlan, home: Option<&Path>) -> Self
pub fn systemd(plan: &InstallPlan, home: Option<&Path>) -> Self
A systemd unit.
home is only consulted for --start-at login, where the unit belongs
in the operator’s own ~/.config/systemd/user.
Trait Implementations§
Source§impl Clone for ServiceDefinition
impl Clone for ServiceDefinition
Source§fn clone(&self) -> ServiceDefinition
fn clone(&self) -> ServiceDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more