Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbdalido/gomarathon
Package gomarathon provides a go client to interact with a marathon
https://github.com/jbdalido/gomarathon
Last synced: 2 months ago
JSON representation
Package gomarathon provides a go client to interact with a marathon
- Host: GitHub
- URL: https://github.com/jbdalido/gomarathon
- Owner: jbdalido
- License: mit
- Created: 2014-07-23T08:35:27.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-01-24T17:35:43.000Z (over 4 years ago)
- Last Synced: 2024-01-26T08:03:50.728Z (5 months ago)
- Language: Go
- Homepage:
- Size: 301 KB
- Stars: 20
- Watchers: 3
- Forks: 14
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-mesos - GoMarathon
README
Go client for marathon
======================[![GoDoc](https://godoc.org/github.com/jbdalido/gomarathon?status.svg)](https://godoc.org/github.com/jbdalido/gomarathon)
Versions:
- **2014/08/30 Tag V0.1.0**:
Fixed version compatible with marathon 0.6Dev :
- **Branch marathon-0.7**:
Dev version for marathon 0.7**_* This is a BETA_**
This is a small go client to use with **[Marathon api v2](https://mesosphere.github.io/marathon/docs/rest-api.html)**. All endpoints are handled (EventSubscriptions have not yet been tested).
Feel free to hack.
### TODO
* Tests like everywhere
* Params building might be much more clean## Usage example
================
package mainimport (
"encoding/json"
"github.com/jbdalido/go-marathon"
"log"
)func main() {
c, err := gomarathon.NewClient("http://example.io:8080", nil)
if err != nil {
log.Fatal(err)
}// Update app
a := &gomarathon.Application{
ID: "test_app",
Mem: 515,
Container: &gomarathon.Container{
Docker: &gomarathon.Docker{
Image: "docker://jbaptiste/envspitter",
PortMappings: []*gomarathon.PortMapping{
{
ContainerPort: 80,
HostPort: 8080,
},
},
},
},
}
r, err := c.CreateApp(a)
if err != nil {
log.Fatal(err)
}
v, _ := json.Marshal(r)
log.Printf("%s", v)// List all apps
r, err = c.ListApps()
if err != nil {
log.Fatal(err)
}
v, _ = json.Marshal(r)
log.Printf("%s", v)// List one app
r, err = c.GetApp("test_app")
if err != nil {
log.Fatal(err)
}
v, _ = json.Marshal(r)
log.Printf("%s", v)// List Versions
r, err = c.ListAppVersions("test_app")
if err != nil {
log.Fatal(err)
}
v, _ = json.Marshal(r)
log.Printf("%s", v)// Update app
a = &gomarathon.Application{
Mem: 515,
Instances: 2,
}
r, err = c.UpdateApp("test_app", a)
if err != nil {
log.Fatal(err)
}
v, _ = json.Marshal(r)
log.Printf("%s", v)// Get all tasks
r, err = c.ListTasks()
if err != nil {
log.Fatal(err)
}
v, _ = json.Marshal(r)
log.Printf("%s", v)// Delete app
r, err = c.DeleteApp("test_app")
if err != nil {
log.Fatal(err)
}
v, _ = json.Marshal(r)
log.Printf("%s", v)}
## Authors
==========
- Jean-Baptiste Dalido
- Anton Lindström