Documentation ¶
Overview ¶
Cepko implements easy-to-use communication with CloudSigma's VMs through a virtual serial port without bothering with formatting the messages properly nor parsing the output with the specific and sometimes confusing shell tools for that purpose.
Having the server definition accessible by the VM can be useful in various ways. For example it is possible to easily determine from within the VM, which network interfaces are connected to public and which to private network. Another use is to pass some data to initial VM setup scripts, like setting the hostname to the VM name or passing ssh public keys through server meta.
Example usage:
package main import ( "fmt" "github.com/cloudsigma/cepgo" ) func main() { c := cepgo.NewCepgo() result, err := c.Meta() if err != nil { panic(err) } fmt.Printf("%#v", result) }
Output:
map[string]string{ "optimize_for":"custom", "ssh_public_key":"ssh-rsa AAA...", "description":"[...]", }
For more information take a look at the Server Context section API Docs: http://cloudsigma-docs.readthedocs.org/en/latest/server_context.html
Index ¶
Constants ¶
const (
EOT = '\x04' // End Of Transmission
)
Variables ¶
var ( SerialPort string = "/dev/ttyS1" Baud int = 115200 )
Functions ¶
This section is empty.
Types ¶
type Cepgo ¶
type Cepgo struct {
// contains filtered or unexported fields
}
Queries to the serial port can be executed only from instance of this type. The result from each of them can be either interface{}, map[string]string or a single in case of single value is returned. There is also a public metod who directly calls the fetcher and returns raw []byte from the serial port.
func NewCepgo ¶
func NewCepgo() *Cepgo
Creates a Cepgo instance with the default serial port fetcher.
func NewCepgoFetcher ¶
Creates a Cepgo instance with custom fetcher.
func (*Cepgo) GlobalContext ¶
Fetches only the global context and makes sure to return a proper map[string]string