cc_lb_plugin_wire/v1/
normalize_error.rs1extern crate alloc;
2
3use alloc::string::String;
4use serde::{Deserialize, Serialize};
5
6use crate::wire_function::{FallbackPolicy, WireFunction};
7
8#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
9#[serde(deny_unknown_fields)]
10pub struct NormalizeErrorRequest {
11 pub status: u16,
12 pub body_base64: String,
13}
14
15impl NormalizeErrorRequest {
16 pub fn dry_run_sample() -> Self {
17 Self {
18 status: 500,
19 body_base64: String::new(),
20 }
21 }
22}
23
24#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
25#[serde(deny_unknown_fields)]
26pub struct NormalizeErrorResponse {
27 pub body_base64: Option<String>,
28}
29
30impl NormalizeErrorResponse {
31 pub fn dry_run_sample() -> Self {
32 Self { body_base64: None }
33 }
34}
35
36pub struct NormalizeErrorFn;
37
38impl WireFunction for NormalizeErrorFn {
39 const NAME: &'static str = "normalize_error";
40 const FALLBACK: FallbackPolicy = FallbackPolicy::PassThrough;
41 const SUPPORTED_VERSIONS: &'static [u32] = &[1];
42
43 type Request = NormalizeErrorRequest;
44 type Response = NormalizeErrorResponse;
45
46 fn dry_run_request() -> Self::Request {
47 NormalizeErrorRequest::dry_run_sample()
48 }
49
50 fn dry_run_response() -> Self::Response {
51 NormalizeErrorResponse::dry_run_sample()
52 }
53}