fix: update API endpoints for bucket and key information retrieval

- Changed bucket information fetching from v1 to v2 endpoints in `browse.go` and `buckets.go`.
- Updated key information fetching in `page.tsx` to use the new v2 endpoint.
- Ensured consistency across the application with the latest API version.
This commit is contained in:
Adekabang 2025-07-31 16:35:11 -04:00
parent 621761aeb6
commit 8247840e26
3 changed files with 5 additions and 5 deletions

View File

@ -292,7 +292,7 @@ func getBucketCredentials(bucket string) (aws.CredentialsProvider, error) {
return cacheData.(aws.CredentialsProvider), nil
}
body, err := utils.Garage.Fetch("/v1/bucket?globalAlias="+bucket, &utils.FetchOptions{})
body, err := utils.Garage.Fetch("/v2/GetBucketInfo?globalAlias="+bucket, &utils.FetchOptions{})
if err != nil {
return nil, err
}
@ -309,7 +309,7 @@ func getBucketCredentials(bucket string) (aws.CredentialsProvider, error) {
continue
}
body, err := utils.Garage.Fetch(fmt.Sprintf("/v1/key?id=%s&showSecretKey=true", k.AccessKeyID), &utils.FetchOptions{})
body, err := utils.Garage.Fetch(fmt.Sprintf("/v2/GetKeyInfo?id=%s&showSecretKey=true", k.AccessKeyID), &utils.FetchOptions{})
if err != nil {
return nil, err
}

View File

@ -11,7 +11,7 @@ import (
type Buckets struct{}
func (b *Buckets) GetAll(w http.ResponseWriter, r *http.Request) {
body, err := utils.Garage.Fetch("/v1/bucket?list", &utils.FetchOptions{})
body, err := utils.Garage.Fetch("/v2/ListBuckets", &utils.FetchOptions{})
if err != nil {
utils.ResponseError(w, err)
return
@ -27,7 +27,7 @@ func (b *Buckets) GetAll(w http.ResponseWriter, r *http.Request) {
for _, bucket := range buckets {
go func() {
body, err := utils.Garage.Fetch(fmt.Sprintf("/v1/bucket?id=%s", bucket.ID), &utils.FetchOptions{})
body, err := utils.Garage.Fetch(fmt.Sprintf("/v2/GetBucketInfo?id=%s", bucket.ID), &utils.FetchOptions{})
if err != nil {
ch <- schema.Bucket{ID: bucket.ID, GlobalAliases: bucket.GlobalAliases}

View File

@ -24,7 +24,7 @@ const KeysPage = () => {
const fetchSecretKey = useCallback(async (id: string) => {
try {
const result = await api.get<{ secretAccessKey: string }>("/v1/key", {
const result = await api.get<{ secretAccessKey: string }>("/v2/GetKeyInfo", {
params: { id, showSecretKey: "true" },
});
if (!result?.secretAccessKey) {