github.com/djenriquez/nomad-1@v0.8.1/command/agent/system_endpoint.go (about)

     1  package agent
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/hashicorp/nomad/nomad/structs"
     7  )
     8  
     9  func (s *HTTPServer) GarbageCollectRequest(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
    10  	if req.Method != "PUT" {
    11  		return nil, CodedError(405, ErrInvalidMethod)
    12  	}
    13  
    14  	var args structs.GenericRequest
    15  	if s.parse(resp, req, &args.Region, &args.QueryOptions) {
    16  		return nil, nil
    17  	}
    18  
    19  	var gResp structs.GenericResponse
    20  	if err := s.agent.RPC("System.GarbageCollect", &args, &gResp); err != nil {
    21  		return nil, err
    22  	}
    23  	return nil, nil
    24  }
    25  
    26  func (s *HTTPServer) ReconcileJobSummaries(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
    27  	if req.Method != "PUT" {
    28  		return nil, CodedError(405, ErrInvalidMethod)
    29  	}
    30  
    31  	var args structs.GenericRequest
    32  	if s.parse(resp, req, &args.Region, &args.QueryOptions) {
    33  		return nil, nil
    34  	}
    35  
    36  	var gResp structs.GenericResponse
    37  	if err := s.agent.RPC("System.ReconcileJobSummaries", &args, &gResp); err != nil {
    38  		return nil, err
    39  	}
    40  	return nil, nil
    41  }