katbox/stream/docs/docs.go
2021-04-12 12:03:46 -07:00

232 lines
6.3 KiB
Go

// swag init
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import (
"bytes"
"encoding/json"
"strings"
"text/template"
"github.com/swaggo/swag"
)
var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"title": "{{.Title}}",
"contact": {
"name": "Revanth Chandra",
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/files/browse": {
"get": {
"description": "serves sandbox logs filesystem as a json object",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Browse Filesystem",
"parameters": [
{
"type": "string",
"description": "Path",
"name": "path",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.Result"
}
}
}
}
},
"/files/download": {
"get": {
"description": "Download any file from sandbox logs filesystem",
"consumes": [
"application/json"
],
"produces": [
"application/octet-stream"
],
"summary": "Download a file from Filesystem",
"parameters": [
{
"type": "string",
"description": "Path",
"name": "path",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.StreamData"
}
}
}
}
},
"/files/read": {
"get": {
"description": "Reads any file from sandbox logs filesystem and serves as a json object",
"consumes": [
"application/json"
],
"summary": "Read a file from Filesystem",
"parameters": [
{
"type": "string",
"description": "Path",
"name": "path",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "Offset",
"name": "offset",
"in": "query",
"required": true
},
{
"type": "integer",
"description": "Length",
"name": "length",
"in": "query",
"required": true
},
{
"type": "string",
"description": "jsonp",
"name": "jsonp",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.StreamData"
}
}
}
}
}
},
"definitions": {
"main.FileInformation": {
"type": "object",
"properties": {
"gid": {
"type": "string"
},
"mode": {
"type": "string"
},
"mtime": {
"type": "string"
},
"nlink": {
"type": "string"
},
"path": {
"type": "string"
},
"size": {
"type": "string"
},
"uid": {
"type": "string"
}
}
},
"main.Result": {
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/main.FileInformation"
}
}
}
},
"main.StreamData": {
"type": "object",
"properties": {
"data": {
"type": "string"
},
"offset": {
"type": "integer"
}
}
}
}
}`
type swaggerInfo struct {
Version string
Host string
BasePath string
Schemes []string
Title string
Description string
}
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = swaggerInfo{
Version: "1.0",
Host: "localhost:8080",
BasePath: "/",
Schemes: []string{},
Title: "k8s Sandbox Go Restful API with Swagger",
Description: "Rest API doc for sandbox API's",
}
type s struct{}
func (s *s) ReadDoc() string {
sInfo := SwaggerInfo
sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
t, err := template.New("swagger_info").Funcs(template.FuncMap{
"marshal": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
}).Parse(doc)
if err != nil {
return doc
}
var tpl bytes.Buffer
if err := t.Execute(&tpl, sInfo); err != nil {
return doc
}
return tpl.String()
}
func init() {
swag.Register(swag.Name, &s{})
}