| 71 | |
| 72 | #[must_use] |
| 73 | pub fn build(self) -> OcsfEvent { |
| 74 | let activity_name = self.activity.http_label().to_string(); |
| 75 | let mut base = BaseEventData::new( |
| 76 | 4002, |
| 77 | "HTTP Activity", |
| 78 | 4, |
| 79 | "Network Activity", |
| 80 | self.activity.as_u8(), |
| 81 | &activity_name, |
| 82 | self.severity, |
| 83 | self.ctx |
| 84 | .metadata(&["security_control", "network_proxy", "container", "host"]), |
| 85 | ); |
| 86 | if let Some(detail) = self.status_detail { |
| 87 | base.set_status_detail(detail); |
| 88 | } |
| 89 | self.ctx |
| 90 | .apply_common_fields(&mut base, self.status, self.message); |
| 91 | |
| 92 | OcsfEvent::HttpActivity(HttpActivityEvent { |
| 93 | base, |
| 94 | http_request: self.http_request, |
| 95 | http_response: self.http_response, |
| 96 | src_endpoint: self.src_endpoint, |
| 97 | dst_endpoint: self.dst_endpoint, |
| 98 | proxy_endpoint: Some(self.ctx.proxy_endpoint()), |
| 99 | actor: self.actor, |
| 100 | firewall_rule: self.firewall_rule, |
| 101 | action: self.action, |
| 102 | disposition: self.disposition, |
| 103 | observation_point_id: Some(2), |
| 104 | is_src_dst_assignment_known: Some(true), |
| 105 | }) |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | impl_activity_setter!(HttpActivityBuilder); |