isle/go/bootstrap/garage_global_bucket.go

36 lines
742 B
Go
Raw Normal View History

package bootstrap
import (
"context"
"isle/garage"
"path/filepath"
"github.com/minio/minio-go/v7"
)
// Paths within garage's global bucket.
//
// TODO this is getting moved into daemon package.
const (
garageGlobalBucketBootstrapHostsDirPath = "bootstrap/hosts"
)
// RemoveGarageBootstrapHost removes the <hostname>.json.signed for the given
// host from garage.
//
// The given client should be for the global bucket.
func RemoveGarageBootstrapHost(
ctx context.Context, client garage.S3APIClient, hostName string,
) error {
filePath := filepath.Join(
garageGlobalBucketBootstrapHostsDirPath,
hostName+".json.signed",
)
return client.RemoveObject(
ctx, garage.GlobalBucket, filePath,
minio.RemoveObjectOptions{},
)
}