Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #365 from nuclearbob/device-rescue
Browse files Browse the repository at this point in the history
Add Rescue function to device
  • Loading branch information
displague authored May 15, 2023
2 parents f12198a + 69e5d8a commit b45284c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type DeviceService interface {
Reinstall(string, *DeviceReinstallFields) (*Response, error)
PowerOff(string) (*Response, error)
PowerOn(string) (*Response, error)
Rescue(string) (*Response, error)
Lock(string) (*Response, error)
Unlock(string) (*Response, error)
ListBGPSessions(deviceID string, opts *ListOptions) ([]BGPSession, *Response, error)
Expand Down Expand Up @@ -443,9 +444,9 @@ type DeviceDeleteRequest struct {
Force bool `json:"force_delete"`
}
type DeviceReinstallFields struct {
OperatingSystem string `json:"operating_system,omitempty"`
PreserveData bool `json:"preserve_data,omitempty"`
DeprovisionFast bool `json:"deprovision_fast,omitempty"`
OperatingSystem string `json:"operating_system,omitempty"`
PreserveData bool `json:"preserve_data,omitempty"`
DeprovisionFast bool `json:"deprovision_fast,omitempty"`
}

type DeviceReinstallRequest struct {
Expand Down Expand Up @@ -600,6 +601,17 @@ func (s *DeviceServiceOp) PowerOn(deviceID string) (*Response, error) {
return s.client.DoRequest("POST", apiPath, action, nil)
}

// Rescue boots a device into Rescue OS
func (s *DeviceServiceOp) Rescue(deviceID string) (*Response, error) {
if validateErr := ValidateUUID(deviceID); validateErr != nil {
return nil, validateErr
}
apiPath := path.Join(deviceBasePath, deviceID, "actions")
action := &DeviceActionRequest{Type: "rescue"}

return s.client.DoRequest("POST", apiPath, action, nil)
}

type lockType struct {
Locked bool `json:"locked"`
}
Expand Down

0 comments on commit b45284c

Please sign in to comment.