feat(ops): add object storage management and site-mapping CSV import/export
Ship the Ops backstage 对象存储 page (browse / upload / move / delete / folder ops) backed by a new object-storage service + handler, with the shared storage client extended with List/Stat/Copy/Usage/DownloadURL so both MinIO and Aliyun providers cover the new surface. Add ForcePathStyle to the object-storage config and treat r2/s3/custom_s3 as external providers so Cloudflare R2 and other S3-compatibles can share the MinIO client path without spinning up the bundled MinIO. Also add CSV import/export + template download to the site-domain mappings page, raise gin MaxMultipartMemory to 8 MiB for the new multipart endpoints, register Ops swagger routes, and extend the descriptions-parity test to cover the ops router. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,55 @@ func (c *ReloadableClient) PublicURL(objectKey string) (string, error) {
|
||||
return c.snapshot().PublicURL(objectKey)
|
||||
}
|
||||
|
||||
func (c *ReloadableClient) DownloadURL(objectKey string) (string, error) {
|
||||
return c.snapshot().DownloadURL(objectKey)
|
||||
}
|
||||
|
||||
func (c *ReloadableClient) List(ctx context.Context, in ListInput) (*ListResult, error) {
|
||||
client := c.snapshot()
|
||||
management, ok := client.(ManagementClient)
|
||||
if !ok {
|
||||
return nil, ErrNotConfigured
|
||||
}
|
||||
return management.List(ctx, in)
|
||||
}
|
||||
|
||||
func (c *ReloadableClient) Stat(ctx context.Context, objectKey string) (*ObjectInfo, error) {
|
||||
client := c.snapshot()
|
||||
management, ok := client.(ManagementClient)
|
||||
if !ok {
|
||||
return nil, ErrNotConfigured
|
||||
}
|
||||
return management.Stat(ctx, objectKey)
|
||||
}
|
||||
|
||||
func (c *ReloadableClient) Copy(ctx context.Context, sourceKey, destinationKey string) error {
|
||||
client := c.snapshot()
|
||||
management, ok := client.(ManagementClient)
|
||||
if !ok {
|
||||
return ErrNotConfigured
|
||||
}
|
||||
return management.Copy(ctx, sourceKey, destinationKey)
|
||||
}
|
||||
|
||||
func (c *ReloadableClient) Usage(ctx context.Context) (*UsageInfo, error) {
|
||||
client := c.snapshot()
|
||||
usageClient, ok := client.(UsageClient)
|
||||
if !ok {
|
||||
return nil, ErrUsageUnsupported
|
||||
}
|
||||
return usageClient.Usage(ctx)
|
||||
}
|
||||
|
||||
func (c *ReloadableClient) PublicReadableURL(objectKey string) (string, error) {
|
||||
client := c.snapshot()
|
||||
publicClient, ok := client.(PublicReadableClient)
|
||||
if !ok {
|
||||
return "", ErrObjectNotPublic
|
||||
}
|
||||
return publicClient.PublicReadableURL(objectKey)
|
||||
}
|
||||
|
||||
func (c *ReloadableClient) snapshot() Client {
|
||||
if c == nil {
|
||||
return disabledClient{reason: "object storage client is nil"}
|
||||
|
||||
Reference in New Issue
Block a user