Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (47 sloc) 2.12 KB
package junos
// All of our HTTP Content-Types we use.
var (
contentDiscoverDevices = "application/;version=2;charset=UTF-8"
contentExecDeploy = "application/;version=1;charset=UTF-8"
contentExecRemove = "application/;version=1;charset=UTF-8"
contentExecStage = "application/;version=1;charset=UTF-8"
contentAddress = "application/;version=1;charset=UTF-8"
contentUpdateDevices = "application/;version=1;charset=UTF-8"
contentPublish = "application/;version=1;charset=UTF-8"
contentAddressPatch = "application/;version=1;charset=UTF-8"
contentService = "application/;version=1;charset=UTF-8"
contentServicePatch = "application/;version=1;charset=UTF-8"
contentVariable = "application/;version=1;charset=UTF-8"
contentResync = "application/;version=1"
// Space contains our session state.
type Space struct {
Host string
User string
Password string
// APIRequest builds our request before sending it to the server.
type APIRequest struct {
Method string
URL string
Body string
ContentType string
type jobID struct {
ID int `xml:"id"`
type jobDetail struct {
ID jobID
Name string `xml:"name"`
State string `xml:"job-state"`
Status string `xml:"job-status"`
Percent float64 `xml:"percent-complete"`
// NewServer sets up our connection to the Junos Space server.
func NewServer(host, user, passwd string) *Space {
return &Space{
Host: host,
User: user,
Password: passwd,