go get "github.com/CodePicnic/codepicnic-go"
package main
import (
"fmt"
"github.com/CodePicnic/codepicnic-go"
)
func main() {
client_id := "XXXXXXXXXXXXXX"
secret_id := "YYYYYYYYYYYYYY"
err := codepicnic.Init(client_id, secret_id)
if err != nil {
fmt.Println(err.Error())
} else {
token := codepicnic.GetToken()
fmt.Println(token)
}
}
console_request := codepicnic.ConsoleRequest{
Title: "My Awesome Console",
Type: "golang",
}
console, err := codepicnic.CreateConsole(console_request)
if err != nil {
fmt.Println(err.Error())
return
}
var consoles []codepicnic.Console
consoles, err = codepicnic.ListConsoles()`
var console codepicnic.Console
console, err = codepicnic.GetConsole("3b0e40daaad6cd0ac3ec16efa5a25762")
console.Start()
console.Stop()
console.Restart()
console.Remove()
status, err := console.Status()
if status == "exited" {
console.Start()
}
fmt.Println(console.Title())
fmt.Println(console.Name())
fmt.Println(console.ContainerName())
fmt.Println(console.ContainerType())