consul/agent/connect_ca_endpoint.go

29 lines
654 B
Go
Raw Normal View History

2018-03-17 04:39:26 +00:00
package agent
import (
"net/http"
"github.com/hashicorp/consul/agent/structs"
)
// GET /v1/connect/ca/roots
func (s *HTTPServer) ConnectCARoots(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
// Test the method
if req.Method != "GET" {
return nil, MethodNotAllowedError{req.Method, []string{"GET"}}
}
var args structs.DCSpecificRequest
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
return nil, nil
}
var reply structs.IndexedCARoots
defer setMeta(resp, &reply.QueryMeta)
if err := s.agent.RPC("ConnectCA.Roots", &args, &reply); err != nil {
return nil, err
}
2018-03-19 05:07:52 +00:00
return reply, nil
2018-03-17 04:39:26 +00:00
}