diff --git a/client.go b/client.go index ee65a51..226c1aa 100644 --- a/client.go +++ b/client.go @@ -14,6 +14,7 @@ type RapiClient interface { GetNetworks() ([]map[string]interface{}, error) GetNetworksBulk() ([]map[string]interface{}, error) GetNetworkInfo(name string) (map[string]interface{}, error) + GetInstancesBulk() ([]map[string]interface{}, error) } type Client struct { @@ -73,6 +74,19 @@ func (s *Client) GetNetworksBulk() ([]map[string]interface{}, error) { return data, nil } +func (s *Client) GetInstancesBulk() ([]map[string]interface{}, error) { + result, err := s.Do("GET", "instances?bulk=1") + if err != nil { + return nil, err + } + data := make([]map[string]interface{}, 0) + err = json.Unmarshal(result, &data) + if err != nil { + return nil, err + } + return data, nil +} + func (s *Client) GetNetworkInformation(name string) (map[string]interface{}, error) { result, err := s.Do("GET", "networks/" + name) if err != nil {