Skip to content

Commit

Permalink
aliyun_kms: fixup KMS after plugin refactor
Browse files Browse the repository at this point in the history
It looks like we might not be testing all of our storage backend
features, which allowed some bugs to creep into the refactoring PR.

Reconcile the aliyun_kms with the changes to the resource plugin.

Signed-off-by: Tobin Feldman-Fitzthum <[email protected]>
  • Loading branch information
fitzthum committed Nov 8, 2024
1 parent c0d2f36 commit 500a860
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions kbs/src/plugins/implementations/resource/aliyun_kms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

use super::{Error, Repository, ResourceDesc, Result};
use anyhow::Context;
use super::backend::{ResourceDesc, StorageBackend};
use anyhow::{Context, Result};
use kms::{plugins::aliyun::AliyunKmsClient, Annotations, Getter};
use log::info;
use serde::Deserialize;
Expand All @@ -21,7 +21,7 @@ pub struct AliyunKmsBackend {
}

#[async_trait::async_trait]
impl Repository for AliyunKmsBackend {
impl StorageBackend for AliyunKmsBackend {
async fn read_secret_resource(&self, resource_desc: ResourceDesc) -> Result<Vec<u8>> {
info!(
"Use aliyun KMS backend. Ignore {}/{}",
Expand All @@ -32,8 +32,7 @@ impl Repository for AliyunKmsBackend {
.client
.get_secret(&name, &Annotations::default())
.await
.context("failed to get resource from aliyun KMS")
.map_err(|e| Error::AliyunError { source: e })?;
.context("failed to get resource from aliyun KMS")?;
Ok(resource_bytes)
}

Expand All @@ -54,8 +53,7 @@ impl AliyunKmsBackend {
&repo_desc.password,
&repo_desc.cert_pem,
)
.context("create aliyun KMS backend")
.map_err(|e| Error::AliyunError { source: e })?;
.context("create aliyun KMS backend")?;
Ok(Self { client })
}
}

0 comments on commit 500a860

Please sign in to comment.