controllers

package
v0.0.0-...-a8acd24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

README

Controllers

This is generated by Beego framework after running bee new seagul. There're controllers of back-end server which are responsible for rendering a HTML file or processing API requests.

Default.go

This is generated to render a simple page to the browser. We keep it because we use Beego as a web server.

But this is quite simple when we use AngularJS as the front-end framework. The MainController in default.go just needs to render one HTML file in the whole website.

Here's almost all the code of it.

func (this *MainController) Get() {
  this.TplName = "index.html"
  this.Render()
}

Dockerapi.go

This is another controller for seagull to process API request about docker.

It will not render a whole HTML file and just return JSON data or pure string.

The code of Dockerapi.go is as simple as the previous one.

/* Wrap docker remote API to get version info */
func (this *DockerapiController) GetVersion() {
  address := "/version"
  result := RequestUnixSocket(address, "GET")
  this.Ctx.WriteString(result)
}

Then the front-end framework or other processes and get the data from thess APIs.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestUnixSocket

func RequestUnixSocket(address, method string) string

Give address and method to request docker unix socket

Types

type DockerapiController

type DockerapiController struct {
	beego.Controller
}

It's a beego controller

func (*DockerapiController) DeleteContainer

func (this *DockerapiController) DeleteContainer()

Wrap docker remote API to delete contaienrs

func (*DockerapiController) DeleteImage

func (this *DockerapiController) DeleteImage()

Wrap docker remote API to delete image

func (*DockerapiController) GetContainer

func (this *DockerapiController) GetContainer()

Wrap docker remote API to get data of contaienr

func (*DockerapiController) GetContainerStats

func (this *DockerapiController) GetContainerStats()

Wrap docker remote API to get container stats

func (*DockerapiController) GetContainers

func (this *DockerapiController) GetContainers()

Wrap docker remote API to get contaienrs

func (*DockerapiController) GetImage

func (this *DockerapiController) GetImage()

Wrap docker remote API to get data of image

func (*DockerapiController) GetImages

func (this *DockerapiController) GetImages()

Wrap docker remote API to get images

func (*DockerapiController) GetInfo

func (this *DockerapiController) GetInfo()

Wrap docker remote API to get docker info

func (*DockerapiController) GetSearchImages

func (this *DockerapiController) GetSearchImages()

Wrap docker remote API to get search images

func (*DockerapiController) GetUserImage

func (this *DockerapiController) GetUserImage()

Wrap docker remote API to get data of user image

func (*DockerapiController) GetVersion

func (this *DockerapiController) GetVersion()

Wrap docker remote API to get version info

func (*DockerapiController) Ping

func (this *DockerapiController) Ping()

Warp docker remote API to ping docker daemon

func (*DockerapiController) StartContainer

func (this *DockerapiController) StartContainer()

Wrap docker remote API to start contaienrs

func (*DockerapiController) StopContainer

func (this *DockerapiController) StopContainer()

Wrap docker remote API to stop contaienrs

func (*DockerapiController) TopContainer

func (this *DockerapiController) TopContainer()

Wrap docker remote API to get container's status

type MainController

type MainController struct {
	beego.Controller
}

The default controller just to render the index page

func (*MainController) Get

func (this *MainController) Get()

Only accept the get request and return the webiste HTML file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL