Implement base operator #1
28
src/minio.rs
28
src/minio.rs
@ -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(),
|
||||||
|
Loading…
Reference in New Issue
Block a user