Skip to content

msawka/fleet-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FleetApi

An elixir wrapper for the Fleet API. Connect to the API running on one of your fleet cluster nodes using either a direct node URL or an etcd etcd token.

Build Status

Usage

etcd token

Note that this is a config value you can set to override the port used to connect to the Fleet API when using an etcd token. In your app's config, you can set

config :fleet_api, :etcd
  fix_port_number: true,
  api_port: 4001

To get the api to use the correct port, regardless of what might be stored in etcd.

{:ok, pid} = FleetApi.Etcd.start_link("your etcd token")
{:ok, units} = FleetApi.Etcd.list_units(pid)

[%FleetApi.Unit{currentState: "launched", desiredState: "launched",
  machineID: "820c30c0867844129d63f4409871ba39", name: "subgun-http.service",
  options: [%FleetApi.UnitOption{name: "Description", section: "Unit",
    value: "subgun"},
   %FleetApi.UnitOption{name: "ExecStartPre", section: "Service",
    value: "-/usr/bin/docker kill subgun-%i"},
   %FleetApi.UnitOption{name: "ExecStartPre", section: "Service",
    value: "-/usr/bin/docker rm subgun-%i"}...]

Direct node URL

{:ok, pid} = FleetApi.Direct.start_link("http://your-node-host-or-ip:7002")
{:ok, units} = FleetApi.Direct.list_units(pid)

[%FleetApi.Unit{currentState: "launched", desiredState: "launched",
  machineID: "820c30c0867844129d63f4409871ba39", name: "subgun-http.service",
  options: [%FleetApi.UnitOption{name: "Description", section: "Unit",
    value: "subgun"},
   %FleetApi.UnitOption{name: "ExecStartPre", section: "Service",
    value: "-/usr/bin/docker kill subgun-%i"},
   %FleetApi.UnitOption{name: "ExecStartPre", section: "Service",
    value: "-/usr/bin/docker rm subgun-%i"}...]

About

An Elixir API wrapper for the Fleet API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Elixir 100.0%