From 066a32853872b3757db2eeb620d4351668bc62d1 Mon Sep 17 00:00:00 2001 From: jackyalbo Date: Mon, 11 Nov 2024 16:46:21 +0200 Subject: [PATCH] Adapting operator to new bucket list API change Adapting operator to new bucket list API change Signed-off-by: jackyalbo --- pkg/bucket/bucket.go | 2 +- pkg/nb/api.go | 6 +++--- pkg/nb/types.go | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/pkg/bucket/bucket.go b/pkg/bucket/bucket.go index b78d9752f6..bd4a19c8a3 100644 --- a/pkg/bucket/bucket.go +++ b/pkg/bucket/bucket.go @@ -239,7 +239,7 @@ func RunStatus(cmd *cobra.Command, args []string) { func RunList(cmd *cobra.Command, args []string) { log := util.Logger() nbClient := system.GetNBClient() - list, err := nbClient.ListBucketsAPI() + list, err := nbClient.ListBucketsAPI(nb.ListBucketsParams{}) if err != nil { log.Fatal(err) } diff --git a/pkg/nb/api.go b/pkg/nb/api.go index 5ac1c26493..d22dcd5f0a 100644 --- a/pkg/nb/api.go +++ b/pkg/nb/api.go @@ -19,7 +19,7 @@ type Client interface { SetNamespaceStoreInfo(NamespaceStoreInfo) error ListAccountsAPI(ListAccountsParams) (ListAccountsReply, error) - ListBucketsAPI() (ListBucketsReply, error) + ListBucketsAPI(ListBucketsParams) (ListBucketsReply, error) ListHostsAPI(ListHostsParams) (ListHostsReply, error) CreateAuthAPI(CreateAuthParams) (CreateAuthReply, error) @@ -146,8 +146,8 @@ func (c *RPCClient) ListAccountsAPI(params ListAccountsParams) (ListAccountsRepl } // ListBucketsAPI calls bucket_api.list_buckets() -func (c *RPCClient) ListBucketsAPI() (ListBucketsReply, error) { - req := &RPCMessage{API: "bucket_api", Method: "list_buckets"} +func (c *RPCClient) ListBucketsAPI(params ListBucketsParams) (ListBucketsReply, error) { + req := &RPCMessage{API: "bucket_api", Method: "list_buckets", Params: params} res := &struct { RPCMessage `json:",inline"` Reply ListBucketsReply `json:"reply"` diff --git a/pkg/nb/types.go b/pkg/nb/types.go index 991ea28c63..2c3415faa2 100644 --- a/pkg/nb/types.go +++ b/pkg/nb/types.go @@ -283,6 +283,12 @@ type ListAccountsReply struct { Accounts []*AccountInfo `json:"accounts"` } +// ListBcuketsParams is the params to account_api.list_buckets() +type ListBucketsParams struct { + ContinuationToken *string `json:"continuation_token,omitempty"` + MaxBuckets *int `json:"max_buckets,omitempty"` +} + // ListBucketsReply is the reply of bucket_api.list_buckets() type ListBucketsReply struct { Buckets []struct {