file_system/docs/swagger.yaml
2025-12-18 09:34:49 +08:00

413 lines
9.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

basePath: /
definitions:
common.Part:
properties:
etag:
type: string
partNumber:
type: integer
type: object
repository.FileInfo:
properties:
etag:
type: string
key:
type: string
lastModified:
type: string
size:
type: integer
type: object
repository.ListFilesResult:
properties:
files:
items:
$ref: '#/definitions/repository.FileInfo'
type: array
nextContinuationToken:
type: string
type: object
requests.CompleteMultipartRequest:
properties:
bucket_name:
type: string
object_key:
type: string
parts:
items:
$ref: '#/definitions/common.Part'
type: array
upload_id:
type: string
type: object
requests.CreateBucketRequest:
properties:
bucket_name:
type: string
type: object
requests.InitMultipartRequest:
properties:
bucket_name:
type: string
object_key:
type: string
type: object
host: localhost:8080
info:
contact: {}
description: RustFS 文件存储系统 API支持分片上传、文件预览、分页查询等高级功能。
title: RustFS File System API
version: "1.1"
paths:
/buckets:
get:
consumes:
- application/json
description: 列出所有可用的 S3 存储桶
produces:
- application/json
responses:
"200":
description: 存储桶列表
schema:
additionalProperties:
items:
type: string
type: array
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties:
type: string
type: object
summary: 获取存储桶列表
tags:
- 存储桶管理
post:
consumes:
- application/json
description: 创建一个新的 S3 存储桶
parameters:
- description: 创建存储桶请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/requests.CreateBucketRequest'
produces:
- application/json
responses:
"200":
description: 创建成功消息
schema:
additionalProperties:
type: string
type: object
"400":
description: 参数错误
schema:
additionalProperties:
type: string
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties:
type: string
type: object
summary: 创建存储桶
tags:
- 存储桶管理
/files/download:
get:
consumes:
- application/json
description: 从指定的存储桶下载文件
parameters:
- description: 存储桶名称
in: query
name: bucket_name
required: true
type: string
- description: 对象键(文件名)
in: query
name: object_key
required: true
type: string
produces:
- application/octet-stream
responses:
"200":
description: 文件流
schema:
type: file
"400":
description: 参数错误
schema:
additionalProperties:
type: string
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties:
type: string
type: object
summary: 下载文件
tags:
- 文件操作
/files/list:
get:
consumes:
- application/json
description: 分页查询存储桶中的文件
parameters:
- description: 存储桶名称
in: query
name: bucket_name
required: true
type: string
- description: 文件名前缀筛选
in: query
name: prefix
type: string
- description: 每页数量
in: query
name: max_keys
type: integer
- description: 分页Token
in: query
name: token
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/repository.ListFilesResult'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: 文件列表 (分页)
tags:
- 文件操作
/files/multipart/complete:
post:
consumes:
- application/json
description: 合并所有分片完成上传
parameters:
- description: 请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/requests.CompleteMultipartRequest'
produces:
- application/json
responses:
"200":
description: 返回文件位置
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: 完成分片上传
tags:
- 大文件上传
/files/multipart/init:
post:
consumes:
- application/json
description: 开始一个新的大文件分片上传任务
parameters:
- description: 请求参数
in: body
name: request
required: true
schema:
$ref: '#/definitions/requests.InitMultipartRequest'
produces:
- application/json
responses:
"200":
description: 返回 upload_id
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: 初始化分片上传
tags:
- 大文件上传
/files/multipart/part:
put:
consumes:
- multipart/form-data
description: 上传单个文件分片
parameters:
- description: 存储桶名称
in: formData
name: bucket_name
required: true
type: string
- description: 对象键
in: formData
name: object_key
required: true
type: string
- description: 上传ID
in: formData
name: upload_id
required: true
type: string
- description: 分片序号 (从1开始)
in: formData
name: part_number
required: true
type: integer
- description: 分片文件数据
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
"200":
description: 返回 ETag
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: 上传分片
tags:
- 大文件上传
/files/preview:
get:
consumes:
- application/json
description: 生成文件的临时预览链接 (24小时有效)
parameters:
- description: 存储桶名称
in: query
name: bucket_name
required: true
type: string
- description: 对象键
in: query
name: object_key
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: 获取预览链接
tags:
- 文件操作
/files/upload:
post:
consumes:
- multipart/form-data
description: 上传小文件到指定的存储桶
parameters:
- description: 存储桶名称
in: formData
name: bucket_name
required: true
type: string
- description: 要上传的文件
in: formData
name: file
required: true
type: file
produces:
- application/json
responses:
"200":
description: 上传成功消息
schema:
additionalProperties:
type: string
type: object
"400":
description: 参数错误
schema:
additionalProperties:
type: string
type: object
"500":
description: 服务器内部错误
schema:
additionalProperties:
type: string
type: object
summary: 上传文件 (简单上传)
tags:
- 文件操作
swagger: "2.0"