-
Notifications
You must be signed in to change notification settings - Fork 115
/
remove_persistent_disk.go
51 lines (39 loc) · 1.22 KB
/
remove_persistent_disk.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package action
import (
"errors"
boshsettings "github.com/cloudfoundry/bosh-agent/settings"
bosherr "github.com/cloudfoundry/bosh-utils/errors"
)
type RemovePersistentDiskAction struct {
settingsService boshsettings.Service
}
func NewRemovePersistentDiskAction(settingsService boshsettings.Service) RemovePersistentDiskAction {
return RemovePersistentDiskAction{
settingsService: settingsService,
}
}
func (a RemovePersistentDiskAction) Run(diskCID string) (interface{}, error) {
err := a.settingsService.LoadSettings()
if err != nil {
return nil, bosherr.WrapError(err, "Refreshing the settings")
}
if err := a.settingsService.RemovePersistentDiskSettings(diskCID); err != nil {
return "", bosherr.WrapError(err, "Removing persistent disk hints")
}
return map[string]string{}, nil
}
func (a RemovePersistentDiskAction) IsAsynchronous(_ ProtocolVersion) bool {
return true
}
func (a RemovePersistentDiskAction) IsPersistent() bool {
return false
}
func (a RemovePersistentDiskAction) IsLoggable() bool {
return true
}
func (a RemovePersistentDiskAction) Resume() (interface{}, error) {
return nil, errors.New("not supported")
}
func (a RemovePersistentDiskAction) Cancel() error {
return errors.New("not supported")
}