Skip to content

Commit

Permalink
handle buckets list: shared
Browse files Browse the repository at this point in the history
  • Loading branch information
YangSen-qn committed Dec 27, 2023
1 parent 75b049f commit dd608c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions iqshell/storage/servers/all_buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package servers

import (
"fmt"

"github.com/qiniu/go-sdk/v7/auth"

"github.com/qiniu/qshell/v2/iqshell/common/config"
"github.com/qiniu/qshell/v2/iqshell/common/data"
"github.com/qiniu/qshell/v2/iqshell/common/utils"
Expand Down Expand Up @@ -48,7 +50,6 @@ func BucketInfoDetailDescriptionStringFormat() string {
}

type ListApiInfo struct {
Shared bool
Region string
}

Expand All @@ -65,9 +66,9 @@ func allBuckets(cfg *config.Config, info ListApiInfo) ([]BucketInfo, *data.CodeE
}

ucHost := cfg.Hosts.GetOneUc()
reqURL := fmt.Sprintf("%s/v3/buckets?shared=%v", utils.Endpoint(cfg.UseHttps.Value(), ucHost), info.Shared)
reqURL := fmt.Sprintf("%s/v3/buckets", utils.Endpoint(cfg.UseHttps.Value(), ucHost))
if len(info.Region) > 0 {
reqURL = fmt.Sprintf("%s&region=%s", reqURL, info.Region)
reqURL = fmt.Sprintf("%s?region=%s", reqURL, info.Region)
}
var buckets []BucketInfo
e := bucketManager.Client.CredentialedCall(workspace.GetContext(), bucketManager.Mac, auth.TokenQiniu, &buckets, "POST", reqURL, nil)
Expand Down

0 comments on commit dd608c0

Please sign in to comment.