feat(server/services): add generic services scoped under server

pull/10616/head
Chris Goller 2018-05-16 18:04:52 -05:00 committed by Andrew Watkins
parent 179e4259c6
commit b3de8947a4
9 changed files with 469 additions and 136 deletions

View File

@ -86,6 +86,7 @@ func MarshalServer(s chronograf.Server) ([]byte, error) {
Active: s.Active,
Organization: s.Organization,
InsecureSkipVerify: s.InsecureSkipVerify,
Type: s.Type,
})
}
@ -105,6 +106,7 @@ func UnmarshalServer(data []byte, s *chronograf.Server) error {
s.Active = pb.Active
s.Organization = pb.Organization
s.InsecureSkipVerify = pb.InsecureSkipVerify
s.Type = pb.Type
return nil
}

View File

@ -734,6 +734,7 @@ type Server struct {
Active bool `protobuf:"varint,7,opt,name=Active,proto3" json:"Active,omitempty"`
Organization string `protobuf:"bytes,8,opt,name=Organization,proto3" json:"Organization,omitempty"`
InsecureSkipVerify bool `protobuf:"varint,9,opt,name=InsecureSkipVerify,proto3" json:"InsecureSkipVerify,omitempty"`
Type string `protobuf:"bytes,10,opt,name=Type,proto3" json:"Type,omitempty"`
}
func (m *Server) Reset() { *m = Server{} }
@ -804,6 +805,13 @@ func (m *Server) GetInsecureSkipVerify() bool {
return false
}
func (m *Server) GetType() string {
if m != nil {
return m.Type
}
return ""
}
type Layout struct {
ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"`
Application string `protobuf:"bytes,2,opt,name=Application,proto3" json:"Application,omitempty"`
@ -1372,110 +1380,110 @@ func init() {
func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) }
var fileDescriptorInternal = []byte{
// 1667 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x5b, 0x6f, 0xe4, 0x48,
0x15, 0x96, 0xbb, 0xed, 0x4e, 0xfb, 0x74, 0x92, 0x8d, 0x8a, 0xd1, 0xae, 0x59, 0x10, 0x6a, 0x2c,
0x2e, 0xe1, 0xb2, 0xc3, 0x2a, 0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0x4c, 0x94, 0x12, 0x07, 0xbd, 0x79, 0x5d,
0x30, 0x71, 0x92, 0x6c, 0xb8, 0x99, 0x90, 0x2c, 0x49, 0xf4, 0x85, 0xfa, 0xb6, 0xda, 0x62, 0x39,
0x67, 0xf7, 0x77, 0xd8, 0xfd, 0x93, 0x47, 0x7f, 0x75, 0x60, 0xfc, 0x5c, 0x4f, 0x64, 0xf6, 0x2d,
0x9c, 0x37, 0xde, 0x62, 0xd0, 0xbb, 0xc5, 0x31, 0x3c, 0x30, 0x36, 0xbd, 0xfd, 0x55, 0x14, 0x76,
0xea, 0x74, 0x44, 0xdd, 0x36, 0x59, 0xef, 0xf2, 0x69, 0x75, 0xd5, 0xb7, 0xd9, 0x95, 0xf0, 0xad,
0xac, 0xcc, 0x60, 0x6a, 0x3e, 0x29, 0xf3, 0xd4, 0x3c, 0x3a, 0xb6, 0x28, 0x3a, 0x86, 0xd1, 0x59,
0x9e, 0x2d, 0xf9, 0x2a, 0x38, 0x02, 0xf7, 0xa4, 0xae, 0xd6, 0xd2, 0xe3, 0xf4, 0xf8, 0x81, 0xd5,
0xf8, 0x75, 0xb5, 0x56, 0x36, 0x44, 0x5a, 0x44, 0x9f, 0x01, 0x74, 0x32, 0x7c, 0x39, 0xba, 0x6c,
0xbc, 0x60, 0xb7, 0x58, 0x32, 0xa5, 0x1e, 0xc8, 0x77, 0x68, 0xa2, 0xcf, 0xc1, 0x3f, 0xad, 0x79,
0x9a, 0x5c, 0x64, 0xcb, 0x1c, 0xa9, 0xe3, 0x35, 0x13, 0x65, 0x97, 0x2f, 0x03, 0x31, 0xdc, 0xc8,
0x22, 0x6d, 0x0f, 0x69, 0xb4, 0x18, 0xc9, 0x3f, 0x2c, 0x3e, 0xf9, 0x6f, 0x00, 0x00, 0x00, 0xff,
0xff, 0x59, 0xb8, 0x9d, 0x3e, 0xc2, 0x10, 0x00, 0x00,
}

