pub struct PluginBuilder { /* private fields */ }Expand description
Builder for creating instances of Plugin.
Provides a fluent interface for constructing a Plugin object with optional fields.
Implementations§
Source§impl PluginBuilder
impl PluginBuilder
Sourcepub fn clear_envvars(self) -> Self
pub fn clear_envvars(self) -> Self
Clears the envvars field.
Sourcepub fn clear_name(self) -> Self
pub fn clear_name(self) -> Self
Clears the name field.
Sourcepub fn clear_origin_id(self) -> Self
pub fn clear_origin_id(self) -> Self
Clears the origin_id field.
Sourcepub fn built_in(self, built_in: bool) -> Self
pub fn built_in(self, built_in: bool) -> Self
Alias for setting the origin_id field.
§Arguments
built_in- A boolean indicating whether thePluginis built-in.
Sourcepub fn origin_id(self, origin_id: u64) -> Self
pub fn origin_id(self, origin_id: u64) -> Self
Sets the origin_id field.
§Arguments
origin_id- The origin ID of thePlugin. Must be 0 (for built-in plugins) or 1 (for user-uploaded plugins).
Sourcepub fn user_uploaded(self, user_uploaded: bool) -> Self
pub fn user_uploaded(self, user_uploaded: bool) -> Self
Alias for setting the origin_id field.
§Arguments
user_uploaded- A boolean indicating whether thePluginis user-uploaded.
Trait Implementations§
Source§impl Builder for PluginBuilder
impl Builder for PluginBuilder
Source§fn new() -> Self
fn new() -> Self
Creates a new instance of PluginBuilder with default values.
Initializes a new builder for creating a Plugin object with all fields in their default
state.
§Returns
A new instance of PluginBuilder.
Source§fn build(self) -> Result<Self::ConfigObject, OpsviewConfigError>
fn build(self) -> Result<Self::ConfigObject, OpsviewConfigError>
Consumes the builder and returns a Plugin object.
§Returns
A Result containing the constructed Plugin object or an error if the object
could not be built due to the absence of the required name field or if the
origin_id field is set but not 0 or 1.
§Errors
Returns an error if the name field is not set. Returns an error if the origin_id field is set but > 1.
type ConfigObject = Plugin
Source§impl Clone for PluginBuilder
impl Clone for PluginBuilder
Source§fn clone(&self) -> PluginBuilder
fn clone(&self) -> PluginBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more