Public release of katbox

This commit is contained in:
Renán Del Valle 2021-04-12 12:00:01 -07:00
commit 4c764e09a4
46 changed files with 4646 additions and 0 deletions

232
stream/docs/docs.go Normal file
View file

@ -0,0 +1,232 @@
// 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{})
}

170
stream/docs/swagger.json Normal file
View file

@ -0,0 +1,170 @@
{
"swagger": "2.0",
"info": {
"description": "Rest API doc for sandbox API's",
"title": "k8s Sandbox Go Restful API with Swagger",
"contact": {
"name": "Revanth Chandra",
},
"version": "1.0"
},
"host": "localhost:8080",
"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"
}
}
}
}
}

113
stream/docs/swagger.yaml Normal file
View file

@ -0,0 +1,113 @@
basePath: /
definitions:
main.FileInformation:
properties:
gid:
type: string
mode:
type: string
mtime:
type: string
nlink:
type: string
path:
type: string
size:
type: string
uid:
type: string
type: object
main.Result:
properties:
data:
items:
$ref: '#/definitions/main.FileInformation'
type: array
type: object
main.StreamData:
properties:
data:
type: string
offset:
type: integer
type: object
host: localhost:8080
info:
contact:
name: Revanth Chandra
description: Rest API doc for sandbox API's
title: k8s Sandbox Go Restful API with Swagger
version: "1.0"
paths:
/files/browse:
get:
consumes:
- application/json
description: serves sandbox logs filesystem as a json object
parameters:
- description: Path
in: query
name: path
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/main.Result'
summary: Browse Filesystem
/files/download:
get:
consumes:
- application/json
description: Download any file from sandbox logs filesystem
parameters:
- description: Path
in: query
name: path
required: true
type: string
produces:
- application/octet-stream
responses:
"200":
description: OK
schema:
$ref: '#/definitions/main.StreamData'
summary: Download a file from Filesystem
/files/read:
get:
consumes:
- application/json
description: Reads any file from sandbox logs filesystem and serves as a json
object
parameters:
- description: Path
in: query
name: path
required: true
type: string
- description: Offset
in: query
name: offset
required: true
type: integer
- description: Length
in: query
name: length
required: true
type: integer
- description: jsonp
in: query
name: jsonp
required: true
type: string
responses:
"200":
description: OK
schema:
$ref: '#/definitions/main.StreamData'
summary: Read a file from Filesystem
swagger: "2.0"