Skip to content

Commit

Permalink
Add running services (#162)
Browse files Browse the repository at this point in the history
* Add running services

* Add Exit call
  • Loading branch information
cmmarslender authored Sep 24, 2024
1 parent 11e544b commit b106592
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions pkg/rpc/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,52 @@ func (s *DaemonService) IsRunning(opts *IsRunningOptions) (*IsRunningResponse, *
return r, resp, nil
}

// RunningServicesResponse is service running response
type RunningServicesResponse struct {
Response
RunningServices []ServiceFullName `json:"running_services"`
}

// RunningServices returns all running services
func (s *DaemonService) RunningServices() (*RunningServicesResponse, *http.Response, error) {
request, err := s.NewRequest("running_services", nil)
if err != nil {
return nil, nil, err
}

r := &RunningServicesResponse{}

resp, err := s.Do(request, r)
if err != nil {
return nil, resp, err
}

return r, resp, nil
}

// ExitResponse shows information about the services that were stopped
type ExitResponse struct {
Response
ServicesStopped []ServiceFullName `json:"services_stopped"`
}

// Exit tells the daemon to exit
func (s *DaemonService) Exit() (*ExitResponse, *http.Response, error) {
request, err := s.NewRequest("exit", nil)
if err != nil {
return nil, nil, err
}

r := &ExitResponse{}

resp, err := s.Do(request, r)
if err != nil {
return nil, resp, err
}

return r, resp, nil
}

// DaemonDeleteAllKeysOpts options for delete all keys request
type DaemonDeleteAllKeysOpts struct{}

Expand Down

0 comments on commit b106592

Please sign in to comment.