pub enum ServiceBlockExpectedState {
State {
name: String,
state: Option<ServiceExpectedState>,
enabled: bool,
},
Action {
name: String,
action: ServiceAction,
},
}Expand description
Configuration for a system service
This enum represents the desired state for a system service, supporting configurations:
State: Manage the service’s running state (started/stopped) and/or boot enablementAction: Manage unconditional actions (restart/reload)
§YAML Representation
§State with enabled:
Name: httpd
State: Started
Enabled: true§State only:
Name: nginx
State: Started§Enabled only:
Name: mysql
Enabled: true§Action only:
Name: nginx
Action: RestartedVariants§
State
Manage the service’s running state and/or boot enablement
Note: The enabled field is only present in this variant to respect the semantics
that enabled state is managed alongside running state.
Fields
§
state: Option<ServiceExpectedState>Desired running state of the service (optional - can be omitted for enabled-only config)
Action
Manage unconditional actions (restart/reload)
Implementations§
Source§impl ServiceBlockExpectedState
impl ServiceBlockExpectedState
Sourcepub fn state(
name: &str,
state: ServiceExpectedState,
enabled: bool,
) -> ServiceBlockExpectedState
pub fn state( name: &str, state: ServiceExpectedState, enabled: bool, ) -> ServiceBlockExpectedState
Create a state configuration with running state and boot enablement
Sourcepub fn enabled(name: &str, enabled: bool) -> ServiceBlockExpectedState
pub fn enabled(name: &str, enabled: bool) -> ServiceBlockExpectedState
Create an enabled-only configuration (no state management, only enablement)
Sourcepub fn restarted(name: &str) -> ServiceBlockExpectedState
pub fn restarted(name: &str) -> ServiceBlockExpectedState
Create a restarted action configuration
Sourcepub fn reloaded(name: &str) -> ServiceBlockExpectedState
pub fn reloaded(name: &str) -> ServiceBlockExpectedState
Create a reloaded action configuration
Trait Implementations§
Source§impl<Handler: HostHandler> AssessCompliance<Handler> for ServiceBlockExpectedState
impl<Handler: HostHandler> AssessCompliance<Handler> for ServiceBlockExpectedState
Source§async fn assess_compliance(
&self,
host_handler: &mut Handler,
host_properties: &Option<HostProperties>,
privilege: &Privilege,
_optional_secret_provider: &Option<SecretProvidersPool>,
) -> Result<AttributeComplianceAssessment, RegentError>
async fn assess_compliance( &self, host_handler: &mut Handler, host_properties: &Option<HostProperties>, privilege: &Privilege, _optional_secret_provider: &Option<SecretProvidersPool>, ) -> Result<AttributeComplianceAssessment, RegentError>
Assess whether the host is compliant. Read more
Source§impl Check for ServiceBlockExpectedState
impl Check for ServiceBlockExpectedState
Source§fn check_host_compatibility(
&self,
host_properties: &HostProperties,
) -> Result<(), RegentError>
fn check_host_compatibility( &self, host_properties: &HostProperties, ) -> Result<(), RegentError>
If host properties are known, checks whether this attribute is compatible with the host or not. Read more
Source§impl Clone for ServiceBlockExpectedState
impl Clone for ServiceBlockExpectedState
Source§fn clone(&self) -> ServiceBlockExpectedState
fn clone(&self) -> ServiceBlockExpectedState
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 ServiceBlockExpectedState
impl Debug for ServiceBlockExpectedState
Source§impl<'de> Deserialize<'de> for ServiceBlockExpectedState
impl<'de> Deserialize<'de> for ServiceBlockExpectedState
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 StructuralPartialEq for ServiceBlockExpectedState
Source§impl Timeout for ServiceBlockExpectedState
impl Timeout for ServiceBlockExpectedState
Source§fn default_timeout(&self) -> Duration
fn default_timeout(&self) -> Duration
Get the default timeout for this operation. Read more
Auto Trait Implementations§
impl Freeze for ServiceBlockExpectedState
impl RefUnwindSafe for ServiceBlockExpectedState
impl Send for ServiceBlockExpectedState
impl Sync for ServiceBlockExpectedState
impl Unpin for ServiceBlockExpectedState
impl UnsafeUnpin for ServiceBlockExpectedState
impl UnwindSafe for ServiceBlockExpectedState
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