View File

@ -112,15 +112,16 @@ message TemplateQuery {
}
message Server {
int64 ID = 1; // ID is the unique ID of the server
string Name = 2; // Name is the user-defined name for the server
string Username = 3; // Username is the username to connect to the server
int64 ID = 1; // ID is the unique ID of the server
string Name = 2; // Name is the user-defined name for the server
string Username = 3; // Username is the username to connect to the server
string Password = 4;
string URL = 5; // URL is the path to the server
int64 SrcID = 6; // SrcID is the ID of the data source
bool Active = 7; // is this the currently active server for the source
string Organization = 8; // Organization is the organization ID that resource belongs to
bool InsecureSkipVerify = 9; // InsecureSkipVerify accepts any certificate from the client
string URL = 5; // URL is the path to the server
int64 SrcID = 6; // SrcID is the ID of the data source
bool Active = 7; // is this the currently active server for the source
string Organization = 8; // Organization is the organization ID that resource belongs to
bool InsecureSkipVerify = 9; // InsecureSkipVerify accepts any certificate from the client
string Type = 10; // Type is the kind of the server (e.g. ifql)
}
message Layout {

View File

@ -368,6 +368,7 @@ type Server struct {
InsecureSkipVerify bool `json:"insecureSkipVerify"` // InsecureSkipVerify as true means any certificate presented by the server is accepted.
Active bool `json:"active"` // Is this the active server for the source?
Organization string `json:"organization"` // Organization is the organization ID that resource belongs to
Type string `json:"type"` // Type is the kind of service (e.g. kapacitor or ifql)
}
// ServersStore stores connection information for a `Server`

View File

@ -154,7 +154,7 @@ func (s *Service) Kapacitors(w http.ResponseWriter, r *http.Request) {
srvs := []kapacitor{}
for _, srv := range mrSrvs {
if srv.SrcID == srcID {
if srv.SrcID == srcID && srv.Type == "" {
srvs = append(srvs, newKapacitor(srv))
}
}
@ -182,7 +182,7 @@ func (s *Service) KapacitorsID(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
srv, err := s.Store.Servers(ctx).Get(ctx, id)
if err != nil || srv.SrcID != srcID {
if err != nil || srv.SrcID != srcID || srv.Type != "" {
notFound(w, id, s.Logger)
return
}
@ -207,7 +207,7 @@ func (s *Service) RemoveKapacitor(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
srv, err := s.Store.Servers(ctx).Get(ctx, id)
if err != nil || srv.SrcID != srcID {
if err != nil || srv.SrcID != srcID || srv.Type != "" {
notFound(w, id, s.Logger)
return
}
@ -258,7 +258,7 @@ func (s *Service) UpdateKapacitor(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
srv, err := s.Store.Servers(ctx).Get(ctx, id)
if err != nil || srv.SrcID != srcID {
if err != nil || srv.SrcID != srcID || srv.Type != "" {
notFound(w, id, s.Logger)
return
}

View File

@ -203,6 +203,19 @@ func NewMux(opts MuxOpts, service Service) http.Handler {
router.DELETE("/chronograf/v1/sources/:id/roles/:rid", EnsureEditor(service.RemoveSourceRole))
router.PATCH("/chronograf/v1/sources/:id/roles/:rid", EnsureEditor(service.UpdateSourceRole))
// Services are resources that chronograf proxies to
router.GET("/chronograf/v1/sources/:id/services", EnsureViewer(service.Services))
router.POST("/chronograf/v1/sources/:id/services", EnsureEditor(service.NewService))
router.GET("/chronograf/v1/sources/:id/services/:kid", EnsureViewer(service.ServiceID))
router.PATCH("/chronograf/v1/sources/:id/services/:kid", EnsureEditor(service.UpdateService))
router.DELETE("/chronograf/v1/sources/:id/services/:kid", EnsureEditor(service.RemoveService))
// Service Proxy
router.GET("/chronograf/v1/sources/:id/services/:kid/proxy", EnsureViewer(service.ProxyGet))
router.POST("/chronograf/v1/sources/:id/services/:kid/proxy", EnsureEditor(service.ProxyPost))
router.PATCH("/chronograf/v1/sources/:id/services/:kid/proxy", EnsureEditor(service.ProxyPatch))
router.DELETE("/chronograf/v1/sources/:id/services/:kid/proxy", EnsureEditor(service.ProxyDelete))
// Kapacitor
router.GET("/chronograf/v1/sources/:id/kapacitors", EnsureViewer(service.Kapacitors))
router.POST("/chronograf/v1/sources/:id/kapacitors", EnsureEditor(service.NewKapacitor))
@ -221,10 +234,10 @@ func NewMux(opts MuxOpts, service Service) http.Handler {
router.DELETE("/chronograf/v1/sources/:id/kapacitors/:kid/rules/:tid", EnsureEditor(service.KapacitorRulesDelete))
// Kapacitor Proxy
router.GET("/chronograf/v1/sources/:id/kapacitors/:kid/proxy", EnsureViewer(service.KapacitorProxyGet))
router.POST("/chronograf/v1/sources/:id/kapacitors/:kid/proxy", EnsureEditor(service.KapacitorProxyPost))
router.PATCH("/chronograf/v1/sources/:id/kapacitors/:kid/proxy", EnsureEditor(service.KapacitorProxyPatch))
router.DELETE("/chronograf/v1/sources/:id/kapacitors/:kid/proxy", EnsureEditor(service.KapacitorProxyDelete))
router.GET("/chronograf/v1/sources/:id/kapacitors/:kid/proxy", EnsureViewer(service.ProxyGet))
router.POST("/chronograf/v1/sources/:id/kapacitors/:kid/proxy", EnsureEditor(service.ProxyPost))
router.PATCH("/chronograf/v1/sources/:id/kapacitors/:kid/proxy", EnsureEditor(service.ProxyPatch))
router.DELETE("/chronograf/v1/sources/:id/kapacitors/:kid/proxy", EnsureEditor(service.ProxyDelete))
// Layouts
router.GET("/chronograf/v1/layouts", EnsureViewer(service.Layouts))

View File

@ -11,8 +11,8 @@ import (
"time"
)
// KapacitorProxy proxies requests to kapacitor using the path query parameter.
func (s *Service) KapacitorProxy(w http.ResponseWriter, r *http.Request) {
// Proxy proxies requests to services using the path query parameter.
func (s *Service) Proxy(w http.ResponseWriter, r *http.Request) {
srcID, err := paramID("id", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
@ -88,24 +88,24 @@ func (s *Service) KapacitorProxy(w http.ResponseWriter, r *http.Request) {
proxy.ServeHTTP(w, r)
}
// KapacitorProxyPost proxies POST to kapacitor
func (s *Service) KapacitorProxyPost(w http.ResponseWriter, r *http.Request) {
s.KapacitorProxy(w, r)
// ProxyPost proxies POST to service
func (s *Service) ProxyPost(w http.ResponseWriter, r *http.Request) {
s.Proxy(w, r)
}
// KapacitorProxyPatch proxies PATCH to kapacitor
func (s *Service) KapacitorProxyPatch(w http.ResponseWriter, r *http.Request) {
s.KapacitorProxy(w, r)
// ProxyPatch proxies PATCH to Service
func (s *Service) ProxyPatch(w http.ResponseWriter, r *http.Request) {
s.Proxy(w, r)
}
// KapacitorProxyGet proxies GET to kapacitor
func (s *Service) KapacitorProxyGet(w http.ResponseWriter, r *http.Request) {
s.KapacitorProxy(w, r)
// ProxyGet proxies GET to service
func (s *Service) ProxyGet(w http.ResponseWriter, r *http.Request) {
s.Proxy(w, r)
}
// KapacitorProxyDelete proxies DELETE to kapacitor
func (s *Service) KapacitorProxyDelete(w http.ResponseWriter, r *http.Request) {
s.KapacitorProxy(w, r)
// ProxyDelete proxies DELETE to service
func (s *Service) ProxyDelete(w http.ResponseWriter, r *http.Request) {
s.Proxy(w, r)
}
func singleJoiningSlash(a, b string) string {

306
server/services.go Normal file
View File

@ -0,0 +1,306 @@
package server
import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"github.com/influxdata/chronograf"
)
type postServiceRequest struct {
Name *string `json:"name"` // User facing name of service instance.; Required: true
URL *string `json:"url"` // URL for the service backend (e.g. http://localhost:9092);/ Required: true
Type *string `json:"type"` // Type is the kind of service (e.g. ifql); Required
Username string `json:"username,omitempty"` // Username for authentication to service
Password string `json:"password,omitempty"`
InsecureSkipVerify bool `json:"insecureSkipVerify"` // InsecureSkipVerify as true means any certificate presented by the service is accepted.
Organization string `json:"organization"` // Organization is the organization ID that resource belongs to
}
func (p *postServiceRequest) Valid(defaultOrgID string) error {
if p.Name == nil || p.URL == nil {
return fmt.Errorf("name and url required")
}
if p.Type == nil {
return fmt.Errorf("type required")
}
if p.Organization == "" {
p.Organization = defaultOrgID
}
url, err := url.ParseRequestURI(*p.URL)
if err != nil {
return fmt.Errorf("invalid source URI: %v", err)
}
if len(url.Scheme) == 0 {
return fmt.Errorf("Invalid URL; no URL scheme defined")
}
return nil
}
type serviceLinks struct {
Proxy string `json:"proxy"` // URL location of proxy endpoint for this source
Self string `json:"self"` // Self link mapping to this resource
}
type service struct {
ID int `json:"id,string"` // Unique identifier representing a service instance.
Name string `json:"name"` // User facing name of service instance.
URL string `json:"url"` // URL for the service backend (e.g. http://localhost:9092)
Username string `json:"username,omitempty"` // Username for authentication to service
Password string `json:"password,omitempty"`
InsecureSkipVerify bool `json:"insecureSkipVerify"` // InsecureSkipVerify as true means any certificate presented by the service is accepted.
Type string `json:"type"` // Type is the kind of service (e.g. ifql)
Links serviceLinks `json:"links"` // Links are URI locations related to service
}
// NewService adds valid service store store.
func (s *Service) NewService(w http.ResponseWriter, r *http.Request) {
srcID, err := paramID("id", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
ctx := r.Context()
_, err = s.Store.Sources(ctx).Get(ctx, srcID)
if err != nil {
notFound(w, srcID, s.Logger)
return
}
var req postServiceRequest
if err = json.NewDecoder(r.Body).Decode(&req); err != nil {
invalidJSON(w, s.Logger)
return
}
defaultOrg, err := s.Store.Organizations(ctx).DefaultOrganization(ctx)
if err != nil {
unknownErrorWithMessage(w, err, s.Logger)
return
}
if err := req.Valid(defaultOrg.ID); err != nil {
invalidData(w, err, s.Logger)
return
}
srv := chronograf.Server{
SrcID: srcID,
Name: *req.Name,
Username: req.Username,
Password: req.Password,
InsecureSkipVerify: req.InsecureSkipVerify,
URL: *req.URL,
Organization: req.Organization,
Type: *req.Type,
}
if srv, err = s.Store.Servers(ctx).Add(ctx, srv); err != nil {
msg := fmt.Errorf("Error storing service %v: %v", req, err)
unknownErrorWithMessage(w, msg, s.Logger)
return
}
res := newService(srv)
location(w, res.Links.Self)
encodeJSON(w, http.StatusCreated, res, s.Logger)
}
func newService(srv chronograf.Server) service {
httpAPISrcs := "/chronograf/v1/sources"
return service{
ID: srv.ID,
Name: srv.Name,
Username: srv.Username,
URL: srv.URL,
InsecureSkipVerify: srv.InsecureSkipVerify,
Type: srv.Type,
Links: serviceLinks{
Self: fmt.Sprintf("%s/%d/services/%d", httpAPISrcs, srv.SrcID, srv.ID),
Proxy: fmt.Sprintf("%s/%d/services/%d/proxy", httpAPISrcs, srv.SrcID, srv.ID),
},
}
}
type services struct {
Services []service `json:"services"`
}
// Services retrieves all services from store.
func (s *Service) Services(w http.ResponseWriter, r *http.Request) {
srcID, err := paramID("id", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
ctx := r.Context()
mrSrvs, err := s.Store.Servers(ctx).All(ctx)
if err != nil {
Error(w, http.StatusInternalServerError, "Error loading services", s.Logger)
return
}
srvs := []service{}
for _, srv := range mrSrvs {
if srv.SrcID == srcID && srv.Type != "" {
srvs = append(srvs, newService(srv))
}
}
res := services{
Services: srvs,
}
encodeJSON(w, http.StatusOK, res, s.Logger)
}
// ServiceID retrieves a service with ID from store.
func (s *Service) ServiceID(w http.ResponseWriter, r *http.Request) {
id, err := paramID("kid", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
srcID, err := paramID("id", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
ctx := r.Context()
srv, err := s.Store.Servers(ctx).Get(ctx, id)
if err != nil || srv.SrcID != srcID || srv.Type == "" {
notFound(w, id, s.Logger)
return
}
res := newService(srv)
encodeJSON(w, http.StatusOK, res, s.Logger)
}
// RemoveService deletes service from store.
func (s *Service) RemoveService(w http.ResponseWriter, r *http.Request) {
id, err := paramID("kid", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
srcID, err := paramID("id", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
ctx := r.Context()
srv, err := s.Store.Servers(ctx).Get(ctx, id)
if err != nil || srv.SrcID != srcID || srv.Type == "" {
notFound(w, id, s.Logger)
return
}
if err = s.Store.Servers(ctx).Delete(ctx, srv); err != nil {
unknownErrorWithMessage(w, err, s.Logger)
return
}
w.WriteHeader(http.StatusNoContent)
}
type patchServiceRequest struct {
Name *string `json:"name,omitempty"` // User facing name of service instance.
Type *string `json:"type,omitempty"` // Type is the kind of service (e.g. ifql)
URL *string `json:"url,omitempty"` // URL for the service
Username *string `json:"username,omitempty"` // Username for service auth
Password *string `json:"password,omitempty"`
InsecureSkipVerify *bool `json:"insecureSkipVerify"` // InsecureSkipVerify as true means any certificate presented by the service is accepted.
}
func (p *patchServiceRequest) Valid() error {
if p.URL != nil {
url, err := url.ParseRequestURI(*p.URL)
if err != nil {
return fmt.Errorf("invalid source URI: %v", err)
}
if len(url.Scheme) == 0 {
return fmt.Errorf("Invalid URL; no URL scheme defined")
}
}
if p.Type != nil && *p.Type == "" {
return fmt.Errorf("Invalid type; type must not be an empty string")
}
return nil
}
// UpdateService incrementally updates a service definition in the store
func (s *Service) UpdateService(w http.ResponseWriter, r *http.Request) {
id, err := paramID("kid", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
srcID, err := paramID("id", r)
if err != nil {
Error(w, http.StatusUnprocessableEntity, err.Error(), s.Logger)
return
}
ctx := r.Context()
srv, err := s.Store.Servers(ctx).Get(ctx, id)
if err != nil || srv.SrcID != srcID || srv.Type == "" {
notFound(w, id, s.Logger)
return
}
var req patchServiceRequest
if err := json.NewDecoder(r.Body).Decode(&req); err != nil {
invalidJSON(w, s.Logger)
return
}
if err := req.Valid(); err != nil {
invalidData(w, err, s.Logger)
return
}
if req.Name != nil {
srv.Name = *req.Name
}
if req.Type != nil {
srv.Type = *req.Type
}
if req.URL != nil {
srv.URL = *req.URL
}
if req.Password != nil {
srv.Password = *req.Password
}
if req.Username != nil {
srv.Username = *req.Username
}
if req.InsecureSkipVerify != nil {
srv.InsecureSkipVerify = *req.InsecureSkipVerify
}
if err := s.Store.Servers(ctx).Update(ctx, srv); err != nil {
msg := fmt.Sprintf("Error updating service ID %d", id)
Error(w, http.StatusInternalServerError, msg, s.Logger)
return
}
res := newService(srv)
encodeJSON(w, http.StatusOK, res, s.Logger)
}

View File

@ -17,6 +17,7 @@ import (
type sourceLinks struct {
Self string `json:"self"` // Self link mapping to this resource
Kapacitors string `json:"kapacitors"` // URL for kapacitors endpoint
Services string `json:"services"` // URL for services endpoint
Proxy string `json:"proxy"` // URL for proxy endpoint
Queries string `json:"queries"` // URL for the queries analysis endpoint
Write string `json:"write"` // URL for the write line-protocol endpoint
@ -49,6 +50,7 @@ func newSourceResponse(src chronograf.Source) sourceResponse {
Links: sourceLinks{
Self: fmt.Sprintf("%s/%d", httpAPISrcs, src.ID),
Kapacitors: fmt.Sprintf("%s/%d/kapacitors", httpAPISrcs, src.ID),
Services: fmt.Sprintf("%s/%d/services", httpAPISrcs, src.ID),
Proxy: fmt.Sprintf("%s/%d/proxy", httpAPISrcs, src.ID),
Queries: fmt.Sprintf("%s/%d/queries", httpAPISrcs, src.ID),
Write: fmt.Sprintf("%s/%d/write", httpAPISrcs, src.ID),