| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613 |
- openapi: 3.0.3
- tags:
- - name: fs
- info:
- title: SFTPGo HTTPFs
- description: |
- SFTPGo can use custom storage backend implementations compliant with the API defined here.
- HTTPFs is a work in progress and makes no API stability promises.
- version: 0.1.0
- license:
- name: AGPL-3.0-only
- url: 'https://www.gnu.org/licenses/agpl-3.0.en.html'
- servers:
- - url: /v1
- security:
- - ApiKeyAuth: []
- - BasicAuth: []
- paths:
- /stat/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- get:
- tags:
- - fs
- summary: Describes the named object
- operationId: stat
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/FileInfo'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /open/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- - name: offset
- in: query
- description: 'offset, in bytes, from the start. If not specified 0 must be assumed'
- required: false
- schema:
- type: integer
- format: int64
- get:
- tags:
- - fs
- summary: Opens the named file for reading
- operationId: open
- responses:
- '200':
- description: successful operation
- content:
- '*/*':
- schema:
- type: string
- format: binary
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /create/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- - name: flags
- in: query
- description: 'flags to use for opening the file, if omitted O_RDWR|O_CREATE|O_TRUNC must be assumed. Supported flags: https://pkg.go.dev/os#pkg-constants'
- required: false
- schema:
- type: integer
- format: int32
- - name: checks
- in: query
- description: 'If set to `1`, the parent directory must exist before creating the file'
- required: false
- schema:
- type: integer
- format: int32
- post:
- tags:
- - fs
- summary: Creates or opens the named file for writing
- operationId: create
- requestBody:
- content:
- '*/*':
- schema:
- type: string
- format: binary
- required: true
- responses:
- 201:
- $ref: '#/components/responses/OKResponse'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /rename/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- - name: target
- in: query
- description: target name
- required: true
- schema:
- type: string
- patch:
- tags:
- - fs
- summary: Renames (moves) source to target
- operationId: rename
- responses:
- 200:
- $ref: '#/components/responses/OKResponse'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /remove/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- delete:
- tags:
- - fs
- summary: Removes the named file or (empty) directory.
- operationId: delete
- responses:
- 200:
- $ref: '#/components/responses/OKResponse'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /mkdir/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- post:
- tags:
- - fs
- summary: Creates a new directory with the specified name
- operationId: mkdir
- responses:
- 200:
- $ref: '#/components/responses/OKResponse'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /chmod/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- - name: mode
- in: query
- required: true
- schema:
- type: integer
- patch:
- tags:
- - fs
- summary: Changes the mode of the named file
- operationId: chmod
- responses:
- 200:
- $ref: '#/components/responses/OKResponse'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /chtimes/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- - name: access_time
- in: query
- required: true
- schema:
- type: string
- format: date-time
- - name: modification_time
- in: query
- required: true
- schema:
- type: string
- format: date-time
- patch:
- tags:
- - fs
- summary: Changes the access and modification time of the named file
- operationId: chtimes
- responses:
- 200:
- $ref: '#/components/responses/OKResponse'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /truncate/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- - name: size
- in: query
- required: true
- description: 'new file size in bytes'
- schema:
- type: integer
- format: int64
- patch:
- tags:
- - fs
- summary: Changes the size of the named file
- operationId: truncate
- responses:
- 200:
- $ref: '#/components/responses/OKResponse'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /readdir/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- get:
- tags:
- - fs
- summary: Reads the named directory and returns the contents
- operationId: readdir
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- type: array
- items:
- $ref: '#/components/schemas/FileInfo'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /dirsize/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- get:
- tags:
- - fs
- summary: Returns the number of files and the size for the named directory including any sub-directory
- operationId: dirsize
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- type: object
- properties:
- files:
- type: integer
- description: 'Total number of files'
- size:
- type: integer
- format: int64
- description: 'Total size of files'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /mimetype/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- get:
- tags:
- - fs
- summary: Returns the mime type for the named file
- operationId: mimetype
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- type: object
- properties:
- mime:
- type: string
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- /statvfs/{name}:
- parameters:
- - name: name
- in: path
- description: object name
- required: true
- schema:
- type: string
- get:
- tags:
- - fs
- summary: Returns the VFS stats for the specified path
- operationId: statvfs
- responses:
- 200:
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/StatVFS'
- 401:
- $ref: '#/components/responses/Unauthorized'
- 403:
- $ref: '#/components/responses/Forbidden'
- 404:
- $ref: '#/components/responses/NotFound'
- 500:
- $ref: '#/components/responses/InternalServerError'
- 501:
- $ref: '#/components/responses/NotImplemented'
- default:
- $ref: '#/components/responses/DefaultResponse'
- components:
- responses:
- OKResponse:
- description: successful operation
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- BadRequest:
- description: Bad Request
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- Unauthorized:
- description: Unauthorized
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- Forbidden:
- description: Forbidden
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- NotFound:
- description: Not Found
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- NotImplemented:
- description: Not Implemented
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- Conflict:
- description: Conflict
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- RequestEntityTooLarge:
- description: Request Entity Too Large, max allowed size exceeded
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- InternalServerError:
- description: Internal Server Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- DefaultResponse:
- description: Unexpected Error
- content:
- application/json:
- schema:
- $ref: '#/components/schemas/ApiResponse'
- schemas:
- ApiResponse:
- type: object
- properties:
- message:
- type: string
- description: 'message, can be empty'
- error:
- type: string
- description: error description if any
- FileInfo:
- type: object
- properties:
- name:
- type: string
- description: base name of the file
- size:
- type: integer
- format: int64
- description: length in bytes for regular files; system-dependent for others
- mode:
- type: integer
- description: |
- File mode and permission bits. More details here: https://golang.org/pkg/io/fs/#FileMode.
- Let's see some examples:
- - for a directory mode&2147483648 != 0
- - for a symlink mode&134217728 != 0
- - for a regular file mode&2401763328 == 0
- last_modified:
- type: string
- format: date-time
- StatVFS:
- type: object
- properties:
- bsize:
- type: integer
- description: file system block size
- frsize:
- type: integer
- description: fundamental fs block size
- blocks:
- type: integer
- description: number of blocks
- bfree:
- type: integer
- description: free blocks in file system
- bavail:
- type: integer
- description: free blocks for non-root
- files:
- type: integer
- description: total file inodes
- ffree:
- type: integer
- description: free file inodes
- favail:
- type: integer
- description: free file inodes for non-root
- fsid:
- type: integer
- description: file system id
- flag:
- type: integer
- description: bit mask of f_flag values
- namemax:
- type: integer
- description: maximum filename length
- securitySchemes:
- BasicAuth:
- type: http
- scheme: basic
- ApiKeyAuth:
- type: apiKey
- in: header
- name: X-API-KEY
|