diff options
Diffstat (limited to 'garage.go')
-rw-r--r-- | garage.go | 27 |
1 files changed, 27 insertions, 0 deletions
@@ -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() |