pub struct AdmitCommand {
pub rule: String,
pub argv: Vec<String>,
pub line: String,
}Expand description
One command that admits a rule: the rule’s label, its argument vector exactly as
apply executes it, and the same quoted as one line a person pastes into a root
shell. The two are projections of one vector, so what the report shows is what runs.
use std::net::Ipv4Addr;
use majordomus_cli::mesh::firewall::{plan, render, AdmitCommand, Backend};
use majordomus_cli::mesh::MeshConfig;
let config: MeshConfig = serde_json::from_value(serde_json::json!({
"schema": "mesh/v1", "kind": "mesh-declaration", "id": "doc", "enabled": true,
})).unwrap();
let p = plan(Some(&config), &[Ipv4Addr::new(10, 0, 0, 2)], None);
let commands: Vec<AdmitCommand> = render(Backend::Ufw, &p, None);
assert_eq!(commands[0].argv[0], "ufw");
assert_eq!(commands[0].rule, "udp/7741 to 239.255.77.77 from any");
assert_eq!(commands[0].line, "ufw allow in proto udp to 239.255.77.77 port 7741 comment 'majordomus mesh: multicast discovery'");Fields§
§rule: StringThe rule it admits.
argv: Vec<String>The program and its arguments, as executed.
line: StringThe same, quoted for a shell.
Trait Implementations§
Source§impl Clone for AdmitCommand
impl Clone for AdmitCommand
Source§fn clone(&self) -> AdmitCommand
fn clone(&self) -> AdmitCommand
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 AdmitCommand
impl Debug for AdmitCommand
Source§impl<'de> Deserialize<'de> for AdmitCommand
impl<'de> Deserialize<'de> for AdmitCommand
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 Eq for AdmitCommand
Source§impl JsonSchema for AdmitCommand
impl JsonSchema for AdmitCommand
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for AdmitCommand
impl PartialEq for AdmitCommand
Source§fn eq(&self, other: &AdmitCommand) -> bool
fn eq(&self, other: &AdmitCommand) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for AdmitCommand
impl Serialize for AdmitCommand
impl StructuralPartialEq for AdmitCommand
Auto Trait Implementations§
impl Freeze for AdmitCommand
impl RefUnwindSafe for AdmitCommand
impl Send for AdmitCommand
impl Sync for AdmitCommand
impl Unpin for AdmitCommand
impl UnsafeUnpin for AdmitCommand
impl UnwindSafe for AdmitCommand
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.