aboutsummaryrefslogtreecommitdiff
path: root/garage.go
diff options
context:
space:
mode:
Diffstat (limited to 'garage.go')
-rw-r--r--garage.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/garage.go b/garage.go
index 7cd879b..0176382 100644
--- a/garage.go
+++ b/garage.go
@@ -61,6 +61,33 @@ func grgCreateBucket(bucket string) (*garage.BucketInfo, error) {
return binfo, nil
}
+func grgCreateLocalBucket(bucket, gkey string) (*garage.BucketInfo, error) {
+ client, ctx := gadmin()
+
+ is_true := true
+ is_false := false
+
+ la := garage.CreateBucketRequestLocalAlias {
+ AccessKeyId: &gkey,
+ Alias: &bucket,
+ Allow: &garage.CreateBucketRequestLocalAliasAllow {
+ Read: &is_true,
+ Write: &is_true,
+ Owner: &is_false,
+ },
+ }
+
+ br := garage.NewCreateBucketRequest()
+ br.SetLocalAlias(la)
+
+ binfo, _, err := client.BucketApi.CreateBucket(ctx).CreateBucketRequest(*br).Execute()
+ if err != nil {
+ fmt.Printf("%+v\n", err)
+ return nil, err
+ }
+ return binfo, nil
+}
+
func grgAllowKeyOnBucket(bid, gkey string) (*garage.BucketInfo, error) {
client, ctx := gadmin()