mirror of
https://github.com/khairul169/garage-webui.git
synced 2025-10-14 23:09:32 +07:00
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:
parent
621761aeb6
commit
8247840e26
@ -292,7 +292,7 @@ func getBucketCredentials(bucket string) (aws.CredentialsProvider, error) {
|
|||||||
return cacheData.(aws.CredentialsProvider), nil
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ func getBucketCredentials(bucket string) (aws.CredentialsProvider, error) {
|
|||||||
continue
|
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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
type Buckets struct{}
|
type Buckets struct{}
|
||||||
|
|
||||||
func (b *Buckets) GetAll(w http.ResponseWriter, r *http.Request) {
|
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 {
|
if err != nil {
|
||||||
utils.ResponseError(w, err)
|
utils.ResponseError(w, err)
|
||||||
return
|
return
|
||||||
@ -27,7 +27,7 @@ func (b *Buckets) GetAll(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
for _, bucket := range buckets {
|
for _, bucket := range buckets {
|
||||||
go func() {
|
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 {
|
if err != nil {
|
||||||
ch <- schema.Bucket{ID: bucket.ID, GlobalAliases: bucket.GlobalAliases}
|
ch <- schema.Bucket{ID: bucket.ID, GlobalAliases: bucket.GlobalAliases}
|
||||||
|
@ -24,7 +24,7 @@ const KeysPage = () => {
|
|||||||
|
|
||||||
const fetchSecretKey = useCallback(async (id: string) => {
|
const fetchSecretKey = useCallback(async (id: string) => {
|
||||||
try {
|
try {
|
||||||
const result = await api.get<{ secretAccessKey: string }>("/v1/key", {
|
const result = await api.get<{ secretAccessKey: string }>("/v2/GetKeyInfo", {
|
||||||
params: { id, showSecretKey: "true" },
|
params: { id, showSecretKey: "true" },
|
||||||
});
|
});
|
||||||
if (!result?.secretAccessKey) {
|
if (!result?.secretAccessKey) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user