Add GetInstancesBulk
This commit is contained in:
		
							parent
							
								
									698589ddcc
								
							
						
					
					
						commit
						84e0ad321f
					
				
							
								
								
									
										14
									
								
								client.go
								
								
								
								
							
							
						
						
									
										14
									
								
								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 { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue