mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-10-29 14:02:21 +00:00
This uses the Packet.net API and iPXE to boot a Moby host. There are several enhancements coming soon, such as SSH key customisation, but this PR is sufficient to boot a host and then use the web interface to get console access. The user must currently upload the built artefacts to a public URL and specify it via --base-url, e.g.: moby run packet --api-key <key> --project-id <id> \ --base-url http://recoil.org/~avsm/ipxe --hostname test-moby packet See #1424 #1245 for related issues. Signed-off-by: Anil Madhavapeddy <anil@docker.com>
46 lines
936 B
Go
46 lines
936 B
Go
package packngo
|
|
|
|
const osBasePath = "/operating-systems"
|
|
|
|
// OSService interface defines available operating_systems methods
|
|
type OSService interface {
|
|
List() ([]OS, *Response, error)
|
|
}
|
|
|
|
type osRoot struct {
|
|
OperatingSystems []OS `json:"operating_systems"`
|
|
}
|
|
|
|
// OS represents a Packet operating system
|
|
type OS struct {
|
|
Name string `json:"name"`
|
|
Slug string `json:"slug"`
|
|
Distro string `json:"distro"`
|
|
Version string `json:"version"`
|
|
}
|
|
|
|
func (o OS) String() string {
|
|
return Stringify(o)
|
|
}
|
|
|
|
// OSServiceOp implements OSService
|
|
type OSServiceOp struct {
|
|
client *Client
|
|
}
|
|
|
|
// List returns all available operating systems
|
|
func (s *OSServiceOp) List() ([]OS, *Response, error) {
|
|
req, err := s.client.NewRequest("GET", osBasePath, nil)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
|
|
root := new(osRoot)
|
|
resp, err := s.client.Do(req, root)
|
|
if err != nil {
|
|
return nil, resp, err
|
|
}
|
|
|
|
return root.OperatingSystems, resp, err
|
|
}
|