aboutsummaryrefslogtreecommitdiff
path: root/garage.go
diff options
context:
space:
mode:
Diffstat (limited to 'garage.go')
-rw-r--r--garage.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/garage.go b/garage.go
index f9529e9..52a26b0 100644
--- a/garage.go
+++ b/garage.go
@@ -23,8 +23,9 @@ func gadmin() (*garage.APIClient, context.Context) {
func grgCreateKey(name string) (*garage.KeyInfo, error) {
client, ctx := gadmin()
- kr := garage.AddKeyRequest{Name: &name}
- resp, _, err := client.KeyApi.AddKey(ctx).AddKeyRequest(kr).Execute()
+ kr := garage.NewAddKeyRequest()
+ kr.SetName(name)
+ resp, _, err := client.KeyApi.AddKey(ctx).AddKeyRequest(*kr).Execute()
if err != nil {
fmt.Printf("%+v\n", err)
return nil, err
@@ -35,7 +36,7 @@ func grgCreateKey(name string) (*garage.KeyInfo, error) {
func grgGetKey(accessKey string) (*garage.KeyInfo, error) {
client, ctx := gadmin()
- resp, _, err := client.KeyApi.GetKey(ctx, accessKey).Execute()
+ resp, _, err := client.KeyApi.GetKey(ctx).Id(accessKey).ShowSecretKey("true").Execute()
if err != nil {
fmt.Printf("%+v\n", err)
return nil, err
@@ -88,7 +89,7 @@ func allowWebsiteDefault() *garage.UpdateBucketRequestWebsiteAccess {
func grgUpdateBucket(bid string, ur *garage.UpdateBucketRequest) (*garage.BucketInfo, error) {
client, ctx := gadmin()
- binfo, _, err := client.BucketApi.UpdateBucket(ctx, bid).UpdateBucketRequest(*ur).Execute()
+ binfo, _, err := client.BucketApi.UpdateBucket(ctx).Id(bid).UpdateBucketRequest(*ur).Execute()
if err != nil {
fmt.Printf("%+v\n", err)
return nil, err
@@ -145,7 +146,7 @@ func grgDelLocalAlias(bid, key, alias string) (*garage.BucketInfo, error) {
func grgGetBucket(bid string) (*garage.BucketInfo, error) {
client, ctx := gadmin()
- resp, _, err := client.BucketApi.GetBucketInfo(ctx, bid).Execute()
+ resp, _, err := client.BucketApi.GetBucketInfo(ctx).Id(bid).Execute()
if err != nil {
log.Println(err)
return nil, err
@@ -157,7 +158,7 @@ func grgGetBucket(bid string) (*garage.BucketInfo, error) {
func grgDeleteBucket(bid string) error {
client, ctx := gadmin()
- _, err := client.BucketApi.DeleteBucket(ctx, bid).Execute()
+ _, err := client.BucketApi.DeleteBucket(ctx).Id(bid).Execute()
if err != nil {
log.Println(err)
}