Applied first configuration
This commit is contained in:
18
src/main.rs
18
src/main.rs
@@ -88,8 +88,22 @@ async fn apply_bucket(b: &MinioBucket, client: &Client) -> anyhow::Result<()> {
|
||||
password: read_secret_str(&user_secret, SECRET_MINIO_BUCKET_SECRET_KEY)?,
|
||||
};
|
||||
|
||||
println!("{:?}", service);
|
||||
println!("{:?}", user);
|
||||
log::debug!("Create or update bucket...");
|
||||
service.bucket_apply(&b.spec).await?;
|
||||
|
||||
let policy_name = format!("bucket-{}", b.spec.name);
|
||||
log::debug!("Create or update policy '{policy_name}'...");
|
||||
let policy_content =
|
||||
include_str!("policy_template.json").replace("{{ bucket }}", b.spec.name.as_str());
|
||||
service.policy_apply(&policy_name, &policy_content).await?;
|
||||
|
||||
log::debug!("Create or update user '{}'...", user.username);
|
||||
service.user_apply(&user).await?;
|
||||
|
||||
log::debug!("Attach policy '{policy_name}' to user...");
|
||||
service.policy_attach_user(&user, &policy_name).await?;
|
||||
|
||||
log::debug!("Successfully applied desired configuration!");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user