Implement base operator #1

Merged
pierre merged 21 commits from operator into master 2023-05-08 16:20:17 +00:00
Showing only changes of commit 42e2ea5539 - Show all commits

View File

@ -207,11 +207,11 @@ impl MinioService {
.any(|b| b.bucket_name().eq(name))) .any(|b| b.bucket_name().eq(name)))
} }
/// Create a bucket /// Apply bucket desired configuration. If bucket already exists, it is not dropped
pub async fn create_bucket(&self, b: &MinioBucketSpec) -> anyhow::Result<()> { pub async fn apply_bucket(&self, b: &MinioBucketSpec) -> anyhow::Result<()> {
// Set base parameters // Set base parameters
let bucket_name = format!("{}/{}", MC_ALIAS_NAME, b.name); let bucket_name = format!("{}/{}", MC_ALIAS_NAME, b.name);
let mut args = ["mb", bucket_name.as_str()].to_vec(); let mut args = ["mb", bucket_name.as_str(), "-p"].to_vec();
if b.lock { if b.lock {
args.push("--with-lock"); args.push("--with-lock");
@ -441,7 +441,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -463,7 +463,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -498,7 +498,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -529,7 +529,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -582,7 +582,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -609,7 +609,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -636,7 +636,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -679,7 +679,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -724,7 +724,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -751,7 +751,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),
@ -841,7 +841,7 @@ mod test {
let srv = MinioTestServer::start().await.unwrap(); let srv = MinioTestServer::start().await.unwrap();
let service = srv.as_service(); let service = srv.as_service();
service service
.create_bucket(&MinioBucketSpec { .apply_bucket(&MinioBucketSpec {
instance: "".to_string(), instance: "".to_string(),
name: TEST_BUCKET_NAME.to_string(), name: TEST_BUCKET_NAME.to_string(),
secret: "".to_string(), secret: "".to_string(),