File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,9 @@ See updating [Changelog example here](https://keepachangelog.com/en/1.0.0/)
55
66## [ Unreleased]
77
8+ ### Added
9+ - new ` Backups ` field for ` DeleteServerAndStoragesRequest ` that controls if backups should be kept or deleted while deleting the server
10+
811## [ 6.0.0]
912
1013### Added
Original file line number Diff line number Diff line change @@ -360,11 +360,16 @@ func (r *DeleteServerRequest) RequestURL() string {
360360
361361// DeleteServerAndStoragesRequest represents a request to delete a server and all attached storages
362362type DeleteServerAndStoragesRequest struct {
363- UUID string
363+ UUID string
364+ Backups DeleteStorageBackupsMode
364365}
365366
366367// RequestURL implements the Request interface
367368func (r * DeleteServerAndStoragesRequest ) RequestURL () string {
369+ if r .Backups != "" {
370+ return fmt .Sprintf ("/server/%s/?storages=1&backups=%s" , r .UUID , r .Backups )
371+ }
372+
368373 return fmt .Sprintf ("/server/%s/?storages=1" , r .UUID )
369374}
370375
Original file line number Diff line number Diff line change @@ -356,6 +356,27 @@ func TestDeleteServerAndStoragesRequest(t *testing.T) {
356356 }
357357
358358 assert .Equal (t , "/server/foo/?storages=1" , request .RequestURL ())
359+
360+ request = DeleteServerAndStoragesRequest {
361+ UUID : "bar" ,
362+ Backups : DeleteStorageBackupsModeDelete ,
363+ }
364+
365+ assert .Equal (t , "/server/bar/?storages=1&backups=delete" , request .RequestURL ())
366+
367+ request = DeleteServerAndStoragesRequest {
368+ UUID : "baz" ,
369+ Backups : DeleteStorageBackupsModeKeepLatest ,
370+ }
371+
372+ assert .Equal (t , "/server/baz/?storages=1&backups=keep_latest" , request .RequestURL ())
373+
374+ request = DeleteServerAndStoragesRequest {
375+ UUID : "fizz" ,
376+ Backups : DeleteStorageBackupsModeKeep ,
377+ }
378+
379+ assert .Equal (t , "/server/fizz/?storages=1&backups=keep" , request .RequestURL ())
359380}
360381
361382// TestTagServerRequest tests that TestTagServer behaves correctly
You can’t perform that action at this time.
0 commit comments