Add ability to remove interfaces

This commit is contained in:
Kalle Carlbark 2022-02-14 12:19:02 +01:00
parent 2bd3658b60
commit 170fde8a31
No known key found for this signature in database

View file

@ -268,3 +268,21 @@ func (s *InterfacesService) Create(ctx context.Context, c *NewInterface) (*Inter
return &nic, nil
}
// Delete a interface
func (s *InterfacesService) Delete(ctx context.Context, i string) error {
var err error
var req *http.Request
req, err = s.client.newRequest(ctx, "DELETE", interfacesPath+"/"+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
}