agent: get rid of method checks since they're done in the http layer
This commit is contained in:
parent
3efe3f8aff
commit
68fa4a83b1
|
@ -852,11 +852,6 @@ func (s *HTTPServer) AgentConnectCARoots(resp http.ResponseWriter, req *http.Req
|
||||||
// AgentConnectCALeafCert returns the certificate bundle for a service
|
// AgentConnectCALeafCert returns the certificate bundle for a service
|
||||||
// instance. This supports blocking queries to update the returned bundle.
|
// instance. This supports blocking queries to update the returned bundle.
|
||||||
func (s *HTTPServer) AgentConnectCALeafCert(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
func (s *HTTPServer) AgentConnectCALeafCert(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
||||||
// Test the method
|
|
||||||
if req.Method != "GET" {
|
|
||||||
return nil, MethodNotAllowedError{req.Method, []string{"GET"}}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the service ID. Note that this is the ID of a service instance.
|
// Get the service ID. Note that this is the ID of a service instance.
|
||||||
id := strings.TrimPrefix(req.URL.Path, "/v1/agent/connect/ca/leaf/")
|
id := strings.TrimPrefix(req.URL.Path, "/v1/agent/connect/ca/leaf/")
|
||||||
|
|
||||||
|
@ -890,11 +885,6 @@ func (s *HTTPServer) AgentConnectCALeafCert(resp http.ResponseWriter, req *http.
|
||||||
//
|
//
|
||||||
// POST /v1/agent/connect/authorize
|
// POST /v1/agent/connect/authorize
|
||||||
func (s *HTTPServer) AgentConnectAuthorize(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
func (s *HTTPServer) AgentConnectAuthorize(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
||||||
// Test the method
|
|
||||||
if req.Method != "POST" {
|
|
||||||
return nil, MethodNotAllowedError{req.Method, []string{"POST"}}
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE(mitchellh): return 200 for now. To be implemented later.
|
// NOTE(mitchellh): return 200 for now. To be implemented later.
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,6 @@ import (
|
||||||
|
|
||||||
// GET /v1/connect/ca/roots
|
// GET /v1/connect/ca/roots
|
||||||
func (s *HTTPServer) ConnectCARoots(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
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
|
var args structs.DCSpecificRequest
|
||||||
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
|
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
|
@ -152,10 +152,6 @@ func (s *HTTPServer) HealthServiceNodes(resp http.ResponseWriter, req *http.Requ
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *HTTPServer) healthServiceNodes(resp http.ResponseWriter, req *http.Request, connect bool) (interface{}, error) {
|
func (s *HTTPServer) healthServiceNodes(resp http.ResponseWriter, req *http.Request, connect bool) (interface{}, error) {
|
||||||
if req.Method != "GET" {
|
|
||||||
return nil, MethodNotAllowedError{req.Method, []string{"GET"}}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set default DC
|
// Set default DC
|
||||||
args := structs.ServiceSpecificRequest{Connect: connect}
|
args := structs.ServiceSpecificRequest{Connect: connect}
|
||||||
s.parseSource(req, &args.Source)
|
s.parseSource(req, &args.Source)
|
||||||
|
|
|
@ -65,11 +65,6 @@ func (s *HTTPServer) IntentionCreate(resp http.ResponseWriter, req *http.Request
|
||||||
|
|
||||||
// GET /v1/connect/intentions/match
|
// GET /v1/connect/intentions/match
|
||||||
func (s *HTTPServer) IntentionMatch(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
func (s *HTTPServer) IntentionMatch(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
|
||||||
// Test the method
|
|
||||||
if req.Method != "GET" {
|
|
||||||
return nil, MethodNotAllowedError{req.Method, []string{"GET"}}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prepare args
|
// Prepare args
|
||||||
args := &structs.IntentionQueryRequest{Match: &structs.IntentionQueryMatch{}}
|
args := &structs.IntentionQueryRequest{Match: &structs.IntentionQueryMatch{}}
|
||||||
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
|
if done := s.parse(resp, req, &args.Datacenter, &args.QueryOptions); done {
|
||||||
|
|
Loading…
Reference in New Issue