From 84e0ad321f96e700aeacd075e5f8b7704d68cf98 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Sat, 24 Oct 2020 21:28:54 -0400 Subject: [PATCH] Add GetInstancesBulk --- client.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 {