Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aw-client-rust): make create_bucket_simple useful #331

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions aw-client-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ impl AwClient {
&self,
bucketname: &str,
buckettype: &str,
) -> Result<(), reqwest::Error> {
) -> Result<Bucket, reqwest::Error> {
let bucket = Bucket {
bid: None,
id: bucketname.to_string(),
id: format!("{}_{}", bucketname, self.hostname),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change. I suggest to keep the original behavior to avoid mishaps.

Suggested change
id: format!("{}_{}", bucketname, self.hostname),
id: bucketname.to_string(),

If you want your ID with a hostname suffix, better pass a different bucketname instead of adding this assumption to the create_bucket_simple method.

client: self.name.clone(),
_type: buckettype.to_string(),
hostname: self.hostname.clone(),
Expand All @@ -75,7 +75,8 @@ impl AwClient {
created: None,
last_updated: None,
};
self.create_bucket(&bucket)
self.create_bucket(&bucket)?;
Ok(bucket)
}

pub fn delete_bucket(&self, bucketname: &str) -> Result<(), reqwest::Error> {
Expand Down