Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Switch to v4 apufferi, begin documentation work
Browse files Browse the repository at this point in the history
  • Loading branch information
LordRalex committed Oct 22, 2019
1 parent 7e0feeb commit b56e578
Show file tree
Hide file tree
Showing 48 changed files with 588 additions and 243 deletions.
2 changes: 1 addition & 1 deletion cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package cache

import (
"github.com/pufferpanel/apufferi/v3"
"github.com/pufferpanel/apufferi/v4"
"github.com/spf13/viper"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package main

import "github.com/pufferpanel/apufferi/v3/logging"
import "github.com/pufferpanel/apufferi/v4/logging"

func main() {
defer logging.Close()
Expand Down
2 changes: 1 addition & 1 deletion cmd/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"github.com/pufferpanel/apufferi/v3"
"github.com/pufferpanel/apufferi/v4"
"github.com/pufferpanel/pufferd/v2"
"github.com/pufferpanel/pufferd/v2/programs"
"github.com/spf13/cobra"
Expand Down
2 changes: 1 addition & 1 deletion cmd/reload.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package main

import (
"errors"
"github.com/pufferpanel/apufferi/v3/logging"
"github.com/pufferpanel/apufferi/v4/logging"
"github.com/spf13/cobra"
"os"
"syscall"
Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package main

import (
"fmt"
"github.com/pufferpanel/apufferi/v3/logging"
"github.com/pufferpanel/apufferi/v4/logging"
"github.com/pufferpanel/pufferd/v2"
"github.com/spf13/cobra"
"os"
Expand Down
4 changes: 2 additions & 2 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package main
import (
"fmt"
"github.com/braintree/manners"
"github.com/pufferpanel/apufferi/v3"
"github.com/pufferpanel/apufferi/v3/logging"
"github.com/pufferpanel/apufferi/v4"
"github.com/pufferpanel/apufferi/v4/logging"
"github.com/pufferpanel/pufferd/v2"
"github.com/pufferpanel/pufferd/v2/environments"
"github.com/pufferpanel/pufferd/v2/programs"
Expand Down
2 changes: 1 addition & 1 deletion cmd/shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package main

import (
"errors"
"github.com/pufferpanel/apufferi/v3/logging"
"github.com/pufferpanel/apufferi/v4/logging"
"github.com/spf13/cobra"
"os"
"syscall"
Expand Down
2 changes: 1 addition & 1 deletion commons/close.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package commons

import (
"github.com/pufferpanel/apufferi/v3"
"github.com/pufferpanel/apufferi/v4"
"net/http"
)

Expand Down
141 changes: 141 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// This file was generated by swaggo/swag at
// 2019-10-22 13:48:36.6271935 -0500 CDT m=+3.760001801

package docs

import (
"bytes"
"encoding/json"
"strings"

"github.com/alecthomas/template"
"github.com/swaggo/swag"
)

var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"title": "{{.Title}}",
"contact": {
"name": "PufferPanel",
"url": "https://pufferpanel.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/server/{id}": {
"post": {
"description": "Starts the given server",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Starts server",
"parameters": [
{
"type": "string",
"description": "Server Identifier",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/response.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Error"
}
}
}
}
}
},
"definitions": {
"response.Error": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
}
}`

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: "2.0",
Host: "",
BasePath: "",
Schemes: []string{},
Title: "Pufferd API",
Description: "PufferPanel daemon service",
}

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{})
}
76 changes: 76 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"swagger": "2.0",
"info": {
"description": "PufferPanel daemon service",
"title": "Pufferd API",
"contact": {
"name": "PufferPanel",
"url": "https://pufferpanel.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "2.0"
},
"paths": {
"/server/{id}": {
"post": {
"description": "Starts the given server",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"summary": "Starts server",
"parameters": [
{
"type": "string",
"description": "Server Identifier",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.Error"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/response.Error"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Error"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/response.Error"
}
}
}
}
}
},
"definitions": {
"response.Error": {
"type": "object",
"properties": {
"error": {
"type": "string"
}
}
}
}
}
50 changes: 50 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
definitions:
response.Error:
properties:
error:
type: string
type: object
info:
contact:
name: PufferPanel
url: https://pufferpanel.com
description: PufferPanel daemon service
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: Pufferd API
version: "2.0"
paths:
/server/{id}:
post:
consumes:
- application/json
description: Starts the given server
parameters:
- description: Server Identifier
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200": {}
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.Error'
"403":
description: Forbidden
schema:
$ref: '#/definitions/response.Error'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Error'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/response.Error'
summary: Starts server
swagger: "2.0"
4 changes: 2 additions & 2 deletions environments/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package environments
import (
"crypto/sha1"
"fmt"
"github.com/pufferpanel/apufferi/v3"
"github.com/pufferpanel/apufferi/v3/logging"
"github.com/pufferpanel/apufferi/v4"
"github.com/pufferpanel/apufferi/v4/logging"
"github.com/pufferpanel/pufferd/v2/commons"
"github.com/pufferpanel/pufferd/v2/environments/envs"
"github.com/spf13/viper"
Expand Down
2 changes: 1 addition & 1 deletion environments/environmentloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package environments
import (
"fmt"
"github.com/pkg/errors"
"github.com/pufferpanel/apufferi/v3"
"github.com/pufferpanel/apufferi/v4"
"github.com/pufferpanel/pufferd/v2/cache"
"github.com/pufferpanel/pufferd/v2/environments/envs"
"github.com/pufferpanel/pufferd/v2/environments/impl/docker"
Expand Down
5 changes: 3 additions & 2 deletions environments/envs/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ package envs
import (
"fmt"
"github.com/gorilla/websocket"
"github.com/pufferpanel/apufferi/v3"
"github.com/pufferpanel/apufferi/v4"
"github.com/pufferpanel/pufferd/v2"
"github.com/pufferpanel/pufferd/v2/utils"
"github.com/spf13/viper"
"io"
Expand Down Expand Up @@ -62,7 +63,7 @@ type Environment interface {

AddListener(ws *websocket.Conn)

GetStats() (map[string]interface{}, error)
GetStats() (*pufferd.ServerStats, error)

DisplayToConsole(msg string, data ...interface{})

Expand Down
Loading

0 comments on commit b56e578

Please sign in to comment.