Merge branch 'dev' into vod

This commit is contained in:
Ingo Oppermann
2023-03-17 13:56:07 +01:00
4 changed files with 58 additions and 38 deletions

View File

@@ -322,6 +322,7 @@ const docTemplate = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"v16.12.0",
"v16.12.0" "v16.12.0"
], ],
"summary": "List all registered filesystems", "summary": "List all registered filesystems",
@@ -389,7 +390,7 @@ const docTemplate = `{
} }
} }
}, },
"/api/v3/fs/{name}": { "/api/v3/fs/{storage}": {
"get": { "get": {
"security": [ "security": [
{ {
@@ -401,6 +402,7 @@ const docTemplate = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"v16.7.2",
"v16.7.2" "v16.7.2"
], ],
"summary": "List all files on a filesystem", "summary": "List all files on a filesystem",
@@ -409,7 +411,7 @@ const docTemplate = `{
{ {
"type": "string", "type": "string",
"description": "Name of the filesystem", "description": "Name of the filesystem",
"name": "name", "name": "storage",
"in": "path", "in": "path",
"required": true "required": true
}, },
@@ -445,7 +447,7 @@ const docTemplate = `{
} }
} }
}, },
"/api/v3/fs/{name}/{path}": { "/api/v3/fs/{storage}/{filepath}": {
"get": { "get": {
"security": [ "security": [
{ {
@@ -458,6 +460,7 @@ const docTemplate = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"v16.7.2",
"v16.7.2" "v16.7.2"
], ],
"summary": "Fetch a file from a filesystem", "summary": "Fetch a file from a filesystem",
@@ -466,14 +469,14 @@ const docTemplate = `{
{ {
"type": "string", "type": "string",
"description": "Name of the filesystem", "description": "Name of the filesystem",
"name": "name", "name": "storage",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "string", "type": "string",
"description": "Path to file", "description": "Path to file",
"name": "path", "name": "filepath",
"in": "path", "in": "path",
"required": true "required": true
} }
@@ -514,6 +517,7 @@ const docTemplate = `{
"application/json" "application/json"
], ],
"tags": [ "tags": [
"v16.7.2",
"v16.7.2" "v16.7.2"
], ],
"summary": "Add a file to a filesystem", "summary": "Add a file to a filesystem",
@@ -522,14 +526,14 @@ const docTemplate = `{
{ {
"type": "string", "type": "string",
"description": "Name of the filesystem", "description": "Name of the filesystem",
"name": "name", "name": "storage",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "string", "type": "string",
"description": "Path to file", "description": "Path to file",
"name": "path", "name": "filepath",
"in": "path", "in": "path",
"required": true "required": true
}, },
@@ -578,6 +582,7 @@ const docTemplate = `{
"text/plain" "text/plain"
], ],
"tags": [ "tags": [
"v16.7.2",
"v16.7.2" "v16.7.2"
], ],
"summary": "Remove a file from a filesystem", "summary": "Remove a file from a filesystem",
@@ -586,14 +591,14 @@ const docTemplate = `{
{ {
"type": "string", "type": "string",
"description": "Name of the filesystem", "description": "Name of the filesystem",
"name": "name", "name": "storage",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "string", "type": "string",
"description": "Path to file", "description": "Path to file",
"name": "path", "name": "filepath",
"in": "path", "in": "path",
"required": true "required": true
} }

View File

@@ -315,6 +315,7 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"v16.12.0",
"v16.12.0" "v16.12.0"
], ],
"summary": "List all registered filesystems", "summary": "List all registered filesystems",
@@ -382,7 +383,7 @@
} }
} }
}, },
"/api/v3/fs/{name}": { "/api/v3/fs/{storage}": {
"get": { "get": {
"security": [ "security": [
{ {
@@ -394,6 +395,7 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"v16.7.2",
"v16.7.2" "v16.7.2"
], ],
"summary": "List all files on a filesystem", "summary": "List all files on a filesystem",
@@ -402,7 +404,7 @@
{ {
"type": "string", "type": "string",
"description": "Name of the filesystem", "description": "Name of the filesystem",
"name": "name", "name": "storage",
"in": "path", "in": "path",
"required": true "required": true
}, },
@@ -438,7 +440,7 @@
} }
} }
}, },
"/api/v3/fs/{name}/{path}": { "/api/v3/fs/{storage}/{filepath}": {
"get": { "get": {
"security": [ "security": [
{ {
@@ -451,6 +453,7 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"v16.7.2",
"v16.7.2" "v16.7.2"
], ],
"summary": "Fetch a file from a filesystem", "summary": "Fetch a file from a filesystem",
@@ -459,14 +462,14 @@
{ {
"type": "string", "type": "string",
"description": "Name of the filesystem", "description": "Name of the filesystem",
"name": "name", "name": "storage",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "string", "type": "string",
"description": "Path to file", "description": "Path to file",
"name": "path", "name": "filepath",
"in": "path", "in": "path",
"required": true "required": true
} }
@@ -507,6 +510,7 @@
"application/json" "application/json"
], ],
"tags": [ "tags": [
"v16.7.2",
"v16.7.2" "v16.7.2"
], ],
"summary": "Add a file to a filesystem", "summary": "Add a file to a filesystem",
@@ -515,14 +519,14 @@
{ {
"type": "string", "type": "string",
"description": "Name of the filesystem", "description": "Name of the filesystem",
"name": "name", "name": "storage",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "string", "type": "string",
"description": "Path to file", "description": "Path to file",
"name": "path", "name": "filepath",
"in": "path", "in": "path",
"required": true "required": true
}, },
@@ -571,6 +575,7 @@
"text/plain" "text/plain"
], ],
"tags": [ "tags": [
"v16.7.2",
"v16.7.2" "v16.7.2"
], ],
"summary": "Remove a file from a filesystem", "summary": "Remove a file from a filesystem",
@@ -579,14 +584,14 @@
{ {
"type": "string", "type": "string",
"description": "Name of the filesystem", "description": "Name of the filesystem",
"name": "name", "name": "storage",
"in": "path", "in": "path",
"required": true "required": true
}, },
{ {
"type": "string", "type": "string",
"description": "Path to file", "description": "Path to file",
"name": "path", "name": "filepath",
"in": "path", "in": "path",
"required": true "required": true
} }

View File

@@ -2172,6 +2172,7 @@ paths:
summary: List all registered filesystems summary: List all registered filesystems
tags: tags:
- v16.12.0 - v16.12.0
- v16.12.0
put: put:
consumes: consumes:
- application/json - application/json
@@ -2204,7 +2205,7 @@ paths:
summary: File operations between filesystems summary: File operations between filesystems
tags: tags:
- v16.?.? - v16.?.?
/api/v3/fs/{name}: /api/v3/fs/{storage}:
get: get:
description: List all files on a filesystem. The listing can be ordered by name, description: List all files on a filesystem. The listing can be ordered by name,
size, or date of last modification in ascending or descending order. size, or date of last modification in ascending or descending order.
@@ -2212,7 +2213,7 @@ paths:
parameters: parameters:
- description: Name of the filesystem - description: Name of the filesystem
in: path in: path
name: name name: storage
required: true required: true
type: string type: string
- description: glob pattern for file names - description: glob pattern for file names
@@ -2241,19 +2242,20 @@ paths:
summary: List all files on a filesystem summary: List all files on a filesystem
tags: tags:
- v16.7.2 - v16.7.2
/api/v3/fs/{name}/{path}: - v16.7.2
/api/v3/fs/{storage}/{filepath}:
delete: delete:
description: Remove a file from a filesystem description: Remove a file from a filesystem
operationId: filesystem-3-delete-file operationId: filesystem-3-delete-file
parameters: parameters:
- description: Name of the filesystem - description: Name of the filesystem
in: path in: path
name: name name: storage
required: true required: true
type: string type: string
- description: Path to file - description: Path to file
in: path in: path
name: path name: filepath
required: true required: true
type: string type: string
produces: produces:
@@ -2272,18 +2274,19 @@ paths:
summary: Remove a file from a filesystem summary: Remove a file from a filesystem
tags: tags:
- v16.7.2 - v16.7.2
- v16.7.2
get: get:
description: Fetch a file from a filesystem description: Fetch a file from a filesystem
operationId: filesystem-3-get-file operationId: filesystem-3-get-file
parameters: parameters:
- description: Name of the filesystem - description: Name of the filesystem
in: path in: path
name: name name: storage
required: true required: true
type: string type: string
- description: Path to file - description: Path to file
in: path in: path
name: path name: filepath
required: true required: true
type: string type: string
produces: produces:
@@ -2307,6 +2310,7 @@ paths:
summary: Fetch a file from a filesystem summary: Fetch a file from a filesystem
tags: tags:
- v16.7.2 - v16.7.2
- v16.7.2
put: put:
consumes: consumes:
- application/data - application/data
@@ -2315,12 +2319,12 @@ paths:
parameters: parameters:
- description: Name of the filesystem - description: Name of the filesystem
in: path in: path
name: name name: storage
required: true required: true
type: string type: string
- description: Path to file - description: Path to file
in: path in: path
name: path name: filepath
required: true required: true
type: string type: string
- description: File data - description: File data
@@ -2352,6 +2356,7 @@ paths:
summary: Add a file to a filesystem summary: Add a file to a filesystem
tags: tags:
- v16.7.2 - v16.7.2
- v16.7.2
/api/v3/log: /api/v3/log:
get: get:
description: Get the last log lines of the Restreamer application description: Get the last log lines of the Restreamer application

View File

@@ -32,17 +32,18 @@ func NewFS(filesystems map[string]FSConfig) *FSHandler {
// GetFileAPI returns the file at the given path // GetFileAPI returns the file at the given path
// @Summary Fetch a file from a filesystem // @Summary Fetch a file from a filesystem
// @Description Fetch a file from a filesystem // @Description Fetch a file from a filesystem
// @Tags v16.7.2
// @ID filesystem-3-get-file // @ID filesystem-3-get-file
// @Tags v16.7.2 // @Tags v16.7.2
// @Produce application/data // @Produce application/data
// @Produce json // @Produce json
// @Param name path string true "Name of the filesystem" // @Param storage path string true "Name of the filesystem"
// @Param path path string true "Path to file" // @Param filepath path string true "Path to file"
// @Success 200 {file} byte // @Success 200 {file} byte
// @Success 301 {string} string // @Success 301 {string} string
// @Failure 404 {object} api.Error // @Failure 404 {object} api.Error
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /api/v3/fs/{name}/{path} [get] // @Router /api/v3/fs/{storage}/{filepath} [get]
func (h *FSHandler) GetFile(c echo.Context) error { func (h *FSHandler) GetFile(c echo.Context) error {
name := util.PathParam(c, "name") name := util.PathParam(c, "name")
@@ -57,19 +58,20 @@ func (h *FSHandler) GetFile(c echo.Context) error {
// PutFileAPI adds or overwrites a file at the given path // PutFileAPI adds or overwrites a file at the given path
// @Summary Add a file to a filesystem // @Summary Add a file to a filesystem
// @Description Writes or overwrites a file on a filesystem // @Description Writes or overwrites a file on a filesystem
// @Tags v16.7.2
// @ID filesystem-3-put-file // @ID filesystem-3-put-file
// @Tags v16.7.2 // @Tags v16.7.2
// @Accept application/data // @Accept application/data
// @Produce text/plain // @Produce text/plain
// @Produce json // @Produce json
// @Param name path string true "Name of the filesystem" // @Param storage path string true "Name of the filesystem"
// @Param path path string true "Path to file" // @Param filepath path string true "Path to file"
// @Param data body []byte true "File data" // @Param data body []byte true "File data"
// @Success 201 {string} string // @Success 201 {string} string
// @Success 204 {string} string // @Success 204 {string} string
// @Failure 507 {object} api.Error // @Failure 507 {object} api.Error
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /api/v3/fs/{name}/{path} [put] // @Router /api/v3/fs/{storage}/{filepath} [put]
func (h *FSHandler) PutFile(c echo.Context) error { func (h *FSHandler) PutFile(c echo.Context) error {
name := util.PathParam(c, "name") name := util.PathParam(c, "name")
@@ -84,15 +86,16 @@ func (h *FSHandler) PutFile(c echo.Context) error {
// DeleteFileAPI removes a file from a filesystem // DeleteFileAPI removes a file from a filesystem
// @Summary Remove a file from a filesystem // @Summary Remove a file from a filesystem
// @Description Remove a file from a filesystem // @Description Remove a file from a filesystem
// @Tags v16.7.2
// @ID filesystem-3-delete-file // @ID filesystem-3-delete-file
// @Tags v16.7.2 // @Tags v16.7.2
// @Produce text/plain // @Produce text/plain
// @Param name path string true "Name of the filesystem" // @Param storage path string true "Name of the filesystem"
// @Param path path string true "Path to file" // @Param filepath path string true "Path to file"
// @Success 200 {string} string // @Success 200 {string} string
// @Failure 404 {object} api.Error // @Failure 404 {object} api.Error
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /api/v3/fs/{name}/{path} [delete] // @Router /api/v3/fs/{storage}/{filepath} [delete]
func (h *FSHandler) DeleteFile(c echo.Context) error { func (h *FSHandler) DeleteFile(c echo.Context) error {
name := util.PathParam(c, "name") name := util.PathParam(c, "name")
@@ -107,16 +110,17 @@ func (h *FSHandler) DeleteFile(c echo.Context) error {
// ListFiles lists all files on a filesystem // ListFiles lists all files on a filesystem
// @Summary List all files on a filesystem // @Summary List all files on a filesystem
// @Description List all files on a filesystem. The listing can be ordered by name, size, or date of last modification in ascending or descending order. // @Description List all files on a filesystem. The listing can be ordered by name, size, or date of last modification in ascending or descending order.
// @Tags v16.7.2
// @ID filesystem-3-list-files // @ID filesystem-3-list-files
// @Tags v16.7.2 // @Tags v16.7.2
// @Produce json // @Produce json
// @Param name path string true "Name of the filesystem" // @Param storage path string true "Name of the filesystem"
// @Param glob query string false "glob pattern for file names" // @Param glob query string false "glob pattern for file names"
// @Param sort query string false "none, name, size, lastmod" // @Param sort query string false "none, name, size, lastmod"
// @Param order query string false "asc, desc" // @Param order query string false "asc, desc"
// @Success 200 {array} api.FileInfo // @Success 200 {array} api.FileInfo
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /api/v3/fs/{name} [get] // @Router /api/v3/fs/{storage} [get]
func (h *FSHandler) ListFiles(c echo.Context) error { func (h *FSHandler) ListFiles(c echo.Context) error {
name := util.PathParam(c, "name") name := util.PathParam(c, "name")
@@ -131,6 +135,7 @@ func (h *FSHandler) ListFiles(c echo.Context) error {
// List lists all registered filesystems // List lists all registered filesystems
// @Summary List all registered filesystems // @Summary List all registered filesystems
// @Description Listall registered filesystems // @Description Listall registered filesystems
// @Tags v16.12.0
// @ID filesystem-3-list // @ID filesystem-3-list
// @Tags v16.12.0 // @Tags v16.12.0
// @Produce json // @Produce json