pub struct ObjectStore { /* private fields */ }Expand description
In-memory store for firewall objects.
Implementations§
Source§impl ObjectStore
impl ObjectStore
pub fn new() -> Self
pub fn create(&mut self, obj: ObjectRecord) -> Result<()>
Sourcepub fn add<T>(&mut self, entry: T) -> Result<()>where
T: Into<BuilderEntry>,
pub fn add<T>(&mut self, entry: T) -> Result<()>where
T: Into<BuilderEntry>,
Insert any builder entry or object emitted by the builder helpers.
use firewall_objects::builder::{address, service, service_group};
use firewall_objects::objects::ObjectStore;
let mut store = ObjectStore::new();
store.add(address("server1", "192.0.2.10").unwrap()).unwrap();
let services = service_group("web").unwrap()
.with_service(service::tcp(443)).unwrap()
.with_service(service::udp(8443)).unwrap()
.build().unwrap();
store.add(services).unwrap();pub fn update(&mut self, obj: ObjectRecord) -> Result<()>
pub fn delete(&mut self, kind: ObjectKind, name: &str) -> Result<()>
pub fn get(&self, kind: ObjectKind, name: &str) -> Result<ObjectRecord>
Sourcepub fn insert_network(&mut self, obj: NetworkObj) -> Result<()>
pub fn insert_network(&mut self, obj: NetworkObj) -> Result<()>
Convenience: insert a network object.
Sourcepub fn insert_network_group(&mut self, group: NetworkObjGroup) -> Result<()>
pub fn insert_network_group(&mut self, group: NetworkObjGroup) -> Result<()>
Convenience: insert a network group.
Sourcepub fn insert_service(&mut self, obj: ServiceObj) -> Result<()>
pub fn insert_service(&mut self, obj: ServiceObj) -> Result<()>
Convenience: insert a service object.
Sourcepub fn insert_service_group(&mut self, group: ServiceObjGroup) -> Result<()>
pub fn insert_service_group(&mut self, group: ServiceObjGroup) -> Result<()>
Convenience: insert a service group.
Sourcepub fn insert_application(&mut self, app: ApplicationObj) -> Result<()>
pub fn insert_application(&mut self, app: ApplicationObj) -> Result<()>
Convenience: insert an application.
Sourcepub fn network(&self, name: &str) -> Result<NetworkObj>
pub fn network(&self, name: &str) -> Result<NetworkObj>
Convenience accessor for networks.
Sourcepub fn network_group(&self, name: &str) -> Result<NetworkObjGroup>
pub fn network_group(&self, name: &str) -> Result<NetworkObjGroup>
Convenience accessor for network groups.
Sourcepub fn service(&self, name: &str) -> Result<ServiceObj>
pub fn service(&self, name: &str) -> Result<ServiceObj>
Convenience accessor for services.
Sourcepub fn service_group(&self, name: &str) -> Result<ServiceObjGroup>
pub fn service_group(&self, name: &str) -> Result<ServiceObjGroup>
Convenience accessor for service groups.
Sourcepub fn application(&self, name: &str) -> Result<ApplicationObj>
pub fn application(&self, name: &str) -> Result<ApplicationObj>
Convenience accessor for applications.
Trait Implementations§
Source§impl Debug for ObjectStore
impl Debug for ObjectStore
Source§impl Default for ObjectStore
impl Default for ObjectStore
Source§fn default() -> ObjectStore
fn default() -> ObjectStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ObjectStore
impl RefUnwindSafe for ObjectStore
impl Send for ObjectStore
impl Sync for ObjectStore
impl Unpin for ObjectStore
impl UnwindSafe for ObjectStore
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