-
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.
Add profile support to the
tedge cli
and fix mosquitto configuration
- Loading branch information
1 parent
82df8e0
commit 8f9ab76
Showing
21 changed files
with
414 additions
and
406 deletions.
There are no files selected for viewing
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
29 changes: 21 additions & 8 deletions
29
crates/common/tedge_config/src/system_services/services.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 |
---|---|---|
@@ -1,25 +1,38 @@ | ||
use std::fmt; | ||
|
||
use tedge_config_macros::ProfileName; | ||
|
||
/// An enumeration of all supported system services. | ||
#[derive(Debug, Copy, Clone, strum_macros::Display, strum_macros::IntoStaticStr)] | ||
pub enum SystemService { | ||
#[derive(Debug, Copy, Clone, strum_macros::IntoStaticStr)] | ||
pub enum SystemService<'a> { | ||
#[strum(serialize = "mosquitto")] | ||
/// Mosquitto broker | ||
Mosquitto, | ||
#[strum(serialize = "tedge-mapper-az")] | ||
/// Azure TEdge mapper | ||
TEdgeMapperAz, | ||
TEdgeMapperAz(Option<&'a ProfileName>), | ||
#[strum(serialize = "tedge-mapper-aws")] | ||
/// AWS TEdge mapper | ||
TEdgeMapperAws, | ||
TEdgeMapperAws(Option<&'a ProfileName>), | ||
#[strum(serialize = "tedge-mapper-c8y")] | ||
/// Cumulocity TEdge mapper | ||
TEdgeMapperC8y, | ||
TEdgeMapperC8y(Option<&'a ProfileName>), | ||
#[strum(serialize = "tedge-agent")] | ||
/// TEdge SM agent | ||
TEdgeSMAgent, | ||
} | ||
|
||
impl SystemService { | ||
pub(crate) fn as_service_name(service: SystemService) -> &'static str { | ||
service.into() | ||
impl<'a> fmt::Display for SystemService<'a> { | ||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | ||
match self { | ||
Self::Mosquitto => write!(f, "mosquitto"), | ||
Self::TEdgeMapperAz(None) => write!(f, "tedge-mapper-az"), | ||
Self::TEdgeMapperAz(Some(profile)) => write!(f, "tedge-mapper-az@{profile}"), | ||
Self::TEdgeMapperAws(None) => write!(f, "tedge-mapper-aws"), | ||
Self::TEdgeMapperAws(Some(profile)) => write!(f, "tedge-mapper-aws@{profile}"), | ||
Self::TEdgeMapperC8y(None) => write!(f, "tedge-mapper-c8y"), | ||
Self::TEdgeMapperC8y(Some(profile)) => write!(f, "tedge-mapper-c8y@{profile}"), | ||
Self::TEdgeSMAgent => write!(f, "tedge-agent"), | ||
} | ||
} | ||
} |
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.