Add ability to remove virtual-machine

This commit is contained in:
Kalle Carlbark 2022-02-08 08:23:25 +01:00
parent cdbabd262a
commit e6298e598a
No known key found for this signature in database
2 changed files with 20 additions and 0 deletions

2
.gitconfig Normal file
View file

@ -0,0 +1,2 @@
[core]
sshCommand = "/usr/bin/ssh"

View file

@ -194,3 +194,21 @@ func (s *VirtualMachinesService) Create(ctx context.Context, c *NewVirtualMachin
return nil return nil
} }
// Delete a virtual-machine
func (s *VirtualMachinesService) Delete(ctx context.Context, i string) error {
var err error
var req *http.Request
req, err = s.client.newRequest(ctx, "DELETE", virtualMachinesPath+"/"+i+"/", "", nil)
if err != nil {
return fmt.Errorf("unable to create request: %w", err)
}
_, err = s.client.do(req, nil)
if err != nil {
return fmt.Errorf("unable to do request: %w", err)
}
return nil
}