-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2771 from rina23q/improve/2654/c8y-mapper-support…
…s-advanced-software-type c8y-mapper sends software list to advanced software management endpoint
- Loading branch information
Showing
10 changed files
with
406 additions
and
24 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
crates/common/tedge_config/src/tedge_config_cli/models/c8y_software_management.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::str::FromStr; | ||
use strum::Display; | ||
|
||
/// A flag that switches legacy or advanced software management API. | ||
/// Can be set to auto in the future, see #2778. | ||
#[derive( | ||
Debug, Clone, serde::Serialize, serde::Deserialize, Eq, PartialEq, doku::Document, Display, | ||
)] | ||
#[strum(serialize_all = "camelCase")] | ||
pub enum SoftwareManagementApiFlag { | ||
Legacy, | ||
Advanced, | ||
} | ||
|
||
#[derive(thiserror::Error, Debug)] | ||
#[error("Failed to parse flag: {input}. Supported values are: legacy, advanced")] | ||
pub struct InvalidSoftwareManagementApiFlag { | ||
input: String, | ||
} | ||
|
||
impl FromStr for SoftwareManagementApiFlag { | ||
type Err = InvalidSoftwareManagementApiFlag; | ||
|
||
fn from_str(input: &str) -> Result<Self, Self::Err> { | ||
match input { | ||
"legacy" => Ok(SoftwareManagementApiFlag::Legacy), | ||
"advanced" => Ok(SoftwareManagementApiFlag::Advanced), | ||
_ => Err(InvalidSoftwareManagementApiFlag { | ||
input: input.to_string(), | ||
}), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.