Skip to content

Commit

Permalink
close #7
Browse files Browse the repository at this point in the history
Signed-off-by: mohemohe <[email protected]>
  • Loading branch information
mohemohe committed May 5, 2019
1 parent 71c8cf2 commit 707ecd9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions s3fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,27 @@ func New(config *Config) *S3FS {
}
}

func (this *S3FS) CreateBucket(name string) error {
_, err := this.s3.CreateBucket(&s3.CreateBucketInput{
Bucket: aws.String(name),
})
if err != nil {
return err
}

err = this.s3.WaitUntilBucketExists(&s3.HeadBucketInput{
Bucket: aws.String(name),
})
return err
}

func (this *S3FS) DeleteBucket(name string) error {
_, err := this.s3.DeleteBucket(&s3.DeleteBucketInput{
Bucket: aws.String(name),
})
return err
}

func (this *S3FS) List(key string) *[]FileInfo {
fileList := make([]FileInfo, 0)
var continuationToken *string
Expand Down
1 change: 1 addition & 0 deletions s3fs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func setup() {
AccessSecretKey: "secretkey",
Bucket: "test",
})
_ = fs.CreateBucket("test")
}

func teardown() {
Expand Down

0 comments on commit 707ecd9

Please sign in to comment.