aboutsummaryrefslogtreecommitdiff
path: root/garage.go
diff options
context:
space:
mode:
Diffstat (limited to 'garage.go')
-rw-r--r--garage.go46
1 files changed, 45 insertions, 1 deletions
diff --git a/garage.go b/garage.go
index 61d1b93..db35366 100644
--- a/garage.go
+++ b/garage.go
@@ -97,12 +97,56 @@ func grgCreateWebsite(gkey, bucket string) (*garage.BucketInfo, error) {
return binfo, nil
}
+func grgAddGlobalAlias(bid, alias string) (*garage.BucketInfo, error) {
+ client, ctx := gadmin()
+
+ resp, _, err := client.BucketApi.PutBucketGlobalAlias(ctx).Id(bid).Alias(alias).Execute()
+ if err != nil {
+ log.Println(err)
+ return nil, err
+ }
+ return resp, nil
+}
+
+func grgAddLocalAlias(bid, key, alias string) (*garage.BucketInfo, error) {
+ client, ctx := gadmin()
+
+ resp, _, err := client.BucketApi.PutBucketLocalAlias(ctx).Id(bid).AccessKeyId(key).Alias(alias).Execute()
+ if err != nil {
+ log.Println(err)
+ return nil, err
+ }
+ return resp, nil
+}
+
+func grgDelGlobalAlias(bid, alias string) (*garage.BucketInfo, error) {
+ client, ctx := gadmin()
+
+ resp, _, err := client.BucketApi.DeleteBucketGlobalAlias(ctx).Id(bid).Alias(alias).Execute()
+ if err != nil {
+ log.Println(err)
+ return nil, err
+ }
+ return resp, nil
+}
+
+func grgDelLocalAlias(bid, key, alias string) (*garage.BucketInfo, error) {
+ client, ctx := gadmin()
+
+ resp, _, err := client.BucketApi.DeleteBucketLocalAlias(ctx).Id(bid).AccessKeyId(key).Alias(alias).Execute()
+ if err != nil {
+ log.Println(err)
+ return nil, err
+ }
+ return resp, nil
+}
+
func grgGetBucket(bid string) (*garage.BucketInfo, error) {
client, ctx := gadmin()
resp, _, err := client.BucketApi.GetBucketInfo(ctx, bid).Execute()
if err != nil {
- fmt.Printf("%+v\n", err)
+ log.Println(err)
return nil, err
}
return resp, nil