-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a07598
commit b21d752
Showing
21 changed files
with
356 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) [2024] SUSE LLC | ||
// | ||
// All Rights Reserved. | ||
// | ||
// This program is free software; you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 2 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along | ||
// with this program; if not, contact SUSE LLC. | ||
// | ||
// To contact SUSE LLC about this file by physical or electronic mail, you may | ||
// find current contact information at www.suse.com. | ||
|
||
//! Implements support for handling the storage settings | ||
pub mod client; | ||
// pub mod http_client; | ||
pub mod model; | ||
pub mod proxies; | ||
pub mod http_client; | ||
pub mod store; |
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,21 @@ | ||
// Copyright (c) [2024] SUSE LLC | ||
// | ||
// All Rights Reserved. | ||
// | ||
// This program is free software; you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 2 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along | ||
// with this program; if not, contact SUSE LLC. | ||
// | ||
// To contact SUSE LLC about this file by physical or electronic mail, you may | ||
// find current contact information at www.suse.com. | ||
|
||
pub mod bootloader; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) [2024] SUSE LLC | ||
// | ||
// All Rights Reserved. | ||
// | ||
// This program is free software; you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 2 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along | ||
// with this program; if not, contact SUSE LLC. | ||
// | ||
// To contact SUSE LLC about this file by physical or electronic mail, you may | ||
// find current contact information at www.suse.com. | ||
|
||
//! Implements a client to access Agama's HTTP API related to Bootloader management. | ||
use crate::base_http_client::BaseHTTPClient; | ||
use crate::bootloader::model::bootloader::Bootloader; | ||
use crate::ServiceError; | ||
|
||
pub struct BootloaderHTTPClient { | ||
client: BaseHTTPClient, | ||
} | ||
|
||
impl BootloaderHTTPClient { | ||
pub fn new(base: BaseHTTPClient) -> Self { | ||
Self { client: base } | ||
} | ||
|
||
pub async fn get_config(&self) -> Result<Bootloader, ServiceError> { | ||
self.client.get("/bootloader/config").await | ||
} | ||
|
||
pub async fn set_config(&self, config: &Bootloader) -> Result<(), ServiceError> { | ||
self.client.put_void("/bootloader/config", config).await | ||
} | ||
} |
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,21 @@ | ||
// Copyright (c) [2024] SUSE LLC | ||
// | ||
// All Rights Reserved. | ||
// | ||
// This program is free software; you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 2 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along | ||
// with this program; if not, contact SUSE LLC. | ||
// | ||
// To contact SUSE LLC about this file by physical or electronic mail, you may | ||
// find current contact information at www.suse.com. | ||
|
||
pub mod bootloader; |
File renamed without changes.
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,21 @@ | ||
// Copyright (c) [2024] SUSE LLC | ||
// | ||
// All Rights Reserved. | ||
// | ||
// This program is free software; you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 2 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along | ||
// with this program; if not, contact SUSE LLC. | ||
// | ||
// To contact SUSE LLC about this file by physical or electronic mail, you may | ||
// find current contact information at www.suse.com. | ||
|
||
pub(crate) mod bootloader; |
File renamed without changes.
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,49 @@ | ||
// Copyright (c) [2024] SUSE LLC | ||
// | ||
// All Rights Reserved. | ||
// | ||
// This program is free software; you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 2 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along | ||
// with this program; if not, contact SUSE LLC. | ||
// | ||
// To contact SUSE LLC about this file by physical or electronic mail, you may | ||
// find current contact information at www.suse.com. | ||
|
||
//! Implements the store for the storage settings. | ||
use crate::base_http_client::BaseHTTPClient; | ||
use crate::error::ServiceError; | ||
|
||
use super::http_client::BootloaderHTTPClient; | ||
use super::model::bootloader::Bootloader; | ||
|
||
/// Loads and stores the storage settings from/to the HTTP service. | ||
pub struct BootloaderStore { | ||
bootloader_client: BootloaderHTTPClient, | ||
} | ||
|
||
impl BootloaderStore { | ||
pub fn new(client: BaseHTTPClient) -> Result<Self, ServiceError> { | ||
Ok(Self { | ||
bootloader_client: BootloaderHTTPClient::new(client), | ||
}) | ||
} | ||
|
||
pub async fn load(&self) -> Result<Bootloader, ServiceError> { | ||
self.bootloader_client.get_config().await | ||
} | ||
|
||
pub async fn store(&self, settings: &Bootloader) -> Result<(), ServiceError> { | ||
self.bootloader_client.set_config(settings).await?; | ||
Ok(()) | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) [2024] SUSE LLC | ||
// | ||
// All Rights Reserved. | ||
// | ||
// This program is free software; you can redistribute it and/or modify it | ||
// under the terms of the GNU General Public License as published by the Free | ||
// Software Foundation; either version 2 of the License, or (at your option) | ||
// any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, but WITHOUT | ||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
// more details. | ||
// | ||
// You should have received a copy of the GNU General Public License along | ||
// with this program; if not, contact SUSE LLC. | ||
// | ||
// To contact SUSE LLC about this file by physical or electronic mail, you may | ||
// find current contact information at www.suse.com. | ||
|
||
pub mod web; |
Oops, something went wrong.