commit
baf40ad644
1
Godeps
1
Godeps
|
@ -18,6 +18,7 @@ github.com/gogo/protobuf 6abcf94fd4c97dcb423fdafd42fe9f96ca7e421b
|
|||
github.com/gorilla/context 08b5f424b9271eedf6f9f0ce86cb9396ed337a42
|
||||
github.com/jessevdk/go-flags 4cc2832a6e6d1d3b815e2b9d544b2a4dfb3ce8fa
|
||||
github.com/mailru/easyjson e978125a7e335d8f4db746a9ac5b44643f27416b
|
||||
github.com/satori/go.uuid b061729afc07e77a8aa4fad0a2fd840958f1942a
|
||||
github.com/tylerb/graceful 50a48b6e73fcc75b45e22c05b79629a67c79e938
|
||||
golang.org/x/net 749a502dd1eaf3e5bfd4f8956748c502357c0bbe
|
||||
golang.org/x/text 1e65e9bf72c307081cea196f47ef37aed17eb316
|
||||
|
|
|
@ -4,6 +4,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/uuid"
|
||||
)
|
||||
|
||||
// Client is a client for the boltDB data store.
|
||||
|
@ -11,10 +13,12 @@ type Client struct {
|
|||
Path string
|
||||
db *bolt.DB
|
||||
Now func() time.Time
|
||||
LayoutIDs mrfusion.ID
|
||||
|
||||
ExplorationStore *ExplorationStore
|
||||
SourcesStore *SourcesStore
|
||||
ServersStore *ServersStore
|
||||
LayoutStore *LayoutStore
|
||||
}
|
||||
|
||||
func NewClient() *Client {
|
||||
|
@ -22,6 +26,10 @@ func NewClient() *Client {
|
|||
c.ExplorationStore = &ExplorationStore{client: c}
|
||||
c.SourcesStore = &SourcesStore{client: c}
|
||||
c.ServersStore = &ServersStore{client: c}
|
||||
c.LayoutStore = &LayoutStore{
|
||||
client: c,
|
||||
IDs: &uuid.V4{},
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
|
@ -47,15 +55,23 @@ func (c *Client) Open() error {
|
|||
if _, err := tx.CreateBucketIfNotExists(ServersBucket); err != nil {
|
||||
return err
|
||||
}
|
||||
// Always create Layouts bucket.
|
||||
if _, err := tx.CreateBucketIfNotExists(LayoutBucket); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// TODO: Ask @gunnar about these
|
||||
/*
|
||||
c.ExplorationStore = &ExplorationStore{client: c}
|
||||
c.SourcesStore = &SourcesStore{client: c}
|
||||
c.ServersStore = &ServersStore{client: c}
|
||||
c.LayoutStore = &LayoutStore{client: c}
|
||||
*/
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ func UnmarshalExploration(data []byte, e *mrfusion.Exploration) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// MarshalSource encodes an source to binary protobuf format.
|
||||
// MarshalSource encodes a source to binary protobuf format.
|
||||
func MarshalSource(s mrfusion.Source) ([]byte, error) {
|
||||
return proto.Marshal(&Source{
|
||||
ID: int64(s.ID),
|
||||
|
@ -53,7 +53,7 @@ func MarshalSource(s mrfusion.Source) ([]byte, error) {
|
|||
})
|
||||
}
|
||||
|
||||
// UnmarshalSource decodes an source from binary protobuf data.
|
||||
// UnmarshalSource decodes a source from binary protobuf data.
|
||||
func UnmarshalSource(data []byte, s *mrfusion.Source) error {
|
||||
var pb Source
|
||||
if err := proto.Unmarshal(data, &pb); err != nil {
|
||||
|
@ -70,7 +70,7 @@ func UnmarshalSource(data []byte, s *mrfusion.Source) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// MarshalServer encodes an source to binary protobuf format.
|
||||
// MarshalServer encodes a server to binary protobuf format.
|
||||
func MarshalServer(s mrfusion.Server) ([]byte, error) {
|
||||
return proto.Marshal(&Server{
|
||||
ID: int64(s.ID),
|
||||
|
@ -82,7 +82,7 @@ func MarshalServer(s mrfusion.Server) ([]byte, error) {
|
|||
})
|
||||
}
|
||||
|
||||
// UnmarshalServer decodes an source from binary protobuf data.
|
||||
// UnmarshalServer decodes a server from binary protobuf data.
|
||||
func UnmarshalServer(data []byte, s *mrfusion.Server) error {
|
||||
var pb Server
|
||||
if err := proto.Unmarshal(data, &pb); err != nil {
|
||||
|
@ -97,3 +97,63 @@ func UnmarshalServer(data []byte, s *mrfusion.Server) error {
|
|||
s.URL = pb.URL
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarshalLayout encodes a layout to binary protobuf format.
|
||||
func MarshalLayout(l mrfusion.Layout) ([]byte, error) {
|
||||
cells := make([]*Cell, len(l.Cells))
|
||||
for i, c := range l.Cells {
|
||||
queries := make([]*Query, len(c.Queries))
|
||||
for j, q := range c.Queries {
|
||||
queries[j] = &Query{
|
||||
Command: q.Command,
|
||||
DB: q.DB,
|
||||
RP: q.RP,
|
||||
}
|
||||
}
|
||||
cells[i] = &Cell{
|
||||
X: c.X,
|
||||
Y: c.Y,
|
||||
W: c.W,
|
||||
H: c.H,
|
||||
Queries: queries,
|
||||
}
|
||||
}
|
||||
return proto.Marshal(&Layout{
|
||||
ID: l.ID,
|
||||
Measurement: l.Measurement,
|
||||
Application: l.Application,
|
||||
Cells: cells,
|
||||
})
|
||||
}
|
||||
|
||||
// UnmarshalLayout decodes a layout from binary protobuf data.
|
||||
func UnmarshalLayout(data []byte, l *mrfusion.Layout) error {
|
||||
var pb Layout
|
||||
if err := proto.Unmarshal(data, &pb); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
l.ID = pb.ID
|
||||
l.Measurement = pb.Measurement
|
||||
l.Application = pb.Application
|
||||
cells := make([]mrfusion.Cell, len(pb.Cells))
|
||||
for i, c := range pb.Cells {
|
||||
queries := make([]mrfusion.Query, len(c.Queries))
|
||||
for j, q := range c.Queries {
|
||||
queries[j] = mrfusion.Query{
|
||||
Command: q.Command,
|
||||
DB: q.DB,
|
||||
RP: q.RP,
|
||||
}
|
||||
}
|
||||
cells[i] = mrfusion.Cell{
|
||||
X: c.X,
|
||||
Y: c.Y,
|
||||
W: c.W,
|
||||
H: c.H,
|
||||
Queries: queries,
|
||||
}
|
||||
}
|
||||
l.Cells = cells
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -12,6 +12,9 @@ It has these top-level messages:
|
|||
Exploration
|
||||
Source
|
||||
Server
|
||||
Layout
|
||||
Cell
|
||||
Query
|
||||
*/
|
||||
package internal
|
||||
|
||||
|
@ -74,33 +77,96 @@ func (m *Server) String() string { return proto.CompactTextString(m)
|
|||
func (*Server) ProtoMessage() {}
|
||||
func (*Server) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{2} }
|
||||
|
||||
type Layout struct {
|
||||
ID string `protobuf:"bytes,1,opt,name=ID,json=iD,proto3" json:"ID,omitempty"`
|
||||
Application string `protobuf:"bytes,2,opt,name=Application,json=application,proto3" json:"Application,omitempty"`
|
||||
Measurement string `protobuf:"bytes,3,opt,name=Measurement,json=measurement,proto3" json:"Measurement,omitempty"`
|
||||
Cells []*Cell `protobuf:"bytes,4,rep,name=Cells,json=cells" json:"Cells,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Layout) Reset() { *m = Layout{} }
|
||||
func (m *Layout) String() string { return proto.CompactTextString(m) }
|
||||
func (*Layout) ProtoMessage() {}
|
||||
func (*Layout) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{3} }
|
||||
|
||||
func (m *Layout) GetCells() []*Cell {
|
||||
if m != nil {
|
||||
return m.Cells
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Cell struct {
|
||||
X int32 `protobuf:"varint,1,opt,name=x,proto3" json:"x,omitempty"`
|
||||
Y int32 `protobuf:"varint,2,opt,name=y,proto3" json:"y,omitempty"`
|
||||
W int32 `protobuf:"varint,3,opt,name=w,proto3" json:"w,omitempty"`
|
||||
H int32 `protobuf:"varint,4,opt,name=h,proto3" json:"h,omitempty"`
|
||||
Queries []*Query `protobuf:"bytes,5,rep,name=queries" json:"queries,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Cell) Reset() { *m = Cell{} }
|
||||
func (m *Cell) String() string { return proto.CompactTextString(m) }
|
||||
func (*Cell) ProtoMessage() {}
|
||||
func (*Cell) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{4} }
|
||||
|
||||
func (m *Cell) GetQueries() []*Query {
|
||||
if m != nil {
|
||||
return m.Queries
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Query struct {
|
||||
Command string `protobuf:"bytes,1,opt,name=Command,json=command,proto3" json:"Command,omitempty"`
|
||||
DB string `protobuf:"bytes,2,opt,name=DB,json=dB,proto3" json:"DB,omitempty"`
|
||||
RP string `protobuf:"bytes,3,opt,name=RP,json=rP,proto3" json:"RP,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Query) Reset() { *m = Query{} }
|
||||
func (m *Query) String() string { return proto.CompactTextString(m) }
|
||||
func (*Query) ProtoMessage() {}
|
||||
func (*Query) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{5} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Exploration)(nil), "internal.Exploration")
|
||||
proto.RegisterType((*Source)(nil), "internal.Source")
|
||||
proto.RegisterType((*Server)(nil), "internal.Server")
|
||||
proto.RegisterType((*Layout)(nil), "internal.Layout")
|
||||
proto.RegisterType((*Cell)(nil), "internal.Cell")
|
||||
proto.RegisterType((*Query)(nil), "internal.Query")
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) }
|
||||
|
||||
var fileDescriptorInternal = []byte{
|
||||
// 299 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x91, 0xcd, 0x4a, 0x33, 0x31,
|
||||
0x14, 0x86, 0x99, 0x4e, 0x9a, 0xce, 0x9c, 0x0f, 0xca, 0x47, 0x10, 0x09, 0xe2, 0x62, 0xe8, 0xaa,
|
||||
0x2b, 0x37, 0x5e, 0x81, 0x18, 0x17, 0x85, 0x41, 0x24, 0x75, 0x2e, 0x20, 0x76, 0x8e, 0x50, 0x68,
|
||||
0x27, 0x21, 0x3f, 0x6a, 0xef, 0xc1, 0xeb, 0xf0, 0x06, 0xbc, 0x41, 0x49, 0x9a, 0x01, 0x71, 0x51,
|
||||
0xba, 0x7c, 0xce, 0xfb, 0x72, 0x78, 0x92, 0x03, 0xf3, 0xed, 0xe0, 0xd1, 0x0e, 0x6a, 0x77, 0x63,
|
||||
0xac, 0xf6, 0x9a, 0x55, 0x23, 0x2f, 0xbe, 0x0b, 0xf8, 0xf7, 0xf0, 0x61, 0x76, 0xda, 0x2a, 0xbf,
|
||||
0xd5, 0x03, 0x9b, 0xc3, 0x64, 0x25, 0x78, 0xd1, 0x14, 0xcb, 0x52, 0x4e, 0xb6, 0x82, 0x31, 0x20,
|
||||
0x8f, 0x6a, 0x8f, 0x7c, 0xd2, 0x14, 0xcb, 0x5a, 0x92, 0x41, 0xed, 0x91, 0x5d, 0x02, 0xed, 0x1c,
|
||||
0xda, 0x95, 0xe0, 0x65, 0xea, 0xd1, 0x90, 0x28, 0x76, 0x85, 0xf2, 0x8a, 0x93, 0x63, 0xb7, 0x57,
|
||||
0x5e, 0xb1, 0x6b, 0xa8, 0xef, 0x2d, 0x2a, 0x8f, 0xfd, 0x9d, 0xe7, 0xd3, 0x54, 0xaf, 0x37, 0xe3,
|
||||
0x20, 0xa6, 0x9d, 0xe9, 0x73, 0x4a, 0x8f, 0x69, 0x18, 0x07, 0x8c, 0xc3, 0x4c, 0xe0, 0xab, 0x0a,
|
||||
0x3b, 0xcf, 0x67, 0x4d, 0xb1, 0xac, 0xe4, 0xac, 0x3f, 0xe2, 0xe2, 0xab, 0x00, 0xba, 0xd6, 0xc1,
|
||||
0x6e, 0xf0, 0x2c, 0x61, 0x06, 0xe4, 0xf9, 0x60, 0x30, 0xe9, 0xd6, 0x92, 0xf8, 0x83, 0x41, 0x76,
|
||||
0x05, 0x55, 0x7c, 0x44, 0xcc, 0xb3, 0x70, 0x15, 0x32, 0xc7, 0xec, 0x49, 0x39, 0xf7, 0xae, 0x6d,
|
||||
0x9f, 0x9c, 0x6b, 0x59, 0x99, 0xcc, 0x71, 0x57, 0x27, 0x5b, 0xc7, 0x69, 0x53, 0xc6, 0x5d, 0x41,
|
||||
0xb6, 0xee, 0x84, 0xe8, 0x67, 0x14, 0x45, 0xfb, 0x86, 0xf6, 0x2c, 0xd1, 0xdf, 0x52, 0xe5, 0x09,
|
||||
0x29, 0xf2, 0x47, 0xea, 0x3f, 0x94, 0x9d, 0x6c, 0xb3, 0x6b, 0x19, 0x64, 0xcb, 0x2e, 0x60, 0xba,
|
||||
0xb6, 0x9b, 0x95, 0xc8, 0xbf, 0x3a, 0x75, 0x11, 0x5e, 0x68, 0x3a, 0xff, 0xed, 0x4f, 0x00, 0x00,
|
||||
0x00, 0xff, 0xff, 0xd9, 0x74, 0xaa, 0x1f, 0x10, 0x02, 0x00, 0x00,
|
||||
// 454 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x93, 0xcf, 0x8e, 0xd3, 0x3e,
|
||||
0x10, 0xc7, 0xe5, 0x26, 0x4e, 0x13, 0xe7, 0xa7, 0xfe, 0x90, 0x85, 0x90, 0x85, 0x38, 0x44, 0x11,
|
||||
0x87, 0x72, 0xd9, 0x03, 0x3c, 0x41, 0xb7, 0xe1, 0x50, 0x29, 0xa0, 0xe2, 0xa5, 0x0f, 0x60, 0x92,
|
||||
0x41, 0x1b, 0x29, 0xff, 0x70, 0x6c, 0xda, 0x5c, 0x39, 0xf3, 0x1c, 0xbc, 0x00, 0x2f, 0x88, 0xc6,
|
||||
0x75, 0xe9, 0x8a, 0xc3, 0x6a, 0x8f, 0x9f, 0xf9, 0x8e, 0x3c, 0x9f, 0x71, 0x1c, 0xb6, 0x6a, 0x7a,
|
||||
0x03, 0xba, 0x57, 0xed, 0xcd, 0xa8, 0x07, 0x33, 0xf0, 0xf8, 0xc2, 0xf9, 0x6f, 0xc2, 0xd2, 0xf7,
|
||||
0xa7, 0xb1, 0x1d, 0xb4, 0x32, 0xcd, 0xd0, 0xf3, 0x15, 0x5b, 0xec, 0x0a, 0x41, 0x32, 0xb2, 0x0e,
|
||||
0xe4, 0xa2, 0x29, 0x38, 0x67, 0xe1, 0x47, 0xd5, 0x81, 0x58, 0x64, 0x64, 0x9d, 0xc8, 0xb0, 0x57,
|
||||
0x1d, 0xf0, 0x17, 0x2c, 0x3a, 0x4c, 0xa0, 0x77, 0x85, 0x08, 0x5c, 0x5f, 0x64, 0x1d, 0x61, 0x6f,
|
||||
0xa1, 0x8c, 0x12, 0xe1, 0xb9, 0xb7, 0x56, 0x46, 0xf1, 0x57, 0x2c, 0xd9, 0x6a, 0x50, 0x06, 0xea,
|
||||
0x8d, 0x11, 0xd4, 0xb5, 0x27, 0xd5, 0xa5, 0x80, 0xe9, 0x61, 0xac, 0x7d, 0x1a, 0x9d, 0x53, 0x7b,
|
||||
0x29, 0x70, 0xc1, 0x96, 0x05, 0x7c, 0x55, 0xb6, 0x35, 0x62, 0x99, 0x91, 0x75, 0x2c, 0x97, 0xf5,
|
||||
0x19, 0xf3, 0x5f, 0x84, 0x45, 0x77, 0x83, 0xd5, 0x15, 0x3c, 0x49, 0x98, 0xb3, 0xf0, 0xf3, 0x3c,
|
||||
0x82, 0xd3, 0x4d, 0x64, 0x68, 0xe6, 0x11, 0xf8, 0x4b, 0x16, 0xe3, 0x12, 0x98, 0x7b, 0xe1, 0xd8,
|
||||
0x7a, 0xc6, 0x6c, 0xaf, 0xa6, 0xe9, 0x38, 0xe8, 0xda, 0x39, 0x27, 0x32, 0x1e, 0x3d, 0xe3, 0x59,
|
||||
0x07, 0x59, 0x4e, 0x22, 0xca, 0x02, 0x3c, 0xcb, 0xca, 0x72, 0x7a, 0x44, 0xf4, 0x27, 0x8a, 0x82,
|
||||
0xfe, 0x0e, 0xfa, 0x49, 0xa2, 0x0f, 0xa5, 0x82, 0x47, 0xa4, 0xc2, 0x7f, 0xa4, 0x9e, 0xb1, 0xe0,
|
||||
0x20, 0x4b, 0xef, 0x1a, 0x58, 0x59, 0xf2, 0xe7, 0x8c, 0xde, 0xe9, 0x6a, 0x57, 0xf8, 0x5b, 0xa5,
|
||||
0x13, 0x42, 0xfe, 0x83, 0xb0, 0xa8, 0x54, 0xf3, 0x60, 0xcd, 0x03, 0x9d, 0xc4, 0xe9, 0x64, 0x2c,
|
||||
0xdd, 0x8c, 0x63, 0xdb, 0x54, 0xee, 0x1d, 0x78, 0xab, 0x54, 0x5d, 0x4b, 0xd8, 0xf1, 0x01, 0xd4,
|
||||
0x64, 0x35, 0x74, 0xd0, 0x1b, 0xef, 0x97, 0x76, 0xd7, 0x12, 0x7f, 0xcd, 0xe8, 0x16, 0xda, 0x76,
|
||||
0x12, 0x61, 0x16, 0xac, 0xd3, 0xb7, 0xab, 0x9b, 0xbf, 0xcf, 0x0e, 0xcb, 0x92, 0x56, 0x18, 0xe6,
|
||||
0x0d, 0x0b, 0x11, 0xf9, 0x7f, 0x8c, 0x9c, 0x9c, 0x00, 0x95, 0xe4, 0x84, 0x34, 0xbb, 0xa9, 0x54,
|
||||
0x92, 0x19, 0xe9, 0xe8, 0x26, 0x50, 0x49, 0x8e, 0x48, 0xf7, 0x6e, 0x67, 0x2a, 0xc9, 0x3d, 0x7f,
|
||||
0xc3, 0x96, 0xdf, 0x2c, 0xe8, 0x06, 0x26, 0x41, 0xdd, 0x9c, 0xff, 0xaf, 0x73, 0x3e, 0x59, 0xd0,
|
||||
0xb3, 0xbc, 0xe4, 0xf9, 0x86, 0x51, 0x57, 0xc1, 0x2f, 0xb4, 0x1d, 0xba, 0x4e, 0xf5, 0xb5, 0x5f,
|
||||
0x79, 0x59, 0x9d, 0x11, 0xef, 0xa1, 0xb8, 0xf5, 0xeb, 0x2e, 0xea, 0x5b, 0x64, 0xb9, 0xf7, 0xcb,
|
||||
0x2d, 0xf4, 0xfe, 0x4b, 0xe4, 0xfe, 0x98, 0x77, 0x7f, 0x02, 0x00, 0x00, 0xff, 0xff, 0x6b, 0x5c,
|
||||
0x8c, 0x14, 0x43, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -29,3 +29,24 @@ message Server {
|
|||
string URL = 5; // URL is the path to the server
|
||||
int64 SrcID = 6; // SrcID is the ID of the data source
|
||||
}
|
||||
|
||||
message Layout {
|
||||
string ID = 1; // ID is the unique ID of the layout.
|
||||
string Application = 2; // Application is the user facing name of this Layout.
|
||||
string Measurement = 3; // Measurement is the descriptive name of the time series data.
|
||||
repeated Cell Cells = 4; // Cells are the individual visualization elements.
|
||||
}
|
||||
|
||||
message Cell {
|
||||
int32 x = 1; // X-coordinate of Cell in the Layout
|
||||
int32 y = 2; // Y-coordinate of Cell in the Layout
|
||||
int32 w = 3; // Width of Cell in the Layout
|
||||
int32 h = 4; // Height of Cell in the Layout
|
||||
repeated Query queries = 5; // Time-series data queries for Cell.
|
||||
}
|
||||
|
||||
message Query {
|
||||
string Command = 1; // Command is the query itself
|
||||
string DB = 2; // DB the database for the query (optional)
|
||||
string RP = 3; // RP is a retention policy and optional;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
package bolt
|
||||
|
||||
import (
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/bolt/internal"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Ensure LayoutStore implements mrfusion.LayoutStore.
|
||||
var _ mrfusion.LayoutStore = &LayoutStore{}
|
||||
|
||||
var LayoutBucket = []byte("Layout")
|
||||
|
||||
type LayoutStore struct {
|
||||
client *Client
|
||||
IDs mrfusion.ID
|
||||
}
|
||||
|
||||
// All returns all known layouts
|
||||
func (s *LayoutStore) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
||||
var srcs []mrfusion.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
|
||||
if err := internal.UnmarshalLayout(v, &src); err != nil {
|
||||
return err
|
||||
}
|
||||
srcs = append(srcs, src)
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return srcs, nil
|
||||
|
||||
}
|
||||
|
||||
// Add creates a new Layout in the LayoutStore.
|
||||
func (s *LayoutStore) Add(ctx context.Context, src mrfusion.Layout) (mrfusion.Layout, error) {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
b := tx.Bucket(LayoutBucket)
|
||||
id, err := s.IDs.Generate()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
src.ID = id
|
||||
if v, err := internal.MarshalLayout(src); err != nil {
|
||||
return err
|
||||
} else if err := b.Put([]byte(src.ID), v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return mrfusion.Layout{}, err
|
||||
}
|
||||
|
||||
return src, nil
|
||||
}
|
||||
|
||||
// Delete removes the Layout from the LayoutStore
|
||||
func (s *LayoutStore) Delete(ctx context.Context, src mrfusion.Layout) error {
|
||||
if err := s.client.db.Update(func(tx *bolt.Tx) error {
|
||||
if err := tx.Bucket(LayoutBucket).Delete([]byte(src.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get returns a Layout if the id exists.
|
||||
func (s *LayoutStore) Get(ctx context.Context, id string) (mrfusion.Layout, error) {
|
||||
var src mrfusion.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
|
||||
} else if err := internal.UnmarshalLayout(v, &src); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return mrfusion.Layout{}, err
|
||||
}
|
||||
|
||||
return src, nil
|
||||
}
|
||||
|
||||
// Update a Layout
|
||||
func (s *LayoutStore) Update(ctx context.Context, src mrfusion.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
|
||||
}
|
||||
|
||||
if v, err := internal.MarshalLayout(src); err != nil {
|
||||
return err
|
||||
} else if err := b.Put([]byte(src.ID), v); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -6,6 +6,7 @@ const (
|
|||
ErrExplorationNotFound = Error("exploration not found")
|
||||
ErrSourceNotFound = Error("source not found")
|
||||
ErrServerNotFound = Error("server not found")
|
||||
ErrLayoutNotFound = Error("layout not found")
|
||||
)
|
||||
|
||||
// Error is a domain error encountered while processing mrfusion requests
|
||||
|
|
|
@ -0,0 +1,169 @@
|
|||
package handlers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/influxdata/mrfusion"
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
|
||||
op "github.com/influxdata/mrfusion/restapi/operations"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
func layoutToMrF(l *models.Layout) mrfusion.Layout {
|
||||
cells := make([]mrfusion.Cell, len(l.Cells))
|
||||
for i, c := range l.Cells {
|
||||
queries := make([]mrfusion.Query, len(c.Queries))
|
||||
for j, q := range c.Queries {
|
||||
queries[j] = mrfusion.Query{
|
||||
Command: *q.Query,
|
||||
DB: q.Db,
|
||||
RP: q.Rp,
|
||||
}
|
||||
}
|
||||
cells[i] = mrfusion.Cell{
|
||||
X: *c.X,
|
||||
Y: *c.Y,
|
||||
W: *c.W,
|
||||
H: *c.H,
|
||||
Queries: queries,
|
||||
}
|
||||
}
|
||||
return mrfusion.Layout{
|
||||
ID: l.ID,
|
||||
Measurement: *l.TelegrafMeasurement,
|
||||
Application: *l.App,
|
||||
Cells: cells,
|
||||
}
|
||||
}
|
||||
|
||||
func (h *Store) NewLayout(ctx context.Context, params op.PostLayoutsParams) middleware.Responder {
|
||||
layout := layoutToMrF(params.Layout)
|
||||
var err error
|
||||
if layout, err = h.LayoutStore.Add(ctx, layout); err != nil {
|
||||
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error storing layout %v: %v", params.Layout, err)}
|
||||
return op.NewPostLayoutsDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
mlayout := layoutToModel(layout)
|
||||
return op.NewPostLayoutsCreated().WithPayload(mlayout).WithLocation(*mlayout.Link.Href)
|
||||
}
|
||||
|
||||
func layoutToModel(l mrfusion.Layout) *models.Layout {
|
||||
href := fmt.Sprintf("/chronograf/v1/layouts/%s", l.ID)
|
||||
rel := "self"
|
||||
|
||||
cells := make([]*models.Cell, len(l.Cells))
|
||||
for i, c := range l.Cells {
|
||||
queries := make([]*models.Proxy, len(c.Queries))
|
||||
for j, q := range c.Queries {
|
||||
queries[j] = &models.Proxy{
|
||||
Query: &q.Command,
|
||||
Db: q.DB,
|
||||
Rp: q.RP,
|
||||
}
|
||||
}
|
||||
|
||||
x := c.X
|
||||
y := c.Y
|
||||
w := c.W
|
||||
h := c.H
|
||||
|
||||
cells[i] = &models.Cell{
|
||||
X: &x,
|
||||
Y: &y,
|
||||
W: &w,
|
||||
H: &h,
|
||||
Queries: queries,
|
||||
}
|
||||
}
|
||||
|
||||
return &models.Layout{
|
||||
Link: &models.Link{
|
||||
Href: &href,
|
||||
Rel: &rel,
|
||||
},
|
||||
Cells: cells,
|
||||
TelegrafMeasurement: &l.Measurement,
|
||||
App: &l.Application,
|
||||
ID: l.ID,
|
||||
}
|
||||
}
|
||||
|
||||
func requestedLayout(filtered map[string]bool, layout mrfusion.Layout) bool {
|
||||
// If the length of the filter is zero then all values are acceptable.
|
||||
if len(filtered) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
// If filter contains either measurement or application
|
||||
return filtered[layout.Measurement] || filtered[layout.Application]
|
||||
}
|
||||
|
||||
func (h *Store) Layouts(ctx context.Context, params op.GetLayoutsParams) middleware.Responder {
|
||||
// Construct a filter sieve for both applications and measurements
|
||||
filtered := map[string]bool{}
|
||||
for _, a := range params.Apps {
|
||||
filtered[a] = true
|
||||
}
|
||||
|
||||
for _, m := range params.TelegrafMeasurements {
|
||||
filtered[m] = true
|
||||
}
|
||||
|
||||
mrLays, err := h.LayoutStore.All(ctx)
|
||||
if err != nil {
|
||||
errMsg := &models.Error{Code: 500, Message: "Error loading layouts"}
|
||||
return op.NewGetLayoutsDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
lays := []*models.Layout{}
|
||||
for _, layout := range mrLays {
|
||||
if requestedLayout(filtered, layout) {
|
||||
lays = append(lays, layoutToModel(layout))
|
||||
}
|
||||
}
|
||||
|
||||
res := &models.Layouts{
|
||||
Layouts: lays,
|
||||
}
|
||||
|
||||
return op.NewGetLayoutsOK().WithPayload(res)
|
||||
}
|
||||
|
||||
func (h *Store) LayoutsID(ctx context.Context, params op.GetLayoutsIDParams) middleware.Responder {
|
||||
layout, err := h.LayoutStore.Get(ctx, params.ID)
|
||||
if err != nil {
|
||||
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.ID)}
|
||||
return op.NewGetLayoutsIDNotFound().WithPayload(errMsg)
|
||||
}
|
||||
|
||||
return op.NewGetLayoutsIDOK().WithPayload(layoutToModel(layout))
|
||||
}
|
||||
|
||||
func (h *Store) RemoveLayout(ctx context.Context, params op.DeleteLayoutsIDParams) middleware.Responder {
|
||||
layout := mrfusion.Layout{
|
||||
ID: params.ID,
|
||||
}
|
||||
if err := h.LayoutStore.Delete(ctx, layout); err != nil {
|
||||
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Unknown error deleting layout %s", params.ID)}
|
||||
return op.NewDeleteLayoutsIDDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
|
||||
return op.NewDeleteLayoutsIDNoContent()
|
||||
}
|
||||
|
||||
func (h *Store) UpdateLayout(ctx context.Context, params op.PutLayoutsIDParams) middleware.Responder {
|
||||
layout, err := h.LayoutStore.Get(ctx, params.ID)
|
||||
if err != nil {
|
||||
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.ID)}
|
||||
return op.NewPutLayoutsIDNotFound().WithPayload(errMsg)
|
||||
}
|
||||
layout = layoutToMrF(params.Config)
|
||||
layout.ID = params.ID
|
||||
if err := h.LayoutStore.Update(ctx, layout); err != nil {
|
||||
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error updating layout ID %s: %v", params.ID, err)}
|
||||
return op.NewPutLayoutsIDDefault(500).WithPayload(errMsg)
|
||||
}
|
||||
return op.NewPutLayoutsIDOK().WithPayload(layoutToModel(layout))
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package handlers_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"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"
|
||||
)
|
||||
|
||||
func TestNewLayout(t *testing.T) {
|
||||
t.Parallel()
|
||||
var tests = []struct {
|
||||
Desc string
|
||||
AddError error
|
||||
ExistingLayouts map[string]mrfusion.Layout
|
||||
NewLayout *models.Layout
|
||||
ExpectedID int
|
||||
ExpectedHref string
|
||||
ExpectedStatus int
|
||||
}{
|
||||
{
|
||||
Desc: "Test that an error in datastore returns 500 status",
|
||||
AddError: errors.New("error"),
|
||||
NewLayout: &models.Layout{
|
||||
TelegrafMeasurement: new(string),
|
||||
App: new(string),
|
||||
Cells: []*models.Cell{
|
||||
&models.Cell{
|
||||
X: new(int32),
|
||||
Y: new(int32),
|
||||
W: new(int32),
|
||||
H: new(int32),
|
||||
},
|
||||
},
|
||||
},
|
||||
ExpectedStatus: http.StatusInternalServerError,
|
||||
},
|
||||
{
|
||||
Desc: "Test that creating a layout returns 201 status",
|
||||
ExistingLayouts: map[string]mrfusion.Layout{},
|
||||
NewLayout: &models.Layout{
|
||||
TelegrafMeasurement: new(string),
|
||||
App: new(string),
|
||||
Cells: []*models.Cell{
|
||||
&models.Cell{
|
||||
X: new(int32),
|
||||
Y: new(int32),
|
||||
W: new(int32),
|
||||
H: new(int32),
|
||||
},
|
||||
},
|
||||
},
|
||||
ExpectedID: 0,
|
||||
ExpectedHref: "/chronograf/v1/layouts/0",
|
||||
ExpectedStatus: http.StatusCreated,
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
// The mocked backing store will be used to
|
||||
// check stored values.
|
||||
store := handlers.Store{
|
||||
LayoutStore: &mock.LayoutStore{
|
||||
AddError: test.AddError,
|
||||
Layouts: test.ExistingLayouts,
|
||||
},
|
||||
}
|
||||
|
||||
// Send the test layout to the mocked store.
|
||||
params := op.PostLayoutsParams{
|
||||
Layout: test.NewLayout,
|
||||
}
|
||||
resp := store.NewLayout(context.Background(), params)
|
||||
w := httptest.NewRecorder()
|
||||
resp.WriteResponse(w, runtime.JSONProducer())
|
||||
if w.Code != test.ExpectedStatus {
|
||||
t.Fatalf("Expected status %d; actual %d", test.ExpectedStatus, w.Code)
|
||||
}
|
||||
loc := w.Header().Get("Location")
|
||||
if loc != test.ExpectedHref {
|
||||
t.Fatalf("Expected status %s; actual %s", test.ExpectedHref, loc)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,4 +7,5 @@ type Store struct {
|
|||
ExplorationStore mrfusion.ExplorationStore
|
||||
SourcesStore mrfusion.SourcesStore
|
||||
ServersStore mrfusion.ServersStore
|
||||
LayoutStore mrfusion.LayoutStore
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package mrfusion
|
||||
|
||||
// ID creates uniq ID string
|
||||
type ID interface {
|
||||
// Generate creates a unique ID string
|
||||
Generate() (string, error)
|
||||
}
|
|
@ -32,8 +32,7 @@ func NewHandler() Handler {
|
|||
func (m *Handler) AllRoutes(ctx context.Context, params op.GetParams) middleware.Responder {
|
||||
routes := &models.Routes{
|
||||
Sources: "/chronograf/v1/sources",
|
||||
Dashboards: "/chronograf/v1/dashboards",
|
||||
Apps: "/chronograf/v1/apps",
|
||||
Layouts: "/chronograf/v1/layouts",
|
||||
Users: "/chronograf/v1/users",
|
||||
}
|
||||
return op.NewGetOK().WithPayload(routes)
|
||||
|
|
75
mock/mock.go
75
mock/mock.go
|
@ -2,6 +2,7 @@ package mock
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/influxdata/mrfusion"
|
||||
|
@ -168,3 +169,77 @@ func (t *TimeSeries) MonitoredServices(context.Context) ([]mrfusion.MonitoredSer
|
|||
}
|
||||
return hosts, nil
|
||||
}
|
||||
|
||||
type LayoutStore struct {
|
||||
Layouts map[string]mrfusion.Layout
|
||||
AllError error
|
||||
AddError error
|
||||
DeleteError error
|
||||
GetError error
|
||||
UpdateError error
|
||||
}
|
||||
|
||||
// All will return all info in the map or whatever is AllError
|
||||
func (l *LayoutStore) All(ctx context.Context) ([]mrfusion.Layout, error) {
|
||||
if l.AllError != nil {
|
||||
return nil, l.AllError
|
||||
}
|
||||
layouts := []mrfusion.Layout{}
|
||||
for _, l := range l.Layouts {
|
||||
layouts = append(layouts, l)
|
||||
}
|
||||
return layouts, nil
|
||||
}
|
||||
|
||||
// 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) {
|
||||
if l.AddError != nil {
|
||||
return mrfusion.Layout{}, l.AddError
|
||||
}
|
||||
id := strconv.Itoa(len(l.Layouts))
|
||||
layout.ID = id
|
||||
l.Layouts[id] = layout
|
||||
return layout, nil
|
||||
}
|
||||
|
||||
// Delete will remove layout from map or return DeleteError
|
||||
func (l *LayoutStore) Delete(ctx context.Context, layout mrfusion.Layout) error {
|
||||
if l.DeleteError != nil {
|
||||
return l.DeleteError
|
||||
}
|
||||
|
||||
id := layout.ID
|
||||
if _, ok := l.Layouts[id]; !ok {
|
||||
return mrfusion.ErrLayoutNotFound
|
||||
}
|
||||
|
||||
delete(l.Layouts, id)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get will return map with key ID or GetError
|
||||
func (l *LayoutStore) Get(ctx context.Context, ID string) (mrfusion.Layout, error) {
|
||||
if l.GetError != nil {
|
||||
return mrfusion.Layout{}, l.GetError
|
||||
}
|
||||
|
||||
if layout, ok := l.Layouts[ID]; !ok {
|
||||
return mrfusion.Layout{}, mrfusion.ErrLayoutNotFound
|
||||
} else {
|
||||
return layout, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Update will update layout or return UpdateError
|
||||
func (l *LayoutStore) Update(ctx context.Context, layout mrfusion.Layout) error {
|
||||
if l.UpdateError != nil {
|
||||
return l.UpdateError
|
||||
}
|
||||
id := layout.ID
|
||||
if _, ok := l.Layouts[id]; !ok {
|
||||
return mrfusion.ErrLayoutNotFound
|
||||
} else {
|
||||
l.Layouts[id] = layout
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
100
models/cell.go
100
models/cell.go
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
/*Cell cell
|
||||
|
@ -16,47 +17,126 @@ swagger:model Cell
|
|||
*/
|
||||
type Cell struct {
|
||||
|
||||
/* Height of Cell in the Dashboard
|
||||
/* Height of Cell in the Layout
|
||||
|
||||
Required: true
|
||||
*/
|
||||
H int32 `json:"h,omitempty"`
|
||||
H *int32 `json:"h"`
|
||||
|
||||
/* Time-series data queries for Cell.
|
||||
*/
|
||||
Queries []string `json:"queries,omitempty"`
|
||||
Queries []*Proxy `json:"queries,omitempty"`
|
||||
|
||||
/* Width of Cell in the Dashboard
|
||||
*/
|
||||
W int32 `json:"w,omitempty"`
|
||||
/* Width of Cell in the Layout
|
||||
|
||||
/* X-coordinate of Cell in the Dashboard
|
||||
Required: true
|
||||
*/
|
||||
X int32 `json:"x,omitempty"`
|
||||
W *int32 `json:"w"`
|
||||
|
||||
/* Y-coordinate of Cell in the Dashboard
|
||||
/* X-coordinate of Cell in the Layout
|
||||
|
||||
Required: true
|
||||
*/
|
||||
Y int32 `json:"y,omitempty"`
|
||||
X *int32 `json:"x"`
|
||||
|
||||
/* Y-coordinate of Cell in the Layout
|
||||
|
||||
Required: true
|
||||
*/
|
||||
Y *int32 `json:"y"`
|
||||
}
|
||||
|
||||
// Validate validates this cell
|
||||
func (m *Cell) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateH(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateQueries(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateW(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateX(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateY(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Cell) validateH(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("h", "body", m.H); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Cell) validateQueries(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.Queries) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Queries); i++ {
|
||||
|
||||
if swag.IsZero(m.Queries[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Queries[i] != nil {
|
||||
|
||||
if err := m.Queries[i].Validate(formats); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Cell) validateW(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("w", "body", m.W); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Cell) validateX(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("x", "body", m.X); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Cell) validateY(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("y", "body", m.Y); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
)
|
||||
|
||||
/*Dashboards dashboards
|
||||
|
||||
swagger:model Dashboards
|
||||
*/
|
||||
type Dashboards struct {
|
||||
|
||||
/* dashboards
|
||||
*/
|
||||
Dashboards []*Dashboard `json:"dashboards,omitempty"`
|
||||
}
|
||||
|
||||
// Validate validates this dashboards
|
||||
func (m *Dashboards) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateDashboards(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Dashboards) validateDashboards(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.Dashboards) { // not required
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Dashboards); i++ {
|
||||
|
||||
if swag.IsZero(m.Dashboards[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Dashboards[i] != nil {
|
||||
|
||||
if err := m.Dashboards[i].Validate(formats); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -11,11 +11,17 @@ import (
|
|||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
/*Dashboard dashboard
|
||||
/*Layout layout
|
||||
|
||||
swagger:model Dashboard
|
||||
swagger:model Layout
|
||||
*/
|
||||
type Dashboard struct {
|
||||
type Layout struct {
|
||||
|
||||
/* App is the user facing name of this Layout
|
||||
|
||||
Required: true
|
||||
*/
|
||||
App *string `json:"app"`
|
||||
|
||||
/* Cells are the individual visualization elements.
|
||||
|
||||
|
@ -23,15 +29,30 @@ type Dashboard struct {
|
|||
*/
|
||||
Cells []*Cell `json:"cells"`
|
||||
|
||||
/* ID is an opaque string that uniquely identifies this layout.
|
||||
*/
|
||||
ID string `json:"id,omitempty"`
|
||||
|
||||
/* link
|
||||
*/
|
||||
Link *Link `json:"link,omitempty"`
|
||||
|
||||
/* Measurement is the descriptive name of the time series data.
|
||||
|
||||
Required: true
|
||||
*/
|
||||
TelegrafMeasurement *string `json:"telegraf_measurement"`
|
||||
}
|
||||
|
||||
// Validate validates this dashboard
|
||||
func (m *Dashboard) Validate(formats strfmt.Registry) error {
|
||||
// Validate validates this layout
|
||||
func (m *Layout) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateApp(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateCells(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
|
@ -42,13 +63,27 @@ func (m *Dashboard) Validate(formats strfmt.Registry) error {
|
|||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateTelegrafMeasurement(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Dashboard) validateCells(formats strfmt.Registry) error {
|
||||
func (m *Layout) validateApp(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("app", "body", m.App); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Layout) validateCells(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("cells", "body", m.Cells); err != nil {
|
||||
return err
|
||||
|
@ -72,7 +107,7 @@ func (m *Dashboard) validateCells(formats strfmt.Registry) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *Dashboard) validateLink(formats strfmt.Registry) error {
|
||||
func (m *Layout) validateLink(formats strfmt.Registry) error {
|
||||
|
||||
if swag.IsZero(m.Link) { // not required
|
||||
return nil
|
||||
|
@ -87,3 +122,12 @@ func (m *Dashboard) validateLink(formats strfmt.Registry) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Layout) validateTelegrafMeasurement(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("telegraf_measurement", "body", m.TelegrafMeasurement); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package models
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
/*Layouts layouts
|
||||
|
||||
swagger:model Layouts
|
||||
*/
|
||||
type Layouts struct {
|
||||
|
||||
/* layouts
|
||||
|
||||
Required: true
|
||||
*/
|
||||
Layouts []*Layout `json:"layouts"`
|
||||
}
|
||||
|
||||
// Validate validates this layouts
|
||||
func (m *Layouts) Validate(formats strfmt.Registry) error {
|
||||
var res []error
|
||||
|
||||
if err := m.validateLayouts(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *Layouts) validateLayouts(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("layouts", "body", m.Layouts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for i := 0; i < len(m.Layouts); i++ {
|
||||
|
||||
if swag.IsZero(m.Layouts[i]) { // not required
|
||||
continue
|
||||
}
|
||||
|
||||
if m.Layouts[i] != nil {
|
||||
|
||||
if err := m.Layouts[i].Validate(formats); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -15,13 +15,9 @@ swagger:model Routes
|
|||
*/
|
||||
type Routes struct {
|
||||
|
||||
/* Location of the apps endpoint
|
||||
/* Location of the layouts endpoint
|
||||
*/
|
||||
Apps string `json:"apps,omitempty"`
|
||||
|
||||
/* Location of the dashboards endpoint
|
||||
*/
|
||||
Dashboards string `json:"dashboards,omitempty"`
|
||||
Layouts string `json:"layouts,omitempty"`
|
||||
|
||||
/* Location of the sources endpoint
|
||||
*/
|
||||
|
|
|
@ -97,7 +97,9 @@ func configureAPI(api *op.MrFusionAPI) http.Handler {
|
|||
ExplorationStore: c.ExplorationStore,
|
||||
SourcesStore: c.SourcesStore,
|
||||
ServersStore: c.ServersStore,
|
||||
LayoutStore: c.LayoutStore,
|
||||
}
|
||||
|
||||
api.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler = op.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc(h.DeleteExploration)
|
||||
api.GetSourcesIDUsersUserIDExplorationsExplorationIDHandler = op.GetSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc(h.Exploration)
|
||||
api.GetSourcesIDUsersUserIDExplorationsHandler = op.GetSourcesIDUsersUserIDExplorationsHandlerFunc(h.Explorations)
|
||||
|
@ -130,6 +132,12 @@ func configureAPI(api *op.MrFusionAPI) http.Handler {
|
|||
api.PatchSourcesIDKapacitorsKapaIDProxyHandler = op.PatchSourcesIDKapacitorsKapaIDProxyHandlerFunc(p.KapacitorProxyPatch)
|
||||
api.GetSourcesIDKapacitorsKapaIDProxyHandler = op.GetSourcesIDKapacitorsKapaIDProxyHandlerFunc(p.KapacitorProxyGet)
|
||||
api.DeleteSourcesIDKapacitorsKapaIDProxyHandler = op.DeleteSourcesIDKapacitorsKapaIDProxyHandlerFunc(p.KapacitorProxyDelete)
|
||||
|
||||
api.DeleteLayoutsIDHandler = op.DeleteLayoutsIDHandlerFunc(h.RemoveLayout)
|
||||
api.GetLayoutsHandler = op.GetLayoutsHandlerFunc(h.Layouts)
|
||||
api.GetLayoutsIDHandler = op.GetLayoutsIDHandlerFunc(h.LayoutsID)
|
||||
api.PostLayoutsHandler = op.PostLayoutsHandlerFunc(h.NewLayout)
|
||||
api.PutLayoutsIDHandler = op.PutLayoutsIDHandlerFunc(h.UpdateLayout)
|
||||
} else {
|
||||
api.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler = op.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc(mockHandler.DeleteExploration)
|
||||
api.GetSourcesIDUsersUserIDExplorationsExplorationIDHandler = op.GetSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc(mockHandler.Exploration)
|
||||
|
@ -154,16 +162,6 @@ func configureAPI(api *op.MrFusionAPI) http.Handler {
|
|||
return middleware.NotImplemented("operation .DeleteSourcesIDUsersUserID has not yet been implemented")
|
||||
})
|
||||
|
||||
api.DeleteDashboardsIDHandler = op.DeleteDashboardsIDHandlerFunc(func(ctx context.Context, params op.DeleteDashboardsIDParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation .DeleteDashboardsID has not yet been implemented")
|
||||
})
|
||||
api.GetDashboardsHandler = op.GetDashboardsHandlerFunc(func(ctx context.Context, params op.GetDashboardsParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation .GetDashboards has not yet been implemented")
|
||||
})
|
||||
api.GetDashboardsIDHandler = op.GetDashboardsIDHandlerFunc(func(ctx context.Context, params op.GetDashboardsIDParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation .GetDashboardsID has not yet been implemented")
|
||||
})
|
||||
|
||||
api.GetSourcesIDPermissionsHandler = op.GetSourcesIDPermissionsHandlerFunc(func(ctx context.Context, params op.GetSourcesIDPermissionsParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation .GetSourcesIDPermissions has not yet been implemented")
|
||||
})
|
||||
|
@ -188,21 +186,12 @@ func configureAPI(api *op.MrFusionAPI) http.Handler {
|
|||
api.PatchSourcesIDUsersUserIDHandler = op.PatchSourcesIDUsersUserIDHandlerFunc(func(ctx context.Context, params op.PatchSourcesIDUsersUserIDParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation .PatchSourcesIDUsersUserID has not yet been implemented")
|
||||
})
|
||||
api.PostDashboardsHandler = op.PostDashboardsHandlerFunc(func(ctx context.Context, params op.PostDashboardsParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation .PostDashboards has not yet been implemented")
|
||||
})
|
||||
|
||||
api.PostSourcesIDRolesHandler = op.PostSourcesIDRolesHandlerFunc(func(ctx context.Context, params op.PostSourcesIDRolesParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation .PostSourcesIDRoles has not yet been implemented")
|
||||
})
|
||||
api.PostSourcesIDUsersHandler = op.PostSourcesIDUsersHandlerFunc(func(ctx context.Context, params op.PostSourcesIDUsersParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation .PostSourcesIDUsers has not yet been implemented")
|
||||
})
|
||||
|
||||
api.PutDashboardsIDHandler = op.PutDashboardsIDHandlerFunc(func(ctx context.Context, params op.PutDashboardsIDParams) middleware.Responder {
|
||||
return middleware.NotImplemented("operation .PutDashboardsID has not yet been implemented")
|
||||
})
|
||||
|
||||
api.GetSourcesIDMonitoredHandler = op.GetSourcesIDMonitoredHandlerFunc(mockHandler.MonitoredServices)
|
||||
|
||||
api.ServerShutdown = func() {}
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// DeleteDashboardsIDHandlerFunc turns a function with the right signature into a delete dashboards ID handler
|
||||
type DeleteDashboardsIDHandlerFunc func(context.Context, DeleteDashboardsIDParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn DeleteDashboardsIDHandlerFunc) Handle(ctx context.Context, params DeleteDashboardsIDParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// DeleteDashboardsIDHandler interface for that can handle valid delete dashboards ID params
|
||||
type DeleteDashboardsIDHandler interface {
|
||||
Handle(context.Context, DeleteDashboardsIDParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewDeleteDashboardsID creates a new http.Handler for the delete dashboards ID operation
|
||||
func NewDeleteDashboardsID(ctx *middleware.Context, handler DeleteDashboardsIDHandler) *DeleteDashboardsID {
|
||||
return &DeleteDashboardsID{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*DeleteDashboardsID swagger:route DELETE /dashboards/{id} deleteDashboardsId
|
||||
|
||||
This specific dashboard will be removed from the data store
|
||||
|
||||
*/
|
||||
type DeleteDashboardsID struct {
|
||||
Context *middleware.Context
|
||||
Handler DeleteDashboardsIDHandler
|
||||
}
|
||||
|
||||
func (o *DeleteDashboardsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewDeleteDashboardsIDParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*DeleteDashboardsIDNoContent An array of dashboards
|
||||
|
||||
swagger:response deleteDashboardsIdNoContent
|
||||
*/
|
||||
type DeleteDashboardsIDNoContent struct {
|
||||
}
|
||||
|
||||
// NewDeleteDashboardsIDNoContent creates DeleteDashboardsIDNoContent with default headers values
|
||||
func NewDeleteDashboardsIDNoContent() *DeleteDashboardsIDNoContent {
|
||||
return &DeleteDashboardsIDNoContent{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteDashboardsIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(204)
|
||||
}
|
||||
|
||||
/*DeleteDashboardsIDNotFound Unknown dashboard id
|
||||
|
||||
swagger:response deleteDashboardsIdNotFound
|
||||
*/
|
||||
type DeleteDashboardsIDNotFound struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDeleteDashboardsIDNotFound creates DeleteDashboardsIDNotFound with default headers values
|
||||
func NewDeleteDashboardsIDNotFound() *DeleteDashboardsIDNotFound {
|
||||
return &DeleteDashboardsIDNotFound{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the delete dashboards Id not found response
|
||||
func (o *DeleteDashboardsIDNotFound) WithPayload(payload *models.Error) *DeleteDashboardsIDNotFound {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the delete dashboards Id not found response
|
||||
func (o *DeleteDashboardsIDNotFound) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteDashboardsIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(404)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*DeleteDashboardsIDDefault Unexpected internal service error
|
||||
|
||||
swagger:response deleteDashboardsIdDefault
|
||||
*/
|
||||
type DeleteDashboardsIDDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDeleteDashboardsIDDefault creates DeleteDashboardsIDDefault with default headers values
|
||||
func NewDeleteDashboardsIDDefault(code int) *DeleteDashboardsIDDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &DeleteDashboardsIDDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the delete dashboards ID default response
|
||||
func (o *DeleteDashboardsIDDefault) WithStatusCode(code int) *DeleteDashboardsIDDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the delete dashboards ID default response
|
||||
func (o *DeleteDashboardsIDDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the delete dashboards ID default response
|
||||
func (o *DeleteDashboardsIDDefault) WithPayload(payload *models.Error) *DeleteDashboardsIDDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the delete dashboards ID default response
|
||||
func (o *DeleteDashboardsIDDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteDashboardsIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// DeleteLayoutsIDHandlerFunc turns a function with the right signature into a delete layouts ID handler
|
||||
type DeleteLayoutsIDHandlerFunc func(context.Context, DeleteLayoutsIDParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn DeleteLayoutsIDHandlerFunc) Handle(ctx context.Context, params DeleteLayoutsIDParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// DeleteLayoutsIDHandler interface for that can handle valid delete layouts ID params
|
||||
type DeleteLayoutsIDHandler interface {
|
||||
Handle(context.Context, DeleteLayoutsIDParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewDeleteLayoutsID creates a new http.Handler for the delete layouts ID operation
|
||||
func NewDeleteLayoutsID(ctx *middleware.Context, handler DeleteLayoutsIDHandler) *DeleteLayoutsID {
|
||||
return &DeleteLayoutsID{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*DeleteLayoutsID swagger:route DELETE /layouts/{id} deleteLayoutsId
|
||||
|
||||
This specific layout will be removed from the data store
|
||||
|
||||
*/
|
||||
type DeleteLayoutsID struct {
|
||||
Context *middleware.Context
|
||||
Handler DeleteLayoutsIDHandler
|
||||
}
|
||||
|
||||
func (o *DeleteLayoutsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewDeleteLayoutsIDParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -12,23 +12,23 @@ import (
|
|||
strfmt "github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetDashboardsIDParams creates a new GetDashboardsIDParams object
|
||||
// NewDeleteLayoutsIDParams creates a new DeleteLayoutsIDParams object
|
||||
// with the default values initialized.
|
||||
func NewGetDashboardsIDParams() GetDashboardsIDParams {
|
||||
func NewDeleteLayoutsIDParams() DeleteLayoutsIDParams {
|
||||
var ()
|
||||
return GetDashboardsIDParams{}
|
||||
return DeleteLayoutsIDParams{}
|
||||
}
|
||||
|
||||
// GetDashboardsIDParams contains all the bound params for the get dashboards ID operation
|
||||
// DeleteLayoutsIDParams contains all the bound params for the delete layouts ID operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters GetDashboardsID
|
||||
type GetDashboardsIDParams struct {
|
||||
// swagger:parameters DeleteLayoutsID
|
||||
type DeleteLayoutsIDParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request
|
||||
|
||||
/*ID of the dashboard
|
||||
/*ID of the layout
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@ type GetDashboardsIDParams struct {
|
|||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetDashboardsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
func (o *DeleteLayoutsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
o.HTTPRequest = r
|
||||
|
||||
|
@ -52,7 +52,7 @@ func (o *GetDashboardsIDParams) BindRequest(r *http.Request, route *middleware.M
|
|||
return nil
|
||||
}
|
||||
|
||||
func (o *GetDashboardsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
func (o *DeleteLayoutsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
|
@ -0,0 +1,122 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*DeleteLayoutsIDNoContent Layout has been removed.
|
||||
|
||||
swagger:response deleteLayoutsIdNoContent
|
||||
*/
|
||||
type DeleteLayoutsIDNoContent struct {
|
||||
}
|
||||
|
||||
// NewDeleteLayoutsIDNoContent creates DeleteLayoutsIDNoContent with default headers values
|
||||
func NewDeleteLayoutsIDNoContent() *DeleteLayoutsIDNoContent {
|
||||
return &DeleteLayoutsIDNoContent{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteLayoutsIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(204)
|
||||
}
|
||||
|
||||
/*DeleteLayoutsIDNotFound Unknown layout id
|
||||
|
||||
swagger:response deleteLayoutsIdNotFound
|
||||
*/
|
||||
type DeleteLayoutsIDNotFound struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDeleteLayoutsIDNotFound creates DeleteLayoutsIDNotFound with default headers values
|
||||
func NewDeleteLayoutsIDNotFound() *DeleteLayoutsIDNotFound {
|
||||
return &DeleteLayoutsIDNotFound{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the delete layouts Id not found response
|
||||
func (o *DeleteLayoutsIDNotFound) WithPayload(payload *models.Error) *DeleteLayoutsIDNotFound {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the delete layouts Id not found response
|
||||
func (o *DeleteLayoutsIDNotFound) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteLayoutsIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(404)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*DeleteLayoutsIDDefault Unexpected internal service error
|
||||
|
||||
swagger:response deleteLayoutsIdDefault
|
||||
*/
|
||||
type DeleteLayoutsIDDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewDeleteLayoutsIDDefault creates DeleteLayoutsIDDefault with default headers values
|
||||
func NewDeleteLayoutsIDDefault(code int) *DeleteLayoutsIDDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &DeleteLayoutsIDDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the delete layouts ID default response
|
||||
func (o *DeleteLayoutsIDDefault) WithStatusCode(code int) *DeleteLayoutsIDDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the delete layouts ID default response
|
||||
func (o *DeleteLayoutsIDDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the delete layouts ID default response
|
||||
func (o *DeleteLayoutsIDDefault) WithPayload(payload *models.Error) *DeleteLayoutsIDDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the delete layouts ID default response
|
||||
func (o *DeleteLayoutsIDDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *DeleteLayoutsIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// GetDashboardsHandlerFunc turns a function with the right signature into a get dashboards handler
|
||||
type GetDashboardsHandlerFunc func(context.Context, GetDashboardsParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetDashboardsHandlerFunc) Handle(ctx context.Context, params GetDashboardsParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// GetDashboardsHandler interface for that can handle valid get dashboards params
|
||||
type GetDashboardsHandler interface {
|
||||
Handle(context.Context, GetDashboardsParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetDashboards creates a new http.Handler for the get dashboards operation
|
||||
func NewGetDashboards(ctx *middleware.Context, handler GetDashboardsHandler) *GetDashboards {
|
||||
return &GetDashboards{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*GetDashboards swagger:route GET /dashboards getDashboards
|
||||
|
||||
Pre-configured dashboards
|
||||
|
||||
Dashboards are a collection of `Cells` that visualize time-series data.
|
||||
|
||||
|
||||
*/
|
||||
type GetDashboards struct {
|
||||
Context *middleware.Context
|
||||
Handler GetDashboardsHandler
|
||||
}
|
||||
|
||||
func (o *GetDashboards) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewGetDashboardsParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// GetDashboardsIDHandlerFunc turns a function with the right signature into a get dashboards ID handler
|
||||
type GetDashboardsIDHandlerFunc func(context.Context, GetDashboardsIDParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetDashboardsIDHandlerFunc) Handle(ctx context.Context, params GetDashboardsIDParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// GetDashboardsIDHandler interface for that can handle valid get dashboards ID params
|
||||
type GetDashboardsIDHandler interface {
|
||||
Handle(context.Context, GetDashboardsIDParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetDashboardsID creates a new http.Handler for the get dashboards ID operation
|
||||
func NewGetDashboardsID(ctx *middleware.Context, handler GetDashboardsIDHandler) *GetDashboardsID {
|
||||
return &GetDashboardsID{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*GetDashboardsID swagger:route GET /dashboards/{id} getDashboardsId
|
||||
|
||||
Specific pre-configured dashboard containing cells and queries.
|
||||
|
||||
dashboards will hold information about how to layout the page of graphs.
|
||||
|
||||
|
||||
*/
|
||||
type GetDashboardsID struct {
|
||||
Context *middleware.Context
|
||||
Handler GetDashboardsIDHandler
|
||||
}
|
||||
|
||||
func (o *GetDashboardsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewGetDashboardsIDParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*GetDashboardsIDOK Returns the specified dashboard containing `cells`.
|
||||
|
||||
swagger:response getDashboardsIdOK
|
||||
*/
|
||||
type GetDashboardsIDOK struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Dashboard `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDashboardsIDOK creates GetDashboardsIDOK with default headers values
|
||||
func NewGetDashboardsIDOK() *GetDashboardsIDOK {
|
||||
return &GetDashboardsIDOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get dashboards Id o k response
|
||||
func (o *GetDashboardsIDOK) WithPayload(payload *models.Dashboard) *GetDashboardsIDOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get dashboards Id o k response
|
||||
func (o *GetDashboardsIDOK) SetPayload(payload *models.Dashboard) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDashboardsIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetDashboardsIDNotFound Unknown dashboard id
|
||||
|
||||
swagger:response getDashboardsIdNotFound
|
||||
*/
|
||||
type GetDashboardsIDNotFound struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDashboardsIDNotFound creates GetDashboardsIDNotFound with default headers values
|
||||
func NewGetDashboardsIDNotFound() *GetDashboardsIDNotFound {
|
||||
return &GetDashboardsIDNotFound{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get dashboards Id not found response
|
||||
func (o *GetDashboardsIDNotFound) WithPayload(payload *models.Error) *GetDashboardsIDNotFound {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get dashboards Id not found response
|
||||
func (o *GetDashboardsIDNotFound) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDashboardsIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(404)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetDashboardsIDDefault Unexpected internal service error
|
||||
|
||||
swagger:response getDashboardsIdDefault
|
||||
*/
|
||||
type GetDashboardsIDDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDashboardsIDDefault creates GetDashboardsIDDefault with default headers values
|
||||
func NewGetDashboardsIDDefault(code int) *GetDashboardsIDDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetDashboardsIDDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get dashboards ID default response
|
||||
func (o *GetDashboardsIDDefault) WithStatusCode(code int) *GetDashboardsIDDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get dashboards ID default response
|
||||
func (o *GetDashboardsIDDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get dashboards ID default response
|
||||
func (o *GetDashboardsIDDefault) WithPayload(payload *models.Error) *GetDashboardsIDDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get dashboards ID default response
|
||||
func (o *GetDashboardsIDDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDashboardsIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// NewGetDashboardsParams creates a new GetDashboardsParams object
|
||||
// with the default values initialized.
|
||||
func NewGetDashboardsParams() GetDashboardsParams {
|
||||
var ()
|
||||
return GetDashboardsParams{}
|
||||
}
|
||||
|
||||
// GetDashboardsParams contains all the bound params for the get dashboards operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters GetDashboards
|
||||
type GetDashboardsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetDashboardsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
o.HTTPRequest = r
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*GetDashboardsOK An array of dashboards
|
||||
|
||||
swagger:response getDashboardsOK
|
||||
*/
|
||||
type GetDashboardsOK struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Dashboards `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDashboardsOK creates GetDashboardsOK with default headers values
|
||||
func NewGetDashboardsOK() *GetDashboardsOK {
|
||||
return &GetDashboardsOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get dashboards o k response
|
||||
func (o *GetDashboardsOK) WithPayload(payload *models.Dashboards) *GetDashboardsOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get dashboards o k response
|
||||
func (o *GetDashboardsOK) SetPayload(payload *models.Dashboards) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDashboardsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetDashboardsDefault Unexpected internal service error
|
||||
|
||||
swagger:response getDashboardsDefault
|
||||
*/
|
||||
type GetDashboardsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetDashboardsDefault creates GetDashboardsDefault with default headers values
|
||||
func NewGetDashboardsDefault(code int) *GetDashboardsDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetDashboardsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get dashboards default response
|
||||
func (o *GetDashboardsDefault) WithStatusCode(code int) *GetDashboardsDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get dashboards default response
|
||||
func (o *GetDashboardsDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get dashboards default response
|
||||
func (o *GetDashboardsDefault) WithPayload(payload *models.Error) *GetDashboardsDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get dashboards default response
|
||||
func (o *GetDashboardsDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetDashboardsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// GetLayoutsHandlerFunc turns a function with the right signature into a get layouts handler
|
||||
type GetLayoutsHandlerFunc func(context.Context, GetLayoutsParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetLayoutsHandlerFunc) Handle(ctx context.Context, params GetLayoutsParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// GetLayoutsHandler interface for that can handle valid get layouts params
|
||||
type GetLayoutsHandler interface {
|
||||
Handle(context.Context, GetLayoutsParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetLayouts creates a new http.Handler for the get layouts operation
|
||||
func NewGetLayouts(ctx *middleware.Context, handler GetLayoutsHandler) *GetLayouts {
|
||||
return &GetLayouts{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*GetLayouts swagger:route GET /layouts getLayouts
|
||||
|
||||
Pre-configured layouts
|
||||
|
||||
Layouts are a collection of `Cells` that visualize time-series data.
|
||||
|
||||
|
||||
*/
|
||||
type GetLayouts struct {
|
||||
Context *middleware.Context
|
||||
Handler GetLayoutsHandler
|
||||
}
|
||||
|
||||
func (o *GetLayouts) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewGetLayoutsParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// GetLayoutsIDHandlerFunc turns a function with the right signature into a get layouts ID handler
|
||||
type GetLayoutsIDHandlerFunc func(context.Context, GetLayoutsIDParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn GetLayoutsIDHandlerFunc) Handle(ctx context.Context, params GetLayoutsIDParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// GetLayoutsIDHandler interface for that can handle valid get layouts ID params
|
||||
type GetLayoutsIDHandler interface {
|
||||
Handle(context.Context, GetLayoutsIDParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewGetLayoutsID creates a new http.Handler for the get layouts ID operation
|
||||
func NewGetLayoutsID(ctx *middleware.Context, handler GetLayoutsIDHandler) *GetLayoutsID {
|
||||
return &GetLayoutsID{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*GetLayoutsID swagger:route GET /layouts/{id} getLayoutsId
|
||||
|
||||
Specific pre-configured layout containing cells and queries.
|
||||
|
||||
layouts will hold information about how to layout the page of graphs.
|
||||
|
||||
|
||||
*/
|
||||
type GetLayoutsID struct {
|
||||
Context *middleware.Context
|
||||
Handler GetLayoutsIDHandler
|
||||
}
|
||||
|
||||
func (o *GetLayoutsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewGetLayoutsIDParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -12,23 +12,23 @@ import (
|
|||
strfmt "github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewDeleteDashboardsIDParams creates a new DeleteDashboardsIDParams object
|
||||
// NewGetLayoutsIDParams creates a new GetLayoutsIDParams object
|
||||
// with the default values initialized.
|
||||
func NewDeleteDashboardsIDParams() DeleteDashboardsIDParams {
|
||||
func NewGetLayoutsIDParams() GetLayoutsIDParams {
|
||||
var ()
|
||||
return DeleteDashboardsIDParams{}
|
||||
return GetLayoutsIDParams{}
|
||||
}
|
||||
|
||||
// DeleteDashboardsIDParams contains all the bound params for the delete dashboards ID operation
|
||||
// GetLayoutsIDParams contains all the bound params for the get layouts ID operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters DeleteDashboardsID
|
||||
type DeleteDashboardsIDParams struct {
|
||||
// swagger:parameters GetLayoutsID
|
||||
type GetLayoutsIDParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request
|
||||
|
||||
/*ID of the dashboard
|
||||
/*ID of the layout
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@ type DeleteDashboardsIDParams struct {
|
|||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *DeleteDashboardsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
func (o *GetLayoutsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
o.HTTPRequest = r
|
||||
|
||||
|
@ -52,7 +52,7 @@ func (o *DeleteDashboardsIDParams) BindRequest(r *http.Request, route *middlewar
|
|||
return nil
|
||||
}
|
||||
|
||||
func (o *DeleteDashboardsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
func (o *GetLayoutsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
|
@ -0,0 +1,141 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*GetLayoutsIDOK Returns the specified layout containing `cells`.
|
||||
|
||||
swagger:response getLayoutsIdOK
|
||||
*/
|
||||
type GetLayoutsIDOK struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Layout `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetLayoutsIDOK creates GetLayoutsIDOK with default headers values
|
||||
func NewGetLayoutsIDOK() *GetLayoutsIDOK {
|
||||
return &GetLayoutsIDOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get layouts Id o k response
|
||||
func (o *GetLayoutsIDOK) WithPayload(payload *models.Layout) *GetLayoutsIDOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get layouts Id o k response
|
||||
func (o *GetLayoutsIDOK) SetPayload(payload *models.Layout) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetLayoutsIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetLayoutsIDNotFound Unknown layout id
|
||||
|
||||
swagger:response getLayoutsIdNotFound
|
||||
*/
|
||||
type GetLayoutsIDNotFound struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetLayoutsIDNotFound creates GetLayoutsIDNotFound with default headers values
|
||||
func NewGetLayoutsIDNotFound() *GetLayoutsIDNotFound {
|
||||
return &GetLayoutsIDNotFound{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get layouts Id not found response
|
||||
func (o *GetLayoutsIDNotFound) WithPayload(payload *models.Error) *GetLayoutsIDNotFound {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get layouts Id not found response
|
||||
func (o *GetLayoutsIDNotFound) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetLayoutsIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(404)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetLayoutsIDDefault Unexpected internal service error
|
||||
|
||||
swagger:response getLayoutsIdDefault
|
||||
*/
|
||||
type GetLayoutsIDDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetLayoutsIDDefault creates GetLayoutsIDDefault with default headers values
|
||||
func NewGetLayoutsIDDefault(code int) *GetLayoutsIDDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetLayoutsIDDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get layouts ID default response
|
||||
func (o *GetLayoutsIDDefault) WithStatusCode(code int) *GetLayoutsIDDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get layouts ID default response
|
||||
func (o *GetLayoutsIDDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get layouts ID default response
|
||||
func (o *GetLayoutsIDDefault) WithPayload(payload *models.Error) *GetLayoutsIDDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get layouts ID default response
|
||||
func (o *GetLayoutsIDDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetLayoutsIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,137 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/swag"
|
||||
|
||||
strfmt "github.com/go-openapi/strfmt"
|
||||
)
|
||||
|
||||
// NewGetLayoutsParams creates a new GetLayoutsParams object
|
||||
// with the default values initialized.
|
||||
func NewGetLayoutsParams() GetLayoutsParams {
|
||||
var ()
|
||||
return GetLayoutsParams{}
|
||||
}
|
||||
|
||||
// GetLayoutsParams contains all the bound params for the get layouts operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters GetLayouts
|
||||
type GetLayoutsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request
|
||||
|
||||
/*Returns layouts with this app
|
||||
In: query
|
||||
Collection Format: csv
|
||||
*/
|
||||
Apps []string
|
||||
/*Returns layouts with this telegraf measurement
|
||||
In: query
|
||||
Collection Format: csv
|
||||
*/
|
||||
TelegrafMeasurements []string
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *GetLayoutsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
qApps, qhkApps, _ := qs.GetOK("apps")
|
||||
if err := o.bindApps(qApps, qhkApps, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qTelegrafMeasurements, qhkTelegrafMeasurements, _ := qs.GetOK("telegraf_measurements")
|
||||
if err := o.bindTelegrafMeasurements(qTelegrafMeasurements, qhkTelegrafMeasurements, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetLayoutsParams) bindApps(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
|
||||
var qvApps string
|
||||
if len(rawData) > 0 {
|
||||
qvApps = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
raw := swag.SplitByFormat(qvApps, "csv")
|
||||
size := len(raw)
|
||||
|
||||
if size == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
ic := raw
|
||||
isz := size
|
||||
var ir []string
|
||||
iValidateElement := func(i int, appsI string) *errors.Validation {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < isz; i++ {
|
||||
|
||||
if err := iValidateElement(i, ic[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
ir = append(ir, ic[i])
|
||||
}
|
||||
|
||||
o.Apps = ir
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *GetLayoutsParams) bindTelegrafMeasurements(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
|
||||
var qvTelegrafMeasurements string
|
||||
if len(rawData) > 0 {
|
||||
qvTelegrafMeasurements = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
raw := swag.SplitByFormat(qvTelegrafMeasurements, "csv")
|
||||
size := len(raw)
|
||||
|
||||
if size == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
ic := raw
|
||||
isz := size
|
||||
var ir []string
|
||||
iValidateElement := func(i int, telegrafMeasurementsI string) *errors.Validation {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
for i := 0; i < isz; i++ {
|
||||
|
||||
if err := iValidateElement(i, ic[i]); err != nil {
|
||||
return err
|
||||
}
|
||||
ir = append(ir, ic[i])
|
||||
}
|
||||
|
||||
o.TelegrafMeasurements = ir
|
||||
|
||||
return nil
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*GetLayoutsOK An array of layouts
|
||||
|
||||
swagger:response getLayoutsOK
|
||||
*/
|
||||
type GetLayoutsOK struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Layouts `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetLayoutsOK creates GetLayoutsOK with default headers values
|
||||
func NewGetLayoutsOK() *GetLayoutsOK {
|
||||
return &GetLayoutsOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get layouts o k response
|
||||
func (o *GetLayoutsOK) WithPayload(payload *models.Layouts) *GetLayoutsOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get layouts o k response
|
||||
func (o *GetLayoutsOK) SetPayload(payload *models.Layouts) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetLayoutsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*GetLayoutsDefault Unexpected internal service error
|
||||
|
||||
swagger:response getLayoutsDefault
|
||||
*/
|
||||
type GetLayoutsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewGetLayoutsDefault creates GetLayoutsDefault with default headers values
|
||||
func NewGetLayoutsDefault(code int) *GetLayoutsDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &GetLayoutsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the get layouts default response
|
||||
func (o *GetLayoutsDefault) WithStatusCode(code int) *GetLayoutsDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the get layouts default response
|
||||
func (o *GetLayoutsDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the get layouts default response
|
||||
func (o *GetLayoutsDefault) WithPayload(payload *models.Error) *GetLayoutsDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the get layouts default response
|
||||
func (o *GetLayoutsDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *GetLayoutsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@ import (
|
|||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*GetSourcesIDOK Data source used to supply time series to dashboards.
|
||||
/*GetSourcesIDOK Data source used to supply time series information.
|
||||
|
||||
swagger:response getSourcesIdOK
|
||||
*/
|
||||
|
|
|
@ -42,8 +42,8 @@ type MrFusionAPI struct {
|
|||
// JSONProducer registers a producer for a "application/json" mime type
|
||||
JSONProducer runtime.Producer
|
||||
|
||||
// DeleteDashboardsIDHandler sets the operation handler for the delete dashboards ID operation
|
||||
DeleteDashboardsIDHandler DeleteDashboardsIDHandler
|
||||
// DeleteLayoutsIDHandler sets the operation handler for the delete layouts ID operation
|
||||
DeleteLayoutsIDHandler DeleteLayoutsIDHandler
|
||||
// DeleteSourcesIDHandler sets the operation handler for the delete sources ID operation
|
||||
DeleteSourcesIDHandler DeleteSourcesIDHandler
|
||||
// DeleteSourcesIDKapacitorsKapaIDHandler sets the operation handler for the delete sources ID kapacitors kapa ID operation
|
||||
|
@ -58,10 +58,10 @@ type MrFusionAPI struct {
|
|||
DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler
|
||||
// GetHandler sets the operation handler for the get operation
|
||||
GetHandler GetHandler
|
||||
// GetDashboardsHandler sets the operation handler for the get dashboards operation
|
||||
GetDashboardsHandler GetDashboardsHandler
|
||||
// GetDashboardsIDHandler sets the operation handler for the get dashboards ID operation
|
||||
GetDashboardsIDHandler GetDashboardsIDHandler
|
||||
// GetLayoutsHandler sets the operation handler for the get layouts operation
|
||||
GetLayoutsHandler GetLayoutsHandler
|
||||
// GetLayoutsIDHandler sets the operation handler for the get layouts ID operation
|
||||
GetLayoutsIDHandler GetLayoutsIDHandler
|
||||
// GetSourcesHandler sets the operation handler for the get sources operation
|
||||
GetSourcesHandler GetSourcesHandler
|
||||
// GetSourcesIDHandler sets the operation handler for the get sources ID operation
|
||||
|
@ -100,8 +100,8 @@ type MrFusionAPI struct {
|
|||
PatchSourcesIDUsersUserIDHandler PatchSourcesIDUsersUserIDHandler
|
||||
// PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler sets the operation handler for the patch sources ID users user ID explorations exploration ID operation
|
||||
PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler
|
||||
// PostDashboardsHandler sets the operation handler for the post dashboards operation
|
||||
PostDashboardsHandler PostDashboardsHandler
|
||||
// PostLayoutsHandler sets the operation handler for the post layouts operation
|
||||
PostLayoutsHandler PostLayoutsHandler
|
||||
// PostSourcesHandler sets the operation handler for the post sources operation
|
||||
PostSourcesHandler PostSourcesHandler
|
||||
// PostSourcesIDKapacitorsHandler sets the operation handler for the post sources ID kapacitors operation
|
||||
|
@ -116,8 +116,8 @@ type MrFusionAPI struct {
|
|||
PostSourcesIDUsersHandler PostSourcesIDUsersHandler
|
||||
// PostSourcesIDUsersUserIDExplorationsHandler sets the operation handler for the post sources ID users user ID explorations operation
|
||||
PostSourcesIDUsersUserIDExplorationsHandler PostSourcesIDUsersUserIDExplorationsHandler
|
||||
// PutDashboardsIDHandler sets the operation handler for the put dashboards ID operation
|
||||
PutDashboardsIDHandler PutDashboardsIDHandler
|
||||
// PutLayoutsIDHandler sets the operation handler for the put layouts ID operation
|
||||
PutLayoutsIDHandler PutLayoutsIDHandler
|
||||
|
||||
// ServeError is called when an error is received, there is a default handler
|
||||
// but you can set your own with this
|
||||
|
@ -181,8 +181,8 @@ func (o *MrFusionAPI) Validate() error {
|
|||
unregistered = append(unregistered, "JSONProducer")
|
||||
}
|
||||
|
||||
if o.DeleteDashboardsIDHandler == nil {
|
||||
unregistered = append(unregistered, "DeleteDashboardsIDHandler")
|
||||
if o.DeleteLayoutsIDHandler == nil {
|
||||
unregistered = append(unregistered, "DeleteLayoutsIDHandler")
|
||||
}
|
||||
|
||||
if o.DeleteSourcesIDHandler == nil {
|
||||
|
@ -213,12 +213,12 @@ func (o *MrFusionAPI) Validate() error {
|
|||
unregistered = append(unregistered, "GetHandler")
|
||||
}
|
||||
|
||||
if o.GetDashboardsHandler == nil {
|
||||
unregistered = append(unregistered, "GetDashboardsHandler")
|
||||
if o.GetLayoutsHandler == nil {
|
||||
unregistered = append(unregistered, "GetLayoutsHandler")
|
||||
}
|
||||
|
||||
if o.GetDashboardsIDHandler == nil {
|
||||
unregistered = append(unregistered, "GetDashboardsIDHandler")
|
||||
if o.GetLayoutsIDHandler == nil {
|
||||
unregistered = append(unregistered, "GetLayoutsIDHandler")
|
||||
}
|
||||
|
||||
if o.GetSourcesHandler == nil {
|
||||
|
@ -297,8 +297,8 @@ func (o *MrFusionAPI) Validate() error {
|
|||
unregistered = append(unregistered, "PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler")
|
||||
}
|
||||
|
||||
if o.PostDashboardsHandler == nil {
|
||||
unregistered = append(unregistered, "PostDashboardsHandler")
|
||||
if o.PostLayoutsHandler == nil {
|
||||
unregistered = append(unregistered, "PostLayoutsHandler")
|
||||
}
|
||||
|
||||
if o.PostSourcesHandler == nil {
|
||||
|
@ -329,8 +329,8 @@ func (o *MrFusionAPI) Validate() error {
|
|||
unregistered = append(unregistered, "PostSourcesIDUsersUserIDExplorationsHandler")
|
||||
}
|
||||
|
||||
if o.PutDashboardsIDHandler == nil {
|
||||
unregistered = append(unregistered, "PutDashboardsIDHandler")
|
||||
if o.PutLayoutsIDHandler == nil {
|
||||
unregistered = append(unregistered, "PutLayoutsIDHandler")
|
||||
}
|
||||
|
||||
if len(unregistered) > 0 {
|
||||
|
@ -417,7 +417,7 @@ func (o *MrFusionAPI) initHandlerCache() {
|
|||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["DELETE"]["/dashboards/{id}"] = NewDeleteDashboardsID(o.context, o.DeleteDashboardsIDHandler)
|
||||
o.handlers["DELETE"]["/layouts/{id}"] = NewDeleteLayoutsID(o.context, o.DeleteLayoutsIDHandler)
|
||||
|
||||
if o.handlers["DELETE"] == nil {
|
||||
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
|
||||
|
@ -457,12 +457,12 @@ func (o *MrFusionAPI) initHandlerCache() {
|
|||
if o.handlers["GET"] == nil {
|
||||
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/dashboards"] = NewGetDashboards(o.context, o.GetDashboardsHandler)
|
||||
o.handlers["GET"]["/layouts"] = NewGetLayouts(o.context, o.GetLayoutsHandler)
|
||||
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["GET"]["/dashboards/{id}"] = NewGetDashboardsID(o.context, o.GetDashboardsIDHandler)
|
||||
o.handlers["GET"]["/layouts/{id}"] = NewGetLayoutsID(o.context, o.GetLayoutsIDHandler)
|
||||
|
||||
if o.handlers["GET"] == nil {
|
||||
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
|
||||
|
@ -562,7 +562,7 @@ func (o *MrFusionAPI) initHandlerCache() {
|
|||
if o.handlers["POST"] == nil {
|
||||
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["POST"]["/dashboards"] = NewPostDashboards(o.context, o.PostDashboardsHandler)
|
||||
o.handlers["POST"]["/layouts"] = NewPostLayouts(o.context, o.PostLayoutsHandler)
|
||||
|
||||
if o.handlers["POST"] == nil {
|
||||
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
|
||||
|
@ -602,7 +602,7 @@ func (o *MrFusionAPI) initHandlerCache() {
|
|||
if o.handlers["PUT"] == nil {
|
||||
o.handlers[strings.ToUpper("PUT")] = make(map[string]http.Handler)
|
||||
}
|
||||
o.handlers["PUT"]["/dashboards/{id}"] = NewPutDashboardsID(o.context, o.PutDashboardsIDHandler)
|
||||
o.handlers["PUT"]["/layouts/{id}"] = NewPutLayoutsID(o.context, o.PutLayoutsIDHandler)
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// PostDashboardsHandlerFunc turns a function with the right signature into a post dashboards handler
|
||||
type PostDashboardsHandlerFunc func(context.Context, PostDashboardsParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn PostDashboardsHandlerFunc) Handle(ctx context.Context, params PostDashboardsParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// PostDashboardsHandler interface for that can handle valid post dashboards params
|
||||
type PostDashboardsHandler interface {
|
||||
Handle(context.Context, PostDashboardsParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewPostDashboards creates a new http.Handler for the post dashboards operation
|
||||
func NewPostDashboards(ctx *middleware.Context, handler PostDashboardsHandler) *PostDashboards {
|
||||
return &PostDashboards{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*PostDashboards swagger:route POST /dashboards postDashboards
|
||||
|
||||
Create new Dashboard
|
||||
|
||||
*/
|
||||
type PostDashboards struct {
|
||||
Context *middleware.Context
|
||||
Handler PostDashboardsHandler
|
||||
}
|
||||
|
||||
func (o *PostDashboards) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewPostDashboardsParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*PostDashboardsCreated Successfully created new dashboard
|
||||
|
||||
swagger:response postDashboardsCreated
|
||||
*/
|
||||
type PostDashboardsCreated struct {
|
||||
/*Location of the newly created dashboard
|
||||
Required: true
|
||||
*/
|
||||
Location string `json:"Location"`
|
||||
|
||||
// In: body
|
||||
Payload *models.Dashboard `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPostDashboardsCreated creates PostDashboardsCreated with default headers values
|
||||
func NewPostDashboardsCreated() *PostDashboardsCreated {
|
||||
return &PostDashboardsCreated{}
|
||||
}
|
||||
|
||||
// WithLocation adds the location to the post dashboards created response
|
||||
func (o *PostDashboardsCreated) WithLocation(location string) *PostDashboardsCreated {
|
||||
o.Location = location
|
||||
return o
|
||||
}
|
||||
|
||||
// SetLocation sets the location to the post dashboards created response
|
||||
func (o *PostDashboardsCreated) SetLocation(location string) {
|
||||
o.Location = location
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the post dashboards created response
|
||||
func (o *PostDashboardsCreated) WithPayload(payload *models.Dashboard) *PostDashboardsCreated {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the post dashboards created response
|
||||
func (o *PostDashboardsCreated) SetPayload(payload *models.Dashboard) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PostDashboardsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
// response header Location
|
||||
rw.Header().Add("Location", fmt.Sprintf("%v", o.Location))
|
||||
|
||||
rw.WriteHeader(201)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*PostDashboardsDefault A processing or an unexpected error.
|
||||
|
||||
swagger:response postDashboardsDefault
|
||||
*/
|
||||
type PostDashboardsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPostDashboardsDefault creates PostDashboardsDefault with default headers values
|
||||
func NewPostDashboardsDefault(code int) *PostDashboardsDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &PostDashboardsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the post dashboards default response
|
||||
func (o *PostDashboardsDefault) WithStatusCode(code int) *PostDashboardsDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the post dashboards default response
|
||||
func (o *PostDashboardsDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the post dashboards default response
|
||||
func (o *PostDashboardsDefault) WithPayload(payload *models.Error) *PostDashboardsDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the post dashboards default response
|
||||
func (o *PostDashboardsDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PostDashboardsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// PostLayoutsHandlerFunc turns a function with the right signature into a post layouts handler
|
||||
type PostLayoutsHandlerFunc func(context.Context, PostLayoutsParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn PostLayoutsHandlerFunc) Handle(ctx context.Context, params PostLayoutsParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// PostLayoutsHandler interface for that can handle valid post layouts params
|
||||
type PostLayoutsHandler interface {
|
||||
Handle(context.Context, PostLayoutsParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewPostLayouts creates a new http.Handler for the post layouts operation
|
||||
func NewPostLayouts(ctx *middleware.Context, handler PostLayoutsHandler) *PostLayouts {
|
||||
return &PostLayouts{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*PostLayouts swagger:route POST /layouts postLayouts
|
||||
|
||||
Create new layout
|
||||
|
||||
*/
|
||||
type PostLayouts struct {
|
||||
Context *middleware.Context
|
||||
Handler PostLayoutsHandler
|
||||
}
|
||||
|
||||
func (o *PostLayouts) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewPostLayoutsParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -13,46 +13,46 @@ import (
|
|||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
// NewPostDashboardsParams creates a new PostDashboardsParams object
|
||||
// NewPostLayoutsParams creates a new PostLayoutsParams object
|
||||
// with the default values initialized.
|
||||
func NewPostDashboardsParams() PostDashboardsParams {
|
||||
func NewPostLayoutsParams() PostLayoutsParams {
|
||||
var ()
|
||||
return PostDashboardsParams{}
|
||||
return PostLayoutsParams{}
|
||||
}
|
||||
|
||||
// PostDashboardsParams contains all the bound params for the post dashboards operation
|
||||
// PostLayoutsParams contains all the bound params for the post layouts operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters PostDashboards
|
||||
type PostDashboardsParams struct {
|
||||
// swagger:parameters PostLayouts
|
||||
type PostLayoutsParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request
|
||||
|
||||
/*Defines the dashboard and queries of the cells within the dashboard.
|
||||
/*Defines the layout and queries of the cells within the layout.
|
||||
In: body
|
||||
*/
|
||||
Dashboard *models.Dashboard
|
||||
Layout *models.Layout
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *PostDashboardsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
func (o *PostLayoutsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.Dashboard
|
||||
var body models.Layout
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
res = append(res, errors.NewParseError("dashboard", "body", "", err))
|
||||
res = append(res, errors.NewParseError("layout", "body", "", err))
|
||||
} else {
|
||||
if err := body.Validate(route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) == 0 {
|
||||
o.Dashboard = &body
|
||||
o.Layout = &body
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,123 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*PostLayoutsCreated Successfully created new layout
|
||||
|
||||
swagger:response postLayoutsCreated
|
||||
*/
|
||||
type PostLayoutsCreated struct {
|
||||
/*Location of the newly created layout
|
||||
Required: true
|
||||
*/
|
||||
Location string `json:"Location"`
|
||||
|
||||
// In: body
|
||||
Payload *models.Layout `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPostLayoutsCreated creates PostLayoutsCreated with default headers values
|
||||
func NewPostLayoutsCreated() *PostLayoutsCreated {
|
||||
return &PostLayoutsCreated{}
|
||||
}
|
||||
|
||||
// WithLocation adds the location to the post layouts created response
|
||||
func (o *PostLayoutsCreated) WithLocation(location string) *PostLayoutsCreated {
|
||||
o.Location = location
|
||||
return o
|
||||
}
|
||||
|
||||
// SetLocation sets the location to the post layouts created response
|
||||
func (o *PostLayoutsCreated) SetLocation(location string) {
|
||||
o.Location = location
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the post layouts created response
|
||||
func (o *PostLayoutsCreated) WithPayload(payload *models.Layout) *PostLayoutsCreated {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the post layouts created response
|
||||
func (o *PostLayoutsCreated) SetPayload(payload *models.Layout) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PostLayoutsCreated) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
// response header Location
|
||||
rw.Header().Add("Location", fmt.Sprintf("%v", o.Location))
|
||||
|
||||
rw.WriteHeader(201)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*PostLayoutsDefault A processing or an unexpected error.
|
||||
|
||||
swagger:response postLayoutsDefault
|
||||
*/
|
||||
type PostLayoutsDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPostLayoutsDefault creates PostLayoutsDefault with default headers values
|
||||
func NewPostLayoutsDefault(code int) *PostLayoutsDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &PostLayoutsDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the post layouts default response
|
||||
func (o *PostLayoutsDefault) WithStatusCode(code int) *PostLayoutsDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the post layouts default response
|
||||
func (o *PostLayoutsDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the post layouts default response
|
||||
func (o *PostLayoutsDefault) WithPayload(payload *models.Error) *PostLayoutsDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the post layouts default response
|
||||
func (o *PostLayoutsDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PostLayoutsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// PutDashboardsIDHandlerFunc turns a function with the right signature into a put dashboards ID handler
|
||||
type PutDashboardsIDHandlerFunc func(context.Context, PutDashboardsIDParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn PutDashboardsIDHandlerFunc) Handle(ctx context.Context, params PutDashboardsIDParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// PutDashboardsIDHandler interface for that can handle valid put dashboards ID params
|
||||
type PutDashboardsIDHandler interface {
|
||||
Handle(context.Context, PutDashboardsIDParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewPutDashboardsID creates a new http.Handler for the put dashboards ID operation
|
||||
func NewPutDashboardsID(ctx *middleware.Context, handler PutDashboardsIDHandler) *PutDashboardsID {
|
||||
return &PutDashboardsID{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*PutDashboardsID swagger:route PUT /dashboards/{id} putDashboardsId
|
||||
|
||||
Replace dashboard configuration.
|
||||
|
||||
*/
|
||||
type PutDashboardsID struct {
|
||||
Context *middleware.Context
|
||||
Handler PutDashboardsIDHandler
|
||||
}
|
||||
|
||||
func (o *PutDashboardsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewPutDashboardsIDParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*PutDashboardsIDNoContent Dashboard's configuration was changed
|
||||
|
||||
swagger:response putDashboardsIdNoContent
|
||||
*/
|
||||
type PutDashboardsIDNoContent struct {
|
||||
}
|
||||
|
||||
// NewPutDashboardsIDNoContent creates PutDashboardsIDNoContent with default headers values
|
||||
func NewPutDashboardsIDNoContent() *PutDashboardsIDNoContent {
|
||||
return &PutDashboardsIDNoContent{}
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PutDashboardsIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(204)
|
||||
}
|
||||
|
||||
/*PutDashboardsIDNotFound Happens when trying to access a non-existent dashboard.
|
||||
|
||||
swagger:response putDashboardsIdNotFound
|
||||
*/
|
||||
type PutDashboardsIDNotFound struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPutDashboardsIDNotFound creates PutDashboardsIDNotFound with default headers values
|
||||
func NewPutDashboardsIDNotFound() *PutDashboardsIDNotFound {
|
||||
return &PutDashboardsIDNotFound{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the put dashboards Id not found response
|
||||
func (o *PutDashboardsIDNotFound) WithPayload(payload *models.Error) *PutDashboardsIDNotFound {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the put dashboards Id not found response
|
||||
func (o *PutDashboardsIDNotFound) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PutDashboardsIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(404)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*PutDashboardsIDDefault A processing or an unexpected error.
|
||||
|
||||
swagger:response putDashboardsIdDefault
|
||||
*/
|
||||
type PutDashboardsIDDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPutDashboardsIDDefault creates PutDashboardsIDDefault with default headers values
|
||||
func NewPutDashboardsIDDefault(code int) *PutDashboardsIDDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &PutDashboardsIDDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the put dashboards ID default response
|
||||
func (o *PutDashboardsIDDefault) WithStatusCode(code int) *PutDashboardsIDDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the put dashboards ID default response
|
||||
func (o *PutDashboardsIDDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the put dashboards ID default response
|
||||
func (o *PutDashboardsIDDefault) WithPayload(payload *models.Error) *PutDashboardsIDDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the put dashboards ID default response
|
||||
func (o *PutDashboardsIDDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PutDashboardsIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
context "golang.org/x/net/context"
|
||||
|
||||
middleware "github.com/go-openapi/runtime/middleware"
|
||||
)
|
||||
|
||||
// PutLayoutsIDHandlerFunc turns a function with the right signature into a put layouts ID handler
|
||||
type PutLayoutsIDHandlerFunc func(context.Context, PutLayoutsIDParams) middleware.Responder
|
||||
|
||||
// Handle executing the request and returning a response
|
||||
func (fn PutLayoutsIDHandlerFunc) Handle(ctx context.Context, params PutLayoutsIDParams) middleware.Responder {
|
||||
return fn(ctx, params)
|
||||
}
|
||||
|
||||
// PutLayoutsIDHandler interface for that can handle valid put layouts ID params
|
||||
type PutLayoutsIDHandler interface {
|
||||
Handle(context.Context, PutLayoutsIDParams) middleware.Responder
|
||||
}
|
||||
|
||||
// NewPutLayoutsID creates a new http.Handler for the put layouts ID operation
|
||||
func NewPutLayoutsID(ctx *middleware.Context, handler PutLayoutsIDHandler) *PutLayoutsID {
|
||||
return &PutLayoutsID{Context: ctx, Handler: handler}
|
||||
}
|
||||
|
||||
/*PutLayoutsID swagger:route PUT /layouts/{id} putLayoutsId
|
||||
|
||||
Replace layout configuration.
|
||||
|
||||
*/
|
||||
type PutLayoutsID struct {
|
||||
Context *middleware.Context
|
||||
Handler PutLayoutsIDHandler
|
||||
}
|
||||
|
||||
func (o *PutLayoutsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
|
||||
route, _ := o.Context.RouteInfo(r)
|
||||
var Params = NewPutLayoutsIDParams()
|
||||
|
||||
if err := o.Context.BindValidRequest(r, route, &Params); err != nil { // bind params
|
||||
o.Context.Respond(rw, r, route.Produces, route, err)
|
||||
return
|
||||
}
|
||||
|
||||
res := o.Handler.Handle(context.Background(), Params) // actually handle the request
|
||||
|
||||
o.Context.Respond(rw, r, route.Produces, route, res)
|
||||
|
||||
}
|
|
@ -16,28 +16,28 @@ import (
|
|||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
// NewPutDashboardsIDParams creates a new PutDashboardsIDParams object
|
||||
// NewPutLayoutsIDParams creates a new PutLayoutsIDParams object
|
||||
// with the default values initialized.
|
||||
func NewPutDashboardsIDParams() PutDashboardsIDParams {
|
||||
func NewPutLayoutsIDParams() PutLayoutsIDParams {
|
||||
var ()
|
||||
return PutDashboardsIDParams{}
|
||||
return PutLayoutsIDParams{}
|
||||
}
|
||||
|
||||
// PutDashboardsIDParams contains all the bound params for the put dashboards ID operation
|
||||
// PutLayoutsIDParams contains all the bound params for the put layouts ID operation
|
||||
// typically these are obtained from a http.Request
|
||||
//
|
||||
// swagger:parameters PutDashboardsID
|
||||
type PutDashboardsIDParams struct {
|
||||
// swagger:parameters PutLayoutsID
|
||||
type PutLayoutsIDParams struct {
|
||||
|
||||
// HTTP Request Object
|
||||
HTTPRequest *http.Request
|
||||
|
||||
/*dashboard configuration update parameters
|
||||
/*layout configuration update parameters
|
||||
Required: true
|
||||
In: body
|
||||
*/
|
||||
Config *models.Dashboard
|
||||
/*ID of a dashboard
|
||||
Config *models.Layout
|
||||
/*ID of a layout
|
||||
Required: true
|
||||
In: path
|
||||
*/
|
||||
|
@ -46,13 +46,13 @@ type PutDashboardsIDParams struct {
|
|||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
// for simple values it will use straight method calls
|
||||
func (o *PutDashboardsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
func (o *PutLayoutsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
|
||||
var res []error
|
||||
o.HTTPRequest = r
|
||||
|
||||
if runtime.HasBody(r) {
|
||||
defer r.Body.Close()
|
||||
var body models.Dashboard
|
||||
var body models.Layout
|
||||
if err := route.Consumer.Consume(r.Body, &body); err != nil {
|
||||
if err == io.EOF {
|
||||
res = append(res, errors.Required("config", "body"))
|
||||
|
@ -85,7 +85,7 @@ func (o *PutDashboardsIDParams) BindRequest(r *http.Request, route *middleware.M
|
|||
return nil
|
||||
}
|
||||
|
||||
func (o *PutDashboardsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
func (o *PutLayoutsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
|
@ -0,0 +1,141 @@
|
|||
package operations
|
||||
|
||||
// This file was generated by the swagger tool.
|
||||
// Editing this file might prove futile when you re-run the swagger generate command
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/runtime"
|
||||
|
||||
"github.com/influxdata/mrfusion/models"
|
||||
)
|
||||
|
||||
/*PutLayoutsIDOK Layout has been replaced and the new layout is returned.
|
||||
|
||||
swagger:response putLayoutsIdOK
|
||||
*/
|
||||
type PutLayoutsIDOK struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Layout `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPutLayoutsIDOK creates PutLayoutsIDOK with default headers values
|
||||
func NewPutLayoutsIDOK() *PutLayoutsIDOK {
|
||||
return &PutLayoutsIDOK{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the put layouts Id o k response
|
||||
func (o *PutLayoutsIDOK) WithPayload(payload *models.Layout) *PutLayoutsIDOK {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the put layouts Id o k response
|
||||
func (o *PutLayoutsIDOK) SetPayload(payload *models.Layout) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PutLayoutsIDOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(200)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*PutLayoutsIDNotFound Happens when trying to access a non-existent layout.
|
||||
|
||||
swagger:response putLayoutsIdNotFound
|
||||
*/
|
||||
type PutLayoutsIDNotFound struct {
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPutLayoutsIDNotFound creates PutLayoutsIDNotFound with default headers values
|
||||
func NewPutLayoutsIDNotFound() *PutLayoutsIDNotFound {
|
||||
return &PutLayoutsIDNotFound{}
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the put layouts Id not found response
|
||||
func (o *PutLayoutsIDNotFound) WithPayload(payload *models.Error) *PutLayoutsIDNotFound {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the put layouts Id not found response
|
||||
func (o *PutLayoutsIDNotFound) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PutLayoutsIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(404)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*PutLayoutsIDDefault A processing or an unexpected error.
|
||||
|
||||
swagger:response putLayoutsIdDefault
|
||||
*/
|
||||
type PutLayoutsIDDefault struct {
|
||||
_statusCode int
|
||||
|
||||
// In: body
|
||||
Payload *models.Error `json:"body,omitempty"`
|
||||
}
|
||||
|
||||
// NewPutLayoutsIDDefault creates PutLayoutsIDDefault with default headers values
|
||||
func NewPutLayoutsIDDefault(code int) *PutLayoutsIDDefault {
|
||||
if code <= 0 {
|
||||
code = 500
|
||||
}
|
||||
|
||||
return &PutLayoutsIDDefault{
|
||||
_statusCode: code,
|
||||
}
|
||||
}
|
||||
|
||||
// WithStatusCode adds the status to the put layouts ID default response
|
||||
func (o *PutLayoutsIDDefault) WithStatusCode(code int) *PutLayoutsIDDefault {
|
||||
o._statusCode = code
|
||||
return o
|
||||
}
|
||||
|
||||
// SetStatusCode sets the status to the put layouts ID default response
|
||||
func (o *PutLayoutsIDDefault) SetStatusCode(code int) {
|
||||
o._statusCode = code
|
||||
}
|
||||
|
||||
// WithPayload adds the payload to the put layouts ID default response
|
||||
func (o *PutLayoutsIDDefault) WithPayload(payload *models.Error) *PutLayoutsIDDefault {
|
||||
o.Payload = payload
|
||||
return o
|
||||
}
|
||||
|
||||
// SetPayload sets the payload to the put layouts ID default response
|
||||
func (o *PutLayoutsIDDefault) SetPayload(payload *models.Error) {
|
||||
o.Payload = payload
|
||||
}
|
||||
|
||||
// WriteResponse to the client
|
||||
func (o *PutLayoutsIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
|
||||
|
||||
rw.WriteHeader(o._statusCode)
|
||||
if o.Payload != nil {
|
||||
if err := producer.Produce(rw, o.Payload); err != nil {
|
||||
panic(err) // let the recovery middleware deal with this
|
||||
}
|
||||
}
|
||||
}
|
26
stores.go
26
stores.go
|
@ -97,24 +97,26 @@ type Cell struct {
|
|||
Queries []Query
|
||||
}
|
||||
|
||||
// Dashboard is a collection of Cells for visualization
|
||||
type Dashboard struct {
|
||||
ID int
|
||||
// Layout is a collection of Cells for visualization
|
||||
type Layout struct {
|
||||
ID string
|
||||
Application string
|
||||
Measurement string
|
||||
Cells []Cell
|
||||
}
|
||||
|
||||
// DashboardStore stores dashboards and associated Cells
|
||||
type DashboardStore interface {
|
||||
// LayoutStore stores dashboards and associated Cells
|
||||
type LayoutStore interface {
|
||||
// All returns all dashboards in the store
|
||||
All(context.Context) ([]*Dashboard, error)
|
||||
// Add creates a new dashboard in the DashboardStore
|
||||
Add(context.Context, *Dashboard) error
|
||||
All(context.Context) ([]Layout, error)
|
||||
// Add creates a new dashboard in the LayoutStore
|
||||
Add(context.Context, Layout) (Layout, error)
|
||||
// Delete the dashboard from the store
|
||||
Delete(context.Context, *Dashboard) error
|
||||
// Get retrieves Dashboard if `ID` exists
|
||||
Get(ctx context.Context, ID int) (*Dashboard, error)
|
||||
Delete(context.Context, Layout) error
|
||||
// Get retrieves Layout if `ID` exists
|
||||
Get(ctx context.Context, ID string) (Layout, error)
|
||||
// Update the dashboard in the store.
|
||||
Update(context.Context, *Dashboard) error
|
||||
Update(context.Context, Layout) error
|
||||
}
|
||||
|
||||
type Source struct {
|
||||
|
|
125
swagger.yaml
125
swagger.yaml
|
@ -72,7 +72,7 @@ paths:
|
|||
description: These data sources store time series data.
|
||||
responses:
|
||||
200:
|
||||
description: Data source used to supply time series to dashboards.
|
||||
description: Data source used to supply time series information.
|
||||
schema:
|
||||
$ref: '#/definitions/Source'
|
||||
404:
|
||||
|
@ -882,60 +882,77 @@ paths:
|
|||
description: Response directly from kapacitor
|
||||
schema:
|
||||
$ref: '#/definitions/KapacitorProxyResponse'
|
||||
/dashboards:
|
||||
/layouts:
|
||||
get:
|
||||
summary: Pre-configured dashboards
|
||||
summary: Pre-configured layouts
|
||||
parameters:
|
||||
- name: telegraf_measurements
|
||||
in: query
|
||||
description: Returns layouts with this telegraf measurement
|
||||
required: false
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
collectionFormat: csv
|
||||
- name: apps
|
||||
in: query
|
||||
description: Returns layouts with this app
|
||||
required: false
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
collectionFormat: csv
|
||||
description: |
|
||||
Dashboards are a collection of `Cells` that visualize time-series data.
|
||||
Layouts are a collection of `Cells` that visualize time-series data.
|
||||
responses:
|
||||
200:
|
||||
description: An array of dashboards
|
||||
description: An array of layouts
|
||||
schema:
|
||||
$ref: '#/definitions/Dashboards'
|
||||
$ref: '#/definitions/Layouts'
|
||||
default:
|
||||
description: Unexpected internal service error
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
post:
|
||||
summary: Create new Dashboard
|
||||
summary: Create new layout
|
||||
parameters:
|
||||
- name: dashboard
|
||||
- name: layout
|
||||
in: body
|
||||
description: Defines the dashboard and queries of the cells within the dashboard.
|
||||
description: Defines the layout and queries of the cells within the layout.
|
||||
schema:
|
||||
$ref: '#/definitions/Dashboard'
|
||||
$ref: '#/definitions/Layout'
|
||||
responses:
|
||||
201:
|
||||
description: Successfully created new dashboard
|
||||
description: Successfully created new layout
|
||||
headers:
|
||||
Location:
|
||||
type: string
|
||||
format: url
|
||||
description: Location of the newly created dashboard
|
||||
description: Location of the newly created layout
|
||||
schema:
|
||||
$ref: '#/definitions/Dashboard'
|
||||
$ref: '#/definitions/Layout'
|
||||
default:
|
||||
description: A processing or an unexpected error.
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
/dashboards/{id}:
|
||||
/layouts/{id}:
|
||||
get:
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
type: string
|
||||
description: ID of the dashboard
|
||||
description: ID of the layout
|
||||
required: true
|
||||
summary: Specific pre-configured dashboard containing cells and queries.
|
||||
summary: Specific pre-configured layout containing cells and queries.
|
||||
description: |
|
||||
dashboards will hold information about how to layout the page of graphs.
|
||||
layouts will hold information about how to layout the page of graphs.
|
||||
responses:
|
||||
200:
|
||||
description: Returns the specified dashboard containing `cells`.
|
||||
description: Returns the specified layout containing `cells`.
|
||||
schema:
|
||||
$ref: '#/definitions/Dashboard'
|
||||
$ref: '#/definitions/Layout'
|
||||
404:
|
||||
description: Unknown dashboard id
|
||||
description: Unknown layout id
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
default:
|
||||
|
@ -947,14 +964,14 @@ paths:
|
|||
- name: id
|
||||
in: path
|
||||
type: string
|
||||
description: ID of the dashboard
|
||||
description: ID of the layout
|
||||
required: true
|
||||
summary: This specific dashboard will be removed from the data store
|
||||
summary: This specific layout will be removed from the data store
|
||||
responses:
|
||||
204:
|
||||
description: An array of dashboards
|
||||
description: Layout has been removed.
|
||||
404:
|
||||
description: Unknown dashboard id
|
||||
description: Unknown layout id
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
default:
|
||||
|
@ -962,24 +979,26 @@ paths:
|
|||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
put:
|
||||
summary: Replace dashboard configuration.
|
||||
summary: Replace layout configuration.
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
type: string
|
||||
description: ID of a dashboard
|
||||
description: ID of a layout
|
||||
required: true
|
||||
- name: config
|
||||
in: body
|
||||
description: dashboard configuration update parameters
|
||||
description: layout configuration update parameters
|
||||
schema:
|
||||
$ref: '#/definitions/Dashboard'
|
||||
$ref: '#/definitions/Layout'
|
||||
required: true
|
||||
responses:
|
||||
204:
|
||||
description: Dashboard's configuration was changed
|
||||
200:
|
||||
description: Layout has been replaced and the new layout is returned.
|
||||
schema:
|
||||
$ref: '#/definitions/Layout'
|
||||
404:
|
||||
description: Happens when trying to access a non-existent dashboard.
|
||||
description: Happens when trying to access a non-existent layout.
|
||||
schema:
|
||||
$ref: '#/definitions/Error'
|
||||
default:
|
||||
|
@ -1231,18 +1250,31 @@ definitions:
|
|||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Permission"
|
||||
Dashboards:
|
||||
Layouts:
|
||||
required:
|
||||
- layouts
|
||||
type: object
|
||||
properties:
|
||||
dashboards:
|
||||
layouts:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Dashboard"
|
||||
Dashboard:
|
||||
$ref: "#/definitions/Layout"
|
||||
Layout:
|
||||
type: object
|
||||
required:
|
||||
- cells
|
||||
- app
|
||||
- telegraf_measurement
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
description: ID is an opaque string that uniquely identifies this layout.
|
||||
app:
|
||||
type: string
|
||||
description: App is the user facing name of this Layout
|
||||
telegraf_measurement:
|
||||
type: string
|
||||
description: Measurement is the descriptive name of the time series data.
|
||||
cells:
|
||||
type: array
|
||||
description: Cells are the individual visualization elements.
|
||||
|
@ -1252,28 +1284,33 @@ definitions:
|
|||
$ref: "#/definitions/Link"
|
||||
Cell:
|
||||
type: object
|
||||
required:
|
||||
- x
|
||||
- 'y'
|
||||
- w
|
||||
- h
|
||||
properties:
|
||||
x:
|
||||
description: X-coordinate of Cell in the Dashboard
|
||||
description: X-coordinate of Cell in the Layout
|
||||
type: integer
|
||||
format: int32
|
||||
'y':
|
||||
description: Y-coordinate of Cell in the Dashboard
|
||||
description: Y-coordinate of Cell in the Layout
|
||||
type: integer
|
||||
format: int32
|
||||
w:
|
||||
description: Width of Cell in the Dashboard
|
||||
description: Width of Cell in the Layout
|
||||
type: integer
|
||||
format: int32
|
||||
h:
|
||||
description: Height of Cell in the Dashboard
|
||||
description: Height of Cell in the Layout
|
||||
type: integer
|
||||
format: int32
|
||||
queries:
|
||||
description: Time-series data queries for Cell.
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
$ref: "#/definitions/Proxy"
|
||||
Routes:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -1281,18 +1318,14 @@ definitions:
|
|||
description: Location of the users endpoint
|
||||
type: string
|
||||
format: url
|
||||
dashboards:
|
||||
description: Location of the dashboards endpoint
|
||||
layouts:
|
||||
description: Location of the layouts endpoint
|
||||
type: string
|
||||
format: url
|
||||
sources:
|
||||
description: Location of the sources endpoint
|
||||
type: string
|
||||
format: url
|
||||
apps:
|
||||
description: Location of the apps endpoint
|
||||
type: string
|
||||
format: url
|
||||
Services:
|
||||
type: object
|
||||
properties:
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
package uuid
|
||||
|
||||
import uuid "github.com/satori/go.uuid"
|
||||
|
||||
type V4 struct {
|
||||
u *uuid.UUID
|
||||
}
|
||||
|
||||
func (i *V4) Generate() (string, error) {
|
||||
if i.u == nil {
|
||||
u := uuid.NewV4()
|
||||
i.u = &u
|
||||
}
|
||||
return i.u.String(), nil
|
||||
}
|
Loading…
Reference in New Issue