Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Synthetics batch status #362

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-11-04 21:14:31.327488",
"spec_repo_commit": "08338fd1"
"regenerated": "2024-11-05 15:05:36.377755",
"spec_repo_commit": "8d63eae4"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-11-04 21:14:31.346210",
"spec_repo_commit": "08338fd1"
"regenerated": "2024-11-05 15:05:36.396205",
"spec_repo_commit": "8d63eae4"
}
}
}
27 changes: 13 additions & 14 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14418,7 +14418,7 @@ components:
$ref: '#/components/schemas/SyntheticsBatchResult'
type: array
status:
$ref: '#/components/schemas/SyntheticsStatus'
$ref: '#/components/schemas/SyntheticsBatchStatus'
type: object
SyntheticsBatchResult:
description: Object with the results of a Synthetic batch.
Expand All @@ -14442,7 +14442,7 @@ components:
format: double
type: number
status:
$ref: '#/components/schemas/SyntheticsStatus'
$ref: '#/components/schemas/SyntheticsBatchStatus'
test_name:
description: Name of the test.
type: string
Expand All @@ -14452,6 +14452,17 @@ components:
test_type:
$ref: '#/components/schemas/SyntheticsTestDetailsType'
type: object
SyntheticsBatchStatus:
description: Determines whether the batch has passed, failed, or is in progress.
enum:
- passed
- skipped
- failed
type: string
x-enum-varnames:
- PASSED
- SKIPPED
- FAILED
SyntheticsBrowserError:
description: Error response object for a browser test.
properties:
Expand Down Expand Up @@ -16210,18 +16221,6 @@ components:
description: Subject Alternative Name associated with the certificate.
type: string
type: object
SyntheticsStatus:
description: Determines whether or not the batch has passed, failed, or is in
progress.
enum:
- passed
- skipped
- failed
type: string
x-enum-varnames:
- PASSED
- skipped
- failed
SyntheticsStep:
description: The steps used in a Synthetic browser test.
properties:
Expand Down
4 changes: 2 additions & 2 deletions src/datadogV1/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1274,8 +1274,8 @@ pub mod model_synthetics_device_id;
pub use self::model_synthetics_device_id::SyntheticsDeviceID;
pub mod model_synthetics_test_execution_rule;
pub use self::model_synthetics_test_execution_rule::SyntheticsTestExecutionRule;
pub mod model_synthetics_status;
pub use self::model_synthetics_status::SyntheticsStatus;
pub mod model_synthetics_batch_status;
pub use self::model_synthetics_batch_status::SyntheticsBatchStatus;
pub mod model_synthetics_test_details_type;
pub use self::model_synthetics_test_details_type::SyntheticsTestDetailsType;
pub mod model_synthetics_locations;
Expand Down
14 changes: 6 additions & 8 deletions src/datadogV1/model/model_synthetics_batch_details_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pub struct SyntheticsBatchDetailsData {
/// List of results for the batch.
#[serde(rename = "results")]
pub results: Option<Vec<crate::datadogV1::model::SyntheticsBatchResult>>,
/// Determines whether or not the batch has passed, failed, or is in progress.
/// Determines whether the batch has passed, failed, or is in progress.
#[serde(rename = "status")]
pub status: Option<crate::datadogV1::model::SyntheticsStatus>,
pub status: Option<crate::datadogV1::model::SyntheticsBatchStatus>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
Expand Down Expand Up @@ -48,7 +48,7 @@ impl SyntheticsBatchDetailsData {
self
}

pub fn status(mut self, value: crate::datadogV1::model::SyntheticsStatus) -> Self {
pub fn status(mut self, value: crate::datadogV1::model::SyntheticsBatchStatus) -> Self {
self.status = Some(value);
self
}
Expand Down Expand Up @@ -87,7 +87,7 @@ impl<'de> Deserialize<'de> for SyntheticsBatchDetailsData {
{
let mut metadata: Option<crate::datadogV1::model::SyntheticsCIBatchMetadata> = None;
let mut results: Option<Vec<crate::datadogV1::model::SyntheticsBatchResult>> = None;
let mut status: Option<crate::datadogV1::model::SyntheticsStatus> = None;
let mut status: Option<crate::datadogV1::model::SyntheticsBatchStatus> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
Expand Down Expand Up @@ -115,11 +115,9 @@ impl<'de> Deserialize<'de> for SyntheticsBatchDetailsData {
status = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _status) = status {
match _status {
crate::datadogV1::model::SyntheticsStatus::UnparsedObject(
_status,
) => {
crate::datadogV1::model::SyntheticsBatchStatus::UnparsedObject(_status) => {
_unparsed = true;
}
},
_ => {}
}
}
Expand Down
14 changes: 6 additions & 8 deletions src/datadogV1/model/model_synthetics_batch_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ pub struct SyntheticsBatchResult {
/// Number of times this result has been retried.
#[serde(rename = "retries")]
pub retries: Option<f64>,
/// Determines whether or not the batch has passed, failed, or is in progress.
/// Determines whether the batch has passed, failed, or is in progress.
#[serde(rename = "status")]
pub status: Option<crate::datadogV1::model::SyntheticsStatus>,
pub status: Option<crate::datadogV1::model::SyntheticsBatchStatus>,
/// Name of the test.
#[serde(rename = "test_name")]
pub test_name: Option<String>,
Expand Down Expand Up @@ -99,7 +99,7 @@ impl SyntheticsBatchResult {
self
}

pub fn status(mut self, value: crate::datadogV1::model::SyntheticsStatus) -> Self {
pub fn status(mut self, value: crate::datadogV1::model::SyntheticsBatchStatus) -> Self {
self.status = Some(value);
self
}
Expand Down Expand Up @@ -159,7 +159,7 @@ impl<'de> Deserialize<'de> for SyntheticsBatchResult {
let mut location: Option<String> = None;
let mut result_id: Option<String> = None;
let mut retries: Option<f64> = None;
let mut status: Option<crate::datadogV1::model::SyntheticsStatus> = None;
let mut status: Option<crate::datadogV1::model::SyntheticsBatchStatus> = None;
let mut test_name: Option<String> = None;
let mut test_public_id: Option<String> = None;
let mut test_type: Option<crate::datadogV1::model::SyntheticsTestDetailsType> =
Expand Down Expand Up @@ -234,11 +234,9 @@ impl<'de> Deserialize<'de> for SyntheticsBatchResult {
status = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
if let Some(ref _status) = status {
match _status {
crate::datadogV1::model::SyntheticsStatus::UnparsedObject(
_status,
) => {
crate::datadogV1::model::SyntheticsBatchStatus::UnparsedObject(_status) => {
_unparsed = true;
}
},
_ => {}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[non_exhaustive]
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum SyntheticsStatus {
pub enum SyntheticsBatchStatus {
PASSED,
skipped,
failed,
SKIPPED,
FAILED,
UnparsedObject(crate::datadog::UnparsedObject),
}

impl ToString for SyntheticsStatus {
impl ToString for SyntheticsBatchStatus {
fn to_string(&self) -> String {
match self {
Self::PASSED => String::from("passed"),
Self::skipped => String::from("skipped"),
Self::failed => String::from("failed"),
Self::SKIPPED => String::from("skipped"),
Self::FAILED => String::from("failed"),
Self::UnparsedObject(v) => v.value.to_string(),
}
}
}

impl Serialize for SyntheticsStatus {
impl Serialize for SyntheticsBatchStatus {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
Expand All @@ -36,16 +36,16 @@ impl Serialize for SyntheticsStatus {
}
}

impl<'de> Deserialize<'de> for SyntheticsStatus {
impl<'de> Deserialize<'de> for SyntheticsBatchStatus {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let s: String = String::deserialize(deserializer)?;
Ok(match s.as_str() {
"passed" => Self::PASSED,
"skipped" => Self::skipped,
"failed" => Self::failed,
"skipped" => Self::SKIPPED,
"failed" => Self::FAILED,
_ => Self::UnparsedObject(crate::datadog::UnparsedObject {
value: serde_json::Value::String(s.into()),
}),
Expand Down
Loading