|
1 | 1 | //! Types for the query parameters of the pipeline endpoints. |
2 | 2 |
|
3 | | -use serde::Deserialize; |
| 3 | +use serde::{Deserialize, Serialize}; |
4 | 4 | use utoipa::{IntoParams, ToSchema}; |
5 | 5 |
|
6 | 6 | use crate::runtime_status::RuntimeDesiredStatus; |
@@ -42,23 +42,25 @@ impl Default for ActivateParams { |
42 | 42 | } |
43 | 43 | } |
44 | 44 |
|
45 | | -#[derive(Debug, Deserialize, IntoParams, ToSchema)] |
| 45 | +#[derive(Debug, Deserialize, Serialize, IntoParams, ToSchema)] |
| 46 | +#[serde(default)] |
46 | 47 | pub struct SamplyProfileParams { |
47 | | - #[serde(default = "default_samply_profile_duration")] |
48 | 48 | pub duration_secs: u64, |
49 | 49 | } |
50 | 50 |
|
51 | | -/// Default for the `duration_secs` query parameter when POST a pipeline samply profile. |
52 | | -fn default_samply_profile_duration() -> u64 { |
53 | | - 30 |
| 51 | +/// Default query parameters for POST of a pipeline samply profile. |
| 52 | +impl Default for SamplyProfileParams { |
| 53 | + fn default() -> Self { |
| 54 | + Self { duration_secs: 30 } |
| 55 | + } |
54 | 56 | } |
55 | 57 |
|
56 | 58 | /// Query parameters to retrieve samply profile. |
57 | | -#[derive(Debug, Deserialize, IntoParams, ToSchema)] |
| 59 | +#[derive(Debug, Default, Deserialize, Serialize, IntoParams, ToSchema)] |
58 | 60 | #[into_params(parameter_in = Query)] |
| 61 | +#[serde(default)] |
59 | 62 | pub struct SamplyProfileGetParams { |
60 | 63 | /// If true, returns 204 redirect with Retry-After header if profile collection is in progress. |
61 | 64 | /// If false or not provided, returns the last collected profile. |
62 | | - #[serde(default)] |
63 | 65 | pub latest: bool, |
64 | 66 | } |
0 commit comments