Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ListShovelStatus #178

Merged
merged 3 commits into from
Mar 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions shovels_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package rabbithole

import (
"net/url"
)

// ShovelStatus contains the status of a shovel
type ShovelStatus struct {
// Shovel name
Name string `json:"name"`
// Virtual host this shovel belongs to
Vhost string `json:"vhost"`
// Type of this shovel
Type string `json:"type"`
// State of this shovel
State string `json:"state"`
// Timestamp of this shovel
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This timestamp is of the time when the Shovel was started. We should either clarify this or remove this comment altogether.

Timestamp string `json:"timestamp"`
}

//
// GET /api/shovels/{vhost}
//

// ListShovelStatus returns status of all shovels in a vhost
func (c *Client) ListShovelStatus(vhost string) (rec []ShovelStatus, err error) {
req, err := newGETRequest(c, "shovels/"+url.PathEscape(vhost))
if err != nil {
return []ShovelStatus{}, err
}

if err = executeAndParseRequest(c, req, &rec); err != nil {
return []ShovelStatus{}, err
}

return rec, nil
}