mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
daa8eeb9d0
This allows the host details to be refetched on the next check in, rather than waiting for the normal interval to go by. Associated UI changes are in-progress. - Migration and service methods for requesting refetch. - Expose refetch over API. - Change detail query logic to respect this flag.
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
)
|
|
|
|
func decodeGetHostRequest(ctx context.Context, r *http.Request) (interface{}, error) {
|
|
id, err := idFromRequest(r, "id")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return getHostRequest{ID: id}, nil
|
|
}
|
|
|
|
func decodeHostByIdentifierRequest(ctx context.Context, r *http.Request) (interface{}, error) {
|
|
identifier, err := nameFromRequest(r, "identifier")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return hostByIdentifierRequest{Identifier: identifier}, nil
|
|
}
|
|
|
|
func decodeDeleteHostRequest(ctx context.Context, r *http.Request) (interface{}, error) {
|
|
id, err := idFromRequest(r, "id")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return deleteHostRequest{ID: id}, nil
|
|
}
|
|
|
|
func decodeRefetchHostRequest(ctx context.Context, r *http.Request) (interface{}, error) {
|
|
id, err := idFromRequest(r, "id")
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return refetchHostRequest{ID: id}, nil
|
|
}
|
|
|
|
func decodeListHostsRequest(ctx context.Context, r *http.Request) (interface{}, error) {
|
|
hopt, err := hostListOptionsFromRequest(r)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return listHostsRequest{ListOptions: hopt}, nil
|
|
}
|