(protocol: &str, access: &str)
| 728 | } |
| 729 | |
| 730 | fn expand_access_preset(protocol: &str, access: &str) -> Option<Vec<L7Rule>> { |
| 731 | let methods = match (protocol, access) { |
| 732 | (_, "full") => vec!["*"], |
| 733 | ("websocket", "read-only") => vec!["GET"], |
| 734 | ("websocket", "read-write") => vec!["GET", "WEBSOCKET_TEXT"], |
| 735 | (_, "read-only") => vec!["GET", "HEAD", "OPTIONS"], |
| 736 | (_, "read-write") => vec!["GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH"], |
| 737 | _ => return None, |
| 738 | }; |
| 739 | |
| 740 | Some( |
| 741 | methods |
| 742 | .into_iter() |
| 743 | .map(|method| L7Rule { |
| 744 | allow: Some(L7Allow { |
| 745 | method: method.to_string(), |
| 746 | path: "**".to_string(), |
| 747 | command: String::new(), |
| 748 | query: HashMap::default(), |
| 749 | operation_type: String::new(), |
| 750 | operation_name: String::new(), |
| 751 | fields: Vec::new(), |
| 752 | params: HashMap::default(), |
| 753 | }), |
| 754 | }) |
| 755 | .collect(), |
| 756 | ) |
| 757 | } |
| 758 | |
| 759 | fn append_unique_binaries(existing: &mut Vec<NetworkBinary>, incoming: &[NetworkBinary]) { |
| 760 | let mut seen: HashSet<String> = existing.iter().map(|binary| binary.path.clone()).collect(); |
no outgoing calls
no test coverage detected