Update name to chronograf
parent
c6985f6aa3
commit
8911b0fd78
canned
cmd/chronograf-server
docs
influx
kapacitor
layouts
log
restapi
operations
|
@ -2,7 +2,7 @@ dist/dist_gen.go
|
|||
canned/apps_gen.go
|
||||
.pull-request
|
||||
node_modules
|
||||
mrfusion
|
||||
chronograf
|
||||
node_modules/
|
||||
build/
|
||||
chronograf.db
|
||||
|
|
|
@ -4,7 +4,7 @@ MAINTAINER Chris Goller <chris@influxdb.com>
|
|||
RUN apk add --update ca-certificates && \
|
||||
rm /var/cache/apk/*
|
||||
|
||||
ADD mrfusion /mrfusion
|
||||
ADD chronograf /chronograf
|
||||
ADD canned/*.json /canned/
|
||||
|
||||
CMD ["/mrfusion"]
|
||||
CMD ["/chronograf"]
|
||||
|
|
14
Makefile
14
Makefile
|
@ -6,7 +6,7 @@ BUILD_TIME ?= $$(date +%FT%T%z)
|
|||
SOURCES := $(shell find . -name '*.go')
|
||||
|
||||
LDFLAGS=-ldflags "-s -X main.Version=${VERSION} -X main.Commit=${COMMIT} -X main.BuildTime=${BUILD_TIME} -X main.Branch=${BRANCH}"
|
||||
BINARY=mrfusion
|
||||
BINARY=chronograf
|
||||
|
||||
default: dep build
|
||||
|
||||
|
@ -15,14 +15,14 @@ build: assets ${BINARY}
|
|||
dev: dev-assets ${BINARY}
|
||||
|
||||
${BINARY}: $(SOURCES)
|
||||
go build -o ${BINARY} ${LDFLAGS} ./cmd/mr-fusion-server/main.go
|
||||
go build -o ${BINARY} ${LDFLAGS} ./cmd/chronograf-server/main.go
|
||||
|
||||
docker-${BINARY}: $(SOURCES)
|
||||
CGO_ENABLED=0 GOOS=linux go build -installsuffix cgo -o ${BINARY} ${LDFLAGS} \
|
||||
./cmd/mr-fusion-server/main.go
|
||||
./cmd/chronograf-server/main.go
|
||||
|
||||
docker: dep assets docker-${BINARY}
|
||||
docker build -t mrfusion .
|
||||
docker build -t chronograf .
|
||||
|
||||
assets: js bindata
|
||||
|
||||
|
@ -51,7 +51,7 @@ jsdep:
|
|||
cd ui && npm install
|
||||
|
||||
gen: bolt/internal/internal.proto
|
||||
go generate github.com/influxdata/mrfusion/bolt/internal
|
||||
go generate github.com/influxdata/chronograf/bolt/internal
|
||||
|
||||
test: jstest gotest gotestrace
|
||||
|
||||
|
@ -65,10 +65,10 @@ jstest:
|
|||
cd ui && npm test
|
||||
|
||||
run: ${BINARY}
|
||||
./mrfusion --port 8888
|
||||
./chronograf --port 8888
|
||||
|
||||
run-dev: ${BINARY}
|
||||
./mrfusion -d --port 8888
|
||||
./chronograf -d --port 8888
|
||||
|
||||
swagger: swagger.yaml
|
||||
swagger generate server -f swagger.yaml --with-context
|
||||
|
|
10
README.md
10
README.md
|
@ -1,10 +1,10 @@
|
|||
# mrfusion
|
||||
# chronograf
|
||||
|
||||
## Builds
|
||||
|
||||
* To build assets and the go server, run `make`.
|
||||
* To run server either `./mrfusion --port 8888` or `make run`
|
||||
* If you add files to the javascript build and you don't want to rebuild everything, run `make bindata && make mrfusion`
|
||||
* To run server either `./chronograf --port 8888` or `make run`
|
||||
* If you add files to the javascript build and you don't want to rebuild everything, run `make bindata && make chronograf`
|
||||
|
||||
## Deployment (for now)
|
||||
Includes a Dockerfile that builds a container suitable for Heroku.
|
||||
|
@ -15,9 +15,9 @@ In order to push to heroku, make sure you've logged into Heroku normally with...
|
|||
|
||||
Add the acceptance server git remote...
|
||||
|
||||
`git remote add acceptance https://git.heroku.com/mrfusion-acc.git`
|
||||
`git remote add acceptance https://git.heroku.com/chronograf-acc.git`
|
||||
|
||||
When you run `heroku apps` you should see "mrfusion-acc".
|
||||
When you run `heroku apps` you should see "chronograf-acc".
|
||||
|
||||
Then install the container plugin
|
||||
`heroku plugins:install heroku-container-registry`
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/uuid"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/uuid"
|
||||
)
|
||||
|
||||
// Client is a client for the boltDB data store.
|
||||
|
@ -13,7 +13,7 @@ type Client struct {
|
|||
Path string
|
||||
db *bolt.DB
|
||||
Now func() time.Time
|
||||
LayoutIDs mrfusion.ID
|
||||
LayoutIDs chronograf.ID
|
||||
|
||||
ExplorationStore *ExplorationStore
|
||||
SourcesStore *SourcesStore
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/mrfusion/bolt"
|
||||
"github.com/influxdata/chronograf/bolt"
|
||||
)
|
||||
|
||||
// TestNow is a set time for testing.
|
||||
|
@ -19,7 +19,7 @@ type TestClient struct {
|
|||
|
||||
// NewTestClient creates new *bolt.Client with a set time and temp path.
|
||||
func NewTestClient() (*TestClient, error) {
|
||||
f, err := ioutil.TempFile("", "mrfusion-bolt-")
|
||||
f, err := ioutil.TempFile("", "chronograf-bolt-")
|
||||
if err != nil {
|
||||
return nil, errors.New("unable to open temporary boltdb file")
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@ package bolt
|
|||
|
||||
import (
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/bolt/internal"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/bolt/internal"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Ensure ExplorationStore implements mrfusion.ExplorationStore.
|
||||
var _ mrfusion.ExplorationStore = &ExplorationStore{}
|
||||
// Ensure ExplorationStore implements chronograf.ExplorationStore.
|
||||
var _ chronograf.ExplorationStore = &ExplorationStore{}
|
||||
|
||||
var ExplorationBucket = []byte("Explorations")
|
||||
|
||||
|
@ -17,11 +17,11 @@ type ExplorationStore struct {
|
|||
}
|
||||
|
||||
// Search the ExplorationStore for all explorations owned by userID.
|
||||
func (s *ExplorationStore) Query(ctx context.Context, uid mrfusion.UserID) ([]*mrfusion.Exploration, error) {
|
||||
var explorations []*mrfusion.Exploration
|
||||
func (s *ExplorationStore) Query(ctx context.Context, uid chronograf.UserID) ([]*chronograf.Exploration, error) {
|
||||
var explorations []*chronograf.Exploration
|
||||
if err := s.client.db.View(func(tx *bolt.Tx) error {
|
||||
if err := tx.Bucket(ExplorationBucket).ForEach(func(k, v []byte) error {
|
||||
var e mrfusion.Exploration
|
||||
var e chronograf.Exploration
|
||||
if err := internal.UnmarshalExploration(v, &e); err != nil {
|
||||
return err
|
||||
} else if e.UserID != uid {
|
||||
|
@ -41,14 +41,14 @@ func (s *ExplorationStore) Query(ctx context.Context, uid mrfusion.UserID) ([]*m
|
|||
}
|
||||
|
||||
// Create a new Exploration in the ExplorationStore.
|
||||
func (s *ExplorationStore) Add(ctx context.Context, e *mrfusion.Exploration) (*mrfusion.Exploration, error) {
|
||||
func (s *ExplorationStore) Add(ctx context.Context, e *chronograf.Exploration) (*chronograf.Exploration, error) {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
b := tx.Bucket(ExplorationBucket)
|
||||
seq, err := b.NextSequence()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
e.ID = mrfusion.ExplorationID(seq)
|
||||
e.ID = chronograf.ExplorationID(seq)
|
||||
e.CreatedAt = s.client.Now()
|
||||
e.UpdatedAt = e.CreatedAt
|
||||
|
||||
|
@ -66,7 +66,7 @@ func (s *ExplorationStore) Add(ctx context.Context, e *mrfusion.Exploration) (*m
|
|||
}
|
||||
|
||||
// Delete the exploration from the ExplorationStore
|
||||
func (s *ExplorationStore) Delete(ctx context.Context, e *mrfusion.Exploration) error {
|
||||
func (s *ExplorationStore) Delete(ctx context.Context, e *chronograf.Exploration) error {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
if err := tx.Bucket(ExplorationBucket).Delete(itob(int(e.ID))); err != nil {
|
||||
return err
|
||||
|
@ -80,11 +80,11 @@ func (s *ExplorationStore) Delete(ctx context.Context, e *mrfusion.Exploration)
|
|||
}
|
||||
|
||||
// Retrieve an exploration for an id exists.
|
||||
func (s *ExplorationStore) Get(ctx context.Context, id mrfusion.ExplorationID) (*mrfusion.Exploration, error) {
|
||||
var e mrfusion.Exploration
|
||||
func (s *ExplorationStore) Get(ctx context.Context, id chronograf.ExplorationID) (*chronograf.Exploration, error) {
|
||||
var e chronograf.Exploration
|
||||
if err := s.client.db.View(func(tx *bolt.Tx) error {
|
||||
if v := tx.Bucket(ExplorationBucket).Get(itob(int(id))); v == nil {
|
||||
return mrfusion.ErrExplorationNotFound
|
||||
return chronograf.ErrExplorationNotFound
|
||||
} else if err := internal.UnmarshalExploration(v, &e); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -97,13 +97,13 @@ func (s *ExplorationStore) Get(ctx context.Context, id mrfusion.ExplorationID) (
|
|||
}
|
||||
|
||||
// Update an exploration; will also update the `UpdatedAt` time.
|
||||
func (s *ExplorationStore) Update(ctx context.Context, e *mrfusion.Exploration) error {
|
||||
func (s *ExplorationStore) Update(ctx context.Context, e *chronograf.Exploration) error {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
// Retreive an existing exploration with the same exploration ID.
|
||||
var ee mrfusion.Exploration
|
||||
var ee chronograf.Exploration
|
||||
b := tx.Bucket(ExplorationBucket)
|
||||
if v := b.Get(itob(int(e.ID))); v == nil {
|
||||
return mrfusion.ErrExplorationNotFound
|
||||
return chronograf.ErrExplorationNotFound
|
||||
} else if err := internal.UnmarshalExploration(v, &ee); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package bolt_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/chronograf"
|
||||
)
|
||||
|
||||
// Ensure an ExplorationStore can store, retrieve, update, and delete explorations.
|
||||
|
@ -18,18 +18,18 @@ func TestExplorationStore_CRUD(t *testing.T) {
|
|||
defer c.Close()
|
||||
s := c.ExplorationStore
|
||||
|
||||
explorations := []*mrfusion.Exploration{
|
||||
&mrfusion.Exploration{
|
||||
explorations := []*chronograf.Exploration{
|
||||
&chronograf.Exploration{
|
||||
Name: "Ferdinand Magellan",
|
||||
UserID: 2,
|
||||
Data: "{\"panels\":{\"123\":{\"id\":\"123\",\"queryIds\":[\"456\"]}},\"queryConfigs\":{\"456\":{\"id\":\"456\",\"database\":null,\"measurement\":null,\"retentionPolicy\":null,\"fields\":[],\"tags\":{},\"groupBy\":{\"time\":null,\"tags\":[]},\"areTagsAccepted\":true,\"rawText\":null}}}",
|
||||
},
|
||||
&mrfusion.Exploration{
|
||||
&chronograf.Exploration{
|
||||
Name: "Marco Polo",
|
||||
UserID: 3,
|
||||
Data: "{\"panels\":{\"123\":{\"id\":\"123\",\"queryIds\":[\"456\"]}},\"queryConfigs\":{\"456\":{\"id\":\"456\",\"database\":null,\"measurement\":null,\"retentionPolicy\":null,\"fields\":[],\"tags\":{},\"groupBy\":{\"time\":null,\"tags\":[]},\"areTagsAccepted\":true,\"rawText\":null}}}",
|
||||
},
|
||||
&mrfusion.Exploration{
|
||||
&chronograf.Exploration{
|
||||
Name: "Leif Ericson",
|
||||
UserID: 3,
|
||||
Data: "{\"panels\":{\"123\":{\"id\":\"123\",\"queryIds\":[\"456\"]}},\"queryConfigs\":{\"456\":{\"id\":\"456\",\"database\":null,\"measurement\":null,\"retentionPolicy\":null,\"fields\":[],\"tags\":{},\"groupBy\":{\"time\":null,\"tags\":[]},\"areTagsAccepted\":true,\"rawText\":null}}}",
|
||||
|
@ -83,8 +83,8 @@ func TestExplorationStore_CRUD(t *testing.T) {
|
|||
}
|
||||
|
||||
// Confirm exploration has been deleted.
|
||||
if e, err := s.Get(nil, explorations[2].ID); err != mrfusion.ErrExplorationNotFound {
|
||||
t.Fatalf("exploration delete error: got %v, expected %v", e, mrfusion.ErrExplorationNotFound)
|
||||
if e, err := s.Get(nil, explorations[2].ID); err != chronograf.ErrExplorationNotFound {
|
||||
t.Fatalf("exploration delete error: got %v, expected %v", e, chronograf.ErrExplorationNotFound)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,18 +100,18 @@ func TestExplorationStore_Query(t *testing.T) {
|
|||
defer c.Close()
|
||||
s := c.ExplorationStore
|
||||
|
||||
explorations := []*mrfusion.Exploration{
|
||||
&mrfusion.Exploration{
|
||||
explorations := []*chronograf.Exploration{
|
||||
&chronograf.Exploration{
|
||||
Name: "Ferdinand Magellan",
|
||||
UserID: 2,
|
||||
Data: "{\"panels\":{\"123\":{\"id\":\"123\",\"queryIds\":[\"456\"]}},\"queryConfigs\":{\"456\":{\"id\":\"456\",\"database\":null,\"measurement\":null,\"retentionPolicy\":null,\"fields\":[],\"tags\":{},\"groupBy\":{\"time\":null,\"tags\":[]},\"areTagsAccepted\":true,\"rawText\":null}}}",
|
||||
},
|
||||
&mrfusion.Exploration{
|
||||
&chronograf.Exploration{
|
||||
Name: "Marco Polo",
|
||||
UserID: 3,
|
||||
Data: "{\"panels\":{\"123\":{\"id\":\"123\",\"queryIds\":[\"456\"]}},\"queryConfigs\":{\"456\":{\"id\":\"456\",\"database\":null,\"measurement\":null,\"retentionPolicy\":null,\"fields\":[],\"tags\":{},\"groupBy\":{\"time\":null,\"tags\":[]},\"areTagsAccepted\":true,\"rawText\":null}}}",
|
||||
},
|
||||
&mrfusion.Exploration{
|
||||
&chronograf.Exploration{
|
||||
Name: "Leif Ericson",
|
||||
UserID: 3,
|
||||
Data: "{\"panels\":{\"123\":{\"id\":\"123\",\"queryIds\":[\"456\"]}},\"queryConfigs\":{\"456\":{\"id\":\"456\",\"database\":null,\"measurement\":null,\"retentionPolicy\":null,\"fields\":[],\"tags\":{},\"groupBy\":{\"time\":null,\"tags\":[]},\"areTagsAccepted\":true,\"rawText\":null}}}",
|
||||
|
|
|
@ -4,13 +4,13 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/chronograf"
|
||||
)
|
||||
|
||||
//go:generate protoc --gogo_out=. internal.proto
|
||||
|
||||
// MarshalExploration encodes an exploration to binary protobuf format.
|
||||
func MarshalExploration(e *mrfusion.Exploration) ([]byte, error) {
|
||||
func MarshalExploration(e *chronograf.Exploration) ([]byte, error) {
|
||||
return proto.Marshal(&Exploration{
|
||||
ID: int64(e.ID),
|
||||
Name: e.Name,
|
||||
|
@ -23,15 +23,15 @@ func MarshalExploration(e *mrfusion.Exploration) ([]byte, error) {
|
|||
}
|
||||
|
||||
// UnmarshalExploration decodes an exploration from binary protobuf data.
|
||||
func UnmarshalExploration(data []byte, e *mrfusion.Exploration) error {
|
||||
func UnmarshalExploration(data []byte, e *chronograf.Exploration) error {
|
||||
var pb Exploration
|
||||
if err := proto.Unmarshal(data, &pb); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
e.ID = mrfusion.ExplorationID(pb.ID)
|
||||
e.ID = chronograf.ExplorationID(pb.ID)
|
||||
e.Name = pb.Name
|
||||
e.UserID = mrfusion.UserID(pb.UserID)
|
||||
e.UserID = chronograf.UserID(pb.UserID)
|
||||
e.Data = pb.Data
|
||||
e.CreatedAt = time.Unix(0, pb.CreatedAt).UTC()
|
||||
e.UpdatedAt = time.Unix(0, pb.UpdatedAt).UTC()
|
||||
|
@ -41,7 +41,7 @@ func UnmarshalExploration(data []byte, e *mrfusion.Exploration) error {
|
|||
}
|
||||
|
||||
// MarshalSource encodes a source to binary protobuf format.
|
||||
func MarshalSource(s mrfusion.Source) ([]byte, error) {
|
||||
func MarshalSource(s chronograf.Source) ([]byte, error) {
|
||||
return proto.Marshal(&Source{
|
||||
ID: int64(s.ID),
|
||||
Name: s.Name,
|
||||
|
@ -54,7 +54,7 @@ func MarshalSource(s mrfusion.Source) ([]byte, error) {
|
|||
}
|
||||
|
||||
// UnmarshalSource decodes a source from binary protobuf data.
|
||||
func UnmarshalSource(data []byte, s *mrfusion.Source) error {
|
||||
func UnmarshalSource(data []byte, s *chronograf.Source) error {
|
||||
var pb Source
|
||||
if err := proto.Unmarshal(data, &pb); err != nil {
|
||||
return err
|
||||
|
@ -71,7 +71,7 @@ func UnmarshalSource(data []byte, s *mrfusion.Source) error {
|
|||
}
|
||||
|
||||
// MarshalServer encodes a server to binary protobuf format.
|
||||
func MarshalServer(s mrfusion.Server) ([]byte, error) {
|
||||
func MarshalServer(s chronograf.Server) ([]byte, error) {
|
||||
return proto.Marshal(&Server{
|
||||
ID: int64(s.ID),
|
||||
SrcID: int64(s.SrcID),
|
||||
|
@ -83,7 +83,7 @@ func MarshalServer(s mrfusion.Server) ([]byte, error) {
|
|||
}
|
||||
|
||||
// UnmarshalServer decodes a server from binary protobuf data.
|
||||
func UnmarshalServer(data []byte, s *mrfusion.Server) error {
|
||||
func UnmarshalServer(data []byte, s *chronograf.Server) error {
|
||||
var pb Server
|
||||
if err := proto.Unmarshal(data, &pb); err != nil {
|
||||
return err
|
||||
|
@ -99,7 +99,7 @@ func UnmarshalServer(data []byte, s *mrfusion.Server) error {
|
|||
}
|
||||
|
||||
// MarshalLayout encodes a layout to binary protobuf format.
|
||||
func MarshalLayout(l mrfusion.Layout) ([]byte, error) {
|
||||
func MarshalLayout(l chronograf.Layout) ([]byte, error) {
|
||||
cells := make([]*Cell, len(l.Cells))
|
||||
for i, c := range l.Cells {
|
||||
queries := make([]*Query, len(c.Queries))
|
||||
|
@ -127,7 +127,7 @@ func MarshalLayout(l mrfusion.Layout) ([]byte, error) {
|
|||
}
|
||||
|
||||
// UnmarshalLayout decodes a layout from binary protobuf data.
|
||||
func UnmarshalLayout(data []byte, l *mrfusion.Layout) error {
|
||||
func UnmarshalLayout(data []byte, l *chronograf.Layout) error {
|
||||
var pb Layout
|
||||
if err := proto.Unmarshal(data, &pb); err != nil {
|
||||
return err
|
||||
|
@ -136,17 +136,17 @@ func UnmarshalLayout(data []byte, l *mrfusion.Layout) error {
|
|||
l.ID = pb.ID
|
||||
l.Measurement = pb.Measurement
|
||||
l.Application = pb.Application
|
||||
cells := make([]mrfusion.Cell, len(pb.Cells))
|
||||
cells := make([]chronograf.Cell, len(pb.Cells))
|
||||
for i, c := range pb.Cells {
|
||||
queries := make([]mrfusion.Query, len(c.Queries))
|
||||
queries := make([]chronograf.Query, len(c.Queries))
|
||||
for j, q := range c.Queries {
|
||||
queries[j] = mrfusion.Query{
|
||||
queries[j] = chronograf.Query{
|
||||
Command: q.Command,
|
||||
DB: q.DB,
|
||||
RP: q.RP,
|
||||
}
|
||||
}
|
||||
cells[i] = mrfusion.Cell{
|
||||
cells[i] = chronograf.Cell{
|
||||
X: c.X,
|
||||
Y: c.Y,
|
||||
W: c.W,
|
||||
|
|
|
@ -5,13 +5,13 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/bolt/internal"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/bolt/internal"
|
||||
)
|
||||
|
||||
// Ensure an exploration can be marshaled and unmarshaled.
|
||||
func TestMarshalExploration(t *testing.T) {
|
||||
v := mrfusion.Exploration{
|
||||
v := chronograf.Exploration{
|
||||
ID: 12,
|
||||
Name: "Some Exploration",
|
||||
UserID: 34,
|
||||
|
@ -20,7 +20,7 @@ func TestMarshalExploration(t *testing.T) {
|
|||
UpdatedAt: time.Now().UTC(),
|
||||
}
|
||||
|
||||
var vv mrfusion.Exploration
|
||||
var vv chronograf.Exploration
|
||||
if buf, err := internal.MarshalExploration(&v); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if err := internal.UnmarshalExploration(buf, &vv); err != nil {
|
||||
|
@ -31,7 +31,7 @@ func TestMarshalExploration(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMarshalSource(t *testing.T) {
|
||||
v := mrfusion.Source{
|
||||
v := chronograf.Source{
|
||||
ID: 12,
|
||||
Name: "Fountain of Truth",
|
||||
Type: "influx",
|
||||
|
@ -41,7 +41,7 @@ func TestMarshalSource(t *testing.T) {
|
|||
Default: true,
|
||||
}
|
||||
|
||||
var vv mrfusion.Source
|
||||
var vv chronograf.Source
|
||||
if buf, err := internal.MarshalSource(v); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if err := internal.UnmarshalSource(buf, &vv); err != nil {
|
||||
|
@ -52,7 +52,7 @@ func TestMarshalSource(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestMarshalServer(t *testing.T) {
|
||||
v := mrfusion.Server{
|
||||
v := chronograf.Server{
|
||||
ID: 12,
|
||||
SrcID: 2,
|
||||
Name: "Fountain of Truth",
|
||||
|
@ -61,7 +61,7 @@ func TestMarshalServer(t *testing.T) {
|
|||
URL: "http://oldmanpeabody.mall.io:9092",
|
||||
}
|
||||
|
||||
var vv mrfusion.Server
|
||||
var vv chronograf.Server
|
||||
if buf, err := internal.MarshalServer(v); err != nil {
|
||||
t.Fatal(err)
|
||||
} else if err := internal.UnmarshalServer(buf, &vv); err != nil {
|
||||
|
|
|
@ -2,27 +2,27 @@ package bolt
|
|||
|
||||
import (
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/bolt/internal"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/bolt/internal"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Ensure LayoutStore implements mrfusion.LayoutStore.
|
||||
var _ mrfusion.LayoutStore = &LayoutStore{}
|
||||
// Ensure LayoutStore implements chronograf.LayoutStore.
|
||||
var _ chronograf.LayoutStore = &LayoutStore{}
|
||||
|
||||
var LayoutBucket = []byte("Layout")
|
||||
|
||||
type LayoutStore struct {
|
||||
client *Client
|
||||
IDs mrfusion.ID
|
||||
IDs chronograf.ID
|
||||
}
|
||||
|
||||
// All returns all known layouts
|
||||
func (s *LayoutStore) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
||||
var srcs []mrfusion.Layout
|
||||
func (s *LayoutStore) All(ctx context.Context) ([]chronograf.Layout, error) {
|
||||
var srcs []chronograf.Layout
|
||||
if err := s.client.db.View(func(tx *bolt.Tx) error {
|
||||
if err := tx.Bucket(LayoutBucket).ForEach(func(k, v []byte) error {
|
||||
var src mrfusion.Layout
|
||||
var src chronograf.Layout
|
||||
if err := internal.UnmarshalLayout(v, &src); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func (s *LayoutStore) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
|||
}
|
||||
|
||||
// Add creates a new Layout in the LayoutStore.
|
||||
func (s *LayoutStore) Add(ctx context.Context, src mrfusion.Layout) (mrfusion.Layout, error) {
|
||||
func (s *LayoutStore) Add(ctx context.Context, src chronograf.Layout) (chronograf.Layout, error) {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
b := tx.Bucket(LayoutBucket)
|
||||
id, err := s.IDs.Generate()
|
||||
|
@ -57,14 +57,14 @@ func (s *LayoutStore) Add(ctx context.Context, src mrfusion.Layout) (mrfusion.La
|
|||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return mrfusion.Layout{}, err
|
||||
return chronograf.Layout{}, err
|
||||
}
|
||||
|
||||
return src, nil
|
||||
}
|
||||
|
||||
// Delete removes the Layout from the LayoutStore
|
||||
func (s *LayoutStore) Delete(ctx context.Context, src mrfusion.Layout) error {
|
||||
func (s *LayoutStore) Delete(ctx context.Context, src chronograf.Layout) error {
|
||||
_, err := s.Get(ctx, src.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -82,29 +82,29 @@ func (s *LayoutStore) Delete(ctx context.Context, src mrfusion.Layout) error {
|
|||
}
|
||||
|
||||
// Get returns a Layout if the id exists.
|
||||
func (s *LayoutStore) Get(ctx context.Context, id string) (mrfusion.Layout, error) {
|
||||
var src mrfusion.Layout
|
||||
func (s *LayoutStore) Get(ctx context.Context, id string) (chronograf.Layout, error) {
|
||||
var src chronograf.Layout
|
||||
if err := s.client.db.View(func(tx *bolt.Tx) error {
|
||||
if v := tx.Bucket(LayoutBucket).Get([]byte(id)); v == nil {
|
||||
return mrfusion.ErrLayoutNotFound
|
||||
return chronograf.ErrLayoutNotFound
|
||||
} else if err := internal.UnmarshalLayout(v, &src); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return mrfusion.Layout{}, err
|
||||
return chronograf.Layout{}, err
|
||||
}
|
||||
|
||||
return src, nil
|
||||
}
|
||||
|
||||
// Update a Layout
|
||||
func (s *LayoutStore) Update(ctx context.Context, src mrfusion.Layout) error {
|
||||
func (s *LayoutStore) Update(ctx context.Context, src chronograf.Layout) error {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
// Get an existing layout with the same ID.
|
||||
b := tx.Bucket(LayoutBucket)
|
||||
if v := b.Get([]byte(src.ID)); v == nil {
|
||||
return mrfusion.ErrLayoutNotFound
|
||||
return chronograf.ErrLayoutNotFound
|
||||
}
|
||||
|
||||
if v, err := internal.MarshalLayout(src); err != nil {
|
||||
|
|
|
@ -2,13 +2,13 @@ package bolt
|
|||
|
||||
import (
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/bolt/internal"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/bolt/internal"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Ensure ServersStore implements mrfusion.ServersStore.
|
||||
var _ mrfusion.ServersStore = &ServersStore{}
|
||||
// Ensure ServersStore implements chronograf.ServersStore.
|
||||
var _ chronograf.ServersStore = &ServersStore{}
|
||||
|
||||
var ServersBucket = []byte("Servers")
|
||||
|
||||
|
@ -17,11 +17,11 @@ type ServersStore struct {
|
|||
}
|
||||
|
||||
// All returns all known servers
|
||||
func (s *ServersStore) All(ctx context.Context) ([]mrfusion.Server, error) {
|
||||
var srcs []mrfusion.Server
|
||||
func (s *ServersStore) All(ctx context.Context) ([]chronograf.Server, error) {
|
||||
var srcs []chronograf.Server
|
||||
if err := s.client.db.View(func(tx *bolt.Tx) error {
|
||||
if err := tx.Bucket(ServersBucket).ForEach(func(k, v []byte) error {
|
||||
var src mrfusion.Server
|
||||
var src chronograf.Server
|
||||
if err := internal.UnmarshalServer(v, &src); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ func (s *ServersStore) All(ctx context.Context) ([]mrfusion.Server, error) {
|
|||
}
|
||||
|
||||
// Add creates a new Server in the ServerStore.
|
||||
func (s *ServersStore) Add(ctx context.Context, src mrfusion.Server) (mrfusion.Server, error) {
|
||||
func (s *ServersStore) Add(ctx context.Context, src chronograf.Server) (chronograf.Server, error) {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
b := tx.Bucket(ServersBucket)
|
||||
seq, err := b.NextSequence()
|
||||
|
@ -56,14 +56,14 @@ func (s *ServersStore) Add(ctx context.Context, src mrfusion.Server) (mrfusion.S
|
|||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return mrfusion.Server{}, err
|
||||
return chronograf.Server{}, err
|
||||
}
|
||||
|
||||
return src, nil
|
||||
}
|
||||
|
||||
// Delete removes the Server from the ServersStore
|
||||
func (s *ServersStore) Delete(ctx context.Context, src mrfusion.Server) error {
|
||||
func (s *ServersStore) Delete(ctx context.Context, src chronograf.Server) error {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
if err := tx.Bucket(ServersBucket).Delete(itob(src.ID)); err != nil {
|
||||
return err
|
||||
|
@ -77,29 +77,29 @@ func (s *ServersStore) Delete(ctx context.Context, src mrfusion.Server) error {
|
|||
}
|
||||
|
||||
// Get returns a Server if the id exists.
|
||||
func (s *ServersStore) Get(ctx context.Context, id int) (mrfusion.Server, error) {
|
||||
var src mrfusion.Server
|
||||
func (s *ServersStore) Get(ctx context.Context, id int) (chronograf.Server, error) {
|
||||
var src chronograf.Server
|
||||
if err := s.client.db.View(func(tx *bolt.Tx) error {
|
||||
if v := tx.Bucket(ServersBucket).Get(itob(id)); v == nil {
|
||||
return mrfusion.ErrServerNotFound
|
||||
return chronograf.ErrServerNotFound
|
||||
} else if err := internal.UnmarshalServer(v, &src); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return mrfusion.Server{}, err
|
||||
return chronograf.Server{}, err
|
||||
}
|
||||
|
||||
return src, nil
|
||||
}
|
||||
|
||||
// Update a Server
|
||||
func (s *ServersStore) Update(ctx context.Context, src mrfusion.Server) error {
|
||||
func (s *ServersStore) Update(ctx context.Context, src chronograf.Server) error {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
// Get an existing server with the same ID.
|
||||
b := tx.Bucket(ServersBucket)
|
||||
if v := b.Get(itob(src.ID)); v == nil {
|
||||
return mrfusion.ErrServerNotFound
|
||||
return chronograf.ErrServerNotFound
|
||||
}
|
||||
|
||||
if v, err := internal.MarshalServer(src); err != nil {
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/chronograf"
|
||||
)
|
||||
|
||||
// Ensure an ServerStore can store, retrieve, update, and delete servers.
|
||||
|
@ -19,15 +19,15 @@ func TestServerStore(t *testing.T) {
|
|||
defer c.Close()
|
||||
s := c.ServersStore
|
||||
|
||||
srcs := []mrfusion.Server{
|
||||
mrfusion.Server{
|
||||
srcs := []chronograf.Server{
|
||||
chronograf.Server{
|
||||
Name: "Of Truth",
|
||||
SrcID: 10,
|
||||
Username: "marty",
|
||||
Password: "I❤️ jennifer parker",
|
||||
URL: "toyota-hilux.lyon-estates.local",
|
||||
},
|
||||
mrfusion.Server{
|
||||
chronograf.Server{
|
||||
Name: "HipToBeSquare",
|
||||
SrcID: 12,
|
||||
Username: "calvinklein",
|
||||
|
@ -76,8 +76,8 @@ func TestServerStore(t *testing.T) {
|
|||
}
|
||||
|
||||
// Confirm server has been deleted.
|
||||
if _, err := s.Get(nil, srcs[0].ID); err != mrfusion.ErrServerNotFound {
|
||||
t.Fatalf("server delete error: got %v, expected %v", err, mrfusion.ErrServerNotFound)
|
||||
if _, err := s.Get(nil, srcs[0].ID); err != chronograf.ErrServerNotFound {
|
||||
t.Fatalf("server delete error: got %v, expected %v", err, chronograf.ErrServerNotFound)
|
||||
}
|
||||
|
||||
if bsrcs, err := s.All(nil); err != nil {
|
||||
|
|
|
@ -2,13 +2,13 @@ package bolt
|
|||
|
||||
import (
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/bolt/internal"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/bolt/internal"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Ensure SourcesStore implements mrfusion.SourcesStore.
|
||||
var _ mrfusion.SourcesStore = &SourcesStore{}
|
||||
// Ensure SourcesStore implements chronograf.SourcesStore.
|
||||
var _ chronograf.SourcesStore = &SourcesStore{}
|
||||
|
||||
var SourcesBucket = []byte("Sources")
|
||||
|
||||
|
@ -17,11 +17,11 @@ type SourcesStore struct {
|
|||
}
|
||||
|
||||
// All returns all known sources
|
||||
func (s *SourcesStore) All(ctx context.Context) ([]mrfusion.Source, error) {
|
||||
var srcs []mrfusion.Source
|
||||
func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) {
|
||||
var srcs []chronograf.Source
|
||||
if err := s.client.db.View(func(tx *bolt.Tx) error {
|
||||
if err := tx.Bucket(SourcesBucket).ForEach(func(k, v []byte) error {
|
||||
var src mrfusion.Source
|
||||
var src chronograf.Source
|
||||
if err := internal.UnmarshalSource(v, &src); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ func (s *SourcesStore) All(ctx context.Context) ([]mrfusion.Source, error) {
|
|||
}
|
||||
|
||||
// Add creates a new Source in the SourceStore.
|
||||
func (s *SourcesStore) Add(ctx context.Context, src mrfusion.Source) (mrfusion.Source, error) {
|
||||
func (s *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error) {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
b := tx.Bucket(SourcesBucket)
|
||||
seq, err := b.NextSequence()
|
||||
|
@ -56,14 +56,14 @@ func (s *SourcesStore) Add(ctx context.Context, src mrfusion.Source) (mrfusion.S
|
|||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return mrfusion.Source{}, err
|
||||
return chronograf.Source{}, err
|
||||
}
|
||||
|
||||
return src, nil
|
||||
}
|
||||
|
||||
// Delete removes the Source from the SourcesStore
|
||||
func (s *SourcesStore) Delete(ctx context.Context, src mrfusion.Source) error {
|
||||
func (s *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
if err := tx.Bucket(SourcesBucket).Delete(itob(src.ID)); err != nil {
|
||||
return err
|
||||
|
@ -77,29 +77,29 @@ func (s *SourcesStore) Delete(ctx context.Context, src mrfusion.Source) error {
|
|||
}
|
||||
|
||||
// Get returns a Source if the id exists.
|
||||
func (s *SourcesStore) Get(ctx context.Context, id int) (mrfusion.Source, error) {
|
||||
var src mrfusion.Source
|
||||
func (s *SourcesStore) Get(ctx context.Context, id int) (chronograf.Source, error) {
|
||||
var src chronograf.Source
|
||||
if err := s.client.db.View(func(tx *bolt.Tx) error {
|
||||
if v := tx.Bucket(SourcesBucket).Get(itob(id)); v == nil {
|
||||
return mrfusion.ErrSourceNotFound
|
||||
return chronograf.ErrSourceNotFound
|
||||
} else if err := internal.UnmarshalSource(v, &src); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return mrfusion.Source{}, err
|
||||
return chronograf.Source{}, err
|
||||
}
|
||||
|
||||
return src, nil
|
||||
}
|
||||
|
||||
// Update a Source
|
||||
func (s *SourcesStore) Update(ctx context.Context, src mrfusion.Source) error {
|
||||
func (s *SourcesStore) Update(ctx context.Context, src chronograf.Source) error {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
// Get an existing soource with the same ID.
|
||||
b := tx.Bucket(SourcesBucket)
|
||||
if v := b.Get(itob(src.ID)); v == nil {
|
||||
return mrfusion.ErrSourceNotFound
|
||||
return chronograf.ErrSourceNotFound
|
||||
}
|
||||
|
||||
if v, err := internal.MarshalSource(src); err != nil {
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/chronograf"
|
||||
)
|
||||
|
||||
// Ensure an SourceStore can store, retrieve, update, and delete sources.
|
||||
|
@ -19,8 +19,8 @@ func TestSourceStore(t *testing.T) {
|
|||
defer c.Close()
|
||||
s := c.SourcesStore
|
||||
|
||||
srcs := []mrfusion.Source{
|
||||
mrfusion.Source{
|
||||
srcs := []chronograf.Source{
|
||||
chronograf.Source{
|
||||
Name: "Of Truth",
|
||||
Type: "influx",
|
||||
Username: "marty",
|
||||
|
@ -28,7 +28,7 @@ func TestSourceStore(t *testing.T) {
|
|||
URL: []string{"toyota-hilux.lyon-estates.local", "lake.hilldale.local"},
|
||||
Default: true,
|
||||
},
|
||||
mrfusion.Source{
|
||||
chronograf.Source{
|
||||
Name: "HipToBeSquare",
|
||||
Type: "influx",
|
||||
Username: "calvinklein",
|
||||
|
@ -78,8 +78,8 @@ func TestSourceStore(t *testing.T) {
|
|||
}
|
||||
|
||||
// Confirm source has been deleted.
|
||||
if _, err := s.Get(nil, srcs[0].ID); err != mrfusion.ErrSourceNotFound {
|
||||
t.Fatalf("source delete error: got %v, expected %v", err, mrfusion.ErrSourceNotFound)
|
||||
if _, err := s.Get(nil, srcs[0].ID); err != chronograf.ErrSourceNotFound {
|
||||
t.Fatalf("source delete error: got %v, expected %v", err, chronograf.ErrSourceNotFound)
|
||||
}
|
||||
|
||||
if bsrcs, err := s.All(nil); err != nil {
|
||||
|
|
|
@ -10,27 +10,27 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
fusionlog "github.com/influxdata/mrfusion/log"
|
||||
"github.com/influxdata/chronograf"
|
||||
clog "github.com/influxdata/chronograf/log"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
const AppExt = ".json"
|
||||
|
||||
var logger = fusionlog.New()
|
||||
var logger = clog.New()
|
||||
|
||||
// Apps are canned JSON layouts. Implements LayoutStore.
|
||||
type Apps struct {
|
||||
Dir string // Dir is the directory contained the pre-canned applications.
|
||||
Load func(string) (mrfusion.Layout, error) // Load loads string name and return a Layout
|
||||
Filename func(string, mrfusion.Layout) string // Filename takes dir and layout and returns loadable file
|
||||
Create func(string, mrfusion.Layout) error // Create will write layout to file.
|
||||
Load func(string) (chronograf.Layout, error) // Load loads string name and return a Layout
|
||||
Filename func(string, chronograf.Layout) string // Filename takes dir and layout and returns loadable file
|
||||
Create func(string, chronograf.Layout) error // Create will write layout to file.
|
||||
ReadDir func(dirname string) ([]os.FileInfo, error) // ReadDir reads the directory named by dirname and returns a list of directory entries sorted by filename.
|
||||
Remove func(name string) error // Remove file
|
||||
IDs mrfusion.ID // IDs generate unique ids for new application layouts
|
||||
IDs chronograf.ID // IDs generate unique ids for new application layouts
|
||||
}
|
||||
|
||||
func NewApps(dir string, ids mrfusion.ID) mrfusion.LayoutStore {
|
||||
func NewApps(dir string, ids chronograf.ID) chronograf.LayoutStore {
|
||||
return &Apps{
|
||||
Dir: dir,
|
||||
Load: loadFile,
|
||||
|
@ -42,32 +42,32 @@ func NewApps(dir string, ids mrfusion.ID) mrfusion.LayoutStore {
|
|||
}
|
||||
}
|
||||
|
||||
func fileName(dir string, layout mrfusion.Layout) string {
|
||||
func fileName(dir string, layout chronograf.Layout) string {
|
||||
base := fmt.Sprintf("%s_%s%s", layout.Measurement, layout.ID, AppExt)
|
||||
return path.Join(dir, base)
|
||||
}
|
||||
|
||||
func loadFile(name string) (mrfusion.Layout, error) {
|
||||
func loadFile(name string) (chronograf.Layout, error) {
|
||||
octets, err := ioutil.ReadFile(name)
|
||||
if err != nil {
|
||||
logger.
|
||||
WithField("component", "apps").
|
||||
WithField("name", name).
|
||||
Error("Unable to read file")
|
||||
return mrfusion.Layout{}, err
|
||||
return chronograf.Layout{}, err
|
||||
}
|
||||
var layout mrfusion.Layout
|
||||
var layout chronograf.Layout
|
||||
if err = json.Unmarshal(octets, &layout); err != nil {
|
||||
logger.
|
||||
WithField("component", "apps").
|
||||
WithField("name", name).
|
||||
Error("File is not a layout")
|
||||
return mrfusion.Layout{}, err
|
||||
return chronograf.Layout{}, err
|
||||
}
|
||||
return layout, nil
|
||||
}
|
||||
|
||||
func createLayout(file string, layout mrfusion.Layout) error {
|
||||
func createLayout(file string, layout chronograf.Layout) error {
|
||||
h, err := os.Create(file)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -91,13 +91,13 @@ func createLayout(file string, layout mrfusion.Layout) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (a *Apps) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
||||
func (a *Apps) All(ctx context.Context) ([]chronograf.Layout, error) {
|
||||
files, err := a.ReadDir(a.Dir)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
layouts := []mrfusion.Layout{}
|
||||
layouts := []chronograf.Layout{}
|
||||
for _, file := range files {
|
||||
if path.Ext(file.Name()) != AppExt {
|
||||
continue
|
||||
|
@ -111,17 +111,17 @@ func (a *Apps) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
|||
return layouts, nil
|
||||
}
|
||||
|
||||
func (a *Apps) Add(ctx context.Context, layout mrfusion.Layout) (mrfusion.Layout, error) {
|
||||
func (a *Apps) Add(ctx context.Context, layout chronograf.Layout) (chronograf.Layout, error) {
|
||||
var err error
|
||||
layout.ID, err = a.IDs.Generate()
|
||||
file := a.Filename(a.Dir, layout)
|
||||
if err = a.Create(file, layout); err != nil {
|
||||
return mrfusion.Layout{}, err
|
||||
return chronograf.Layout{}, err
|
||||
}
|
||||
return layout, nil
|
||||
}
|
||||
|
||||
func (a *Apps) Delete(ctx context.Context, layout mrfusion.Layout) error {
|
||||
func (a *Apps) Delete(ctx context.Context, layout chronograf.Layout) error {
|
||||
file, err := a.idToFile(layout.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -137,19 +137,19 @@ func (a *Apps) Delete(ctx context.Context, layout mrfusion.Layout) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (a *Apps) Get(ctx context.Context, ID string) (mrfusion.Layout, error) {
|
||||
func (a *Apps) Get(ctx context.Context, ID string) (chronograf.Layout, error) {
|
||||
file, err := a.idToFile(ID)
|
||||
if err != nil {
|
||||
return mrfusion.Layout{}, err
|
||||
return chronograf.Layout{}, err
|
||||
}
|
||||
l, err := a.Load(file)
|
||||
if err != nil {
|
||||
return mrfusion.Layout{}, mrfusion.ErrLayoutNotFound
|
||||
return chronograf.Layout{}, chronograf.ErrLayoutNotFound
|
||||
}
|
||||
return l, nil
|
||||
}
|
||||
|
||||
func (a *Apps) Update(ctx context.Context, layout mrfusion.Layout) error {
|
||||
func (a *Apps) Update(ctx context.Context, layout chronograf.Layout) error {
|
||||
file, err := a.idToFile(layout.ID)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -157,7 +157,7 @@ func (a *Apps) Update(ctx context.Context, layout mrfusion.Layout) error {
|
|||
|
||||
l, err := a.Load(file)
|
||||
if err != nil {
|
||||
return mrfusion.ErrLayoutNotFound
|
||||
return chronograf.ErrLayoutNotFound
|
||||
}
|
||||
|
||||
if err := a.Delete(ctx, l); err != nil {
|
||||
|
@ -183,7 +183,7 @@ func (a *Apps) idToFile(ID string) (string, error) {
|
|||
}
|
||||
}
|
||||
if file == "" {
|
||||
return "", mrfusion.ErrLayoutNotFound
|
||||
return "", chronograf.ErrLayoutNotFound
|
||||
}
|
||||
return file, nil
|
||||
}
|
||||
|
|
|
@ -12,18 +12,18 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/canned"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/canned"
|
||||
)
|
||||
|
||||
func TestAll(t *testing.T) {
|
||||
t.Parallel()
|
||||
var tests = []struct {
|
||||
Existing []mrfusion.Layout
|
||||
Existing []chronograf.Layout
|
||||
Err error
|
||||
}{
|
||||
{
|
||||
Existing: []mrfusion.Layout{
|
||||
Existing: []chronograf.Layout{
|
||||
{ID: "1",
|
||||
Application: "howdy",
|
||||
},
|
||||
|
@ -34,7 +34,7 @@ func TestAll(t *testing.T) {
|
|||
Err: nil,
|
||||
},
|
||||
{
|
||||
Existing: []mrfusion.Layout{},
|
||||
Existing: []chronograf.Layout{},
|
||||
Err: nil,
|
||||
},
|
||||
{
|
||||
|
@ -57,13 +57,13 @@ func TestAll(t *testing.T) {
|
|||
func TestAdd(t *testing.T) {
|
||||
t.Parallel()
|
||||
var tests = []struct {
|
||||
Existing []mrfusion.Layout
|
||||
Add mrfusion.Layout
|
||||
Existing []chronograf.Layout
|
||||
Add chronograf.Layout
|
||||
ExpectedID string
|
||||
Err error
|
||||
}{
|
||||
{
|
||||
Existing: []mrfusion.Layout{
|
||||
Existing: []chronograf.Layout{
|
||||
{ID: "1",
|
||||
Application: "howdy",
|
||||
},
|
||||
|
@ -71,15 +71,15 @@ func TestAdd(t *testing.T) {
|
|||
Application: "doody",
|
||||
},
|
||||
},
|
||||
Add: mrfusion.Layout{
|
||||
Add: chronograf.Layout{
|
||||
Application: "newbie",
|
||||
},
|
||||
ExpectedID: "3",
|
||||
Err: nil,
|
||||
},
|
||||
{
|
||||
Existing: []mrfusion.Layout{},
|
||||
Add: mrfusion.Layout{
|
||||
Existing: []chronograf.Layout{},
|
||||
Add: chronograf.Layout{
|
||||
Application: "newbie",
|
||||
},
|
||||
ExpectedID: "1",
|
||||
|
@ -87,7 +87,7 @@ func TestAdd(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Existing: nil,
|
||||
Add: mrfusion.Layout{
|
||||
Add: chronograf.Layout{
|
||||
Application: "newbie",
|
||||
},
|
||||
ExpectedID: "",
|
||||
|
@ -110,13 +110,13 @@ func TestAdd(t *testing.T) {
|
|||
func TestDelete(t *testing.T) {
|
||||
t.Parallel()
|
||||
var tests = []struct {
|
||||
Existing []mrfusion.Layout
|
||||
Existing []chronograf.Layout
|
||||
DeleteID string
|
||||
Expected map[string]mrfusion.Layout
|
||||
Expected map[string]chronograf.Layout
|
||||
Err error
|
||||
}{
|
||||
{
|
||||
Existing: []mrfusion.Layout{
|
||||
Existing: []chronograf.Layout{
|
||||
{ID: "1",
|
||||
Application: "howdy",
|
||||
},
|
||||
|
@ -125,7 +125,7 @@ func TestDelete(t *testing.T) {
|
|||
},
|
||||
},
|
||||
DeleteID: "1",
|
||||
Expected: map[string]mrfusion.Layout{
|
||||
Expected: map[string]chronograf.Layout{
|
||||
"dir/2.json": {ID: "2",
|
||||
Application: "doody",
|
||||
},
|
||||
|
@ -133,21 +133,21 @@ func TestDelete(t *testing.T) {
|
|||
Err: nil,
|
||||
},
|
||||
{
|
||||
Existing: []mrfusion.Layout{},
|
||||
Existing: []chronograf.Layout{},
|
||||
DeleteID: "1",
|
||||
Expected: map[string]mrfusion.Layout{},
|
||||
Err: mrfusion.ErrLayoutNotFound,
|
||||
Expected: map[string]chronograf.Layout{},
|
||||
Err: chronograf.ErrLayoutNotFound,
|
||||
},
|
||||
{
|
||||
Existing: nil,
|
||||
DeleteID: "1",
|
||||
Expected: map[string]mrfusion.Layout{},
|
||||
Expected: map[string]chronograf.Layout{},
|
||||
Err: errors.New("Error"),
|
||||
},
|
||||
}
|
||||
for i, test := range tests {
|
||||
apps, actual := MockApps(test.Existing, test.Err)
|
||||
err := apps.Delete(context.Background(), mrfusion.Layout{ID: test.DeleteID})
|
||||
err := apps.Delete(context.Background(), chronograf.Layout{ID: test.DeleteID})
|
||||
if err != test.Err {
|
||||
t.Errorf("Test %d: Canned delete error expected: %v; actual: %v", i, test.Err, err)
|
||||
}
|
||||
|
@ -160,13 +160,13 @@ func TestDelete(t *testing.T) {
|
|||
func TestGet(t *testing.T) {
|
||||
t.Parallel()
|
||||
var tests = []struct {
|
||||
Existing []mrfusion.Layout
|
||||
Existing []chronograf.Layout
|
||||
ID string
|
||||
Expected mrfusion.Layout
|
||||
Expected chronograf.Layout
|
||||
Err error
|
||||
}{
|
||||
{
|
||||
Existing: []mrfusion.Layout{
|
||||
Existing: []chronograf.Layout{
|
||||
{ID: "1",
|
||||
Application: "howdy",
|
||||
},
|
||||
|
@ -175,23 +175,23 @@ func TestGet(t *testing.T) {
|
|||
},
|
||||
},
|
||||
ID: "1",
|
||||
Expected: mrfusion.Layout{
|
||||
Expected: chronograf.Layout{
|
||||
ID: "1",
|
||||
Application: "howdy",
|
||||
},
|
||||
Err: nil,
|
||||
},
|
||||
{
|
||||
Existing: []mrfusion.Layout{},
|
||||
Existing: []chronograf.Layout{},
|
||||
ID: "1",
|
||||
Expected: mrfusion.Layout{},
|
||||
Err: mrfusion.ErrLayoutNotFound,
|
||||
Expected: chronograf.Layout{},
|
||||
Err: chronograf.ErrLayoutNotFound,
|
||||
},
|
||||
{
|
||||
Existing: nil,
|
||||
ID: "1",
|
||||
Expected: mrfusion.Layout{},
|
||||
Err: mrfusion.ErrLayoutNotFound,
|
||||
Expected: chronograf.Layout{},
|
||||
Err: chronograf.ErrLayoutNotFound,
|
||||
},
|
||||
}
|
||||
for i, test := range tests {
|
||||
|
@ -209,13 +209,13 @@ func TestGet(t *testing.T) {
|
|||
func TestUpdate(t *testing.T) {
|
||||
t.Parallel()
|
||||
var tests = []struct {
|
||||
Existing []mrfusion.Layout
|
||||
Update mrfusion.Layout
|
||||
Expected map[string]mrfusion.Layout
|
||||
Existing []chronograf.Layout
|
||||
Update chronograf.Layout
|
||||
Expected map[string]chronograf.Layout
|
||||
Err error
|
||||
}{
|
||||
{
|
||||
Existing: []mrfusion.Layout{
|
||||
Existing: []chronograf.Layout{
|
||||
{ID: "1",
|
||||
Application: "howdy",
|
||||
},
|
||||
|
@ -223,12 +223,12 @@ func TestUpdate(t *testing.T) {
|
|||
Application: "doody",
|
||||
},
|
||||
},
|
||||
Update: mrfusion.Layout{
|
||||
Update: chronograf.Layout{
|
||||
ID: "1",
|
||||
Application: "hello",
|
||||
Measurement: "measurement",
|
||||
},
|
||||
Expected: map[string]mrfusion.Layout{
|
||||
Expected: map[string]chronograf.Layout{
|
||||
"dir/1.json": {ID: "1",
|
||||
Application: "hello",
|
||||
Measurement: "measurement",
|
||||
|
@ -240,20 +240,20 @@ func TestUpdate(t *testing.T) {
|
|||
Err: nil,
|
||||
},
|
||||
{
|
||||
Existing: []mrfusion.Layout{},
|
||||
Update: mrfusion.Layout{
|
||||
Existing: []chronograf.Layout{},
|
||||
Update: chronograf.Layout{
|
||||
ID: "1",
|
||||
},
|
||||
Expected: map[string]mrfusion.Layout{},
|
||||
Err: mrfusion.ErrLayoutNotFound,
|
||||
Expected: map[string]chronograf.Layout{},
|
||||
Err: chronograf.ErrLayoutNotFound,
|
||||
},
|
||||
{
|
||||
Existing: nil,
|
||||
Update: mrfusion.Layout{
|
||||
Update: chronograf.Layout{
|
||||
ID: "1",
|
||||
},
|
||||
Expected: map[string]mrfusion.Layout{},
|
||||
Err: mrfusion.ErrLayoutNotFound,
|
||||
Expected: map[string]chronograf.Layout{},
|
||||
Err: chronograf.ErrLayoutNotFound,
|
||||
},
|
||||
}
|
||||
for i, test := range tests {
|
||||
|
@ -311,28 +311,28 @@ func (m *MockID) Generate() (string, error) {
|
|||
return strconv.Itoa(m.id), nil
|
||||
}
|
||||
|
||||
func MockApps(existing []mrfusion.Layout, expected error) (canned.Apps, *map[string]mrfusion.Layout) {
|
||||
layouts := map[string]mrfusion.Layout{}
|
||||
fileName := func(dir string, layout mrfusion.Layout) string {
|
||||
func MockApps(existing []chronograf.Layout, expected error) (canned.Apps, *map[string]chronograf.Layout) {
|
||||
layouts := map[string]chronograf.Layout{}
|
||||
fileName := func(dir string, layout chronograf.Layout) string {
|
||||
return path.Join(dir, layout.ID+".json")
|
||||
}
|
||||
dir := "dir"
|
||||
for _, l := range existing {
|
||||
layouts[fileName(dir, l)] = l
|
||||
}
|
||||
load := func(file string) (mrfusion.Layout, error) {
|
||||
load := func(file string) (chronograf.Layout, error) {
|
||||
if expected != nil {
|
||||
return mrfusion.Layout{}, expected
|
||||
return chronograf.Layout{}, expected
|
||||
}
|
||||
|
||||
if l, ok := layouts[file]; !ok {
|
||||
return mrfusion.Layout{}, mrfusion.ErrLayoutNotFound
|
||||
return chronograf.Layout{}, chronograf.ErrLayoutNotFound
|
||||
} else {
|
||||
return l, nil
|
||||
}
|
||||
}
|
||||
|
||||
create := func(file string, layout mrfusion.Layout) error {
|
||||
create := func(file string, layout chronograf.Layout) error {
|
||||
if expected != nil {
|
||||
return expected
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ func MockApps(existing []mrfusion.Layout, expected error) (canned.Apps, *map[str
|
|||
return expected
|
||||
}
|
||||
if _, ok := layouts[name]; !ok {
|
||||
return mrfusion.ErrLayoutNotFound
|
||||
return chronograf.ErrLayoutNotFound
|
||||
}
|
||||
delete(layouts, name)
|
||||
return nil
|
||||
|
|
|
@ -12,11 +12,11 @@ dependencies:
|
|||
- npm install -g node-sass
|
||||
- git config --global url."git@github.com:".insteadOf "https://github.com/"
|
||||
- mkdir -p ${HOME}/.go_workspace/src/github.com/influxdata
|
||||
- ln -sf ${HOME}/mrfusion ${HOME}/.go_workspace/src/github.com/influxdata
|
||||
- ln -sf ${HOME}/chronograf ${HOME}/.go_workspace/src/github.com/influxdata
|
||||
- "make":
|
||||
pwd: ../.go_workspace/src/github.com/influxdata/mrfusion
|
||||
pwd: ../.go_workspace/src/github.com/influxdata/chronograf
|
||||
cache_directories:
|
||||
- ../../../../../mrfusion/ui/node_modules
|
||||
- ../../../../../chronograf/ui/node_modules
|
||||
|
||||
test:
|
||||
override:
|
||||
|
@ -28,5 +28,5 @@ deployment:
|
|||
commands:
|
||||
- make docker
|
||||
- docker login -e $HEROKU_EMAIL -u $HEROKU_EMAIL -p $HEROKU_PASS registry.heroku.com
|
||||
- docker tag mrfusion registry.heroku.com/mrfusion-acc/web
|
||||
- docker tag chronograf registry.heroku.com/mrfusion-acc/web
|
||||
- docker push registry.heroku.com/mrfusion-acc/web
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
loads "github.com/go-openapi/loads"
|
||||
flags "github.com/jessevdk/go-flags"
|
||||
|
||||
"github.com/influxdata/mrfusion/restapi"
|
||||
"github.com/influxdata/mrfusion/restapi/operations"
|
||||
"github.com/influxdata/chronograf/restapi"
|
||||
"github.com/influxdata/chronograf/restapi/operations"
|
||||
)
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
|
@ -20,13 +20,13 @@ func main() {
|
|||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
api := operations.NewMrFusionAPI(swaggerSpec)
|
||||
api := operations.NewChronografAPI(swaggerSpec)
|
||||
server := restapi.NewServer(api)
|
||||
defer server.Shutdown()
|
||||
|
||||
parser := flags.NewParser(server, flags.Default)
|
||||
parser.ShortDescription = `Mr Fusion`
|
||||
parser.LongDescription = `Fuel for Chronograf`
|
||||
parser.ShortDescription = `Chronograf`
|
||||
parser.LongDescription = `API endpoints for Chronograf`
|
||||
|
||||
server.ConfigureFlags()
|
||||
for _, optsGroup := range api.CommandLineOptionsGroups {
|
|
@ -1,4 +1,4 @@
|
|||
MrFusion with OAuth 2.0 (Github-style)
|
||||
Chronograf with OAuth 2.0 (Github-style)
|
||||
|
||||
Originally Authored with Hackmd.io Link
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package mrfusion
|
||||
package chronograf
|
||||
|
||||
// General errors.
|
||||
const (
|
||||
|
@ -9,7 +9,7 @@ const (
|
|||
ErrLayoutNotFound = Error("layout not found")
|
||||
)
|
||||
|
||||
// Error is a domain error encountered while processing mrfusion requests
|
||||
// Error is a domain error encountered while processing chronograf requests
|
||||
type Error string
|
||||
|
||||
func (e Error) Error() string {
|
||||
|
|
|
@ -7,11 +7,11 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
op "github.com/influxdata/mrfusion/restapi/operations"
|
||||
op "github.com/influxdata/chronograf/restapi/operations"
|
||||
)
|
||||
|
||||
func (h *Store) Explorations(ctx context.Context, params op.GetSourcesIDUsersUserIDExplorationsParams) middleware.Responder {
|
||||
|
@ -22,7 +22,7 @@ func (h *Store) Explorations(ctx context.Context, params op.GetSourcesIDUsersUse
|
|||
return op.NewGetSourcesIDUsersUserIDExplorationsDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
mrExs, err := h.ExplorationStore.Query(ctx, mrfusion.UserID(uID))
|
||||
mrExs, err := h.ExplorationStore.Query(ctx, chronograf.UserID(uID))
|
||||
if err != nil {
|
||||
log.Printf("Error: Unknown response from store while querying UserID: %s: %v", params.UserID, err)
|
||||
errMsg := &models.Error{Code: 500, Message: "Error: Unknown response from store while querying UserID"}
|
||||
|
@ -65,14 +65,14 @@ func (h *Store) Exploration(ctx context.Context, params op.GetSourcesIDUsersUser
|
|||
return op.NewGetSourcesIDUsersUserIDExplorationsExplorationIDDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
e, err := h.ExplorationStore.Get(ctx, mrfusion.ExplorationID(eID))
|
||||
e, err := h.ExplorationStore.Get(ctx, chronograf.ExplorationID(eID))
|
||||
if err != nil {
|
||||
log.Printf("Error: Unknown ExplorationID: %s: %v", params.ExplorationID, err)
|
||||
errMsg := &models.Error{Code: 404, Message: "Error: Unknown ExplorationID"}
|
||||
return op.NewGetSourcesIDUsersUserIDExplorationsExplorationIDNotFound().WithPayload(errMsg)
|
||||
}
|
||||
|
||||
if e.UserID != mrfusion.UserID(uID) {
|
||||
if e.UserID != chronograf.UserID(uID) {
|
||||
log.Printf("Error: Unknown ExplorationID: %s: %v", params.ExplorationID, err)
|
||||
errMsg := &models.Error{Code: 404, Message: "Error: Unknown ExplorationID"}
|
||||
return op.NewGetSourcesIDUsersUserIDExplorationsExplorationIDNotFound().WithPayload(errMsg)
|
||||
|
@ -114,8 +114,8 @@ func (h *Store) UpdateExploration(ctx context.Context, params op.PatchSourcesIDU
|
|||
return op.NewPatchSourcesIDUsersUserIDExplorationsExplorationIDDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
e, err := h.ExplorationStore.Get(ctx, mrfusion.ExplorationID(eID))
|
||||
if err != nil || e.UserID != mrfusion.UserID(uID) {
|
||||
e, err := h.ExplorationStore.Get(ctx, chronograf.ExplorationID(eID))
|
||||
if err != nil || e.UserID != chronograf.UserID(uID) {
|
||||
log.Printf("Error: Unknown ExplorationID: %s: %v", params.ExplorationID, err)
|
||||
errMsg := &models.Error{Code: 404, Message: "Error: Unknown ExplorationID"}
|
||||
return op.NewPatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound().WithPayload(errMsg)
|
||||
|
@ -142,7 +142,7 @@ func (h *Store) UpdateExploration(ctx context.Context, params op.PatchSourcesIDU
|
|||
return op.NewPatchSourcesIDUsersUserIDExplorationsExplorationIDOK().WithPayload(explToModel(e))
|
||||
}
|
||||
|
||||
func explToModel(e *mrfusion.Exploration) *models.Exploration {
|
||||
func explToModel(e *chronograf.Exploration) *models.Exploration {
|
||||
rel := "self"
|
||||
href := fmt.Sprintf("/chronograf/v1/sources/1/users/%d/explorations/%d", e.UserID, e.ID)
|
||||
return &models.Exploration{
|
||||
|
@ -177,9 +177,9 @@ func (h *Store) NewExploration(ctx context.Context, params op.PostSourcesIDUsers
|
|||
if params.Exploration.Data != nil {
|
||||
data, _ = params.Exploration.Data.(string)
|
||||
}
|
||||
e := &mrfusion.Exploration{
|
||||
e := &chronograf.Exploration{
|
||||
Name: params.Exploration.Name,
|
||||
UserID: mrfusion.UserID(uID),
|
||||
UserID: chronograf.UserID(uID),
|
||||
Data: data,
|
||||
}
|
||||
|
||||
|
@ -210,14 +210,14 @@ func (h *Store) DeleteExploration(ctx context.Context, params op.DeleteSourcesID
|
|||
return op.NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
e, err := h.ExplorationStore.Get(ctx, mrfusion.ExplorationID(eID))
|
||||
if err != nil || e.UserID != mrfusion.UserID(uID) {
|
||||
e, err := h.ExplorationStore.Get(ctx, chronograf.ExplorationID(eID))
|
||||
if err != nil || e.UserID != chronograf.UserID(uID) {
|
||||
log.Printf("Error: Unknown ExplorationID: %s: %v", params.ExplorationID, err)
|
||||
errMsg := &models.Error{Code: 404, Message: "Error: Unknown ExplorationID"}
|
||||
return op.NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound().WithPayload(errMsg)
|
||||
}
|
||||
|
||||
if err := h.ExplorationStore.Delete(ctx, &mrfusion.Exploration{ID: mrfusion.ExplorationID(eID)}); err != nil {
|
||||
if err := h.ExplorationStore.Delete(ctx, &chronograf.Exploration{ID: chronograf.ExplorationID(eID)}); err != nil {
|
||||
log.Printf("Error: Failed to delete Exploration: %v: %v", params.ExplorationID, err)
|
||||
errMsg := &models.Error{Code: 500, Message: "Error: Failed to delete Exploration"}
|
||||
return op.NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault(500).WithPayload(errMsg)
|
||||
|
|
|
@ -5,10 +5,10 @@ import (
|
|||
"strconv"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
|
||||
op "github.com/influxdata/mrfusion/restapi/operations"
|
||||
op "github.com/influxdata/chronograf/restapi/operations"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
@ -25,7 +25,7 @@ func (h *Store) NewKapacitor(ctx context.Context, params op.PostSourcesIDKapacit
|
|||
return op.NewGetSourcesIDKapacitorsDefault(404).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
srv := mrfusion.Server{
|
||||
srv := chronograf.Server{
|
||||
SrcID: srcID,
|
||||
Name: *params.Kapacitor.Name,
|
||||
Username: params.Kapacitor.Username,
|
||||
|
@ -47,7 +47,7 @@ func srvLinks(srcID int, id int) *models.KapacitorLinks {
|
|||
}
|
||||
}
|
||||
|
||||
func srvToModel(srv mrfusion.Server) *models.Kapacitor {
|
||||
func srvToModel(srv chronograf.Server) *models.Kapacitor {
|
||||
return &models.Kapacitor{
|
||||
ID: strconv.Itoa(srv.ID),
|
||||
Links: srvLinks(srv.SrcID, srv.ID),
|
||||
|
|
|
@ -4,25 +4,25 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
|
||||
op "github.com/influxdata/mrfusion/restapi/operations"
|
||||
op "github.com/influxdata/chronograf/restapi/operations"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
func layoutToMrF(l *models.Layout) mrfusion.Layout {
|
||||
cells := make([]mrfusion.Cell, len(l.Cells))
|
||||
func layoutToMrF(l *models.Layout) chronograf.Layout {
|
||||
cells := make([]chronograf.Cell, len(l.Cells))
|
||||
for i, c := range l.Cells {
|
||||
queries := make([]mrfusion.Query, len(c.Queries))
|
||||
queries := make([]chronograf.Query, len(c.Queries))
|
||||
for j, q := range c.Queries {
|
||||
queries[j] = mrfusion.Query{
|
||||
queries[j] = chronograf.Query{
|
||||
Command: *q.Query,
|
||||
DB: q.Db,
|
||||
RP: q.Rp,
|
||||
}
|
||||
}
|
||||
cells[i] = mrfusion.Cell{
|
||||
cells[i] = chronograf.Cell{
|
||||
X: *c.X,
|
||||
Y: *c.Y,
|
||||
W: *c.W,
|
||||
|
@ -30,7 +30,7 @@ func layoutToMrF(l *models.Layout) mrfusion.Layout {
|
|||
Queries: queries,
|
||||
}
|
||||
}
|
||||
return mrfusion.Layout{
|
||||
return chronograf.Layout{
|
||||
ID: l.ID,
|
||||
Measurement: *l.Measurement,
|
||||
Application: *l.App,
|
||||
|
@ -49,7 +49,7 @@ func (h *Store) NewLayout(ctx context.Context, params op.PostLayoutsParams) midd
|
|||
return op.NewPostLayoutsCreated().WithPayload(mlayout).WithLocation(*mlayout.Link.Href)
|
||||
}
|
||||
|
||||
func layoutToModel(l mrfusion.Layout) *models.Layout {
|
||||
func layoutToModel(l chronograf.Layout) *models.Layout {
|
||||
href := fmt.Sprintf("/chronograf/v1/layouts/%s", l.ID)
|
||||
rel := "self"
|
||||
|
||||
|
@ -90,7 +90,7 @@ func layoutToModel(l mrfusion.Layout) *models.Layout {
|
|||
}
|
||||
}
|
||||
|
||||
func requestedLayout(filtered map[string]bool, layout mrfusion.Layout) bool {
|
||||
func requestedLayout(filtered map[string]bool, layout chronograf.Layout) bool {
|
||||
// If the length of the filter is zero then all values are acceptable.
|
||||
if len(filtered) == 0 {
|
||||
return true
|
||||
|
@ -142,7 +142,7 @@ func (h *Store) LayoutsID(ctx context.Context, params op.GetLayoutsIDParams) mid
|
|||
}
|
||||
|
||||
func (h *Store) RemoveLayout(ctx context.Context, params op.DeleteLayoutsIDParams) middleware.Responder {
|
||||
layout := mrfusion.Layout{
|
||||
layout := chronograf.Layout{
|
||||
ID: params.ID,
|
||||
}
|
||||
if err := h.LayoutStore.Delete(ctx, layout); err != nil {
|
||||
|
|
|
@ -8,11 +8,11 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/handlers"
|
||||
"github.com/influxdata/mrfusion/mock"
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
op "github.com/influxdata/mrfusion/restapi/operations"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/handlers"
|
||||
"github.com/influxdata/chronograf/mock"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
op "github.com/influxdata/chronograf/restapi/operations"
|
||||
)
|
||||
|
||||
func TestNewLayout(t *testing.T) {
|
||||
|
@ -20,7 +20,7 @@ func TestNewLayout(t *testing.T) {
|
|||
var tests = []struct {
|
||||
Desc string
|
||||
AddError error
|
||||
ExistingLayouts map[string]mrfusion.Layout
|
||||
ExistingLayouts map[string]chronograf.Layout
|
||||
NewLayout *models.Layout
|
||||
ExpectedID int
|
||||
ExpectedHref string
|
||||
|
@ -45,7 +45,7 @@ func TestNewLayout(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Desc: "Test that creating a layout returns 201 status",
|
||||
ExistingLayouts: map[string]mrfusion.Layout{},
|
||||
ExistingLayouts: map[string]chronograf.Layout{},
|
||||
NewLayout: &models.Layout{
|
||||
Measurement: new(string),
|
||||
App: new(string),
|
||||
|
|
|
@ -7,18 +7,18 @@ import (
|
|||
"strconv"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
op "github.com/influxdata/mrfusion/restapi/operations"
|
||||
op "github.com/influxdata/chronograf/restapi/operations"
|
||||
)
|
||||
|
||||
type InfluxProxy struct {
|
||||
Srcs mrfusion.SourcesStore
|
||||
ServersStore mrfusion.ServersStore
|
||||
TimeSeries mrfusion.TimeSeries
|
||||
KapacitorProxy mrfusion.Proxy
|
||||
Srcs chronograf.SourcesStore
|
||||
ServersStore chronograf.ServersStore
|
||||
TimeSeries chronograf.TimeSeries
|
||||
KapacitorProxy chronograf.Proxy
|
||||
}
|
||||
|
||||
func (h *InfluxProxy) Proxy(ctx context.Context, params op.PostSourcesIDProxyParams) middleware.Responder {
|
||||
|
@ -39,7 +39,7 @@ func (h *InfluxProxy) Proxy(ctx context.Context, params op.PostSourcesIDProxyPar
|
|||
return op.NewPostSourcesIDProxyNotFound().WithPayload(errMsg)
|
||||
}
|
||||
|
||||
query := mrfusion.Query{
|
||||
query := chronograf.Query{
|
||||
Command: *params.Query.Query,
|
||||
DB: params.Query.Db,
|
||||
RP: params.Query.Rp,
|
||||
|
@ -47,7 +47,7 @@ func (h *InfluxProxy) Proxy(ctx context.Context, params op.PostSourcesIDProxyPar
|
|||
|
||||
response, err := h.TimeSeries.Query(ctx, query)
|
||||
if err != nil {
|
||||
if err == mrfusion.ErrUpstreamTimeout {
|
||||
if err == chronograf.ErrUpstreamTimeout {
|
||||
e := &models.Error{
|
||||
Code: 408,
|
||||
Message: "Timeout waiting for Influx response",
|
||||
|
@ -100,7 +100,7 @@ func (h *InfluxProxy) KapacitorProxyPost(ctx context.Context, params op.PostSour
|
|||
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
req := &mrfusion.Request{
|
||||
req := &chronograf.Request{
|
||||
Method: "POST",
|
||||
Path: params.Path,
|
||||
Body: body,
|
||||
|
@ -163,7 +163,7 @@ func (h *InfluxProxy) KapacitorProxyPatch(ctx context.Context, params op.PatchSo
|
|||
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
req := &mrfusion.Request{
|
||||
req := &chronograf.Request{
|
||||
Method: "PATCH",
|
||||
Path: params.Path,
|
||||
Body: body,
|
||||
|
@ -220,7 +220,7 @@ func (h *InfluxProxy) KapacitorProxyGet(ctx context.Context, params op.GetSource
|
|||
return op.NewGetSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
req := &mrfusion.Request{
|
||||
req := &chronograf.Request{
|
||||
Method: "GET",
|
||||
Path: params.Path,
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ func (h *InfluxProxy) KapacitorProxyDelete(ctx context.Context, params op.Delete
|
|||
return op.NewDeleteSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
req := &mrfusion.Request{
|
||||
req := &chronograf.Request{
|
||||
Method: "DELETE",
|
||||
Path: params.Path,
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
const index = `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Mr. Fusion API</title>
|
||||
<title>Chronograf API</title>
|
||||
<!-- needed for adaptive design -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!--
|
||||
|
|
|
@ -5,15 +5,15 @@ import (
|
|||
"strconv"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
|
||||
op "github.com/influxdata/mrfusion/restapi/operations"
|
||||
op "github.com/influxdata/chronograf/restapi/operations"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
func (h *Store) NewSource(ctx context.Context, params op.PostSourcesParams) middleware.Responder {
|
||||
src := mrfusion.Source{
|
||||
src := chronograf.Source{
|
||||
Name: *params.Source.Name,
|
||||
Type: params.Source.Type,
|
||||
Username: params.Source.Username,
|
||||
|
@ -41,7 +41,7 @@ func srcLinks(id int) *models.SourceLinks {
|
|||
}
|
||||
}
|
||||
|
||||
func mrToModel(src mrfusion.Source) *models.Source {
|
||||
func mrToModel(src chronograf.Source) *models.Source {
|
||||
return &models.Source{
|
||||
ID: strconv.Itoa(src.ID),
|
||||
Links: srcLinks(src.ID),
|
||||
|
@ -95,7 +95,7 @@ func (h *Store) RemoveSource(ctx context.Context, params op.DeleteSourcesIDParam
|
|||
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.ID)}
|
||||
return op.NewDeleteSourcesIDDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
src := mrfusion.Source{
|
||||
src := chronograf.Source{
|
||||
ID: id,
|
||||
}
|
||||
if err = h.SourcesStore.Delete(ctx, src); err != nil {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package handlers
|
||||
|
||||
import "github.com/influxdata/mrfusion"
|
||||
import "github.com/influxdata/chronograf"
|
||||
|
||||
// Store handles REST calls to the persistence
|
||||
type Store struct {
|
||||
ExplorationStore mrfusion.ExplorationStore
|
||||
SourcesStore mrfusion.SourcesStore
|
||||
ServersStore mrfusion.ServersStore
|
||||
LayoutStore mrfusion.LayoutStore
|
||||
ExplorationStore chronograf.ExplorationStore
|
||||
SourcesStore chronograf.SourcesStore
|
||||
ServersStore chronograf.ServersStore
|
||||
LayoutStore chronograf.LayoutStore
|
||||
}
|
||||
|
|
2
id.go
2
id.go
|
@ -1,4 +1,4 @@
|
|||
package mrfusion
|
||||
package chronograf
|
||||
|
||||
// ID creates uniq ID string
|
||||
type ID interface {
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/chronograf"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
@ -15,13 +15,13 @@ import (
|
|||
type Client struct {
|
||||
URL *url.URL
|
||||
|
||||
lg mrfusion.Logger
|
||||
lg chronograf.Logger
|
||||
}
|
||||
|
||||
// NewClient initializes an HTTP Client for InfluxDB. UDP, although supported
|
||||
// for querying InfluxDB, is not supported here to remove the need to
|
||||
// explicitly Close the client.
|
||||
func NewClient(host string, lg mrfusion.Logger) (*Client, error) {
|
||||
func NewClient(host string, lg chronograf.Logger) (*Client, error) {
|
||||
l := lg.WithField("host", host)
|
||||
u, err := url.Parse(host)
|
||||
if err != nil {
|
||||
|
@ -43,7 +43,7 @@ func (r Response) MarshalJSON() ([]byte, error) {
|
|||
return r.Results, nil
|
||||
}
|
||||
|
||||
func (c *Client) query(u *url.URL, q mrfusion.Query) (mrfusion.Response, error) {
|
||||
func (c *Client) query(u *url.URL, q chronograf.Query) (chronograf.Response, error) {
|
||||
u.Path = "query"
|
||||
|
||||
req, err := http.NewRequest("POST", u.String(), nil)
|
||||
|
@ -99,7 +99,7 @@ func (c *Client) query(u *url.URL, q mrfusion.Query) (mrfusion.Response, error)
|
|||
}
|
||||
|
||||
type result struct {
|
||||
Response mrfusion.Response
|
||||
Response chronograf.Response
|
||||
Err error
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ type result struct {
|
|||
// information specified by query. Queries must be "fully-qualified," and
|
||||
// include both the database and retention policy. In-flight requests can be
|
||||
// cancelled using the provided context.
|
||||
func (c *Client) Query(ctx context.Context, q mrfusion.Query) (mrfusion.Response, error) {
|
||||
func (c *Client) Query(ctx context.Context, q chronograf.Query) (chronograf.Response, error) {
|
||||
resps := make(chan (result))
|
||||
go func() {
|
||||
resp, err := c.query(c.URL, q)
|
||||
|
@ -118,17 +118,17 @@ func (c *Client) Query(ctx context.Context, q mrfusion.Query) (mrfusion.Response
|
|||
case resp := <-resps:
|
||||
return resp.Response, resp.Err
|
||||
case <-ctx.Done():
|
||||
return nil, mrfusion.ErrUpstreamTimeout
|
||||
return nil, chronograf.ErrUpstreamTimeout
|
||||
}
|
||||
}
|
||||
|
||||
// MonitoredServices returns all services for which this instance of InfluxDB
|
||||
// has time series information stored for.
|
||||
func (c *Client) MonitoredServices(ctx context.Context) ([]mrfusion.MonitoredService, error) {
|
||||
return []mrfusion.MonitoredService{}, nil
|
||||
func (c *Client) MonitoredServices(ctx context.Context) ([]chronograf.MonitoredService, error) {
|
||||
return []chronograf.MonitoredService{}, nil
|
||||
}
|
||||
|
||||
func (c *Client) Connect(ctx context.Context, src *mrfusion.Source) error {
|
||||
func (c *Client) Connect(ctx context.Context, src *chronograf.Source) error {
|
||||
u, err := url.Parse(src.URL[0])
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/influx"
|
||||
"github.com/influxdata/mrfusion/log"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/influx"
|
||||
"github.com/influxdata/chronograf/log"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
@ -25,13 +25,13 @@ func Test_Influx_MakesRequestsToQueryEndpoint(t *testing.T) {
|
|||
}))
|
||||
defer ts.Close()
|
||||
|
||||
var series mrfusion.TimeSeries
|
||||
var series chronograf.TimeSeries
|
||||
series, err := influx.NewClient(ts.URL, log.New())
|
||||
if err != nil {
|
||||
t.Fatal("Unexpected error initializing client: err:", err)
|
||||
}
|
||||
|
||||
query := mrfusion.Query{
|
||||
query := chronograf.Query{
|
||||
Command: "show databases",
|
||||
}
|
||||
_, err = series.Query(context.Background(), query)
|
||||
|
@ -64,7 +64,7 @@ func Test_Influx_CancelsInFlightRequests(t *testing.T) {
|
|||
|
||||
errs := make(chan (error))
|
||||
go func() {
|
||||
query := mrfusion.Query{
|
||||
query := chronograf.Query{
|
||||
Command: "show databases",
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ func Test_Influx_CancelsInFlightRequests(t *testing.T) {
|
|||
}
|
||||
|
||||
err := <-errs
|
||||
if err != mrfusion.ErrUpstreamTimeout {
|
||||
if err != chronograf.ErrUpstreamTimeout {
|
||||
t.Error("Expected timeout error but wasn't. err was", err)
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ func Test_Influx_ReportsInfluxErrs(t *testing.T) {
|
|||
t.Fatal("Encountered unexpected error while initializing influx client: err:", err)
|
||||
}
|
||||
|
||||
_, err = cl.Query(context.Background(), mrfusion.Query{"show shards", "_internal", "autogen"})
|
||||
_, err = cl.Query(context.Background(), chronograf.Query{"show shards", "_internal", "autogen"})
|
||||
if err == nil {
|
||||
t.Fatal("Expected an error but received none")
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"net/http"
|
||||
"net/url"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/chronograf"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
@ -15,7 +15,7 @@ type Proxy struct {
|
|||
URL *url.URL
|
||||
}
|
||||
|
||||
func (p *Proxy) Do(ctx context.Context, req *mrfusion.Request) (*http.Response, error) {
|
||||
func (p *Proxy) Do(ctx context.Context, req *chronograf.Request) (*http.Response, error) {
|
||||
// TODO: Locking?
|
||||
p.URL.Path = req.Path
|
||||
|
||||
|
@ -29,7 +29,7 @@ func (p *Proxy) Do(ctx context.Context, req *mrfusion.Request) (*http.Response,
|
|||
return httpClient.Do(httpReq)
|
||||
}
|
||||
|
||||
func (p *Proxy) Connect(ctx context.Context, srv *mrfusion.Server) error {
|
||||
func (p *Proxy) Connect(ctx context.Context, srv *chronograf.Server) error {
|
||||
u, err := url.Parse(srv.URL)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package layouts
|
||||
|
||||
import (
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/chronograf"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
@ -9,12 +9,12 @@ import (
|
|||
// The All method will return the set of all Layouts.
|
||||
// Each method will be tried against the Stores slice serially.
|
||||
type MultiLayoutStore struct {
|
||||
Stores []mrfusion.LayoutStore
|
||||
Stores []chronograf.LayoutStore
|
||||
}
|
||||
|
||||
// All returns the set of all layouts
|
||||
func (s *MultiLayoutStore) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
||||
all := []mrfusion.Layout{}
|
||||
func (s *MultiLayoutStore) All(ctx context.Context) ([]chronograf.Layout, error) {
|
||||
all := []chronograf.Layout{}
|
||||
ok := false
|
||||
var err error
|
||||
for _, store := range s.Stores {
|
||||
|
@ -33,21 +33,21 @@ func (s *MultiLayoutStore) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
|||
}
|
||||
|
||||
// Add creates a new dashboard in the LayoutStore. Tries each store sequentially until success.
|
||||
func (s *MultiLayoutStore) Add(ctx context.Context, layout mrfusion.Layout) (mrfusion.Layout, error) {
|
||||
func (s *MultiLayoutStore) Add(ctx context.Context, layout chronograf.Layout) (chronograf.Layout, error) {
|
||||
var err error
|
||||
for _, store := range s.Stores {
|
||||
var l mrfusion.Layout
|
||||
var l chronograf.Layout
|
||||
l, err = store.Add(ctx, layout)
|
||||
if err == nil {
|
||||
return l, nil
|
||||
}
|
||||
}
|
||||
return mrfusion.Layout{}, err
|
||||
return chronograf.Layout{}, err
|
||||
}
|
||||
|
||||
// Delete the dashboard from the store. Searches through all stores to find Layout and
|
||||
// then deletes from that store.
|
||||
func (s *MultiLayoutStore) Delete(ctx context.Context, layout mrfusion.Layout) error {
|
||||
func (s *MultiLayoutStore) Delete(ctx context.Context, layout chronograf.Layout) error {
|
||||
var err error
|
||||
for _, store := range s.Stores {
|
||||
err = store.Delete(ctx, layout)
|
||||
|
@ -59,20 +59,20 @@ func (s *MultiLayoutStore) Delete(ctx context.Context, layout mrfusion.Layout) e
|
|||
}
|
||||
|
||||
// Get retrieves Layout if `ID` exists. Searches through each store sequentially until success.
|
||||
func (s *MultiLayoutStore) Get(ctx context.Context, ID string) (mrfusion.Layout, error) {
|
||||
func (s *MultiLayoutStore) Get(ctx context.Context, ID string) (chronograf.Layout, error) {
|
||||
var err error
|
||||
for _, store := range s.Stores {
|
||||
var l mrfusion.Layout
|
||||
var l chronograf.Layout
|
||||
l, err = store.Get(ctx, ID)
|
||||
if err == nil {
|
||||
return l, nil
|
||||
}
|
||||
}
|
||||
return mrfusion.Layout{}, err
|
||||
return chronograf.Layout{}, err
|
||||
}
|
||||
|
||||
// Update the dashboard in the store. Searches through each store sequentially until success.
|
||||
func (s *MultiLayoutStore) Update(ctx context.Context, layout mrfusion.Layout) error {
|
||||
func (s *MultiLayoutStore) Update(ctx context.Context, layout chronograf.Layout) error {
|
||||
var err error
|
||||
for _, store := range s.Stores {
|
||||
err = store.Update(ctx, layout)
|
||||
|
|
2
log.go
2
log.go
|
@ -1,4 +1,4 @@
|
|||
package mrfusion
|
||||
package chronograf
|
||||
|
||||
// Logger represents an abstracted structured logging implementation. It
|
||||
// provides methods to trigger log messages at various alert levels and a
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/chronograf"
|
||||
)
|
||||
|
||||
// LogrusLogger is a mrfusion.Logger that uses logrus to process logs
|
||||
// LogrusLogger is a chronograf.Logger that uses logrus to process logs
|
||||
type logrusLogger struct {
|
||||
l *logrus.Entry
|
||||
}
|
||||
|
@ -32,11 +32,11 @@ func (ll *logrusLogger) Error(items ...interface{}) {
|
|||
ll.l.Error(items...)
|
||||
}
|
||||
|
||||
func (ll *logrusLogger) WithField(key string, value interface{}) mrfusion.Logger {
|
||||
func (ll *logrusLogger) WithField(key string, value interface{}) chronograf.Logger {
|
||||
return &logrusLogger{ll.l.WithField(key, value)}
|
||||
}
|
||||
|
||||
func New() mrfusion.Logger {
|
||||
func New() chronograf.Logger {
|
||||
logger := &logrus.Logger{
|
||||
Out: os.Stderr,
|
||||
Formatter: new(logrus.TextFormatter),
|
||||
|
|
|
@ -8,16 +8,16 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
op "github.com/influxdata/mrfusion/restapi/operations"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
op "github.com/influxdata/chronograf/restapi/operations"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type Handler struct {
|
||||
Store mrfusion.ExplorationStore
|
||||
Srcs mrfusion.SourcesStore
|
||||
TimeSeries mrfusion.TimeSeries
|
||||
Store chronograf.ExplorationStore
|
||||
Srcs chronograf.SourcesStore
|
||||
TimeSeries chronograf.TimeSeries
|
||||
}
|
||||
|
||||
func NewHandler() Handler {
|
||||
|
@ -40,7 +40,7 @@ func (m *Handler) AllRoutes(ctx context.Context, params op.GetParams) middleware
|
|||
}
|
||||
|
||||
func (m *Handler) NewSource(ctx context.Context, params op.PostSourcesParams) middleware.Responder {
|
||||
src := mrfusion.Source{
|
||||
src := chronograf.Source{
|
||||
Name: *params.Source.Name,
|
||||
Type: params.Source.Type,
|
||||
Username: params.Source.Username,
|
||||
|
@ -67,7 +67,7 @@ func srcLinks(id int) *models.SourceLinks {
|
|||
}
|
||||
}
|
||||
|
||||
func mrToModel(src mrfusion.Source) *models.Source {
|
||||
func mrToModel(src chronograf.Source) *models.Source {
|
||||
return &models.Source{
|
||||
ID: strconv.Itoa(src.ID),
|
||||
Links: srcLinks(src.ID),
|
||||
|
@ -121,7 +121,7 @@ func (m *Handler) RemoveSource(ctx context.Context, params op.DeleteSourcesIDPar
|
|||
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.ID)}
|
||||
return op.NewDeleteSourcesIDDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
src := mrfusion.Source{
|
||||
src := chronograf.Source{
|
||||
ID: id,
|
||||
}
|
||||
if err = m.Srcs.Delete(ctx, src); err != nil {
|
||||
|
@ -199,12 +199,12 @@ func (m *Handler) Proxy(ctx context.Context, params op.PostSourcesIDProxyParams)
|
|||
errMsg := &models.Error{Code: 400, Message: fmt.Sprintf("Unable to connect to source %s", params.ID)}
|
||||
return op.NewPostSourcesIDProxyNotFound().WithPayload(errMsg)
|
||||
}
|
||||
query := mrfusion.Query{
|
||||
query := chronograf.Query{
|
||||
Command: *params.Query.Query,
|
||||
DB: params.Query.Db,
|
||||
RP: params.Query.Rp,
|
||||
}
|
||||
response, err := m.TimeSeries.Query(ctx, mrfusion.Query(query))
|
||||
response, err := m.TimeSeries.Query(ctx, chronograf.Query(query))
|
||||
if err != nil {
|
||||
return op.NewPostSourcesIDProxyDefault(500)
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ func (m *Handler) Explorations(ctx context.Context, params op.GetSourcesIDUsersU
|
|||
if err != nil {
|
||||
return op.NewGetSourcesIDUsersUserIDExplorationsDefault(500)
|
||||
}
|
||||
exs, err := m.Store.Query(ctx, mrfusion.UserID(id))
|
||||
exs, err := m.Store.Query(ctx, chronograf.UserID(id))
|
||||
if err != nil {
|
||||
return op.NewGetSourcesIDUsersUserIDExplorationsNotFound()
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ func (m *Handler) Exploration(ctx context.Context, params op.GetSourcesIDUsersUs
|
|||
return op.NewGetSourcesIDUsersUserIDExplorationsExplorationIDDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
e, err := m.Store.Get(ctx, mrfusion.ExplorationID(eID))
|
||||
e, err := m.Store.Get(ctx, chronograf.ExplorationID(eID))
|
||||
if err != nil {
|
||||
log.Printf("Error unknown exploration id: %d: %v", eID, err)
|
||||
errMsg := &models.Error{Code: 404, Message: "Error unknown exploration id"}
|
||||
|
@ -284,14 +284,14 @@ func (m *Handler) UpdateExploration(ctx context.Context, params op.PatchSourcesI
|
|||
return op.NewPatchSourcesIDUsersUserIDExplorationsExplorationIDDefault(500)
|
||||
}
|
||||
|
||||
e, err := m.Store.Get(ctx, mrfusion.ExplorationID(eID))
|
||||
e, err := m.Store.Get(ctx, chronograf.ExplorationID(eID))
|
||||
if err != nil {
|
||||
log.Printf("Error unknown exploration id: %d: %v", eID, err)
|
||||
errMsg := &models.Error{Code: 404, Message: "Error unknown exploration id"}
|
||||
return op.NewPatchSourcesIDUsersUserIDExplorationsExplorationIDNotFound().WithPayload(errMsg)
|
||||
}
|
||||
if params.Exploration != nil {
|
||||
e.ID = mrfusion.ExplorationID(eID)
|
||||
e.ID = chronograf.ExplorationID(eID)
|
||||
e.Data = params.Exploration.Data.(string)
|
||||
e.Name = params.Exploration.Name
|
||||
m.Store.Update(ctx, e)
|
||||
|
@ -305,7 +305,7 @@ func (m *Handler) NewExploration(ctx context.Context, params op.PostSourcesIDUse
|
|||
return op.NewPostSourcesIDUsersUserIDExplorationsDefault(500)
|
||||
}
|
||||
|
||||
exs, err := m.Store.Query(ctx, mrfusion.UserID(id))
|
||||
exs, err := m.Store.Query(ctx, chronograf.UserID(id))
|
||||
if err != nil {
|
||||
log.Printf("Error unknown user id: %d: %v", id, err)
|
||||
errMsg := &models.Error{Code: 404, Message: "Error unknown user id"}
|
||||
|
@ -314,10 +314,10 @@ func (m *Handler) NewExploration(ctx context.Context, params op.PostSourcesIDUse
|
|||
eID := len(exs)
|
||||
|
||||
if params.Exploration != nil {
|
||||
e := mrfusion.Exploration{
|
||||
e := chronograf.Exploration{
|
||||
Data: params.Exploration.Data.(string),
|
||||
Name: params.Exploration.Name,
|
||||
ID: mrfusion.ExplorationID(eID),
|
||||
ID: chronograf.ExplorationID(eID),
|
||||
}
|
||||
m.Store.Add(ctx, &e)
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ func (m *Handler) DeleteExploration(ctx context.Context, params op.DeleteSources
|
|||
return op.NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDDefault(500)
|
||||
}
|
||||
|
||||
if err := m.Store.Delete(ctx, &mrfusion.Exploration{ID: mrfusion.ExplorationID(ID)}); err != nil {
|
||||
if err := m.Store.Delete(ctx, &chronograf.Exploration{ID: chronograf.ExplorationID(ID)}); err != nil {
|
||||
log.Printf("Error unknown explorations id: %d: %v", ID, err)
|
||||
errMsg := &models.Error{Code: 404, Message: "Error unknown user id"}
|
||||
return op.NewDeleteSourcesIDUsersUserIDExplorationsExplorationIDNotFound().WithPayload(errMsg)
|
||||
|
|
86
mock/mock.go
86
mock/mock.go
|
@ -5,29 +5,29 @@ import (
|
|||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/chronograf"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
type SourcesStore struct {
|
||||
srcs map[int]mrfusion.Source
|
||||
srcs map[int]chronograf.Source
|
||||
}
|
||||
|
||||
func NewSourcesStore() mrfusion.SourcesStore {
|
||||
func NewSourcesStore() chronograf.SourcesStore {
|
||||
return &SourcesStore{
|
||||
srcs: map[int]mrfusion.Source{},
|
||||
srcs: map[int]chronograf.Source{},
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SourcesStore) All(ctx context.Context) ([]mrfusion.Source, error) {
|
||||
all := []mrfusion.Source{}
|
||||
func (s *SourcesStore) All(ctx context.Context) ([]chronograf.Source, error) {
|
||||
all := []chronograf.Source{}
|
||||
for _, src := range s.srcs {
|
||||
all = append(all, src)
|
||||
}
|
||||
return all, nil
|
||||
}
|
||||
|
||||
func (s *SourcesStore) Add(ctx context.Context, src mrfusion.Source) (mrfusion.Source, error) {
|
||||
func (s *SourcesStore) Add(ctx context.Context, src chronograf.Source) (chronograf.Source, error) {
|
||||
id := len(s.srcs) + 1
|
||||
for k, _ := range s.srcs {
|
||||
if k >= id {
|
||||
|
@ -40,7 +40,7 @@ func (s *SourcesStore) Add(ctx context.Context, src mrfusion.Source) (mrfusion.S
|
|||
return src, nil
|
||||
}
|
||||
|
||||
func (s *SourcesStore) Delete(ctx context.Context, src mrfusion.Source) error {
|
||||
func (s *SourcesStore) Delete(ctx context.Context, src chronograf.Source) error {
|
||||
if _, ok := s.srcs[src.ID]; !ok {
|
||||
return fmt.Errorf("Error unknown id %d", src.ID)
|
||||
}
|
||||
|
@ -48,14 +48,14 @@ func (s *SourcesStore) Delete(ctx context.Context, src mrfusion.Source) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *SourcesStore) Get(ctx context.Context, ID int) (mrfusion.Source, error) {
|
||||
func (s *SourcesStore) Get(ctx context.Context, ID int) (chronograf.Source, error) {
|
||||
if src, ok := s.srcs[ID]; ok {
|
||||
return src, nil
|
||||
}
|
||||
return mrfusion.Source{}, fmt.Errorf("Error no such source %d", ID)
|
||||
return chronograf.Source{}, fmt.Errorf("Error no such source %d", ID)
|
||||
}
|
||||
|
||||
func (s *SourcesStore) Update(ctx context.Context, src mrfusion.Source) error {
|
||||
func (s *SourcesStore) Update(ctx context.Context, src chronograf.Source) error {
|
||||
if _, ok := s.srcs[src.ID]; !ok {
|
||||
return fmt.Errorf("Error unknown ID %d", src.ID)
|
||||
}
|
||||
|
@ -63,25 +63,25 @@ func (s *SourcesStore) Update(ctx context.Context, src mrfusion.Source) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var DefaultSourcesStore mrfusion.SourcesStore = NewSourcesStore()
|
||||
var DefaultSourcesStore chronograf.SourcesStore = NewSourcesStore()
|
||||
|
||||
type ExplorationStore struct {
|
||||
db map[int]*mrfusion.Exploration
|
||||
db map[int]*chronograf.Exploration
|
||||
NowFunc func() time.Time
|
||||
}
|
||||
|
||||
func NewExplorationStore(nowFunc func() time.Time) mrfusion.ExplorationStore {
|
||||
func NewExplorationStore(nowFunc func() time.Time) chronograf.ExplorationStore {
|
||||
e := ExplorationStore{
|
||||
NowFunc: nowFunc,
|
||||
db: map[int]*mrfusion.Exploration{},
|
||||
db: map[int]*chronograf.Exploration{},
|
||||
}
|
||||
e.db[0] = &mrfusion.Exploration{
|
||||
e.db[0] = &chronograf.Exploration{
|
||||
Name: "Ferdinand Magellan",
|
||||
Data: "{\"panels\":{\"123\":{\"id\":\"123\",\"queryIds\":[\"456\"]}},\"queryConfigs\":{\"456\":{\"id\":\"456\",\"database\":null,\"measurement\":null,\"retentionPolicy\":null,\"fields\":[],\"tags\":{},\"groupBy\":{\"time\":null,\"tags\":[]},\"areTagsAccepted\":true,\"rawText\":null}}}",
|
||||
CreatedAt: nowFunc(),
|
||||
UpdatedAt: nowFunc(),
|
||||
}
|
||||
e.db[1] = &mrfusion.Exploration{
|
||||
e.db[1] = &chronograf.Exploration{
|
||||
Name: "Your Mom",
|
||||
Data: "{\"panels\":{\"123\":{\"id\":\"123\",\"queryIds\":[\"456\"]}},\"queryConfigs\":{\"456\":{\"id\":\"456\",\"database\":null,\"measurement\":null,\"retentionPolicy\":null,\"fields\":[],\"tags\":{},\"groupBy\":{\"time\":null,\"tags\":[]},\"areTagsAccepted\":true,\"rawText\":null}}}",
|
||||
CreatedAt: nowFunc(),
|
||||
|
@ -91,29 +91,29 @@ func NewExplorationStore(nowFunc func() time.Time) mrfusion.ExplorationStore {
|
|||
return &e
|
||||
}
|
||||
|
||||
var DefaultExplorationStore mrfusion.ExplorationStore = NewExplorationStore(time.Now)
|
||||
var DefaultExplorationStore chronograf.ExplorationStore = NewExplorationStore(time.Now)
|
||||
|
||||
func (m *ExplorationStore) Query(ctx context.Context, userID mrfusion.UserID) ([]*mrfusion.Exploration, error) {
|
||||
res := []*mrfusion.Exploration{}
|
||||
func (m *ExplorationStore) Query(ctx context.Context, userID chronograf.UserID) ([]*chronograf.Exploration, error) {
|
||||
res := []*chronograf.Exploration{}
|
||||
for _, v := range m.db {
|
||||
res = append(res, v)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (m *ExplorationStore) Add(ctx context.Context, e *mrfusion.Exploration) (*mrfusion.Exploration, error) {
|
||||
func (m *ExplorationStore) Add(ctx context.Context, e *chronograf.Exploration) (*chronograf.Exploration, error) {
|
||||
e.CreatedAt = m.NowFunc()
|
||||
e.UpdatedAt = m.NowFunc()
|
||||
m.db[len(m.db)] = e
|
||||
return e, nil
|
||||
}
|
||||
|
||||
func (m *ExplorationStore) Delete(ctx context.Context, e *mrfusion.Exploration) error {
|
||||
func (m *ExplorationStore) Delete(ctx context.Context, e *chronograf.Exploration) error {
|
||||
delete(m.db, int(e.ID))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *ExplorationStore) Get(ctx context.Context, ID mrfusion.ExplorationID) (*mrfusion.Exploration, error) {
|
||||
func (m *ExplorationStore) Get(ctx context.Context, ID chronograf.ExplorationID) (*chronograf.Exploration, error) {
|
||||
e, ok := m.db[int(ID)]
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("Unknown ID %d", ID)
|
||||
|
@ -121,7 +121,7 @@ func (m *ExplorationStore) Get(ctx context.Context, ID mrfusion.ExplorationID) (
|
|||
return e, nil
|
||||
}
|
||||
|
||||
func (m *ExplorationStore) Update(ctx context.Context, e *mrfusion.Exploration) error {
|
||||
func (m *ExplorationStore) Update(ctx context.Context, e *chronograf.Exploration) error {
|
||||
_, ok := m.db[int(e.ID)]
|
||||
if !ok {
|
||||
return fmt.Errorf("Unknown ID %d", e.ID)
|
||||
|
@ -140,28 +140,28 @@ func (r *Response) MarshalJSON() ([]byte, error) {
|
|||
|
||||
type TimeSeries struct {
|
||||
Hosts []string
|
||||
Response mrfusion.Response
|
||||
Response chronograf.Response
|
||||
}
|
||||
|
||||
func NewTimeSeries(hosts []string, response mrfusion.Response) mrfusion.TimeSeries {
|
||||
func NewTimeSeries(hosts []string, response chronograf.Response) chronograf.TimeSeries {
|
||||
return &TimeSeries{
|
||||
Hosts: hosts,
|
||||
Response: response,
|
||||
}
|
||||
}
|
||||
|
||||
var DefaultTimeSeries mrfusion.TimeSeries = NewTimeSeries([]string{"hydrogen", "helium", "hadron", "howdy"}, &Response{})
|
||||
var DefaultTimeSeries chronograf.TimeSeries = NewTimeSeries([]string{"hydrogen", "helium", "hadron", "howdy"}, &Response{})
|
||||
|
||||
func (t *TimeSeries) Query(context.Context, mrfusion.Query) (mrfusion.Response, error) {
|
||||
func (t *TimeSeries) Query(context.Context, chronograf.Query) (chronograf.Response, error) {
|
||||
return t.Response, nil
|
||||
}
|
||||
|
||||
func (t *TimeSeries) Connect(ctx context.Context, src *mrfusion.Source) error {
|
||||
func (t *TimeSeries) Connect(ctx context.Context, src *chronograf.Source) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *TimeSeries) MonitoredServices(context.Context) ([]mrfusion.MonitoredService, error) {
|
||||
hosts := make([]mrfusion.MonitoredService, len(t.Hosts))
|
||||
func (t *TimeSeries) MonitoredServices(context.Context) ([]chronograf.MonitoredService, error) {
|
||||
hosts := make([]chronograf.MonitoredService, len(t.Hosts))
|
||||
for i, name := range t.Hosts {
|
||||
hosts[i].Type = "host"
|
||||
hosts[i].TagKey = "host"
|
||||
|
@ -171,7 +171,7 @@ func (t *TimeSeries) MonitoredServices(context.Context) ([]mrfusion.MonitoredSer
|
|||
}
|
||||
|
||||
type LayoutStore struct {
|
||||
Layouts map[string]mrfusion.Layout
|
||||
Layouts map[string]chronograf.Layout
|
||||
AllError error
|
||||
AddError error
|
||||
DeleteError error
|
||||
|
@ -180,11 +180,11 @@ type LayoutStore struct {
|
|||
}
|
||||
|
||||
// All will return all info in the map or whatever is AllError
|
||||
func (l *LayoutStore) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
||||
func (l *LayoutStore) All(ctx context.Context) ([]chronograf.Layout, error) {
|
||||
if l.AllError != nil {
|
||||
return nil, l.AllError
|
||||
}
|
||||
layouts := []mrfusion.Layout{}
|
||||
layouts := []chronograf.Layout{}
|
||||
for _, l := range l.Layouts {
|
||||
layouts = append(layouts, l)
|
||||
}
|
||||
|
@ -192,9 +192,9 @@ func (l *LayoutStore) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
|||
}
|
||||
|
||||
// Add create a new ID and add to map or return AddError
|
||||
func (l *LayoutStore) Add(ctx context.Context, layout mrfusion.Layout) (mrfusion.Layout, error) {
|
||||
func (l *LayoutStore) Add(ctx context.Context, layout chronograf.Layout) (chronograf.Layout, error) {
|
||||
if l.AddError != nil {
|
||||
return mrfusion.Layout{}, l.AddError
|
||||
return chronograf.Layout{}, l.AddError
|
||||
}
|
||||
id := strconv.Itoa(len(l.Layouts))
|
||||
layout.ID = id
|
||||
|
@ -203,14 +203,14 @@ func (l *LayoutStore) Add(ctx context.Context, layout mrfusion.Layout) (mrfusion
|
|||
}
|
||||
|
||||
// Delete will remove layout from map or return DeleteError
|
||||
func (l *LayoutStore) Delete(ctx context.Context, layout mrfusion.Layout) error {
|
||||
func (l *LayoutStore) Delete(ctx context.Context, layout chronograf.Layout) error {
|
||||
if l.DeleteError != nil {
|
||||
return l.DeleteError
|
||||
}
|
||||
|
||||
id := layout.ID
|
||||
if _, ok := l.Layouts[id]; !ok {
|
||||
return mrfusion.ErrLayoutNotFound
|
||||
return chronograf.ErrLayoutNotFound
|
||||
}
|
||||
|
||||
delete(l.Layouts, id)
|
||||
|
@ -218,26 +218,26 @@ func (l *LayoutStore) Delete(ctx context.Context, layout mrfusion.Layout) error
|
|||
}
|
||||
|
||||
// Get will return map with key ID or GetError
|
||||
func (l *LayoutStore) Get(ctx context.Context, ID string) (mrfusion.Layout, error) {
|
||||
func (l *LayoutStore) Get(ctx context.Context, ID string) (chronograf.Layout, error) {
|
||||
if l.GetError != nil {
|
||||
return mrfusion.Layout{}, l.GetError
|
||||
return chronograf.Layout{}, l.GetError
|
||||
}
|
||||
|
||||
if layout, ok := l.Layouts[ID]; !ok {
|
||||
return mrfusion.Layout{}, mrfusion.ErrLayoutNotFound
|
||||
return chronograf.Layout{}, chronograf.ErrLayoutNotFound
|
||||
} else {
|
||||
return layout, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Update will update layout or return UpdateError
|
||||
func (l *LayoutStore) Update(ctx context.Context, layout mrfusion.Layout) error {
|
||||
func (l *LayoutStore) Update(ctx context.Context, layout chronograf.Layout) error {
|
||||
if l.UpdateError != nil {
|
||||
return l.UpdateError
|
||||
}
|
||||
id := layout.ID
|
||||
if _, ok := l.Layouts[id]; !ok {
|
||||
return mrfusion.ErrLayoutNotFound
|
||||
return chronograf.ErrLayoutNotFound
|
||||
} else {
|
||||
l.Layouts[id] = layout
|
||||
}
|
||||
|
|
|
@ -12,39 +12,39 @@ import (
|
|||
"github.com/go-openapi/swag"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/bolt"
|
||||
"github.com/influxdata/mrfusion/canned"
|
||||
"github.com/influxdata/mrfusion/dist"
|
||||
"github.com/influxdata/mrfusion/handlers"
|
||||
"github.com/influxdata/mrfusion/influx"
|
||||
"github.com/influxdata/mrfusion/kapacitor"
|
||||
"github.com/influxdata/mrfusion/layouts"
|
||||
fusionlog "github.com/influxdata/mrfusion/log"
|
||||
"github.com/influxdata/mrfusion/mock"
|
||||
op "github.com/influxdata/mrfusion/restapi/operations"
|
||||
"github.com/influxdata/mrfusion/uuid"
|
||||
"github.com/influxdata/chronograf"
|
||||
"github.com/influxdata/chronograf/bolt"
|
||||
"github.com/influxdata/chronograf/canned"
|
||||
"github.com/influxdata/chronograf/dist"
|
||||
"github.com/influxdata/chronograf/handlers"
|
||||
"github.com/influxdata/chronograf/influx"
|
||||
"github.com/influxdata/chronograf/kapacitor"
|
||||
"github.com/influxdata/chronograf/layouts"
|
||||
clog "github.com/influxdata/chronograf/log"
|
||||
"github.com/influxdata/chronograf/mock"
|
||||
op "github.com/influxdata/chronograf/restapi/operations"
|
||||
"github.com/influxdata/chronograf/uuid"
|
||||
)
|
||||
|
||||
// This file is safe to edit. Once it exists it will not be overwritten
|
||||
|
||||
//go:generate swagger generate server --target .. --name --spec ../swagger.yaml --with-context
|
||||
|
||||
var logger = fusionlog.New()
|
||||
var logger = clog.New()
|
||||
|
||||
var devFlags = struct {
|
||||
Develop bool `short:"d" long:"develop" description:"Run server in develop mode."`
|
||||
}{}
|
||||
|
||||
var storeFlags = struct {
|
||||
BoltPath string `short:"b" long:"bolt-path" description:"Full path to boltDB file (/Users/somebody/mrfusion.db)" env:"BOLT_PATH" default:"chronograf.db"`
|
||||
BoltPath string `short:"b" long:"bolt-path" description:"Full path to boltDB file (/Users/somebody/chronograf.db)" env:"BOLT_PATH" default:"chronograf.db"`
|
||||
}{}
|
||||
|
||||
var cannedFlags = struct {
|
||||
CannedPath string `short:"c" long:"canned-path" description:"Path to directory of pre-canned application layouts" env:"CANNED_PATH" default:"canned"`
|
||||
}{}
|
||||
|
||||
func configureFlags(api *op.MrFusionAPI) {
|
||||
func configureFlags(api *op.ChronografAPI) {
|
||||
api.CommandLineOptionsGroups = []swag.CommandLineOptionsGroup{
|
||||
swag.CommandLineOptionsGroup{
|
||||
ShortDescription: "Develop Mode server",
|
||||
|
@ -64,7 +64,7 @@ func configureFlags(api *op.MrFusionAPI) {
|
|||
}
|
||||
}
|
||||
|
||||
func assets() mrfusion.Assets {
|
||||
func assets() chronograf.Assets {
|
||||
if devFlags.Develop {
|
||||
return &dist.DebugAssets{
|
||||
Dir: "ui/build",
|
||||
|
@ -77,7 +77,7 @@ func assets() mrfusion.Assets {
|
|||
}
|
||||
}
|
||||
|
||||
func configureAPI(api *op.MrFusionAPI) http.Handler {
|
||||
func configureAPI(api *op.ChronografAPI) http.Handler {
|
||||
// configure the api here
|
||||
api.ServeError = errors.ServeError
|
||||
|
||||
|
@ -110,7 +110,7 @@ func configureAPI(api *op.MrFusionAPI) http.Handler {
|
|||
|
||||
// allLayouts acts as a front-end to both the bolt layouts and the filesystem layouts.
|
||||
allLayouts := &layouts.MultiLayoutStore{
|
||||
Stores: []mrfusion.LayoutStore{
|
||||
Stores: []chronograf.LayoutStore{
|
||||
c.LayoutStore,
|
||||
apps,
|
||||
},
|
|
@ -1,11 +1,11 @@
|
|||
/*Package restapi Mr Fusion
|
||||
/*Package restapi Chronograf
|
||||
|
||||
Fuel for Chronograf
|
||||
API endpoints for Chronograf
|
||||
|
||||
|
||||
Schemes:
|
||||
http
|
||||
Host: Chronograf.influxdata.com
|
||||
Host: chronograf.influxdata.com
|
||||
BasePath: /chronograf/v1
|
||||
Version: 1.1.0
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ import (
|
|||
"github.com/go-openapi/swag"
|
||||
)
|
||||
|
||||
// NewMrFusionAPI creates a new MrFusion instance
|
||||
func NewMrFusionAPI(spec *loads.Document) *MrFusionAPI {
|
||||
return &MrFusionAPI{
|
||||
// NewChronografAPI creates a new Chronograf instance
|
||||
func NewChronografAPI(spec *loads.Document) *ChronografAPI {
|
||||
return &ChronografAPI{
|
||||
handlers: make(map[string]map[string]http.Handler),
|
||||
formats: strfmt.Default,
|
||||
defaultConsumes: "application/json",
|
||||
|
@ -28,8 +28,8 @@ func NewMrFusionAPI(spec *loads.Document) *MrFusionAPI {
|
|||
}
|
||||
}
|
||||
|
||||
/*MrFusionAPI Fuel for Chronograf */
|
||||
type MrFusionAPI struct {
|
||||
/*ChronografAPI API endpoints for Chronograf */
|
||||
type ChronografAPI struct {
|
||||
spec *loads.Document
|
||||
context *middleware.Context
|
||||
handlers map[string]map[string]http.Handler
|
||||
|
@ -138,42 +138,42 @@ type MrFusionAPI struct {
|
|||
}
|
||||
|
||||
// SetDefaultProduces sets the default produces media type
|
||||
func (o *MrFusionAPI) SetDefaultProduces(mediaType string) {
|
||||
func (o *ChronografAPI) SetDefaultProduces(mediaType string) {
|
||||
o.defaultProduces = mediaType
|
||||
}
|
||||
|
||||
// SetDefaultConsumes returns the default consumes media type
|
||||
func (o *MrFusionAPI) SetDefaultConsumes(mediaType string) {
|
||||
func (o *ChronografAPI) SetDefaultConsumes(mediaType string) {
|
||||
o.defaultConsumes = mediaType
|
||||
}
|
||||
|
||||
// SetSpec sets a spec that will be served for the clients.
|
||||
func (o *MrFusionAPI) SetSpec(spec *loads.Document) {
|
||||
func (o *ChronografAPI) SetSpec(spec *loads.Document) {
|
||||
o.spec = spec
|
||||
}
|
||||
|
||||
// DefaultProduces returns the default produces media type
|
||||
func (o *MrFusionAPI) DefaultProduces() string {
|
||||
func (o *ChronografAPI) DefaultProduces() string {
|
||||
return o.defaultProduces
|
||||
}
|
||||
|
||||
// DefaultConsumes returns the default consumes media type
|
||||
func (o *MrFusionAPI) DefaultConsumes() string {
|
||||
func (o *ChronografAPI) DefaultConsumes() string {
|
||||
return o.defaultConsumes
|
||||
}
|
||||
|
||||
// Formats returns the registered string formats
|
||||
func (o *MrFusionAPI) Formats() strfmt.Registry {
|
||||
func (o *ChronografAPI) Formats() strfmt.Registry {
|
||||
return o.formats
|
||||
}
|
||||
|
||||
// RegisterFormat registers a custom format validator
|
||||
func (o *MrFusionAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
|
||||
func (o *ChronografAPI) RegisterFormat(name string, format strfmt.Format, validator strfmt.Validator) {
|
||||
o.formats.Add(name, format, validator)
|
||||
}
|
||||
|
||||
// Validate validates the registrations in the MrFusionAPI
|
||||
func (o *MrFusionAPI) Validate() error {
|
||||
// Validate validates the registrations in the ChronografAPI
|
||||
func (o *ChronografAPI) Validate() error {
|
||||
var unregistered []string
|
||||
|
||||
if o.JSONConsumer == nil {
|
||||
|
@ -348,19 +348,19 @@ func (o *MrFusionAPI) Validate() error {
|
|||
}
|
||||
|
||||
// ServeErrorFor gets a error handler for a given operation id
|
||||
func (o *MrFusionAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
|
||||
func (o *ChronografAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, *http.Request, error) {
|
||||
return o.ServeError
|
||||
}
|
||||
|
||||
// AuthenticatorsFor gets the authenticators for the specified security schemes
|
||||
func (o *MrFusionAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {
|
||||
func (o *ChronografAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator {
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
// ConsumersFor gets the consumers for the specified media types
|
||||
func (o *MrFusionAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer {
|
||||
func (o *ChronografAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer {
|
||||
|
||||
result := make(map[string]runtime.Consumer)
|
||||
for _, mt := range mediaTypes {
|
||||
|
@ -376,7 +376,7 @@ func (o *MrFusionAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consu
|
|||
}
|
||||
|
||||
// ProducersFor gets the producers for the specified media types
|
||||
func (o *MrFusionAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer {
|
||||
func (o *ChronografAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer {
|
||||
|
||||
result := make(map[string]runtime.Producer)
|
||||
for _, mt := range mediaTypes {
|
||||
|
@ -392,7 +392,7 @@ func (o *MrFusionAPI) ProducersFor(mediaTypes []string) map[string]runtime.Produ
|
|||
}
|
||||
|
||||
// HandlerFor gets a http.Handler for the provided operation method and path
|
||||
func (o *MrFusionAPI) HandlerFor(method, path string) (http.Handler, bool) {
|
||||
func (o *ChronografAPI) HandlerFor(method, path string) (http.Handler, bool) {
|
||||
if o.handlers == nil {
|
||||
return nil, false
|
||||
}
|
||||
|
@ -404,8 +404,8 @@ func (o *MrFusionAPI) HandlerFor(method, path string) (http.Handler, bool) {
|
|||
return h, ok
|
||||
}
|
||||
|
||||
// Context returns the middleware context for the mr fusion API
|
||||
func (o *MrFusionAPI) Context() *middleware.Context {
|
||||
// Context returns the middleware context for the chronograf API
|
||||
func (o *ChronografAPI) Context() *middleware.Context {
|
||||
if o.context == nil {
|
||||
o.context = middleware.NewRoutableContext(o.spec, o, nil)
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ func (o *MrFusionAPI) Context() *middleware.Context {
|
|||
return o.context
|
||||
}
|
||||
|
||||
func (o *MrFusionAPI) initHandlerCache() {
|
||||
func (o *ChronografAPI) initHandlerCache() {
|
||||
o.Context() // don't care about the result, just that the initialization happened
|
||||
|
||||
if o.handlers == nil {
|
||||
|
@ -619,7 +619,7 @@ func (o *MrFusionAPI) initHandlerCache() {
|
|||
|
||||
// Serve creates a http handler to serve the API over HTTP
|
||||
// can be used directly in http.ListenAndServe(":8000", api.Serve(nil))
|
||||
func (o *MrFusionAPI) Serve(builder middleware.Builder) http.Handler {
|
||||
func (o *ChronografAPI) Serve(builder middleware.Builder) http.Handler {
|
||||
o.Init()
|
||||
|
||||
if o.Middleware != nil {
|
||||
|
@ -629,7 +629,7 @@ func (o *MrFusionAPI) Serve(builder middleware.Builder) http.Handler {
|
|||
}
|
||||
|
||||
// Init allows you to just initialize the handler cache, you can then recompose the middelware as you see fit
|
||||
func (o *MrFusionAPI) Init() {
|
||||
func (o *ChronografAPI) Init() {
|
||||
if len(o.handlers) == 0 {
|
||||
o.initHandlerCache()
|
||||
}
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*DeleteLayoutsIDNoContent Layout has been removed.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*DeleteSourcesIDKapacitorsKapaIDProxyNoContent Kapacitor returned no content
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*DeleteSourcesIDKapacitorsKapaIDNoContent kapacitor has been removed.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*DeleteSourcesIDNoContent data source has been removed
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*DeleteSourcesIDRolesRoleIDNoContent Role has been removed
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*DeleteSourcesIDUsersUserIDExplorationsExplorationIDNoContent Exploration session has been removed
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*DeleteSourcesIDUsersUserIDNoContent User has been removed
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetLayoutsIDOK Returns the specified layout containing `cells`.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetLayoutsOK An array of layouts
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetMappingsOK An array of mappings
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetOK Returns the links to the top level endpoints.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDKapacitorsKapaIDProxyNoContent Kapacitor returned no content
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDKapacitorsKapaIDOK Kapacitor connection information
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDKapacitorsOK An array of kapacitors
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDMonitoredOK An array of permissions
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDPermissionsOK An array of permissions
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDOK Data source used to supply time series information.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDRolesOK An array of roles
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDRolesRoleIDOK Information relating to the role
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDUsersOK An array of users
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDUsersUserIDExplorationsExplorationIDOK Information relating to the exploration
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDUsersUserIDExplorationsOK Data Explorations saved sessions for user are returned.
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDUsersUserIDOK Information relating to the user
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*GetSourcesOK An array of data sources
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPatchSourcesIDKapacitorsKapaIDParams creates a new PatchSourcesIDKapacitorsKapaIDParams object
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPatchSourcesIDKapacitorsKapaIDProxyParams creates a new PatchSourcesIDKapacitorsKapaIDProxyParams object
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PatchSourcesIDKapacitorsKapaIDProxyNoContent Kapacitor returned no content
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PatchSourcesIDKapacitorsKapaIDNoContent Kapacitor's configuration was changed
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPatchSourcesIDParams creates a new PatchSourcesIDParams object
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PatchSourcesIDNoContent Data source's configuration was changed
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPatchSourcesIDRolesRoleIDParams creates a new PatchSourcesIDRolesRoleIDParams object
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PatchSourcesIDRolesRoleIDNoContent Role's configuration was changed
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPatchSourcesIDUsersUserIDExplorationsExplorationIDParams creates a new PatchSourcesIDUsersUserIDExplorationsExplorationIDParams object
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PatchSourcesIDUsersUserIDExplorationsExplorationIDOK Exploration's configuration was changed
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPatchSourcesIDUsersUserIDParams creates a new PatchSourcesIDUsersUserIDParams object
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PatchSourcesIDUsersUserIDNoContent Users's configuration was changed
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPostLayoutsParams creates a new PostLayoutsParams object
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PostLayoutsCreated Successfully created new layout
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPostSourcesIDKapacitorsKapaIDProxyParams creates a new PostSourcesIDKapacitorsKapaIDProxyParams object
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PostSourcesIDKapacitorsKapaIDProxyNoContent Kapacitor returned no content
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPostSourcesIDKapacitorsParams creates a new PostSourcesIDKapacitorsParams object
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PostSourcesIDKapacitorsCreated Successfully created kapacitor source
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPostSourcesIDProxyParams creates a new PostSourcesIDProxyParams object
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PostSourcesIDProxyOK Result of the query from the backend time series data source.
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPostSourcesIDRolesParams creates a new PostSourcesIDRolesParams object
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PostSourcesIDRolesCreated Successfully created new role
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPostSourcesIDUsersParams creates a new PostSourcesIDUsersParams object
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PostSourcesIDUsersCreated Successfully created new user
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPostSourcesIDUsersUserIDExplorationsParams creates a new PostSourcesIDUsersUserIDExplorationsParams object
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PostSourcesIDUsersUserIDExplorationsCreated Successfully created new Exploration session
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPostSourcesParams creates a new PostSourcesParams object
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PostSourcesCreated Successfully create data source
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
// NewPutLayoutsIDParams creates a new PutLayoutsIDParams object
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
"github.com/influxdata/chronograf/models"
|
||||
)
|
||||
|
||||
/*PutLayoutsIDOK Layout has been replaced and the new layout is returned.
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
flags "github.com/jessevdk/go-flags"
|
||||
graceful "github.com/tylerb/graceful"
|
||||
|
||||
"github.com/influxdata/mrfusion/restapi/operations"
|
||||
"github.com/influxdata/chronograf/restapi/operations"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -31,8 +31,8 @@ func init() {
|
|||
}
|
||||
}
|
||||
|
||||
// NewServer creates a new api mr fusion server but does not configure it
|
||||
func NewServer(api *operations.MrFusionAPI) *Server {
|
||||
// NewServer creates a new api chronograf server but does not configure it
|
||||
func NewServer(api *operations.ChronografAPI) *Server {
|
||||
s := new(Server)
|
||||
s.api = api
|
||||
return s
|
||||
|
@ -52,11 +52,11 @@ func (s *Server) ConfigureFlags() {
|
|||
}
|
||||
}
|
||||
|
||||
// Server for the mr fusion API
|
||||
// Server for the chronograf API
|
||||
type Server struct {
|
||||
EnabledListeners []string `long:"scheme" description:"the listeners to enable, this can be repeated and defaults to the schemes in the swagger spec"`
|
||||
|
||||
SocketPath flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/mr-fusion.sock"`
|
||||
SocketPath flags.Filename `long:"socket-path" description:"the unix socket to listen on" default:"/var/run/chronograf.sock"`
|
||||
domainSocketL net.Listener
|
||||
|
||||
Host string `long:"host" description:"the IP to listen on" default:"localhost" env:"HOST"`
|
||||
|
@ -69,7 +69,7 @@ type Server struct {
|
|||
TLSCertificateKey flags.Filename `long:"tls-key" description:"the private key to use for secure conections" env:"TLS_PRIVATE_KEY"`
|
||||
httpsServerL net.Listener
|
||||
|
||||
api *operations.MrFusionAPI
|
||||
api *operations.ChronografAPI
|
||||
handler http.Handler
|
||||
hasListeners bool
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ func (s *Server) Fatalf(f string, args ...interface{}) {
|
|||
}
|
||||
|
||||
// SetAPI configures the server with the specified API. Needs to be called before Serve
|
||||
func (s *Server) SetAPI(api *operations.MrFusionAPI) {
|
||||
func (s *Server) SetAPI(api *operations.ChronografAPI) {
|
||||
if api == nil {
|
||||
s.api = nil
|
||||
s.handler = nil
|
||||
|
@ -136,13 +136,13 @@ func (s *Server) Serve() (err error) {
|
|||
domainSocket.Handler = s.handler
|
||||
|
||||
wg.Add(1)
|
||||
s.Logf("Serving mr fusion at unix://%s", s.SocketPath)
|
||||
s.Logf("Serving chronograf at unix://%s", s.SocketPath)
|
||||
go func(l net.Listener) {
|
||||
defer wg.Done()
|
||||
if err := domainSocket.Serve(l); err != nil {
|
||||
s.Fatalf("%v", err)
|
||||
}
|
||||
s.Logf("Stopped serving mr fusion at unix://%s", s.SocketPath)
|
||||
s.Logf("Stopped serving chronograf at unix://%s", s.SocketPath)
|
||||
}(s.domainSocketL)
|
||||
}
|
||||
|
||||
|
@ -153,13 +153,13 @@ func (s *Server) Serve() (err error) {
|
|||
httpServer.Handler = s.handler
|
||||
|
||||
wg.Add(1)
|
||||
s.Logf("Serving mr fusion at http://%s", s.httpServerL.Addr())
|
||||
s.Logf("Serving chronograf at http://%s", s.httpServerL.Addr())
|
||||
go func(l net.Listener) {
|
||||
defer wg.Done()
|
||||
if err := httpServer.Serve(l); err != nil {
|
||||
s.Fatalf("%v", err)
|
||||
}
|
||||
s.Logf("Stopped serving mr fusion at http://%s", l.Addr())
|
||||
s.Logf("Stopped serving chronograf at http://%s", l.Addr())
|
||||
}(s.httpServerL)
|
||||
}
|
||||
|
||||
|
@ -183,13 +183,13 @@ func (s *Server) Serve() (err error) {
|
|||
}
|
||||
|
||||
wg.Add(1)
|
||||
s.Logf("Serving mr fusion at https://%s", s.httpsServerL.Addr())
|
||||
s.Logf("Serving chronograf at https://%s", s.httpsServerL.Addr())
|
||||
go func(l net.Listener) {
|
||||
defer wg.Done()
|
||||
if err := httpsServer.Serve(l); err != nil {
|
||||
s.Fatalf("%v", err)
|
||||
}
|
||||
s.Logf("Stopped serving mr fusion at https://%s", l.Addr())
|
||||
s.Logf("Stopped serving chronograf at https://%s", l.Addr())
|
||||
}(tls.NewListener(s.httpsServerL, httpsServer.TLSConfig))
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
swagger: '2.0'
|
||||
info:
|
||||
title: Mr Fusion
|
||||
description: Fuel for Chronograf
|
||||
title: Chronograf
|
||||
description: API endpoints for Chronograf
|
||||
version: "1.1.0"
|
||||
host: Chronograf.influxdata.com
|
||||
host: chronograf.influxdata.com
|
||||
schemes:
|
||||
- http
|
||||
basePath: /chronograf/v1
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue