1package network 2 3import ( 4 liquidweb "github.com/liquidweb/liquidweb-go" 5) 6 7// VIPBackend describes the interface for interactions with the API. 8type VIPBackend interface { 9 Create(VIPParams) (*VIP, error) 10 Destroy(string) (*VIPDeletion, error) 11 Details(string) (*VIP, error) 12} 13 14// VIPClient is the backend implementation for interacting with VIP. 15type VIPClient struct { 16 Backend liquidweb.Backend 17} 18 19// Create creates a new VIP. 20func (c *VIPClient) Create(params VIPParams) (*VIP, error) { 21 var result VIP 22 err := c.Backend.CallIntoInterface("v1/VIP/create", params, &result) 23 if err != nil { 24 return nil, err 25 } 26 27 return &result, nil 28} 29 30// Details returns details about a VIP. 31func (c *VIPClient) Details(uniqID string) (*VIP, error) { 32 var result VIP 33 params := VIPParams{UniqID: uniqID} 34 35 err := c.Backend.CallIntoInterface("v1/VIP/details", params, &result) 36 if err != nil { 37 return nil, err 38 } 39 return &result, nil 40} 41 42// Destroy will delete a VIP. 43func (c *VIPClient) Destroy(uniqID string) (*VIPDeletion, error) { 44 var result VIPDeletion 45 params := VIPParams{UniqID: uniqID} 46 47 err := c.Backend.CallIntoInterface("v1/VIP/destroy", params, &result) 48 if err != nil { 49 return nil, err 50 } 51 return &result, nil 52} 53