(allow: &L7Allow)
| 596 | } |
| 597 | |
| 598 | fn format_allow_rule(allow: &L7Allow) -> String { |
| 599 | let mut parts = Vec::new(); |
| 600 | if !allow.method.is_empty() || !allow.path.is_empty() { |
| 601 | parts.push(format!( |
| 602 | "{} {}", |
| 603 | non_empty_or(&allow.method, "*"), |
| 604 | non_empty_or(&allow.path, "*") |
| 605 | )); |
| 606 | } |
| 607 | if !allow.command.is_empty() { |
| 608 | parts.push(format!("command {}", allow.command)); |
| 609 | } |
| 610 | if !allow.operation_type.is_empty() || !allow.operation_name.is_empty() { |
| 611 | parts.push(format!( |
| 612 | "graphql {} {}", |
| 613 | non_empty_or(&allow.operation_type, "*"), |
| 614 | non_empty_or(&allow.operation_name, "*") |
| 615 | )); |
| 616 | } |
| 617 | if !allow.fields.is_empty() { |
| 618 | parts.push(format!("fields {}", allow.fields.join(","))); |
| 619 | } |
| 620 | append_query_matchers(&mut parts, &allow.query); |
| 621 | if parts.is_empty() { |
| 622 | "*".to_string() |
| 623 | } else { |
| 624 | parts.join("; ") |
| 625 | } |
| 626 | } |
| 627 | |
| 628 | fn format_deny_rule(deny: &L7DenyRule) -> String { |
| 629 | let mut parts = Vec::new(); |
nothing calls this directly
no test coverage detected