Update kapacitor endpoint to be scoped to sources

pull/10616/head
Chris Goller 2016-10-03 12:41:50 -05:00
parent ca0db1a323
commit 5f24c1994e
59 changed files with 2236 additions and 1940 deletions

View File

@ -53,10 +53,12 @@ jsdep:
gen: bolt/internal/internal.proto
go generate github.com/influxdata/mrfusion/bolt/internal
test: jstest gotest
test: jstest gotest gotestrace
gotest:
go test ./...
gotestrace:
go test -race ./...
jstest:

View File

@ -74,6 +74,7 @@ func UnmarshalSource(data []byte, s *mrfusion.Source) error {
func MarshalServer(s mrfusion.Server) ([]byte, error) {
return proto.Marshal(&Server{
ID: int64(s.ID),
SrcID: int64(s.SrcID),
Name: s.Name,
Username: s.Username,
Password: s.Password,
@ -89,6 +90,7 @@ func UnmarshalServer(data []byte, s *mrfusion.Server) error {
}
s.ID = int(pb.ID)
s.SrcID = int(pb.SrcID)
s.Name = pb.Name
s.Username = pb.Username
s.Password = pb.Password

View File

@ -66,6 +66,7 @@ type Server struct {
Username string `protobuf:"bytes,3,opt,name=Username,json=username,proto3" json:"Username,omitempty"`
Password string `protobuf:"bytes,4,opt,name=Password,json=password,proto3" json:"Password,omitempty"`
URL string `protobuf:"bytes,5,opt,name=URL,json=uRL,proto3" json:"URL,omitempty"`
SrcID int64 `protobuf:"varint,6,opt,name=SrcID,json=srcID,proto3" json:"SrcID,omitempty"`
}
func (m *Server) Reset() { *m = Server{} }
@ -82,23 +83,24 @@ func init() {
func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) }
var fileDescriptorInternal = []byte{
// 284 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x91, 0x41, 0x6a, 0xeb, 0x30,
0x14, 0x45, 0x51, 0xa4, 0xaf, 0xd8, 0xef, 0x43, 0x28, 0x1a, 0x14, 0x51, 0x3a, 0x30, 0x19, 0x65,
0xd4, 0x49, 0x57, 0x50, 0xea, 0x0e, 0x02, 0xa6, 0x14, 0xa5, 0x5e, 0x80, 0x1a, 0xbf, 0x82, 0xc1,
0xb1, 0x84, 0x2c, 0xa5, 0xcd, 0x86, 0xba, 0x81, 0x6e, 0xb0, 0x48, 0xb6, 0xa1, 0x74, 0x10, 0x32,
0xbc, 0xef, 0x5c, 0x2e, 0x47, 0x08, 0x56, 0x6d, 0xef, 0xd1, 0xf5, 0xba, 0xbb, 0xb3, 0xce, 0x78,
0x23, 0xb2, 0x39, 0xaf, 0xbf, 0x09, 0xfc, 0x7f, 0xfa, 0xb4, 0x9d, 0x71, 0xda, 0xb7, 0xa6, 0x17,
0x2b, 0x58, 0x6c, 0x4b, 0x49, 0x0a, 0xb2, 0xa1, 0x6a, 0xd1, 0x96, 0x42, 0x00, 0x7b, 0xd6, 0x07,
0x94, 0x8b, 0x82, 0x6c, 0x72, 0xc5, 0x7a, 0x7d, 0x40, 0x71, 0x0d, 0xbc, 0x1e, 0xd0, 0x6d, 0x4b,
0x49, 0x53, 0x8f, 0x87, 0x94, 0x62, 0xb7, 0xd4, 0x5e, 0x4b, 0x36, 0x76, 0x1b, 0xed, 0xb5, 0xb8,
0x85, 0xfc, 0xd1, 0xa1, 0xf6, 0xd8, 0x3c, 0x78, 0xf9, 0x2f, 0xd5, 0xf3, 0xfd, 0x7c, 0x88, 0xb4,
0xb6, 0xcd, 0x44, 0xf9, 0x48, 0xc3, 0x7c, 0x10, 0x12, 0x96, 0x25, 0xbe, 0xeb, 0xd0, 0x79, 0xb9,
0x2c, 0xc8, 0x26, 0x53, 0xcb, 0x66, 0x8c, 0xeb, 0x2f, 0x02, 0x7c, 0x67, 0x82, 0xdb, 0xe3, 0x45,
0xc2, 0x02, 0xd8, 0xeb, 0xc9, 0x62, 0xd2, 0xcd, 0x15, 0xf3, 0x27, 0x8b, 0xe2, 0x06, 0xb2, 0xf8,
0x88, 0xc8, 0x27, 0xe1, 0x2c, 0x4c, 0x39, 0xb2, 0x17, 0x3d, 0x0c, 0x1f, 0xc6, 0x35, 0xc9, 0x39,
0x57, 0x99, 0x9d, 0x72, 0xdc, 0xaa, 0x55, 0x35, 0x48, 0x5e, 0xd0, 0xb8, 0x15, 0x54, 0x35, 0x9c,
0x11, 0x3d, 0x02, 0xdf, 0xa1, 0x3b, 0xa2, 0xbb, 0xc8, 0xf3, 0xb7, 0x13, 0x3d, 0xe3, 0xc4, 0xfe,
0x38, 0x5d, 0x01, 0xad, 0x55, 0x35, 0xa9, 0xd2, 0xa0, 0xaa, 0x37, 0x9e, 0xfe, 0xf9, 0xfe, 0x27,
0x00, 0x00, 0xff, 0xff, 0xfa, 0x07, 0x21, 0x1c, 0xf9, 0x01, 0x00, 0x00,
// 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,
}

View File

@ -27,4 +27,5 @@ message Server {
string Username = 3; // Username is the username to connect to the server
string Password = 4;
string URL = 5; // URL is the path to the server
int64 SrcID = 6; // SrcID is the ID of the data source
}

View File

@ -50,3 +50,23 @@ func TestMarshalSource(t *testing.T) {
t.Fatalf("source protobuf copy error: got %#v, expected %#v", vv, v)
}
}
func TestMarshalServer(t *testing.T) {
v := mrfusion.Server{
ID: 12,
SrcID: 2,
Name: "Fountain of Truth",
Username: "docbrown",
Password: "1 point twenty-one g1g@w@tts",
URL: "http://oldmanpeabody.mall.io:9092",
}
var vv mrfusion.Server
if buf, err := internal.MarshalServer(v); err != nil {
t.Fatal(err)
} else if err := internal.UnmarshalServer(buf, &vv); err != nil {
t.Fatal(err)
} else if !reflect.DeepEqual(v, vv) {
t.Fatalf("source protobuf copy error: got %#v, expected %#v", vv, v)
}
}

View File

@ -22,12 +22,14 @@ func TestServerStore(t *testing.T) {
srcs := []mrfusion.Server{
mrfusion.Server{
Name: "Of Truth",
SrcID: 10,
Username: "marty",
Password: "I❤ jennifer parker",
URL: "toyota-hilux.lyon-estates.local",
},
mrfusion.Server{
Name: "HipToBeSquare",
SrcID: 12,
Username: "calvinklein",
Password: "chuck b3rry",
URL: "toyota-hilux.lyon-estates.local",

View File

@ -12,7 +12,7 @@ import (
"golang.org/x/net/context"
)
func (h *Store) NewKapacitor(ctx context.Context, params op.PostKapacitorsParams) middleware.Responder {
func (h *Store) NewKapacitor(ctx context.Context, params op.PostSourcesIDKapacitorsParams) middleware.Responder {
srv := mrfusion.Server{
Name: *params.Kapacitor.Name,
Username: params.Kapacitor.Username,
@ -22,10 +22,10 @@ func (h *Store) NewKapacitor(ctx context.Context, params op.PostKapacitorsParams
var err error
if srv, err = h.ServersStore.Add(ctx, srv); err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error storing kapacitor %v: %v", params.Kapacitor, err)}
return op.NewPostKapacitorsDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsDefault(500).WithPayload(errMsg)
}
mSrv := srvToModel(srv)
return op.NewPostKapacitorsCreated().WithPayload(mSrv).WithLocation(mSrv.Links.Self)
return op.NewPostSourcesIDKapacitorsCreated().WithPayload(mSrv).WithLocation(mSrv.Links.Self)
}
func srvLinks(id int) *models.KapacitorLinks {
@ -46,11 +46,11 @@ func srvToModel(srv mrfusion.Server) *models.Kapacitor {
}
}
func (h *Store) Kapacitors(ctx context.Context, params op.GetKapacitorsParams) middleware.Responder {
func (h *Store) Kapacitors(ctx context.Context, params op.GetSourcesIDKapacitorsParams) middleware.Responder {
mrSrvs, err := h.ServersStore.All(ctx)
if err != nil {
errMsg := &models.Error{Code: 500, Message: "Error loading kapacitors"}
return op.NewGetKapacitorsDefault(500).WithPayload(errMsg)
return op.NewGetSourcesIDKapacitorsDefault(500).WithPayload(errMsg)
}
srvs := make([]*models.Kapacitor, len(mrSrvs))
@ -62,52 +62,75 @@ func (h *Store) Kapacitors(ctx context.Context, params op.GetKapacitorsParams) m
Kapacitors: srvs,
}
return op.NewGetKapacitorsOK().WithPayload(res)
return op.NewGetSourcesIDKapacitorsOK().WithPayload(res)
}
func (h *Store) KapacitorsID(ctx context.Context, params op.GetKapacitorsIDParams) middleware.Responder {
id, err := strconv.Atoi(params.ID)
func (h *Store) KapacitorsID(ctx context.Context, params op.GetSourcesIDKapacitorsKapaIDParams) middleware.Responder {
id, err := strconv.Atoi(params.KapaID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.KapaID)}
return op.NewGetSourcesIDKapacitorsKapaIDDefault(500).WithPayload(errMsg)
}
srcID, err := strconv.Atoi(params.ID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.ID)}
return op.NewGetKapacitorsIDDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srv, err := h.ServersStore.Get(ctx, id)
if err != nil {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.ID)}
return op.NewGetKapacitorsIDNotFound().WithPayload(errMsg)
if err != nil || srv.SrcID != srcID {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.KapaID)}
return op.NewGetSourcesIDKapacitorsKapaIDNotFound().WithPayload(errMsg)
}
return op.NewGetKapacitorsIDOK().WithPayload(srvToModel(srv))
return op.NewGetSourcesIDKapacitorsKapaIDOK().WithPayload(srvToModel(srv))
}
func (h *Store) RemoveKapacitor(ctx context.Context, params op.DeleteKapacitorsIDParams) middleware.Responder {
id, err := strconv.Atoi(params.ID)
func (h *Store) RemoveKapacitor(ctx context.Context, params op.DeleteSourcesIDKapacitorsKapaIDParams) middleware.Responder {
id, err := strconv.Atoi(params.KapaID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.KapaID)}
return op.NewDeleteSourcesIDKapacitorsKapaIDDefault(500).WithPayload(errMsg)
}
srcID, err := strconv.Atoi(params.ID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.ID)}
return op.NewDeleteKapacitorsIDDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srv := mrfusion.Server{
ID: id,
srv, err := h.ServersStore.Get(ctx, id)
if err != nil || srv.SrcID != srcID {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.KapaID)}
return op.NewDeleteSourcesIDKapacitorsKapaIDNotFound().WithPayload(errMsg)
}
if err = h.ServersStore.Delete(ctx, srv); err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Unknown error deleting kapacitor %s", params.ID)}
return op.NewDeleteKapacitorsIDDefault(500).WithPayload(errMsg)
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Unknown error deleting kapacitor %s", params.KapaID)}
return op.NewDeleteSourcesIDKapacitorsKapaIDDefault(500).WithPayload(errMsg)
}
return op.NewDeleteKapacitorsIDNoContent()
return op.NewDeleteSourcesIDKapacitorsKapaIDNoContent()
}
func (h *Store) UpdateKapacitor(ctx context.Context, params op.PatchKapacitorsIDParams) middleware.Responder {
id, err := strconv.Atoi(params.ID)
func (h *Store) UpdateKapacitor(ctx context.Context, params op.PatchSourcesIDKapacitorsKapaIDParams) middleware.Responder {
id, err := strconv.Atoi(params.KapaID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.KapaID)}
return op.NewPatchSourcesIDKapacitorsKapaIDDefault(500).WithPayload(errMsg)
}
srcID, err := strconv.Atoi(params.ID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.ID)}
return op.NewPatchKapacitorsIDDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srv, err := h.ServersStore.Get(ctx, id)
if err != nil {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.ID)}
return op.NewPatchKapacitorsIDNotFound().WithPayload(errMsg)
if err != nil || srv.SrcID != srcID {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.KapaID)}
return op.NewPatchSourcesIDKapacitorsKapaIDNotFound().WithPayload(errMsg)
}
if params.Config.Name != nil {
srv.Name = *params.Config.Name
@ -122,8 +145,8 @@ func (h *Store) UpdateKapacitor(ctx context.Context, params op.PatchKapacitorsID
srv.URL = *params.Config.URL
}
if err := h.ServersStore.Update(ctx, srv); err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error updating kapacitor ID %s", params.ID)}
return op.NewPatchKapacitorsIDDefault(500).WithPayload(errMsg)
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error updating kapacitor ID %s", params.KapaID)}
return op.NewPatchSourcesIDKapacitorsKapaIDDefault(500).WithPayload(errMsg)
}
return op.NewPatchKapacitorsIDNoContent()
return op.NewPatchSourcesIDKapacitorsKapaIDNoContent()
}

View File

@ -70,28 +70,34 @@ func (h *InfluxProxy) Proxy(ctx context.Context, params op.PostSourcesIDProxyPar
return op.NewPostSourcesIDProxyOK().WithPayload(res)
}
func (h *InfluxProxy) KapacitorProxyPost(ctx context.Context, params op.PostKapacitorsIDProxyParams) middleware.Responder {
id, err := strconv.Atoi(params.ID)
func (h *InfluxProxy) KapacitorProxyPost(ctx context.Context, params op.PostSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder {
id, err := strconv.Atoi(params.KapaID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.KapaID)}
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srcID, err := strconv.Atoi(params.ID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.ID)}
return op.NewPostKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srv, err := h.ServersStore.Get(ctx, id)
if err != nil {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.ID)}
return op.NewPostKapacitorsIDProxyNotFound().WithPayload(errMsg)
if err != nil || srv.SrcID != srcID {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.KapaID)}
return op.NewPostSourcesIDKapacitorsKapaIDProxyNotFound().WithPayload(errMsg)
}
if err = h.KapacitorProxy.Connect(ctx, &srv); err != nil {
errMsg := &models.Error{Code: 400, Message: fmt.Sprintf("Unable to connect to servers store %s", params.ID)}
return op.NewPostKapacitorsIDProxyNotFound().WithPayload(errMsg)
errMsg := &models.Error{Code: 400, Message: fmt.Sprintf("Unable to connect to servers store %s", params.KapaID)}
return op.NewPostSourcesIDKapacitorsKapaIDProxyNotFound().WithPayload(errMsg)
}
body, err := json.Marshal(params.Query)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting to JSON %v", err)}
return op.NewPostKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
req := &mrfusion.Request{
@ -104,7 +110,7 @@ func (h *InfluxProxy) KapacitorProxyPost(ctx context.Context, params op.PostKapa
defer resp.Body.Close()
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error with proxy %v", err)}
return op.NewPostKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
@ -117,34 +123,40 @@ func (h *InfluxProxy) KapacitorProxyPost(ctx context.Context, params op.PostKapa
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error reading body of response: %v", err)}
return op.NewPostKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
return op.NewPostKapacitorsIDProxyDefault(resp.StatusCode).WithPayload(j)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(resp.StatusCode).WithPayload(j)
}
func (h *InfluxProxy) KapacitorProxyPatch(ctx context.Context, params op.PatchKapacitorsIDProxyParams) middleware.Responder {
id, err := strconv.Atoi(params.ID)
func (h *InfluxProxy) KapacitorProxyPatch(ctx context.Context, params op.PatchSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder {
id, err := strconv.Atoi(params.KapaID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.KapaID)}
return op.NewPatchSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srcID, err := strconv.Atoi(params.ID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.ID)}
return op.NewPatchKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srv, err := h.ServersStore.Get(ctx, id)
if err != nil {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.ID)}
return op.NewPatchKapacitorsIDProxyNotFound().WithPayload(errMsg)
if err != nil || srv.SrcID != srcID {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.KapaID)}
return op.NewPatchSourcesIDKapacitorsKapaIDProxyNotFound().WithPayload(errMsg)
}
if err = h.KapacitorProxy.Connect(ctx, &srv); err != nil {
errMsg := &models.Error{Code: 400, Message: fmt.Sprintf("Unable to connect to servers store %s", params.ID)}
return op.NewPatchKapacitorsIDProxyNotFound().WithPayload(errMsg)
errMsg := &models.Error{Code: 400, Message: fmt.Sprintf("Unable to connect to servers store %s", params.KapaID)}
return op.NewPatchSourcesIDKapacitorsKapaIDProxyNotFound().WithPayload(errMsg)
}
body, err := json.Marshal(params.Query)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting to JSON %v", err)}
return op.NewPostKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
req := &mrfusion.Request{
@ -157,7 +169,7 @@ func (h *InfluxProxy) KapacitorProxyPatch(ctx context.Context, params op.PatchKa
defer resp.Body.Close()
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error with proxy %v", err)}
return op.NewPatchKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPatchSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
dec := json.NewDecoder(resp.Body)
@ -169,29 +181,35 @@ func (h *InfluxProxy) KapacitorProxyPatch(ctx context.Context, params op.PatchKa
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error reading body of response: %v", err)}
return op.NewPatchKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPatchSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
return op.NewPatchKapacitorsIDProxyDefault(resp.StatusCode).WithPayload(j)
return op.NewPatchSourcesIDKapacitorsKapaIDProxyDefault(resp.StatusCode).WithPayload(j)
}
func (h *InfluxProxy) KapacitorProxyGet(ctx context.Context, params op.GetKapacitorsIDProxyParams) middleware.Responder {
id, err := strconv.Atoi(params.ID)
func (h *InfluxProxy) KapacitorProxyGet(ctx context.Context, params op.GetSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder {
id, err := strconv.Atoi(params.KapaID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.KapaID)}
return op.NewGetSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srcID, err := strconv.Atoi(params.ID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.ID)}
return op.NewGetKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srv, err := h.ServersStore.Get(ctx, id)
if err != nil {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.ID)}
return op.NewGetKapacitorsIDProxyNotFound().WithPayload(errMsg)
if err != nil || srv.SrcID != srcID {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.KapaID)}
return op.NewGetSourcesIDKapacitorsKapaIDProxyNotFound().WithPayload(errMsg)
}
if err = h.KapacitorProxy.Connect(ctx, &srv); err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Unable to connect to servers store %s", params.ID)}
return op.NewGetKapacitorsIDProxyDefault(500).WithPayload(errMsg)
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Unable to connect to servers store %s", params.KapaID)}
return op.NewGetSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
req := &mrfusion.Request{
@ -203,12 +221,12 @@ func (h *InfluxProxy) KapacitorProxyGet(ctx context.Context, params op.GetKapaci
defer resp.Body.Close()
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error with proxy %v", err)}
return op.NewGetKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewGetSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
if resp.StatusCode == http.StatusNoContent {
return op.NewGetKapacitorsIDProxyNoContent()
return op.NewGetSourcesIDKapacitorsKapaIDProxyNoContent()
}
dec := json.NewDecoder(resp.Body)
@ -220,28 +238,34 @@ func (h *InfluxProxy) KapacitorProxyGet(ctx context.Context, params op.GetKapaci
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error reading body of response: %v", err)}
return op.NewGetKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewGetSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
return op.NewGetKapacitorsIDProxyDefault(resp.StatusCode).WithPayload(j)
return op.NewGetSourcesIDKapacitorsKapaIDProxyDefault(resp.StatusCode).WithPayload(j)
}
func (h *InfluxProxy) KapacitorProxyDelete(ctx context.Context, params op.DeleteKapacitorsIDProxyParams) middleware.Responder {
id, err := strconv.Atoi(params.ID)
func (h *InfluxProxy) KapacitorProxyDelete(ctx context.Context, params op.DeleteSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder {
id, err := strconv.Atoi(params.KapaID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.KapaID)}
return op.NewDeleteSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srcID, err := strconv.Atoi(params.ID)
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error converting ID %s", params.ID)}
return op.NewDeleteKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewPostSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
srv, err := h.ServersStore.Get(ctx, id)
if err != nil {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.ID)}
return op.NewDeleteKapacitorsIDProxyNotFound().WithPayload(errMsg)
if err != nil || srv.SrcID != srcID {
errMsg := &models.Error{Code: 404, Message: fmt.Sprintf("Unknown ID %s", params.KapaID)}
return op.NewDeleteSourcesIDKapacitorsKapaIDProxyNotFound().WithPayload(errMsg)
}
if err = h.KapacitorProxy.Connect(ctx, &srv); err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Unable to connect to servers store %s", params.ID)}
return op.NewDeleteKapacitorsIDProxyDefault(500).WithPayload(errMsg)
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Unable to connect to servers store %s", params.KapaID)}
return op.NewDeleteSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
req := &mrfusion.Request{
@ -253,12 +277,12 @@ func (h *InfluxProxy) KapacitorProxyDelete(ctx context.Context, params op.Delete
defer resp.Body.Close()
if err != nil {
errMsg := &models.Error{Code: 500, Message: fmt.Sprintf("Error with proxy %v", err)}
return op.NewDeleteKapacitorsIDProxyDefault(500).WithPayload(errMsg)
return op.NewDeleteSourcesIDKapacitorsKapaIDProxyDefault(500).WithPayload(errMsg)
}
if resp.StatusCode == http.StatusNoContent {
return op.NewGetKapacitorsIDProxyNoContent()
return op.NewGetSourcesIDKapacitorsKapaIDProxyNoContent()
}
dec := json.NewDecoder(resp.Body)
@ -268,5 +292,5 @@ func (h *InfluxProxy) KapacitorProxyDelete(ctx context.Context, params op.Delete
err = nil
}
return op.NewDeleteKapacitorsIDProxyDefault(resp.StatusCode).WithPayload(j)
return op.NewDeleteSourcesIDKapacitorsKapaIDProxyDefault(resp.StatusCode).WithPayload(j)
}

View File

@ -111,12 +111,12 @@ func configureAPI(api *op.MrFusionAPI) http.Handler {
api.GetSourcesIDHandler = op.GetSourcesIDHandlerFunc(h.SourcesID)
api.PostSourcesHandler = op.PostSourcesHandlerFunc(h.NewSource)
api.DeleteKapacitorsIDHandler = op.DeleteKapacitorsIDHandlerFunc(h.RemoveKapacitor)
api.PatchKapacitorsIDHandler = op.PatchKapacitorsIDHandlerFunc(h.UpdateKapacitor)
api.GetSourcesIDKapacitorsHandler = op.GetSourcesIDKapacitorsHandlerFunc(h.Kapacitors)
api.PostSourcesIDKapacitorsHandler = op.PostSourcesIDKapacitorsHandlerFunc(h.NewKapacitor)
api.GetKapacitorsHandler = op.GetKapacitorsHandlerFunc(h.Kapacitors)
api.GetKapacitorsIDHandler = op.GetKapacitorsIDHandlerFunc(h.KapacitorsID)
api.PostKapacitorsHandler = op.PostKapacitorsHandlerFunc(h.NewKapacitor)
api.GetSourcesIDKapacitorsKapaIDHandler = op.GetSourcesIDKapacitorsKapaIDHandlerFunc(h.KapacitorsID)
api.DeleteSourcesIDKapacitorsKapaIDHandler = op.DeleteSourcesIDKapacitorsKapaIDHandlerFunc(h.RemoveKapacitor)
api.PatchSourcesIDKapacitorsKapaIDHandler = op.PatchSourcesIDKapacitorsKapaIDHandlerFunc(h.UpdateKapacitor)
p := handlers.InfluxProxy{
Srcs: c.SourcesStore,
@ -125,10 +125,11 @@ func configureAPI(api *op.MrFusionAPI) http.Handler {
ServersStore: c.ServersStore,
}
api.PostSourcesIDProxyHandler = op.PostSourcesIDProxyHandlerFunc(p.Proxy)
api.PostKapacitorsIDProxyHandler = op.PostKapacitorsIDProxyHandlerFunc(p.KapacitorProxyPost)
api.PatchKapacitorsIDProxyHandler = op.PatchKapacitorsIDProxyHandlerFunc(p.KapacitorProxyPatch)
api.GetKapacitorsIDProxyHandler = op.GetKapacitorsIDProxyHandlerFunc(p.KapacitorProxyGet)
api.DeleteKapacitorsIDProxyHandler = op.DeleteKapacitorsIDProxyHandlerFunc(p.KapacitorProxyDelete)
api.PostSourcesIDKapacitorsKapaIDProxyHandler = op.PostSourcesIDKapacitorsKapaIDProxyHandlerFunc(p.KapacitorProxyPost)
api.PatchSourcesIDKapacitorsKapaIDProxyHandler = op.PatchSourcesIDKapacitorsKapaIDProxyHandlerFunc(p.KapacitorProxyPatch)
api.GetSourcesIDKapacitorsKapaIDProxyHandler = op.GetSourcesIDKapacitorsKapaIDProxyHandlerFunc(p.KapacitorProxyGet)
api.DeleteSourcesIDKapacitorsKapaIDProxyHandler = op.DeleteSourcesIDKapacitorsKapaIDProxyHandlerFunc(p.KapacitorProxyDelete)
} else {
api.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandler = op.DeleteSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc(mockHandler.DeleteExploration)
api.GetSourcesIDUsersUserIDExplorationsExplorationIDHandler = op.GetSourcesIDUsersUserIDExplorationsExplorationIDHandlerFunc(mockHandler.Exploration)

View File

@ -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"
)
// DeleteKapacitorsIDHandlerFunc turns a function with the right signature into a delete kapacitors ID handler
type DeleteKapacitorsIDHandlerFunc func(context.Context, DeleteKapacitorsIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteKapacitorsIDHandlerFunc) Handle(ctx context.Context, params DeleteKapacitorsIDParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteKapacitorsIDHandler interface for that can handle valid delete kapacitors ID params
type DeleteKapacitorsIDHandler interface {
Handle(context.Context, DeleteKapacitorsIDParams) middleware.Responder
}
// NewDeleteKapacitorsID creates a new http.Handler for the delete kapacitors ID operation
func NewDeleteKapacitorsID(ctx *middleware.Context, handler DeleteKapacitorsIDHandler) *DeleteKapacitorsID {
return &DeleteKapacitorsID{Context: ctx, Handler: handler}
}
/*DeleteKapacitorsID swagger:route DELETE /kapacitors/{id} deleteKapacitorsId
This specific kapacitor will be removed.
*/
type DeleteKapacitorsID struct {
Context *middleware.Context
Handler DeleteKapacitorsIDHandler
}
func (o *DeleteKapacitorsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteKapacitorsIDParams()
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)
}

View File

@ -1,64 +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"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteKapacitorsIDParams creates a new DeleteKapacitorsIDParams object
// with the default values initialized.
func NewDeleteKapacitorsIDParams() DeleteKapacitorsIDParams {
var ()
return DeleteKapacitorsIDParams{}
}
// DeleteKapacitorsIDParams contains all the bound params for the delete kapacitors ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters DeleteKapacitorsID
type DeleteKapacitorsIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the kapacitor
Required: true
In: path
*/
ID 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 *DeleteKapacitorsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *DeleteKapacitorsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}

View File

@ -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"
)
// DeleteKapacitorsIDProxyHandlerFunc turns a function with the right signature into a delete kapacitors ID proxy handler
type DeleteKapacitorsIDProxyHandlerFunc func(context.Context, DeleteKapacitorsIDProxyParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteKapacitorsIDProxyHandlerFunc) Handle(ctx context.Context, params DeleteKapacitorsIDProxyParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteKapacitorsIDProxyHandler interface for that can handle valid delete kapacitors ID proxy params
type DeleteKapacitorsIDProxyHandler interface {
Handle(context.Context, DeleteKapacitorsIDProxyParams) middleware.Responder
}
// NewDeleteKapacitorsIDProxy creates a new http.Handler for the delete kapacitors ID proxy operation
func NewDeleteKapacitorsIDProxy(ctx *middleware.Context, handler DeleteKapacitorsIDProxyHandler) *DeleteKapacitorsIDProxy {
return &DeleteKapacitorsIDProxy{Context: ctx, Handler: handler}
}
/*DeleteKapacitorsIDProxy swagger:route DELETE /kapacitors/{id}/proxy deleteKapacitorsIdProxy
DELETE to `path` of kapacitor. The response and status code from kapacitor is directly returned.
*/
type DeleteKapacitorsIDProxy struct {
Context *middleware.Context
Handler DeleteKapacitorsIDProxyHandler
}
func (o *DeleteKapacitorsIDProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteKapacitorsIDProxyParams()
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)
}

View File

@ -1,121 +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"
)
/*DeleteKapacitorsIDProxyNoContent Kapacitor returned no content
swagger:response deleteKapacitorsIdProxyNoContent
*/
type DeleteKapacitorsIDProxyNoContent struct {
}
// NewDeleteKapacitorsIDProxyNoContent creates DeleteKapacitorsIDProxyNoContent with default headers values
func NewDeleteKapacitorsIDProxyNoContent() *DeleteKapacitorsIDProxyNoContent {
return &DeleteKapacitorsIDProxyNoContent{}
}
// WriteResponse to the client
func (o *DeleteKapacitorsIDProxyNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteKapacitorsIDProxyNotFound Kapacitor ID does not exist.
swagger:response deleteKapacitorsIdProxyNotFound
*/
type DeleteKapacitorsIDProxyNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteKapacitorsIDProxyNotFound creates DeleteKapacitorsIDProxyNotFound with default headers values
func NewDeleteKapacitorsIDProxyNotFound() *DeleteKapacitorsIDProxyNotFound {
return &DeleteKapacitorsIDProxyNotFound{}
}
// WithPayload adds the payload to the delete kapacitors Id proxy not found response
func (o *DeleteKapacitorsIDProxyNotFound) WithPayload(payload *models.Error) *DeleteKapacitorsIDProxyNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete kapacitors Id proxy not found response
func (o *DeleteKapacitorsIDProxyNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteKapacitorsIDProxyNotFound) 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
}
}
}
/*DeleteKapacitorsIDProxyDefault Response directly from kapacitor
swagger:response deleteKapacitorsIdProxyDefault
*/
type DeleteKapacitorsIDProxyDefault struct {
_statusCode int
// In: body
Payload models.KapacitorProxyResponse `json:"body,omitempty"`
}
// NewDeleteKapacitorsIDProxyDefault creates DeleteKapacitorsIDProxyDefault with default headers values
func NewDeleteKapacitorsIDProxyDefault(code int) *DeleteKapacitorsIDProxyDefault {
if code <= 0 {
code = 500
}
return &DeleteKapacitorsIDProxyDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete kapacitors ID proxy default response
func (o *DeleteKapacitorsIDProxyDefault) WithStatusCode(code int) *DeleteKapacitorsIDProxyDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete kapacitors ID proxy default response
func (o *DeleteKapacitorsIDProxyDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete kapacitors ID proxy default response
func (o *DeleteKapacitorsIDProxyDefault) WithPayload(payload models.KapacitorProxyResponse) *DeleteKapacitorsIDProxyDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete kapacitors ID proxy default response
func (o *DeleteKapacitorsIDProxyDefault) SetPayload(payload models.KapacitorProxyResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteKapacitorsIDProxyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -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"
)
/*DeleteKapacitorsIDNoContent kapacitor has been removed.
swagger:response deleteKapacitorsIdNoContent
*/
type DeleteKapacitorsIDNoContent struct {
}
// NewDeleteKapacitorsIDNoContent creates DeleteKapacitorsIDNoContent with default headers values
func NewDeleteKapacitorsIDNoContent() *DeleteKapacitorsIDNoContent {
return &DeleteKapacitorsIDNoContent{}
}
// WriteResponse to the client
func (o *DeleteKapacitorsIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteKapacitorsIDNotFound Unknown Kapacitor id
swagger:response deleteKapacitorsIdNotFound
*/
type DeleteKapacitorsIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteKapacitorsIDNotFound creates DeleteKapacitorsIDNotFound with default headers values
func NewDeleteKapacitorsIDNotFound() *DeleteKapacitorsIDNotFound {
return &DeleteKapacitorsIDNotFound{}
}
// WithPayload adds the payload to the delete kapacitors Id not found response
func (o *DeleteKapacitorsIDNotFound) WithPayload(payload *models.Error) *DeleteKapacitorsIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete kapacitors Id not found response
func (o *DeleteKapacitorsIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteKapacitorsIDNotFound) 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
}
}
}
/*DeleteKapacitorsIDDefault Unexpected internal service error
swagger:response deleteKapacitorsIdDefault
*/
type DeleteKapacitorsIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteKapacitorsIDDefault creates DeleteKapacitorsIDDefault with default headers values
func NewDeleteKapacitorsIDDefault(code int) *DeleteKapacitorsIDDefault {
if code <= 0 {
code = 500
}
return &DeleteKapacitorsIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete kapacitors ID default response
func (o *DeleteKapacitorsIDDefault) WithStatusCode(code int) *DeleteKapacitorsIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete kapacitors ID default response
func (o *DeleteKapacitorsIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete kapacitors ID default response
func (o *DeleteKapacitorsIDDefault) WithPayload(payload *models.Error) *DeleteKapacitorsIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete kapacitors ID default response
func (o *DeleteKapacitorsIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteKapacitorsIDDefault) 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
}
}
}

View File

@ -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"
)
// DeleteSourcesIDKapacitorsKapaIDHandlerFunc turns a function with the right signature into a delete sources ID kapacitors kapa ID handler
type DeleteSourcesIDKapacitorsKapaIDHandlerFunc func(context.Context, DeleteSourcesIDKapacitorsKapaIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteSourcesIDKapacitorsKapaIDHandlerFunc) Handle(ctx context.Context, params DeleteSourcesIDKapacitorsKapaIDParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteSourcesIDKapacitorsKapaIDHandler interface for that can handle valid delete sources ID kapacitors kapa ID params
type DeleteSourcesIDKapacitorsKapaIDHandler interface {
Handle(context.Context, DeleteSourcesIDKapacitorsKapaIDParams) middleware.Responder
}
// NewDeleteSourcesIDKapacitorsKapaID creates a new http.Handler for the delete sources ID kapacitors kapa ID operation
func NewDeleteSourcesIDKapacitorsKapaID(ctx *middleware.Context, handler DeleteSourcesIDKapacitorsKapaIDHandler) *DeleteSourcesIDKapacitorsKapaID {
return &DeleteSourcesIDKapacitorsKapaID{Context: ctx, Handler: handler}
}
/*DeleteSourcesIDKapacitorsKapaID swagger:route DELETE /sources/{id}/kapacitors/{kapa_id} deleteSourcesIdKapacitorsKapaId
This specific kapacitor will be removed.
*/
type DeleteSourcesIDKapacitorsKapaID struct {
Context *middleware.Context
Handler DeleteSourcesIDKapacitorsKapaIDHandler
}
func (o *DeleteSourcesIDKapacitorsKapaID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteSourcesIDKapacitorsKapaIDParams()
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)
}

View File

@ -0,0 +1,85 @@
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"
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteSourcesIDKapacitorsKapaIDParams creates a new DeleteSourcesIDKapacitorsKapaIDParams object
// with the default values initialized.
func NewDeleteSourcesIDKapacitorsKapaIDParams() DeleteSourcesIDKapacitorsKapaIDParams {
var ()
return DeleteSourcesIDKapacitorsKapaIDParams{}
}
// DeleteSourcesIDKapacitorsKapaIDParams contains all the bound params for the delete sources ID kapacitors kapa ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters DeleteSourcesIDKapacitorsKapaID
type DeleteSourcesIDKapacitorsKapaIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the source
Required: true
In: path
*/
ID string
/*ID of the kapacitor
Required: true
In: path
*/
KapaID 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 *DeleteSourcesIDKapacitorsKapaIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rKapaID, rhkKapaID, _ := route.Params.GetOK("kapa_id")
if err := o.bindKapaID(rKapaID, rhkKapaID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *DeleteSourcesIDKapacitorsKapaIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *DeleteSourcesIDKapacitorsKapaIDParams) bindKapaID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.KapaID = raw
return nil
}

View File

@ -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"
)
// DeleteSourcesIDKapacitorsKapaIDProxyHandlerFunc turns a function with the right signature into a delete sources ID kapacitors kapa ID proxy handler
type DeleteSourcesIDKapacitorsKapaIDProxyHandlerFunc func(context.Context, DeleteSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder
// Handle executing the request and returning a response
func (fn DeleteSourcesIDKapacitorsKapaIDProxyHandlerFunc) Handle(ctx context.Context, params DeleteSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder {
return fn(ctx, params)
}
// DeleteSourcesIDKapacitorsKapaIDProxyHandler interface for that can handle valid delete sources ID kapacitors kapa ID proxy params
type DeleteSourcesIDKapacitorsKapaIDProxyHandler interface {
Handle(context.Context, DeleteSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder
}
// NewDeleteSourcesIDKapacitorsKapaIDProxy creates a new http.Handler for the delete sources ID kapacitors kapa ID proxy operation
func NewDeleteSourcesIDKapacitorsKapaIDProxy(ctx *middleware.Context, handler DeleteSourcesIDKapacitorsKapaIDProxyHandler) *DeleteSourcesIDKapacitorsKapaIDProxy {
return &DeleteSourcesIDKapacitorsKapaIDProxy{Context: ctx, Handler: handler}
}
/*DeleteSourcesIDKapacitorsKapaIDProxy swagger:route DELETE /sources/{id}/kapacitors/{kapa_id}/proxy deleteSourcesIdKapacitorsKapaIdProxy
DELETE to `path` of kapacitor. The response and status code from kapacitor is directly returned.
*/
type DeleteSourcesIDKapacitorsKapaIDProxy struct {
Context *middleware.Context
Handler DeleteSourcesIDKapacitorsKapaIDProxyHandler
}
func (o *DeleteSourcesIDKapacitorsKapaIDProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewDeleteSourcesIDKapacitorsKapaIDProxyParams()
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)
}

View File

@ -14,27 +14,32 @@ import (
strfmt "github.com/go-openapi/strfmt"
)
// NewDeleteKapacitorsIDProxyParams creates a new DeleteKapacitorsIDProxyParams object
// NewDeleteSourcesIDKapacitorsKapaIDProxyParams creates a new DeleteSourcesIDKapacitorsKapaIDProxyParams object
// with the default values initialized.
func NewDeleteKapacitorsIDProxyParams() DeleteKapacitorsIDProxyParams {
func NewDeleteSourcesIDKapacitorsKapaIDProxyParams() DeleteSourcesIDKapacitorsKapaIDProxyParams {
var ()
return DeleteKapacitorsIDProxyParams{}
return DeleteSourcesIDKapacitorsKapaIDProxyParams{}
}
// DeleteKapacitorsIDProxyParams contains all the bound params for the delete kapacitors ID proxy operation
// DeleteSourcesIDKapacitorsKapaIDProxyParams contains all the bound params for the delete sources ID kapacitors kapa ID proxy operation
// typically these are obtained from a http.Request
//
// swagger:parameters DeleteKapacitorsIDProxy
type DeleteKapacitorsIDProxyParams struct {
// swagger:parameters DeleteSourcesIDKapacitorsKapaIDProxy
type DeleteSourcesIDKapacitorsKapaIDProxyParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the kapacitor backend.
/*ID of the source
Required: true
In: path
*/
ID string
/*ID of the kapacitor backend.
Required: true
In: path
*/
KapaID string
/*The kapacitor API path to use in the proxy redirect
Required: true
In: query
@ -44,7 +49,7 @@ type DeleteKapacitorsIDProxyParams 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 *DeleteKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
func (o *DeleteSourcesIDKapacitorsKapaIDProxyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
@ -55,6 +60,11 @@ func (o *DeleteKapacitorsIDProxyParams) BindRequest(r *http.Request, route *midd
res = append(res, err)
}
rKapaID, rhkKapaID, _ := route.Params.GetOK("kapa_id")
if err := o.bindKapaID(rKapaID, rhkKapaID, route.Formats); err != nil {
res = append(res, err)
}
qPath, qhkPath, _ := qs.GetOK("path")
if err := o.bindPath(qPath, qhkPath, route.Formats); err != nil {
res = append(res, err)
@ -66,7 +76,7 @@ func (o *DeleteKapacitorsIDProxyParams) BindRequest(r *http.Request, route *midd
return nil
}
func (o *DeleteKapacitorsIDProxyParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *DeleteSourcesIDKapacitorsKapaIDProxyParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
@ -77,7 +87,18 @@ func (o *DeleteKapacitorsIDProxyParams) bindID(rawData []string, hasKey bool, fo
return nil
}
func (o *DeleteKapacitorsIDProxyParams) bindPath(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *DeleteSourcesIDKapacitorsKapaIDProxyParams) bindKapaID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.KapaID = raw
return nil
}
func (o *DeleteSourcesIDKapacitorsKapaIDProxyParams) bindPath(rawData []string, hasKey bool, formats strfmt.Registry) error {
if !hasKey {
return errors.Required("path", "query")
}

View File

@ -0,0 +1,121 @@
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"
)
/*DeleteSourcesIDKapacitorsKapaIDProxyNoContent Kapacitor returned no content
swagger:response deleteSourcesIdKapacitorsKapaIdProxyNoContent
*/
type DeleteSourcesIDKapacitorsKapaIDProxyNoContent struct {
}
// NewDeleteSourcesIDKapacitorsKapaIDProxyNoContent creates DeleteSourcesIDKapacitorsKapaIDProxyNoContent with default headers values
func NewDeleteSourcesIDKapacitorsKapaIDProxyNoContent() *DeleteSourcesIDKapacitorsKapaIDProxyNoContent {
return &DeleteSourcesIDKapacitorsKapaIDProxyNoContent{}
}
// WriteResponse to the client
func (o *DeleteSourcesIDKapacitorsKapaIDProxyNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteSourcesIDKapacitorsKapaIDProxyNotFound Data source or Kapacitor ID does not exist.
swagger:response deleteSourcesIdKapacitorsKapaIdProxyNotFound
*/
type DeleteSourcesIDKapacitorsKapaIDProxyNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDKapacitorsKapaIDProxyNotFound creates DeleteSourcesIDKapacitorsKapaIDProxyNotFound with default headers values
func NewDeleteSourcesIDKapacitorsKapaIDProxyNotFound() *DeleteSourcesIDKapacitorsKapaIDProxyNotFound {
return &DeleteSourcesIDKapacitorsKapaIDProxyNotFound{}
}
// WithPayload adds the payload to the delete sources Id kapacitors kapa Id proxy not found response
func (o *DeleteSourcesIDKapacitorsKapaIDProxyNotFound) WithPayload(payload *models.Error) *DeleteSourcesIDKapacitorsKapaIDProxyNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources Id kapacitors kapa Id proxy not found response
func (o *DeleteSourcesIDKapacitorsKapaIDProxyNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDKapacitorsKapaIDProxyNotFound) 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
}
}
}
/*DeleteSourcesIDKapacitorsKapaIDProxyDefault Response directly from kapacitor
swagger:response deleteSourcesIdKapacitorsKapaIdProxyDefault
*/
type DeleteSourcesIDKapacitorsKapaIDProxyDefault struct {
_statusCode int
// In: body
Payload models.KapacitorProxyResponse `json:"body,omitempty"`
}
// NewDeleteSourcesIDKapacitorsKapaIDProxyDefault creates DeleteSourcesIDKapacitorsKapaIDProxyDefault with default headers values
func NewDeleteSourcesIDKapacitorsKapaIDProxyDefault(code int) *DeleteSourcesIDKapacitorsKapaIDProxyDefault {
if code <= 0 {
code = 500
}
return &DeleteSourcesIDKapacitorsKapaIDProxyDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete sources ID kapacitors kapa ID proxy default response
func (o *DeleteSourcesIDKapacitorsKapaIDProxyDefault) WithStatusCode(code int) *DeleteSourcesIDKapacitorsKapaIDProxyDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete sources ID kapacitors kapa ID proxy default response
func (o *DeleteSourcesIDKapacitorsKapaIDProxyDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete sources ID kapacitors kapa ID proxy default response
func (o *DeleteSourcesIDKapacitorsKapaIDProxyDefault) WithPayload(payload models.KapacitorProxyResponse) *DeleteSourcesIDKapacitorsKapaIDProxyDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources ID kapacitors kapa ID proxy default response
func (o *DeleteSourcesIDKapacitorsKapaIDProxyDefault) SetPayload(payload models.KapacitorProxyResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDKapacitorsKapaIDProxyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -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"
)
/*DeleteSourcesIDKapacitorsKapaIDNoContent kapacitor has been removed.
swagger:response deleteSourcesIdKapacitorsKapaIdNoContent
*/
type DeleteSourcesIDKapacitorsKapaIDNoContent struct {
}
// NewDeleteSourcesIDKapacitorsKapaIDNoContent creates DeleteSourcesIDKapacitorsKapaIDNoContent with default headers values
func NewDeleteSourcesIDKapacitorsKapaIDNoContent() *DeleteSourcesIDKapacitorsKapaIDNoContent {
return &DeleteSourcesIDKapacitorsKapaIDNoContent{}
}
// WriteResponse to the client
func (o *DeleteSourcesIDKapacitorsKapaIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*DeleteSourcesIDKapacitorsKapaIDNotFound Unknown Data source or Kapacitor id
swagger:response deleteSourcesIdKapacitorsKapaIdNotFound
*/
type DeleteSourcesIDKapacitorsKapaIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDKapacitorsKapaIDNotFound creates DeleteSourcesIDKapacitorsKapaIDNotFound with default headers values
func NewDeleteSourcesIDKapacitorsKapaIDNotFound() *DeleteSourcesIDKapacitorsKapaIDNotFound {
return &DeleteSourcesIDKapacitorsKapaIDNotFound{}
}
// WithPayload adds the payload to the delete sources Id kapacitors kapa Id not found response
func (o *DeleteSourcesIDKapacitorsKapaIDNotFound) WithPayload(payload *models.Error) *DeleteSourcesIDKapacitorsKapaIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources Id kapacitors kapa Id not found response
func (o *DeleteSourcesIDKapacitorsKapaIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDKapacitorsKapaIDNotFound) 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
}
}
}
/*DeleteSourcesIDKapacitorsKapaIDDefault Unexpected internal service error
swagger:response deleteSourcesIdKapacitorsKapaIdDefault
*/
type DeleteSourcesIDKapacitorsKapaIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewDeleteSourcesIDKapacitorsKapaIDDefault creates DeleteSourcesIDKapacitorsKapaIDDefault with default headers values
func NewDeleteSourcesIDKapacitorsKapaIDDefault(code int) *DeleteSourcesIDKapacitorsKapaIDDefault {
if code <= 0 {
code = 500
}
return &DeleteSourcesIDKapacitorsKapaIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the delete sources ID kapacitors kapa ID default response
func (o *DeleteSourcesIDKapacitorsKapaIDDefault) WithStatusCode(code int) *DeleteSourcesIDKapacitorsKapaIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the delete sources ID kapacitors kapa ID default response
func (o *DeleteSourcesIDKapacitorsKapaIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the delete sources ID kapacitors kapa ID default response
func (o *DeleteSourcesIDKapacitorsKapaIDDefault) WithPayload(payload *models.Error) *DeleteSourcesIDKapacitorsKapaIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the delete sources ID kapacitors kapa ID default response
func (o *DeleteSourcesIDKapacitorsKapaIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *DeleteSourcesIDKapacitorsKapaIDDefault) 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
}
}
}

View File

@ -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"
)
// GetKapacitorsHandlerFunc turns a function with the right signature into a get kapacitors handler
type GetKapacitorsHandlerFunc func(context.Context, GetKapacitorsParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetKapacitorsHandlerFunc) Handle(ctx context.Context, params GetKapacitorsParams) middleware.Responder {
return fn(ctx, params)
}
// GetKapacitorsHandler interface for that can handle valid get kapacitors params
type GetKapacitorsHandler interface {
Handle(context.Context, GetKapacitorsParams) middleware.Responder
}
// NewGetKapacitors creates a new http.Handler for the get kapacitors operation
func NewGetKapacitors(ctx *middleware.Context, handler GetKapacitorsHandler) *GetKapacitors {
return &GetKapacitors{Context: ctx, Handler: handler}
}
/*GetKapacitors swagger:route GET /kapacitors getKapacitors
Configured kapacitors
*/
type GetKapacitors struct {
Context *middleware.Context
Handler GetKapacitorsHandler
}
func (o *GetKapacitors) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetKapacitorsParams()
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)
}

View File

@ -1,57 +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"
)
// GetKapacitorsIDHandlerFunc turns a function with the right signature into a get kapacitors ID handler
type GetKapacitorsIDHandlerFunc func(context.Context, GetKapacitorsIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetKapacitorsIDHandlerFunc) Handle(ctx context.Context, params GetKapacitorsIDParams) middleware.Responder {
return fn(ctx, params)
}
// GetKapacitorsIDHandler interface for that can handle valid get kapacitors ID params
type GetKapacitorsIDHandler interface {
Handle(context.Context, GetKapacitorsIDParams) middleware.Responder
}
// NewGetKapacitorsID creates a new http.Handler for the get kapacitors ID operation
func NewGetKapacitorsID(ctx *middleware.Context, handler GetKapacitorsIDHandler) *GetKapacitorsID {
return &GetKapacitorsID{Context: ctx, Handler: handler}
}
/*GetKapacitorsID swagger:route GET /kapacitors/{id} getKapacitorsId
Configured kapacitors
These kapacitors are used for monitoring and alerting.
*/
type GetKapacitorsID struct {
Context *middleware.Context
Handler GetKapacitorsIDHandler
}
func (o *GetKapacitorsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetKapacitorsIDParams()
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)
}

View File

@ -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"
)
// GetKapacitorsIDProxyHandlerFunc turns a function with the right signature into a get kapacitors ID proxy handler
type GetKapacitorsIDProxyHandlerFunc func(context.Context, GetKapacitorsIDProxyParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetKapacitorsIDProxyHandlerFunc) Handle(ctx context.Context, params GetKapacitorsIDProxyParams) middleware.Responder {
return fn(ctx, params)
}
// GetKapacitorsIDProxyHandler interface for that can handle valid get kapacitors ID proxy params
type GetKapacitorsIDProxyHandler interface {
Handle(context.Context, GetKapacitorsIDProxyParams) middleware.Responder
}
// NewGetKapacitorsIDProxy creates a new http.Handler for the get kapacitors ID proxy operation
func NewGetKapacitorsIDProxy(ctx *middleware.Context, handler GetKapacitorsIDProxyHandler) *GetKapacitorsIDProxy {
return &GetKapacitorsIDProxy{Context: ctx, Handler: handler}
}
/*GetKapacitorsIDProxy swagger:route GET /kapacitors/{id}/proxy getKapacitorsIdProxy
GET to `path` of kapacitor. The response and status code from kapacitor is directly returned.
*/
type GetKapacitorsIDProxy struct {
Context *middleware.Context
Handler GetKapacitorsIDProxyHandler
}
func (o *GetKapacitorsIDProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetKapacitorsIDProxyParams()
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)
}

View File

@ -1,121 +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"
)
/*GetKapacitorsIDProxyNoContent Kapacitor returned no content
swagger:response getKapacitorsIdProxyNoContent
*/
type GetKapacitorsIDProxyNoContent struct {
}
// NewGetKapacitorsIDProxyNoContent creates GetKapacitorsIDProxyNoContent with default headers values
func NewGetKapacitorsIDProxyNoContent() *GetKapacitorsIDProxyNoContent {
return &GetKapacitorsIDProxyNoContent{}
}
// WriteResponse to the client
func (o *GetKapacitorsIDProxyNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*GetKapacitorsIDProxyNotFound Kapacitor ID does not exist.
swagger:response getKapacitorsIdProxyNotFound
*/
type GetKapacitorsIDProxyNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetKapacitorsIDProxyNotFound creates GetKapacitorsIDProxyNotFound with default headers values
func NewGetKapacitorsIDProxyNotFound() *GetKapacitorsIDProxyNotFound {
return &GetKapacitorsIDProxyNotFound{}
}
// WithPayload adds the payload to the get kapacitors Id proxy not found response
func (o *GetKapacitorsIDProxyNotFound) WithPayload(payload *models.Error) *GetKapacitorsIDProxyNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get kapacitors Id proxy not found response
func (o *GetKapacitorsIDProxyNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetKapacitorsIDProxyNotFound) 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
}
}
}
/*GetKapacitorsIDProxyDefault Response directly from kapacitor
swagger:response getKapacitorsIdProxyDefault
*/
type GetKapacitorsIDProxyDefault struct {
_statusCode int
// In: body
Payload models.KapacitorProxyResponse `json:"body,omitempty"`
}
// NewGetKapacitorsIDProxyDefault creates GetKapacitorsIDProxyDefault with default headers values
func NewGetKapacitorsIDProxyDefault(code int) *GetKapacitorsIDProxyDefault {
if code <= 0 {
code = 500
}
return &GetKapacitorsIDProxyDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get kapacitors ID proxy default response
func (o *GetKapacitorsIDProxyDefault) WithStatusCode(code int) *GetKapacitorsIDProxyDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get kapacitors ID proxy default response
func (o *GetKapacitorsIDProxyDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get kapacitors ID proxy default response
func (o *GetKapacitorsIDProxyDefault) WithPayload(payload models.KapacitorProxyResponse) *GetKapacitorsIDProxyDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get kapacitors ID proxy default response
func (o *GetKapacitorsIDProxyDefault) SetPayload(payload models.KapacitorProxyResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetKapacitorsIDProxyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -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"
)
/*GetKapacitorsIDOK Kapacitor connection information
swagger:response getKapacitorsIdOK
*/
type GetKapacitorsIDOK struct {
// In: body
Payload *models.Kapacitor `json:"body,omitempty"`
}
// NewGetKapacitorsIDOK creates GetKapacitorsIDOK with default headers values
func NewGetKapacitorsIDOK() *GetKapacitorsIDOK {
return &GetKapacitorsIDOK{}
}
// WithPayload adds the payload to the get kapacitors Id o k response
func (o *GetKapacitorsIDOK) WithPayload(payload *models.Kapacitor) *GetKapacitorsIDOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get kapacitors Id o k response
func (o *GetKapacitorsIDOK) SetPayload(payload *models.Kapacitor) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetKapacitorsIDOK) 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
}
}
}
/*GetKapacitorsIDNotFound Unknown kapacitor id
swagger:response getKapacitorsIdNotFound
*/
type GetKapacitorsIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetKapacitorsIDNotFound creates GetKapacitorsIDNotFound with default headers values
func NewGetKapacitorsIDNotFound() *GetKapacitorsIDNotFound {
return &GetKapacitorsIDNotFound{}
}
// WithPayload adds the payload to the get kapacitors Id not found response
func (o *GetKapacitorsIDNotFound) WithPayload(payload *models.Error) *GetKapacitorsIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get kapacitors Id not found response
func (o *GetKapacitorsIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetKapacitorsIDNotFound) 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
}
}
}
/*GetKapacitorsIDDefault Unexpected internal service error
swagger:response getKapacitorsIdDefault
*/
type GetKapacitorsIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetKapacitorsIDDefault creates GetKapacitorsIDDefault with default headers values
func NewGetKapacitorsIDDefault(code int) *GetKapacitorsIDDefault {
if code <= 0 {
code = 500
}
return &GetKapacitorsIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get kapacitors ID default response
func (o *GetKapacitorsIDDefault) WithStatusCode(code int) *GetKapacitorsIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get kapacitors ID default response
func (o *GetKapacitorsIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get kapacitors ID default response
func (o *GetKapacitorsIDDefault) WithPayload(payload *models.Error) *GetKapacitorsIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get kapacitors ID default response
func (o *GetKapacitorsIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetKapacitorsIDDefault) 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
}
}
}

View File

@ -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"
)
// NewGetKapacitorsParams creates a new GetKapacitorsParams object
// with the default values initialized.
func NewGetKapacitorsParams() GetKapacitorsParams {
var ()
return GetKapacitorsParams{}
}
// GetKapacitorsParams contains all the bound params for the get kapacitors operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetKapacitors
type GetKapacitorsParams 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 *GetKapacitorsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}

View File

@ -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"
)
/*GetKapacitorsOK An array of kapacitors
swagger:response getKapacitorsOK
*/
type GetKapacitorsOK struct {
// In: body
Payload *models.Kapacitors `json:"body,omitempty"`
}
// NewGetKapacitorsOK creates GetKapacitorsOK with default headers values
func NewGetKapacitorsOK() *GetKapacitorsOK {
return &GetKapacitorsOK{}
}
// WithPayload adds the payload to the get kapacitors o k response
func (o *GetKapacitorsOK) WithPayload(payload *models.Kapacitors) *GetKapacitorsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get kapacitors o k response
func (o *GetKapacitorsOK) SetPayload(payload *models.Kapacitors) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetKapacitorsOK) 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
}
}
}
/*GetKapacitorsDefault Unexpected internal service error
swagger:response getKapacitorsDefault
*/
type GetKapacitorsDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetKapacitorsDefault creates GetKapacitorsDefault with default headers values
func NewGetKapacitorsDefault(code int) *GetKapacitorsDefault {
if code <= 0 {
code = 500
}
return &GetKapacitorsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get kapacitors default response
func (o *GetKapacitorsDefault) WithStatusCode(code int) *GetKapacitorsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get kapacitors default response
func (o *GetKapacitorsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get kapacitors default response
func (o *GetKapacitorsDefault) WithPayload(payload *models.Error) *GetKapacitorsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get kapacitors default response
func (o *GetKapacitorsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetKapacitorsDefault) 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
}
}
}

View File

@ -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"
)
// GetSourcesIDKapacitorsHandlerFunc turns a function with the right signature into a get sources ID kapacitors handler
type GetSourcesIDKapacitorsHandlerFunc func(context.Context, GetSourcesIDKapacitorsParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDKapacitorsHandlerFunc) Handle(ctx context.Context, params GetSourcesIDKapacitorsParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDKapacitorsHandler interface for that can handle valid get sources ID kapacitors params
type GetSourcesIDKapacitorsHandler interface {
Handle(context.Context, GetSourcesIDKapacitorsParams) middleware.Responder
}
// NewGetSourcesIDKapacitors creates a new http.Handler for the get sources ID kapacitors operation
func NewGetSourcesIDKapacitors(ctx *middleware.Context, handler GetSourcesIDKapacitorsHandler) *GetSourcesIDKapacitors {
return &GetSourcesIDKapacitors{Context: ctx, Handler: handler}
}
/*GetSourcesIDKapacitors swagger:route GET /sources/{id}/kapacitors getSourcesIdKapacitors
Configured kapacitors
*/
type GetSourcesIDKapacitors struct {
Context *middleware.Context
Handler GetSourcesIDKapacitorsHandler
}
func (o *GetSourcesIDKapacitors) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDKapacitorsParams()
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)
}

View File

@ -0,0 +1,57 @@
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"
)
// GetSourcesIDKapacitorsKapaIDHandlerFunc turns a function with the right signature into a get sources ID kapacitors kapa ID handler
type GetSourcesIDKapacitorsKapaIDHandlerFunc func(context.Context, GetSourcesIDKapacitorsKapaIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDKapacitorsKapaIDHandlerFunc) Handle(ctx context.Context, params GetSourcesIDKapacitorsKapaIDParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDKapacitorsKapaIDHandler interface for that can handle valid get sources ID kapacitors kapa ID params
type GetSourcesIDKapacitorsKapaIDHandler interface {
Handle(context.Context, GetSourcesIDKapacitorsKapaIDParams) middleware.Responder
}
// NewGetSourcesIDKapacitorsKapaID creates a new http.Handler for the get sources ID kapacitors kapa ID operation
func NewGetSourcesIDKapacitorsKapaID(ctx *middleware.Context, handler GetSourcesIDKapacitorsKapaIDHandler) *GetSourcesIDKapacitorsKapaID {
return &GetSourcesIDKapacitorsKapaID{Context: ctx, Handler: handler}
}
/*GetSourcesIDKapacitorsKapaID swagger:route GET /sources/{id}/kapacitors/{kapa_id} getSourcesIdKapacitorsKapaId
Configured kapacitors
These kapacitors are used for monitoring and alerting.
*/
type GetSourcesIDKapacitorsKapaID struct {
Context *middleware.Context
Handler GetSourcesIDKapacitorsKapaIDHandler
}
func (o *GetSourcesIDKapacitorsKapaID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDKapacitorsKapaIDParams()
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)
}

View File

@ -0,0 +1,85 @@
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"
strfmt "github.com/go-openapi/strfmt"
)
// NewGetSourcesIDKapacitorsKapaIDParams creates a new GetSourcesIDKapacitorsKapaIDParams object
// with the default values initialized.
func NewGetSourcesIDKapacitorsKapaIDParams() GetSourcesIDKapacitorsKapaIDParams {
var ()
return GetSourcesIDKapacitorsKapaIDParams{}
}
// GetSourcesIDKapacitorsKapaIDParams contains all the bound params for the get sources ID kapacitors kapa ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetSourcesIDKapacitorsKapaID
type GetSourcesIDKapacitorsKapaIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the source
Required: true
In: path
*/
ID string
/*ID of the kapacitor
Required: true
In: path
*/
KapaID 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 *GetSourcesIDKapacitorsKapaIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
rID, rhkID, _ := route.Params.GetOK("id")
if err := o.bindID(rID, rhkID, route.Formats); err != nil {
res = append(res, err)
}
rKapaID, rhkKapaID, _ := route.Params.GetOK("kapa_id")
if err := o.bindKapaID(rKapaID, rhkKapaID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *GetSourcesIDKapacitorsKapaIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.ID = raw
return nil
}
func (o *GetSourcesIDKapacitorsKapaIDParams) bindKapaID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.KapaID = raw
return nil
}

View File

@ -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"
)
// GetSourcesIDKapacitorsKapaIDProxyHandlerFunc turns a function with the right signature into a get sources ID kapacitors kapa ID proxy handler
type GetSourcesIDKapacitorsKapaIDProxyHandlerFunc func(context.Context, GetSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder
// Handle executing the request and returning a response
func (fn GetSourcesIDKapacitorsKapaIDProxyHandlerFunc) Handle(ctx context.Context, params GetSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder {
return fn(ctx, params)
}
// GetSourcesIDKapacitorsKapaIDProxyHandler interface for that can handle valid get sources ID kapacitors kapa ID proxy params
type GetSourcesIDKapacitorsKapaIDProxyHandler interface {
Handle(context.Context, GetSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder
}
// NewGetSourcesIDKapacitorsKapaIDProxy creates a new http.Handler for the get sources ID kapacitors kapa ID proxy operation
func NewGetSourcesIDKapacitorsKapaIDProxy(ctx *middleware.Context, handler GetSourcesIDKapacitorsKapaIDProxyHandler) *GetSourcesIDKapacitorsKapaIDProxy {
return &GetSourcesIDKapacitorsKapaIDProxy{Context: ctx, Handler: handler}
}
/*GetSourcesIDKapacitorsKapaIDProxy swagger:route GET /sources/{id}/kapacitors/{kapa_id}/proxy getSourcesIdKapacitorsKapaIdProxy
GET to `path` of kapacitor. The response and status code from kapacitor is directly returned.
*/
type GetSourcesIDKapacitorsKapaIDProxy struct {
Context *middleware.Context
Handler GetSourcesIDKapacitorsKapaIDProxyHandler
}
func (o *GetSourcesIDKapacitorsKapaIDProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewGetSourcesIDKapacitorsKapaIDProxyParams()
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)
}

View File

@ -14,27 +14,32 @@ import (
strfmt "github.com/go-openapi/strfmt"
)
// NewGetKapacitorsIDProxyParams creates a new GetKapacitorsIDProxyParams object
// NewGetSourcesIDKapacitorsKapaIDProxyParams creates a new GetSourcesIDKapacitorsKapaIDProxyParams object
// with the default values initialized.
func NewGetKapacitorsIDProxyParams() GetKapacitorsIDProxyParams {
func NewGetSourcesIDKapacitorsKapaIDProxyParams() GetSourcesIDKapacitorsKapaIDProxyParams {
var ()
return GetKapacitorsIDProxyParams{}
return GetSourcesIDKapacitorsKapaIDProxyParams{}
}
// GetKapacitorsIDProxyParams contains all the bound params for the get kapacitors ID proxy operation
// GetSourcesIDKapacitorsKapaIDProxyParams contains all the bound params for the get sources ID kapacitors kapa ID proxy operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetKapacitorsIDProxy
type GetKapacitorsIDProxyParams struct {
// swagger:parameters GetSourcesIDKapacitorsKapaIDProxy
type GetSourcesIDKapacitorsKapaIDProxyParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the kapacitor backend.
/*ID of the source
Required: true
In: path
*/
ID string
/*ID of the kapacitor backend.
Required: true
In: path
*/
KapaID string
/*The kapacitor API path to use in the proxy redirect
Required: true
In: query
@ -44,7 +49,7 @@ type GetKapacitorsIDProxyParams 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 *GetKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
func (o *GetSourcesIDKapacitorsKapaIDProxyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
@ -55,6 +60,11 @@ func (o *GetKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middlew
res = append(res, err)
}
rKapaID, rhkKapaID, _ := route.Params.GetOK("kapa_id")
if err := o.bindKapaID(rKapaID, rhkKapaID, route.Formats); err != nil {
res = append(res, err)
}
qPath, qhkPath, _ := qs.GetOK("path")
if err := o.bindPath(qPath, qhkPath, route.Formats); err != nil {
res = append(res, err)
@ -66,7 +76,7 @@ func (o *GetKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middlew
return nil
}
func (o *GetKapacitorsIDProxyParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *GetSourcesIDKapacitorsKapaIDProxyParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
@ -77,7 +87,18 @@ func (o *GetKapacitorsIDProxyParams) bindID(rawData []string, hasKey bool, forma
return nil
}
func (o *GetKapacitorsIDProxyParams) bindPath(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *GetSourcesIDKapacitorsKapaIDProxyParams) bindKapaID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.KapaID = raw
return nil
}
func (o *GetSourcesIDKapacitorsKapaIDProxyParams) bindPath(rawData []string, hasKey bool, formats strfmt.Registry) error {
if !hasKey {
return errors.Required("path", "query")
}

View File

@ -0,0 +1,121 @@
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"
)
/*GetSourcesIDKapacitorsKapaIDProxyNoContent Kapacitor returned no content
swagger:response getSourcesIdKapacitorsKapaIdProxyNoContent
*/
type GetSourcesIDKapacitorsKapaIDProxyNoContent struct {
}
// NewGetSourcesIDKapacitorsKapaIDProxyNoContent creates GetSourcesIDKapacitorsKapaIDProxyNoContent with default headers values
func NewGetSourcesIDKapacitorsKapaIDProxyNoContent() *GetSourcesIDKapacitorsKapaIDProxyNoContent {
return &GetSourcesIDKapacitorsKapaIDProxyNoContent{}
}
// WriteResponse to the client
func (o *GetSourcesIDKapacitorsKapaIDProxyNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*GetSourcesIDKapacitorsKapaIDProxyNotFound Data source or Kapacitor ID does not exist.
swagger:response getSourcesIdKapacitorsKapaIdProxyNotFound
*/
type GetSourcesIDKapacitorsKapaIDProxyNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDKapacitorsKapaIDProxyNotFound creates GetSourcesIDKapacitorsKapaIDProxyNotFound with default headers values
func NewGetSourcesIDKapacitorsKapaIDProxyNotFound() *GetSourcesIDKapacitorsKapaIDProxyNotFound {
return &GetSourcesIDKapacitorsKapaIDProxyNotFound{}
}
// WithPayload adds the payload to the get sources Id kapacitors kapa Id proxy not found response
func (o *GetSourcesIDKapacitorsKapaIDProxyNotFound) WithPayload(payload *models.Error) *GetSourcesIDKapacitorsKapaIDProxyNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id kapacitors kapa Id proxy not found response
func (o *GetSourcesIDKapacitorsKapaIDProxyNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDKapacitorsKapaIDProxyNotFound) 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
}
}
}
/*GetSourcesIDKapacitorsKapaIDProxyDefault Response directly from kapacitor
swagger:response getSourcesIdKapacitorsKapaIdProxyDefault
*/
type GetSourcesIDKapacitorsKapaIDProxyDefault struct {
_statusCode int
// In: body
Payload models.KapacitorProxyResponse `json:"body,omitempty"`
}
// NewGetSourcesIDKapacitorsKapaIDProxyDefault creates GetSourcesIDKapacitorsKapaIDProxyDefault with default headers values
func NewGetSourcesIDKapacitorsKapaIDProxyDefault(code int) *GetSourcesIDKapacitorsKapaIDProxyDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDKapacitorsKapaIDProxyDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID kapacitors kapa ID proxy default response
func (o *GetSourcesIDKapacitorsKapaIDProxyDefault) WithStatusCode(code int) *GetSourcesIDKapacitorsKapaIDProxyDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID kapacitors kapa ID proxy default response
func (o *GetSourcesIDKapacitorsKapaIDProxyDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID kapacitors kapa ID proxy default response
func (o *GetSourcesIDKapacitorsKapaIDProxyDefault) WithPayload(payload models.KapacitorProxyResponse) *GetSourcesIDKapacitorsKapaIDProxyDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID kapacitors kapa ID proxy default response
func (o *GetSourcesIDKapacitorsKapaIDProxyDefault) SetPayload(payload models.KapacitorProxyResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDKapacitorsKapaIDProxyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -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"
)
/*GetSourcesIDKapacitorsKapaIDOK Kapacitor connection information
swagger:response getSourcesIdKapacitorsKapaIdOK
*/
type GetSourcesIDKapacitorsKapaIDOK struct {
// In: body
Payload *models.Kapacitor `json:"body,omitempty"`
}
// NewGetSourcesIDKapacitorsKapaIDOK creates GetSourcesIDKapacitorsKapaIDOK with default headers values
func NewGetSourcesIDKapacitorsKapaIDOK() *GetSourcesIDKapacitorsKapaIDOK {
return &GetSourcesIDKapacitorsKapaIDOK{}
}
// WithPayload adds the payload to the get sources Id kapacitors kapa Id o k response
func (o *GetSourcesIDKapacitorsKapaIDOK) WithPayload(payload *models.Kapacitor) *GetSourcesIDKapacitorsKapaIDOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id kapacitors kapa Id o k response
func (o *GetSourcesIDKapacitorsKapaIDOK) SetPayload(payload *models.Kapacitor) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDKapacitorsKapaIDOK) 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
}
}
}
/*GetSourcesIDKapacitorsKapaIDNotFound Unknown data source or kapacitor id
swagger:response getSourcesIdKapacitorsKapaIdNotFound
*/
type GetSourcesIDKapacitorsKapaIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDKapacitorsKapaIDNotFound creates GetSourcesIDKapacitorsKapaIDNotFound with default headers values
func NewGetSourcesIDKapacitorsKapaIDNotFound() *GetSourcesIDKapacitorsKapaIDNotFound {
return &GetSourcesIDKapacitorsKapaIDNotFound{}
}
// WithPayload adds the payload to the get sources Id kapacitors kapa Id not found response
func (o *GetSourcesIDKapacitorsKapaIDNotFound) WithPayload(payload *models.Error) *GetSourcesIDKapacitorsKapaIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id kapacitors kapa Id not found response
func (o *GetSourcesIDKapacitorsKapaIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDKapacitorsKapaIDNotFound) 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
}
}
}
/*GetSourcesIDKapacitorsKapaIDDefault Unexpected internal service error
swagger:response getSourcesIdKapacitorsKapaIdDefault
*/
type GetSourcesIDKapacitorsKapaIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDKapacitorsKapaIDDefault creates GetSourcesIDKapacitorsKapaIDDefault with default headers values
func NewGetSourcesIDKapacitorsKapaIDDefault(code int) *GetSourcesIDKapacitorsKapaIDDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDKapacitorsKapaIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID kapacitors kapa ID default response
func (o *GetSourcesIDKapacitorsKapaIDDefault) WithStatusCode(code int) *GetSourcesIDKapacitorsKapaIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID kapacitors kapa ID default response
func (o *GetSourcesIDKapacitorsKapaIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID kapacitors kapa ID default response
func (o *GetSourcesIDKapacitorsKapaIDDefault) WithPayload(payload *models.Error) *GetSourcesIDKapacitorsKapaIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID kapacitors kapa ID default response
func (o *GetSourcesIDKapacitorsKapaIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDKapacitorsKapaIDDefault) 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
}
}
}

View File

@ -12,23 +12,23 @@ import (
strfmt "github.com/go-openapi/strfmt"
)
// NewGetKapacitorsIDParams creates a new GetKapacitorsIDParams object
// NewGetSourcesIDKapacitorsParams creates a new GetSourcesIDKapacitorsParams object
// with the default values initialized.
func NewGetKapacitorsIDParams() GetKapacitorsIDParams {
func NewGetSourcesIDKapacitorsParams() GetSourcesIDKapacitorsParams {
var ()
return GetKapacitorsIDParams{}
return GetSourcesIDKapacitorsParams{}
}
// GetKapacitorsIDParams contains all the bound params for the get kapacitors ID operation
// GetSourcesIDKapacitorsParams contains all the bound params for the get sources ID kapacitors operation
// typically these are obtained from a http.Request
//
// swagger:parameters GetKapacitorsID
type GetKapacitorsIDParams struct {
// swagger:parameters GetSourcesIDKapacitors
type GetSourcesIDKapacitorsParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the kapacitor
/*ID of the source
Required: true
In: path
*/
@ -37,7 +37,7 @@ type GetKapacitorsIDParams 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 *GetKapacitorsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
func (o *GetSourcesIDKapacitorsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
@ -52,7 +52,7 @@ func (o *GetKapacitorsIDParams) BindRequest(r *http.Request, route *middleware.M
return nil
}
func (o *GetKapacitorsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *GetSourcesIDKapacitorsParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]

View File

@ -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"
)
/*GetSourcesIDKapacitorsOK An array of kapacitors
swagger:response getSourcesIdKapacitorsOK
*/
type GetSourcesIDKapacitorsOK struct {
// In: body
Payload *models.Kapacitors `json:"body,omitempty"`
}
// NewGetSourcesIDKapacitorsOK creates GetSourcesIDKapacitorsOK with default headers values
func NewGetSourcesIDKapacitorsOK() *GetSourcesIDKapacitorsOK {
return &GetSourcesIDKapacitorsOK{}
}
// WithPayload adds the payload to the get sources Id kapacitors o k response
func (o *GetSourcesIDKapacitorsOK) WithPayload(payload *models.Kapacitors) *GetSourcesIDKapacitorsOK {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources Id kapacitors o k response
func (o *GetSourcesIDKapacitorsOK) SetPayload(payload *models.Kapacitors) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDKapacitorsOK) 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
}
}
}
/*GetSourcesIDKapacitorsDefault Unexpected internal service error
swagger:response getSourcesIdKapacitorsDefault
*/
type GetSourcesIDKapacitorsDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewGetSourcesIDKapacitorsDefault creates GetSourcesIDKapacitorsDefault with default headers values
func NewGetSourcesIDKapacitorsDefault(code int) *GetSourcesIDKapacitorsDefault {
if code <= 0 {
code = 500
}
return &GetSourcesIDKapacitorsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the get sources ID kapacitors default response
func (o *GetSourcesIDKapacitorsDefault) WithStatusCode(code int) *GetSourcesIDKapacitorsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the get sources ID kapacitors default response
func (o *GetSourcesIDKapacitorsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the get sources ID kapacitors default response
func (o *GetSourcesIDKapacitorsDefault) WithPayload(payload *models.Error) *GetSourcesIDKapacitorsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the get sources ID kapacitors default response
func (o *GetSourcesIDKapacitorsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *GetSourcesIDKapacitorsDefault) 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
}
}
}

View File

@ -44,12 +44,12 @@ type MrFusionAPI struct {
// DeleteDashboardsIDHandler sets the operation handler for the delete dashboards ID operation
DeleteDashboardsIDHandler DeleteDashboardsIDHandler
// DeleteKapacitorsIDHandler sets the operation handler for the delete kapacitors ID operation
DeleteKapacitorsIDHandler DeleteKapacitorsIDHandler
// DeleteKapacitorsIDProxyHandler sets the operation handler for the delete kapacitors ID proxy operation
DeleteKapacitorsIDProxyHandler DeleteKapacitorsIDProxyHandler
// 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
DeleteSourcesIDKapacitorsKapaIDHandler DeleteSourcesIDKapacitorsKapaIDHandler
// DeleteSourcesIDKapacitorsKapaIDProxyHandler sets the operation handler for the delete sources ID kapacitors kapa ID proxy operation
DeleteSourcesIDKapacitorsKapaIDProxyHandler DeleteSourcesIDKapacitorsKapaIDProxyHandler
// DeleteSourcesIDRolesRoleIDHandler sets the operation handler for the delete sources ID roles role ID operation
DeleteSourcesIDRolesRoleIDHandler DeleteSourcesIDRolesRoleIDHandler
// DeleteSourcesIDUsersUserIDHandler sets the operation handler for the delete sources ID users user ID operation
@ -62,16 +62,16 @@ type MrFusionAPI struct {
GetDashboardsHandler GetDashboardsHandler
// GetDashboardsIDHandler sets the operation handler for the get dashboards ID operation
GetDashboardsIDHandler GetDashboardsIDHandler
// GetKapacitorsHandler sets the operation handler for the get kapacitors operation
GetKapacitorsHandler GetKapacitorsHandler
// GetKapacitorsIDHandler sets the operation handler for the get kapacitors ID operation
GetKapacitorsIDHandler GetKapacitorsIDHandler
// GetKapacitorsIDProxyHandler sets the operation handler for the get kapacitors ID proxy operation
GetKapacitorsIDProxyHandler GetKapacitorsIDProxyHandler
// GetSourcesHandler sets the operation handler for the get sources operation
GetSourcesHandler GetSourcesHandler
// GetSourcesIDHandler sets the operation handler for the get sources ID operation
GetSourcesIDHandler GetSourcesIDHandler
// GetSourcesIDKapacitorsHandler sets the operation handler for the get sources ID kapacitors operation
GetSourcesIDKapacitorsHandler GetSourcesIDKapacitorsHandler
// GetSourcesIDKapacitorsKapaIDHandler sets the operation handler for the get sources ID kapacitors kapa ID operation
GetSourcesIDKapacitorsKapaIDHandler GetSourcesIDKapacitorsKapaIDHandler
// GetSourcesIDKapacitorsKapaIDProxyHandler sets the operation handler for the get sources ID kapacitors kapa ID proxy operation
GetSourcesIDKapacitorsKapaIDProxyHandler GetSourcesIDKapacitorsKapaIDProxyHandler
// GetSourcesIDMonitoredHandler sets the operation handler for the get sources ID monitored operation
GetSourcesIDMonitoredHandler GetSourcesIDMonitoredHandler
// GetSourcesIDPermissionsHandler sets the operation handler for the get sources ID permissions operation
@ -88,12 +88,12 @@ type MrFusionAPI struct {
GetSourcesIDUsersUserIDExplorationsHandler GetSourcesIDUsersUserIDExplorationsHandler
// GetSourcesIDUsersUserIDExplorationsExplorationIDHandler sets the operation handler for the get sources ID users user ID explorations exploration ID operation
GetSourcesIDUsersUserIDExplorationsExplorationIDHandler GetSourcesIDUsersUserIDExplorationsExplorationIDHandler
// PatchKapacitorsIDHandler sets the operation handler for the patch kapacitors ID operation
PatchKapacitorsIDHandler PatchKapacitorsIDHandler
// PatchKapacitorsIDProxyHandler sets the operation handler for the patch kapacitors ID proxy operation
PatchKapacitorsIDProxyHandler PatchKapacitorsIDProxyHandler
// PatchSourcesIDHandler sets the operation handler for the patch sources ID operation
PatchSourcesIDHandler PatchSourcesIDHandler
// PatchSourcesIDKapacitorsKapaIDHandler sets the operation handler for the patch sources ID kapacitors kapa ID operation
PatchSourcesIDKapacitorsKapaIDHandler PatchSourcesIDKapacitorsKapaIDHandler
// PatchSourcesIDKapacitorsKapaIDProxyHandler sets the operation handler for the patch sources ID kapacitors kapa ID proxy operation
PatchSourcesIDKapacitorsKapaIDProxyHandler PatchSourcesIDKapacitorsKapaIDProxyHandler
// PatchSourcesIDRolesRoleIDHandler sets the operation handler for the patch sources ID roles role ID operation
PatchSourcesIDRolesRoleIDHandler PatchSourcesIDRolesRoleIDHandler
// PatchSourcesIDUsersUserIDHandler sets the operation handler for the patch sources ID users user ID operation
@ -102,12 +102,12 @@ type MrFusionAPI struct {
PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler PatchSourcesIDUsersUserIDExplorationsExplorationIDHandler
// PostDashboardsHandler sets the operation handler for the post dashboards operation
PostDashboardsHandler PostDashboardsHandler
// PostKapacitorsHandler sets the operation handler for the post kapacitors operation
PostKapacitorsHandler PostKapacitorsHandler
// PostKapacitorsIDProxyHandler sets the operation handler for the post kapacitors ID proxy operation
PostKapacitorsIDProxyHandler PostKapacitorsIDProxyHandler
// PostSourcesHandler sets the operation handler for the post sources operation
PostSourcesHandler PostSourcesHandler
// PostSourcesIDKapacitorsHandler sets the operation handler for the post sources ID kapacitors operation
PostSourcesIDKapacitorsHandler PostSourcesIDKapacitorsHandler
// PostSourcesIDKapacitorsKapaIDProxyHandler sets the operation handler for the post sources ID kapacitors kapa ID proxy operation
PostSourcesIDKapacitorsKapaIDProxyHandler PostSourcesIDKapacitorsKapaIDProxyHandler
// PostSourcesIDProxyHandler sets the operation handler for the post sources ID proxy operation
PostSourcesIDProxyHandler PostSourcesIDProxyHandler
// PostSourcesIDRolesHandler sets the operation handler for the post sources ID roles operation
@ -185,18 +185,18 @@ func (o *MrFusionAPI) Validate() error {
unregistered = append(unregistered, "DeleteDashboardsIDHandler")
}
if o.DeleteKapacitorsIDHandler == nil {
unregistered = append(unregistered, "DeleteKapacitorsIDHandler")
}
if o.DeleteKapacitorsIDProxyHandler == nil {
unregistered = append(unregistered, "DeleteKapacitorsIDProxyHandler")
}
if o.DeleteSourcesIDHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDHandler")
}
if o.DeleteSourcesIDKapacitorsKapaIDHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDKapacitorsKapaIDHandler")
}
if o.DeleteSourcesIDKapacitorsKapaIDProxyHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDKapacitorsKapaIDProxyHandler")
}
if o.DeleteSourcesIDRolesRoleIDHandler == nil {
unregistered = append(unregistered, "DeleteSourcesIDRolesRoleIDHandler")
}
@ -221,18 +221,6 @@ func (o *MrFusionAPI) Validate() error {
unregistered = append(unregistered, "GetDashboardsIDHandler")
}
if o.GetKapacitorsHandler == nil {
unregistered = append(unregistered, "GetKapacitorsHandler")
}
if o.GetKapacitorsIDHandler == nil {
unregistered = append(unregistered, "GetKapacitorsIDHandler")
}
if o.GetKapacitorsIDProxyHandler == nil {
unregistered = append(unregistered, "GetKapacitorsIDProxyHandler")
}
if o.GetSourcesHandler == nil {
unregistered = append(unregistered, "GetSourcesHandler")
}
@ -241,6 +229,18 @@ func (o *MrFusionAPI) Validate() error {
unregistered = append(unregistered, "GetSourcesIDHandler")
}
if o.GetSourcesIDKapacitorsHandler == nil {
unregistered = append(unregistered, "GetSourcesIDKapacitorsHandler")
}
if o.GetSourcesIDKapacitorsKapaIDHandler == nil {
unregistered = append(unregistered, "GetSourcesIDKapacitorsKapaIDHandler")
}
if o.GetSourcesIDKapacitorsKapaIDProxyHandler == nil {
unregistered = append(unregistered, "GetSourcesIDKapacitorsKapaIDProxyHandler")
}
if o.GetSourcesIDMonitoredHandler == nil {
unregistered = append(unregistered, "GetSourcesIDMonitoredHandler")
}
@ -273,18 +273,18 @@ func (o *MrFusionAPI) Validate() error {
unregistered = append(unregistered, "GetSourcesIDUsersUserIDExplorationsExplorationIDHandler")
}
if o.PatchKapacitorsIDHandler == nil {
unregistered = append(unregistered, "PatchKapacitorsIDHandler")
}
if o.PatchKapacitorsIDProxyHandler == nil {
unregistered = append(unregistered, "PatchKapacitorsIDProxyHandler")
}
if o.PatchSourcesIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDHandler")
}
if o.PatchSourcesIDKapacitorsKapaIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDKapacitorsKapaIDHandler")
}
if o.PatchSourcesIDKapacitorsKapaIDProxyHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDKapacitorsKapaIDProxyHandler")
}
if o.PatchSourcesIDRolesRoleIDHandler == nil {
unregistered = append(unregistered, "PatchSourcesIDRolesRoleIDHandler")
}
@ -301,18 +301,18 @@ func (o *MrFusionAPI) Validate() error {
unregistered = append(unregistered, "PostDashboardsHandler")
}
if o.PostKapacitorsHandler == nil {
unregistered = append(unregistered, "PostKapacitorsHandler")
}
if o.PostKapacitorsIDProxyHandler == nil {
unregistered = append(unregistered, "PostKapacitorsIDProxyHandler")
}
if o.PostSourcesHandler == nil {
unregistered = append(unregistered, "PostSourcesHandler")
}
if o.PostSourcesIDKapacitorsHandler == nil {
unregistered = append(unregistered, "PostSourcesIDKapacitorsHandler")
}
if o.PostSourcesIDKapacitorsKapaIDProxyHandler == nil {
unregistered = append(unregistered, "PostSourcesIDKapacitorsKapaIDProxyHandler")
}
if o.PostSourcesIDProxyHandler == nil {
unregistered = append(unregistered, "PostSourcesIDProxyHandler")
}
@ -419,21 +419,21 @@ func (o *MrFusionAPI) initHandlerCache() {
}
o.handlers["DELETE"]["/dashboards/{id}"] = NewDeleteDashboardsID(o.context, o.DeleteDashboardsIDHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/kapacitors/{id}"] = NewDeleteKapacitorsID(o.context, o.DeleteKapacitorsIDHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/kapacitors/{id}/proxy"] = NewDeleteKapacitorsIDProxy(o.context, o.DeleteKapacitorsIDProxyHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/sources/{id}"] = NewDeleteSourcesID(o.context, o.DeleteSourcesIDHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/sources/{id}/kapacitors/{kapa_id}"] = NewDeleteSourcesIDKapacitorsKapaID(o.context, o.DeleteSourcesIDKapacitorsKapaIDHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
o.handlers["DELETE"]["/sources/{id}/kapacitors/{kapa_id}/proxy"] = NewDeleteSourcesIDKapacitorsKapaIDProxy(o.context, o.DeleteSourcesIDKapacitorsKapaIDProxyHandler)
if o.handlers["DELETE"] == nil {
o.handlers[strings.ToUpper("DELETE")] = make(map[string]http.Handler)
}
@ -464,21 +464,6 @@ func (o *MrFusionAPI) initHandlerCache() {
}
o.handlers["GET"]["/dashboards/{id}"] = NewGetDashboardsID(o.context, o.GetDashboardsIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/kapacitors"] = NewGetKapacitors(o.context, o.GetKapacitorsHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/kapacitors/{id}"] = NewGetKapacitorsID(o.context, o.GetKapacitorsIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/kapacitors/{id}/proxy"] = NewGetKapacitorsIDProxy(o.context, o.GetKapacitorsIDProxyHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
@ -489,6 +474,21 @@ func (o *MrFusionAPI) initHandlerCache() {
}
o.handlers["GET"]["/sources/{id}"] = NewGetSourcesID(o.context, o.GetSourcesIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/kapacitors"] = NewGetSourcesIDKapacitors(o.context, o.GetSourcesIDKapacitorsHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/kapacitors/{kapa_id}"] = NewGetSourcesIDKapacitorsKapaID(o.context, o.GetSourcesIDKapacitorsKapaIDHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
o.handlers["GET"]["/sources/{id}/kapacitors/{kapa_id}/proxy"] = NewGetSourcesIDKapacitorsKapaIDProxy(o.context, o.GetSourcesIDKapacitorsKapaIDProxyHandler)
if o.handlers["GET"] == nil {
o.handlers[strings.ToUpper("GET")] = make(map[string]http.Handler)
}
@ -529,21 +529,21 @@ func (o *MrFusionAPI) initHandlerCache() {
}
o.handlers["GET"]["/sources/{id}/users/{user_id}/explorations/{exploration_id}"] = NewGetSourcesIDUsersUserIDExplorationsExplorationID(o.context, o.GetSourcesIDUsersUserIDExplorationsExplorationIDHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/kapacitors/{id}"] = NewPatchKapacitorsID(o.context, o.PatchKapacitorsIDHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/kapacitors/{id}/proxy"] = NewPatchKapacitorsIDProxy(o.context, o.PatchKapacitorsIDProxyHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/sources/{id}"] = NewPatchSourcesID(o.context, o.PatchSourcesIDHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/sources/{id}/kapacitors/{kapa_id}"] = NewPatchSourcesIDKapacitorsKapaID(o.context, o.PatchSourcesIDKapacitorsKapaIDHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
o.handlers["PATCH"]["/sources/{id}/kapacitors/{kapa_id}/proxy"] = NewPatchSourcesIDKapacitorsKapaIDProxy(o.context, o.PatchSourcesIDKapacitorsKapaIDProxyHandler)
if o.handlers["PATCH"] == nil {
o.handlers[strings.ToUpper("PATCH")] = make(map[string]http.Handler)
}
@ -564,21 +564,21 @@ func (o *MrFusionAPI) initHandlerCache() {
}
o.handlers["POST"]["/dashboards"] = NewPostDashboards(o.context, o.PostDashboardsHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/kapacitors"] = NewPostKapacitors(o.context, o.PostKapacitorsHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/kapacitors/{id}/proxy"] = NewPostKapacitorsIDProxy(o.context, o.PostKapacitorsIDProxyHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/sources"] = NewPostSources(o.context, o.PostSourcesHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/sources/{id}/kapacitors"] = NewPostSourcesIDKapacitors(o.context, o.PostSourcesIDKapacitorsHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}
o.handlers["POST"]["/sources/{id}/kapacitors/{kapa_id}/proxy"] = NewPostSourcesIDKapacitorsKapaIDProxy(o.context, o.PostSourcesIDKapacitorsKapaIDProxyHandler)
if o.handlers["POST"] == nil {
o.handlers[strings.ToUpper("POST")] = make(map[string]http.Handler)
}

View File

@ -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"
)
// PatchKapacitorsIDHandlerFunc turns a function with the right signature into a patch kapacitors ID handler
type PatchKapacitorsIDHandlerFunc func(context.Context, PatchKapacitorsIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PatchKapacitorsIDHandlerFunc) Handle(ctx context.Context, params PatchKapacitorsIDParams) middleware.Responder {
return fn(ctx, params)
}
// PatchKapacitorsIDHandler interface for that can handle valid patch kapacitors ID params
type PatchKapacitorsIDHandler interface {
Handle(context.Context, PatchKapacitorsIDParams) middleware.Responder
}
// NewPatchKapacitorsID creates a new http.Handler for the patch kapacitors ID operation
func NewPatchKapacitorsID(ctx *middleware.Context, handler PatchKapacitorsIDHandler) *PatchKapacitorsID {
return &PatchKapacitorsID{Context: ctx, Handler: handler}
}
/*PatchKapacitorsID swagger:route PATCH /kapacitors/{id} patchKapacitorsId
Update kapacitor configuration
*/
type PatchKapacitorsID struct {
Context *middleware.Context
Handler PatchKapacitorsIDHandler
}
func (o *PatchKapacitorsID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPatchKapacitorsIDParams()
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)
}

View File

@ -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"
)
// PatchKapacitorsIDProxyHandlerFunc turns a function with the right signature into a patch kapacitors ID proxy handler
type PatchKapacitorsIDProxyHandlerFunc func(context.Context, PatchKapacitorsIDProxyParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PatchKapacitorsIDProxyHandlerFunc) Handle(ctx context.Context, params PatchKapacitorsIDProxyParams) middleware.Responder {
return fn(ctx, params)
}
// PatchKapacitorsIDProxyHandler interface for that can handle valid patch kapacitors ID proxy params
type PatchKapacitorsIDProxyHandler interface {
Handle(context.Context, PatchKapacitorsIDProxyParams) middleware.Responder
}
// NewPatchKapacitorsIDProxy creates a new http.Handler for the patch kapacitors ID proxy operation
func NewPatchKapacitorsIDProxy(ctx *middleware.Context, handler PatchKapacitorsIDProxyHandler) *PatchKapacitorsIDProxy {
return &PatchKapacitorsIDProxy{Context: ctx, Handler: handler}
}
/*PatchKapacitorsIDProxy swagger:route PATCH /kapacitors/{id}/proxy patchKapacitorsIdProxy
PATCH body directly to configured kapacitor. The response and status code from kapacitor is directly returned.
*/
type PatchKapacitorsIDProxy struct {
Context *middleware.Context
Handler PatchKapacitorsIDProxyHandler
}
func (o *PatchKapacitorsIDProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPatchKapacitorsIDProxyParams()
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)
}

View File

@ -1,103 +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"
)
/*PatchKapacitorsIDProxyNotFound Kapacitor ID does not exist.
swagger:response patchKapacitorsIdProxyNotFound
*/
type PatchKapacitorsIDProxyNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchKapacitorsIDProxyNotFound creates PatchKapacitorsIDProxyNotFound with default headers values
func NewPatchKapacitorsIDProxyNotFound() *PatchKapacitorsIDProxyNotFound {
return &PatchKapacitorsIDProxyNotFound{}
}
// WithPayload adds the payload to the patch kapacitors Id proxy not found response
func (o *PatchKapacitorsIDProxyNotFound) WithPayload(payload *models.Error) *PatchKapacitorsIDProxyNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch kapacitors Id proxy not found response
func (o *PatchKapacitorsIDProxyNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchKapacitorsIDProxyNotFound) 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
}
}
}
/*PatchKapacitorsIDProxyDefault Response directly from kapacitor
swagger:response patchKapacitorsIdProxyDefault
*/
type PatchKapacitorsIDProxyDefault struct {
_statusCode int
// In: body
Payload models.KapacitorProxyResponse `json:"body,omitempty"`
}
// NewPatchKapacitorsIDProxyDefault creates PatchKapacitorsIDProxyDefault with default headers values
func NewPatchKapacitorsIDProxyDefault(code int) *PatchKapacitorsIDProxyDefault {
if code <= 0 {
code = 500
}
return &PatchKapacitorsIDProxyDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the patch kapacitors ID proxy default response
func (o *PatchKapacitorsIDProxyDefault) WithStatusCode(code int) *PatchKapacitorsIDProxyDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the patch kapacitors ID proxy default response
func (o *PatchKapacitorsIDProxyDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the patch kapacitors ID proxy default response
func (o *PatchKapacitorsIDProxyDefault) WithPayload(payload models.KapacitorProxyResponse) *PatchKapacitorsIDProxyDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch kapacitors ID proxy default response
func (o *PatchKapacitorsIDProxyDefault) SetPayload(payload models.KapacitorProxyResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchKapacitorsIDProxyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -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"
)
/*PatchKapacitorsIDNoContent Kapacitor's configuration was changed
swagger:response patchKapacitorsIdNoContent
*/
type PatchKapacitorsIDNoContent struct {
}
// NewPatchKapacitorsIDNoContent creates PatchKapacitorsIDNoContent with default headers values
func NewPatchKapacitorsIDNoContent() *PatchKapacitorsIDNoContent {
return &PatchKapacitorsIDNoContent{}
}
// WriteResponse to the client
func (o *PatchKapacitorsIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*PatchKapacitorsIDNotFound Happens when trying to access a non-existent kapacitor.
swagger:response patchKapacitorsIdNotFound
*/
type PatchKapacitorsIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchKapacitorsIDNotFound creates PatchKapacitorsIDNotFound with default headers values
func NewPatchKapacitorsIDNotFound() *PatchKapacitorsIDNotFound {
return &PatchKapacitorsIDNotFound{}
}
// WithPayload adds the payload to the patch kapacitors Id not found response
func (o *PatchKapacitorsIDNotFound) WithPayload(payload *models.Error) *PatchKapacitorsIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch kapacitors Id not found response
func (o *PatchKapacitorsIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchKapacitorsIDNotFound) 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
}
}
}
/*PatchKapacitorsIDDefault A processing or an unexpected error.
swagger:response patchKapacitorsIdDefault
*/
type PatchKapacitorsIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchKapacitorsIDDefault creates PatchKapacitorsIDDefault with default headers values
func NewPatchKapacitorsIDDefault(code int) *PatchKapacitorsIDDefault {
if code <= 0 {
code = 500
}
return &PatchKapacitorsIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the patch kapacitors ID default response
func (o *PatchKapacitorsIDDefault) WithStatusCode(code int) *PatchKapacitorsIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the patch kapacitors ID default response
func (o *PatchKapacitorsIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the patch kapacitors ID default response
func (o *PatchKapacitorsIDDefault) WithPayload(payload *models.Error) *PatchKapacitorsIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch kapacitors ID default response
func (o *PatchKapacitorsIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchKapacitorsIDDefault) 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
}
}
}

View File

@ -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"
)
// PatchSourcesIDKapacitorsKapaIDHandlerFunc turns a function with the right signature into a patch sources ID kapacitors kapa ID handler
type PatchSourcesIDKapacitorsKapaIDHandlerFunc func(context.Context, PatchSourcesIDKapacitorsKapaIDParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PatchSourcesIDKapacitorsKapaIDHandlerFunc) Handle(ctx context.Context, params PatchSourcesIDKapacitorsKapaIDParams) middleware.Responder {
return fn(ctx, params)
}
// PatchSourcesIDKapacitorsKapaIDHandler interface for that can handle valid patch sources ID kapacitors kapa ID params
type PatchSourcesIDKapacitorsKapaIDHandler interface {
Handle(context.Context, PatchSourcesIDKapacitorsKapaIDParams) middleware.Responder
}
// NewPatchSourcesIDKapacitorsKapaID creates a new http.Handler for the patch sources ID kapacitors kapa ID operation
func NewPatchSourcesIDKapacitorsKapaID(ctx *middleware.Context, handler PatchSourcesIDKapacitorsKapaIDHandler) *PatchSourcesIDKapacitorsKapaID {
return &PatchSourcesIDKapacitorsKapaID{Context: ctx, Handler: handler}
}
/*PatchSourcesIDKapacitorsKapaID swagger:route PATCH /sources/{id}/kapacitors/{kapa_id} patchSourcesIdKapacitorsKapaId
Update kapacitor configuration
*/
type PatchSourcesIDKapacitorsKapaID struct {
Context *middleware.Context
Handler PatchSourcesIDKapacitorsKapaIDHandler
}
func (o *PatchSourcesIDKapacitorsKapaID) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPatchSourcesIDKapacitorsKapaIDParams()
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)
}

View File

@ -16,18 +16,18 @@ import (
"github.com/influxdata/mrfusion/models"
)
// NewPatchKapacitorsIDParams creates a new PatchKapacitorsIDParams object
// NewPatchSourcesIDKapacitorsKapaIDParams creates a new PatchSourcesIDKapacitorsKapaIDParams object
// with the default values initialized.
func NewPatchKapacitorsIDParams() PatchKapacitorsIDParams {
func NewPatchSourcesIDKapacitorsKapaIDParams() PatchSourcesIDKapacitorsKapaIDParams {
var ()
return PatchKapacitorsIDParams{}
return PatchSourcesIDKapacitorsKapaIDParams{}
}
// PatchKapacitorsIDParams contains all the bound params for the patch kapacitors ID operation
// PatchSourcesIDKapacitorsKapaIDParams contains all the bound params for the patch sources ID kapacitors kapa ID operation
// typically these are obtained from a http.Request
//
// swagger:parameters PatchKapacitorsID
type PatchKapacitorsIDParams struct {
// swagger:parameters PatchSourcesIDKapacitorsKapaID
type PatchSourcesIDKapacitorsKapaIDParams struct {
// HTTP Request Object
HTTPRequest *http.Request
@ -37,16 +37,21 @@ type PatchKapacitorsIDParams struct {
In: body
*/
Config *models.Kapacitor
/*ID of a kapacitor backend
/*ID of the source
Required: true
In: path
*/
ID string
/*ID of a kapacitor backend
Required: true
In: path
*/
KapaID 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 *PatchKapacitorsIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
func (o *PatchSourcesIDKapacitorsKapaIDParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
@ -79,13 +84,18 @@ func (o *PatchKapacitorsIDParams) BindRequest(r *http.Request, route *middleware
res = append(res, err)
}
rKapaID, rhkKapaID, _ := route.Params.GetOK("kapa_id")
if err := o.bindKapaID(rKapaID, rhkKapaID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (o *PatchKapacitorsIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *PatchSourcesIDKapacitorsKapaIDParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
@ -95,3 +105,14 @@ func (o *PatchKapacitorsIDParams) bindID(rawData []string, hasKey bool, formats
return nil
}
func (o *PatchSourcesIDKapacitorsKapaIDParams) bindKapaID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.KapaID = raw
return nil
}

View File

@ -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"
)
// PatchSourcesIDKapacitorsKapaIDProxyHandlerFunc turns a function with the right signature into a patch sources ID kapacitors kapa ID proxy handler
type PatchSourcesIDKapacitorsKapaIDProxyHandlerFunc func(context.Context, PatchSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PatchSourcesIDKapacitorsKapaIDProxyHandlerFunc) Handle(ctx context.Context, params PatchSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder {
return fn(ctx, params)
}
// PatchSourcesIDKapacitorsKapaIDProxyHandler interface for that can handle valid patch sources ID kapacitors kapa ID proxy params
type PatchSourcesIDKapacitorsKapaIDProxyHandler interface {
Handle(context.Context, PatchSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder
}
// NewPatchSourcesIDKapacitorsKapaIDProxy creates a new http.Handler for the patch sources ID kapacitors kapa ID proxy operation
func NewPatchSourcesIDKapacitorsKapaIDProxy(ctx *middleware.Context, handler PatchSourcesIDKapacitorsKapaIDProxyHandler) *PatchSourcesIDKapacitorsKapaIDProxy {
return &PatchSourcesIDKapacitorsKapaIDProxy{Context: ctx, Handler: handler}
}
/*PatchSourcesIDKapacitorsKapaIDProxy swagger:route PATCH /sources/{id}/kapacitors/{kapa_id}/proxy patchSourcesIdKapacitorsKapaIdProxy
PATCH body directly to configured kapacitor. The response and status code from kapacitor is directly returned.
*/
type PatchSourcesIDKapacitorsKapaIDProxy struct {
Context *middleware.Context
Handler PatchSourcesIDKapacitorsKapaIDProxyHandler
}
func (o *PatchSourcesIDKapacitorsKapaIDProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPatchSourcesIDKapacitorsKapaIDProxyParams()
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)
}

View File

@ -17,27 +17,32 @@ import (
"github.com/influxdata/mrfusion/models"
)
// NewPostKapacitorsIDProxyParams creates a new PostKapacitorsIDProxyParams object
// NewPatchSourcesIDKapacitorsKapaIDProxyParams creates a new PatchSourcesIDKapacitorsKapaIDProxyParams object
// with the default values initialized.
func NewPostKapacitorsIDProxyParams() PostKapacitorsIDProxyParams {
func NewPatchSourcesIDKapacitorsKapaIDProxyParams() PatchSourcesIDKapacitorsKapaIDProxyParams {
var ()
return PostKapacitorsIDProxyParams{}
return PatchSourcesIDKapacitorsKapaIDProxyParams{}
}
// PostKapacitorsIDProxyParams contains all the bound params for the post kapacitors ID proxy operation
// PatchSourcesIDKapacitorsKapaIDProxyParams contains all the bound params for the patch sources ID kapacitors kapa ID proxy operation
// typically these are obtained from a http.Request
//
// swagger:parameters PostKapacitorsIDProxy
type PostKapacitorsIDProxyParams struct {
// swagger:parameters PatchSourcesIDKapacitorsKapaIDProxy
type PatchSourcesIDKapacitorsKapaIDProxyParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the kapacitor backend.
/*ID of the source
Required: true
In: path
*/
ID string
/*ID of the kapacitor backend.
Required: true
In: path
*/
KapaID string
/*The kapacitor API path to use in the proxy redirect
Required: true
In: query
@ -52,7 +57,7 @@ type PostKapacitorsIDProxyParams 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 *PostKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
func (o *PatchSourcesIDKapacitorsKapaIDProxyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
@ -63,6 +68,11 @@ func (o *PostKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middle
res = append(res, err)
}
rKapaID, rhkKapaID, _ := route.Params.GetOK("kapa_id")
if err := o.bindKapaID(rKapaID, rhkKapaID, route.Formats); err != nil {
res = append(res, err)
}
qPath, qhkPath, _ := qs.GetOK("path")
if err := o.bindPath(qPath, qhkPath, route.Formats); err != nil {
res = append(res, err)
@ -95,7 +105,7 @@ func (o *PostKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middle
return nil
}
func (o *PostKapacitorsIDProxyParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *PatchSourcesIDKapacitorsKapaIDProxyParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
@ -106,7 +116,18 @@ func (o *PostKapacitorsIDProxyParams) bindID(rawData []string, hasKey bool, form
return nil
}
func (o *PostKapacitorsIDProxyParams) bindPath(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *PatchSourcesIDKapacitorsKapaIDProxyParams) bindKapaID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.KapaID = raw
return nil
}
func (o *PatchSourcesIDKapacitorsKapaIDProxyParams) bindPath(rawData []string, hasKey bool, formats strfmt.Registry) error {
if !hasKey {
return errors.Required("path", "query")
}

View File

@ -0,0 +1,103 @@
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"
)
/*PatchSourcesIDKapacitorsKapaIDProxyNotFound Data source or Kapacitor ID does not exist.
swagger:response patchSourcesIdKapacitorsKapaIdProxyNotFound
*/
type PatchSourcesIDKapacitorsKapaIDProxyNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDKapacitorsKapaIDProxyNotFound creates PatchSourcesIDKapacitorsKapaIDProxyNotFound with default headers values
func NewPatchSourcesIDKapacitorsKapaIDProxyNotFound() *PatchSourcesIDKapacitorsKapaIDProxyNotFound {
return &PatchSourcesIDKapacitorsKapaIDProxyNotFound{}
}
// WithPayload adds the payload to the patch sources Id kapacitors kapa Id proxy not found response
func (o *PatchSourcesIDKapacitorsKapaIDProxyNotFound) WithPayload(payload *models.Error) *PatchSourcesIDKapacitorsKapaIDProxyNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources Id kapacitors kapa Id proxy not found response
func (o *PatchSourcesIDKapacitorsKapaIDProxyNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDKapacitorsKapaIDProxyNotFound) 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
}
}
}
/*PatchSourcesIDKapacitorsKapaIDProxyDefault Response directly from kapacitor
swagger:response patchSourcesIdKapacitorsKapaIdProxyDefault
*/
type PatchSourcesIDKapacitorsKapaIDProxyDefault struct {
_statusCode int
// In: body
Payload models.KapacitorProxyResponse `json:"body,omitempty"`
}
// NewPatchSourcesIDKapacitorsKapaIDProxyDefault creates PatchSourcesIDKapacitorsKapaIDProxyDefault with default headers values
func NewPatchSourcesIDKapacitorsKapaIDProxyDefault(code int) *PatchSourcesIDKapacitorsKapaIDProxyDefault {
if code <= 0 {
code = 500
}
return &PatchSourcesIDKapacitorsKapaIDProxyDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the patch sources ID kapacitors kapa ID proxy default response
func (o *PatchSourcesIDKapacitorsKapaIDProxyDefault) WithStatusCode(code int) *PatchSourcesIDKapacitorsKapaIDProxyDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the patch sources ID kapacitors kapa ID proxy default response
func (o *PatchSourcesIDKapacitorsKapaIDProxyDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the patch sources ID kapacitors kapa ID proxy default response
func (o *PatchSourcesIDKapacitorsKapaIDProxyDefault) WithPayload(payload models.KapacitorProxyResponse) *PatchSourcesIDKapacitorsKapaIDProxyDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources ID kapacitors kapa ID proxy default response
func (o *PatchSourcesIDKapacitorsKapaIDProxyDefault) SetPayload(payload models.KapacitorProxyResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDKapacitorsKapaIDProxyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -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"
)
/*PatchSourcesIDKapacitorsKapaIDNoContent Kapacitor's configuration was changed
swagger:response patchSourcesIdKapacitorsKapaIdNoContent
*/
type PatchSourcesIDKapacitorsKapaIDNoContent struct {
}
// NewPatchSourcesIDKapacitorsKapaIDNoContent creates PatchSourcesIDKapacitorsKapaIDNoContent with default headers values
func NewPatchSourcesIDKapacitorsKapaIDNoContent() *PatchSourcesIDKapacitorsKapaIDNoContent {
return &PatchSourcesIDKapacitorsKapaIDNoContent{}
}
// WriteResponse to the client
func (o *PatchSourcesIDKapacitorsKapaIDNoContent) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(204)
}
/*PatchSourcesIDKapacitorsKapaIDNotFound Happens when trying to access a non-existent data source or kapacitor.
swagger:response patchSourcesIdKapacitorsKapaIdNotFound
*/
type PatchSourcesIDKapacitorsKapaIDNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDKapacitorsKapaIDNotFound creates PatchSourcesIDKapacitorsKapaIDNotFound with default headers values
func NewPatchSourcesIDKapacitorsKapaIDNotFound() *PatchSourcesIDKapacitorsKapaIDNotFound {
return &PatchSourcesIDKapacitorsKapaIDNotFound{}
}
// WithPayload adds the payload to the patch sources Id kapacitors kapa Id not found response
func (o *PatchSourcesIDKapacitorsKapaIDNotFound) WithPayload(payload *models.Error) *PatchSourcesIDKapacitorsKapaIDNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources Id kapacitors kapa Id not found response
func (o *PatchSourcesIDKapacitorsKapaIDNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDKapacitorsKapaIDNotFound) 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
}
}
}
/*PatchSourcesIDKapacitorsKapaIDDefault A processing or an unexpected error.
swagger:response patchSourcesIdKapacitorsKapaIdDefault
*/
type PatchSourcesIDKapacitorsKapaIDDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPatchSourcesIDKapacitorsKapaIDDefault creates PatchSourcesIDKapacitorsKapaIDDefault with default headers values
func NewPatchSourcesIDKapacitorsKapaIDDefault(code int) *PatchSourcesIDKapacitorsKapaIDDefault {
if code <= 0 {
code = 500
}
return &PatchSourcesIDKapacitorsKapaIDDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the patch sources ID kapacitors kapa ID default response
func (o *PatchSourcesIDKapacitorsKapaIDDefault) WithStatusCode(code int) *PatchSourcesIDKapacitorsKapaIDDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the patch sources ID kapacitors kapa ID default response
func (o *PatchSourcesIDKapacitorsKapaIDDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the patch sources ID kapacitors kapa ID default response
func (o *PatchSourcesIDKapacitorsKapaIDDefault) WithPayload(payload *models.Error) *PatchSourcesIDKapacitorsKapaIDDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the patch sources ID kapacitors kapa ID default response
func (o *PatchSourcesIDKapacitorsKapaIDDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PatchSourcesIDKapacitorsKapaIDDefault) 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
}
}
}

View File

@ -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"
)
// PostKapacitorsHandlerFunc turns a function with the right signature into a post kapacitors handler
type PostKapacitorsHandlerFunc func(context.Context, PostKapacitorsParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostKapacitorsHandlerFunc) Handle(ctx context.Context, params PostKapacitorsParams) middleware.Responder {
return fn(ctx, params)
}
// PostKapacitorsHandler interface for that can handle valid post kapacitors params
type PostKapacitorsHandler interface {
Handle(context.Context, PostKapacitorsParams) middleware.Responder
}
// NewPostKapacitors creates a new http.Handler for the post kapacitors operation
func NewPostKapacitors(ctx *middleware.Context, handler PostKapacitorsHandler) *PostKapacitors {
return &PostKapacitors{Context: ctx, Handler: handler}
}
/*PostKapacitors swagger:route POST /kapacitors postKapacitors
Create new kapacitor backend
*/
type PostKapacitors struct {
Context *middleware.Context
Handler PostKapacitorsHandler
}
func (o *PostKapacitors) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostKapacitorsParams()
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)
}

View File

@ -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"
)
// PostKapacitorsIDProxyHandlerFunc turns a function with the right signature into a post kapacitors ID proxy handler
type PostKapacitorsIDProxyHandlerFunc func(context.Context, PostKapacitorsIDProxyParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostKapacitorsIDProxyHandlerFunc) Handle(ctx context.Context, params PostKapacitorsIDProxyParams) middleware.Responder {
return fn(ctx, params)
}
// PostKapacitorsIDProxyHandler interface for that can handle valid post kapacitors ID proxy params
type PostKapacitorsIDProxyHandler interface {
Handle(context.Context, PostKapacitorsIDProxyParams) middleware.Responder
}
// NewPostKapacitorsIDProxy creates a new http.Handler for the post kapacitors ID proxy operation
func NewPostKapacitorsIDProxy(ctx *middleware.Context, handler PostKapacitorsIDProxyHandler) *PostKapacitorsIDProxy {
return &PostKapacitorsIDProxy{Context: ctx, Handler: handler}
}
/*PostKapacitorsIDProxy swagger:route POST /kapacitors/{id}/proxy postKapacitorsIdProxy
POST body directly to configured kapacitor. The response and status code from kapacitor is directly returned.
*/
type PostKapacitorsIDProxy struct {
Context *middleware.Context
Handler PostKapacitorsIDProxyHandler
}
func (o *PostKapacitorsIDProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostKapacitorsIDProxyParams()
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)
}

View File

@ -1,103 +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"
)
/*PostKapacitorsIDProxyNotFound Kapacitor ID does not exist.
swagger:response postKapacitorsIdProxyNotFound
*/
type PostKapacitorsIDProxyNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostKapacitorsIDProxyNotFound creates PostKapacitorsIDProxyNotFound with default headers values
func NewPostKapacitorsIDProxyNotFound() *PostKapacitorsIDProxyNotFound {
return &PostKapacitorsIDProxyNotFound{}
}
// WithPayload adds the payload to the post kapacitors Id proxy not found response
func (o *PostKapacitorsIDProxyNotFound) WithPayload(payload *models.Error) *PostKapacitorsIDProxyNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post kapacitors Id proxy not found response
func (o *PostKapacitorsIDProxyNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostKapacitorsIDProxyNotFound) 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
}
}
}
/*PostKapacitorsIDProxyDefault Response directly from kapacitor
swagger:response postKapacitorsIdProxyDefault
*/
type PostKapacitorsIDProxyDefault struct {
_statusCode int
// In: body
Payload models.KapacitorProxyResponse `json:"body,omitempty"`
}
// NewPostKapacitorsIDProxyDefault creates PostKapacitorsIDProxyDefault with default headers values
func NewPostKapacitorsIDProxyDefault(code int) *PostKapacitorsIDProxyDefault {
if code <= 0 {
code = 500
}
return &PostKapacitorsIDProxyDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the post kapacitors ID proxy default response
func (o *PostKapacitorsIDProxyDefault) WithStatusCode(code int) *PostKapacitorsIDProxyDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the post kapacitors ID proxy default response
func (o *PostKapacitorsIDProxyDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the post kapacitors ID proxy default response
func (o *PostKapacitorsIDProxyDefault) WithPayload(payload models.KapacitorProxyResponse) *PostKapacitorsIDProxyDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post kapacitors ID proxy default response
func (o *PostKapacitorsIDProxyDefault) SetPayload(payload models.KapacitorProxyResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostKapacitorsIDProxyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -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"
)
/*PostKapacitorsCreated Successfully created kapacitor source
swagger:response postKapacitorsCreated
*/
type PostKapacitorsCreated struct {
/*Location of the newly created kapacitor resource.
Required: true
*/
Location string `json:"Location"`
// In: body
Payload *models.Kapacitor `json:"body,omitempty"`
}
// NewPostKapacitorsCreated creates PostKapacitorsCreated with default headers values
func NewPostKapacitorsCreated() *PostKapacitorsCreated {
return &PostKapacitorsCreated{}
}
// WithLocation adds the location to the post kapacitors created response
func (o *PostKapacitorsCreated) WithLocation(location string) *PostKapacitorsCreated {
o.Location = location
return o
}
// SetLocation sets the location to the post kapacitors created response
func (o *PostKapacitorsCreated) SetLocation(location string) {
o.Location = location
}
// WithPayload adds the payload to the post kapacitors created response
func (o *PostKapacitorsCreated) WithPayload(payload *models.Kapacitor) *PostKapacitorsCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post kapacitors created response
func (o *PostKapacitorsCreated) SetPayload(payload *models.Kapacitor) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostKapacitorsCreated) 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
}
}
}
/*PostKapacitorsDefault A processing or an unexpected error.
swagger:response postKapacitorsDefault
*/
type PostKapacitorsDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostKapacitorsDefault creates PostKapacitorsDefault with default headers values
func NewPostKapacitorsDefault(code int) *PostKapacitorsDefault {
if code <= 0 {
code = 500
}
return &PostKapacitorsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the post kapacitors default response
func (o *PostKapacitorsDefault) WithStatusCode(code int) *PostKapacitorsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the post kapacitors default response
func (o *PostKapacitorsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the post kapacitors default response
func (o *PostKapacitorsDefault) WithPayload(payload *models.Error) *PostKapacitorsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post kapacitors default response
func (o *PostKapacitorsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostKapacitorsDefault) 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
}
}
}

View File

@ -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"
)
// PostSourcesIDKapacitorsHandlerFunc turns a function with the right signature into a post sources ID kapacitors handler
type PostSourcesIDKapacitorsHandlerFunc func(context.Context, PostSourcesIDKapacitorsParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostSourcesIDKapacitorsHandlerFunc) Handle(ctx context.Context, params PostSourcesIDKapacitorsParams) middleware.Responder {
return fn(ctx, params)
}
// PostSourcesIDKapacitorsHandler interface for that can handle valid post sources ID kapacitors params
type PostSourcesIDKapacitorsHandler interface {
Handle(context.Context, PostSourcesIDKapacitorsParams) middleware.Responder
}
// NewPostSourcesIDKapacitors creates a new http.Handler for the post sources ID kapacitors operation
func NewPostSourcesIDKapacitors(ctx *middleware.Context, handler PostSourcesIDKapacitorsHandler) *PostSourcesIDKapacitors {
return &PostSourcesIDKapacitors{Context: ctx, Handler: handler}
}
/*PostSourcesIDKapacitors swagger:route POST /sources/{id}/kapacitors postSourcesIdKapacitors
Create new kapacitor backend
*/
type PostSourcesIDKapacitors struct {
Context *middleware.Context
Handler PostSourcesIDKapacitorsHandler
}
func (o *PostSourcesIDKapacitors) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostSourcesIDKapacitorsParams()
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)
}

View File

@ -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"
)
// PostSourcesIDKapacitorsKapaIDProxyHandlerFunc turns a function with the right signature into a post sources ID kapacitors kapa ID proxy handler
type PostSourcesIDKapacitorsKapaIDProxyHandlerFunc func(context.Context, PostSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder
// Handle executing the request and returning a response
func (fn PostSourcesIDKapacitorsKapaIDProxyHandlerFunc) Handle(ctx context.Context, params PostSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder {
return fn(ctx, params)
}
// PostSourcesIDKapacitorsKapaIDProxyHandler interface for that can handle valid post sources ID kapacitors kapa ID proxy params
type PostSourcesIDKapacitorsKapaIDProxyHandler interface {
Handle(context.Context, PostSourcesIDKapacitorsKapaIDProxyParams) middleware.Responder
}
// NewPostSourcesIDKapacitorsKapaIDProxy creates a new http.Handler for the post sources ID kapacitors kapa ID proxy operation
func NewPostSourcesIDKapacitorsKapaIDProxy(ctx *middleware.Context, handler PostSourcesIDKapacitorsKapaIDProxyHandler) *PostSourcesIDKapacitorsKapaIDProxy {
return &PostSourcesIDKapacitorsKapaIDProxy{Context: ctx, Handler: handler}
}
/*PostSourcesIDKapacitorsKapaIDProxy swagger:route POST /sources/{id}/kapacitors/{kapa_id}/proxy postSourcesIdKapacitorsKapaIdProxy
POST body directly to configured kapacitor. The response and status code from kapacitor is directly returned.
*/
type PostSourcesIDKapacitorsKapaIDProxy struct {
Context *middleware.Context
Handler PostSourcesIDKapacitorsKapaIDProxyHandler
}
func (o *PostSourcesIDKapacitorsKapaIDProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
route, _ := o.Context.RouteInfo(r)
var Params = NewPostSourcesIDKapacitorsKapaIDProxyParams()
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)
}

View File

@ -17,27 +17,32 @@ import (
"github.com/influxdata/mrfusion/models"
)
// NewPatchKapacitorsIDProxyParams creates a new PatchKapacitorsIDProxyParams object
// NewPostSourcesIDKapacitorsKapaIDProxyParams creates a new PostSourcesIDKapacitorsKapaIDProxyParams object
// with the default values initialized.
func NewPatchKapacitorsIDProxyParams() PatchKapacitorsIDProxyParams {
func NewPostSourcesIDKapacitorsKapaIDProxyParams() PostSourcesIDKapacitorsKapaIDProxyParams {
var ()
return PatchKapacitorsIDProxyParams{}
return PostSourcesIDKapacitorsKapaIDProxyParams{}
}
// PatchKapacitorsIDProxyParams contains all the bound params for the patch kapacitors ID proxy operation
// PostSourcesIDKapacitorsKapaIDProxyParams contains all the bound params for the post sources ID kapacitors kapa ID proxy operation
// typically these are obtained from a http.Request
//
// swagger:parameters PatchKapacitorsIDProxy
type PatchKapacitorsIDProxyParams struct {
// swagger:parameters PostSourcesIDKapacitorsKapaIDProxy
type PostSourcesIDKapacitorsKapaIDProxyParams struct {
// HTTP Request Object
HTTPRequest *http.Request
/*ID of the kapacitor backend.
/*ID of the source
Required: true
In: path
*/
ID string
/*ID of the kapacitor backend.
Required: true
In: path
*/
KapaID string
/*The kapacitor API path to use in the proxy redirect
Required: true
In: query
@ -52,7 +57,7 @@ type PatchKapacitorsIDProxyParams 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 *PatchKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
func (o *PostSourcesIDKapacitorsKapaIDProxyParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r
@ -63,6 +68,11 @@ func (o *PatchKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middl
res = append(res, err)
}
rKapaID, rhkKapaID, _ := route.Params.GetOK("kapa_id")
if err := o.bindKapaID(rKapaID, rhkKapaID, route.Formats); err != nil {
res = append(res, err)
}
qPath, qhkPath, _ := qs.GetOK("path")
if err := o.bindPath(qPath, qhkPath, route.Formats); err != nil {
res = append(res, err)
@ -95,7 +105,7 @@ func (o *PatchKapacitorsIDProxyParams) BindRequest(r *http.Request, route *middl
return nil
}
func (o *PatchKapacitorsIDProxyParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *PostSourcesIDKapacitorsKapaIDProxyParams) bindID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
@ -106,7 +116,18 @@ func (o *PatchKapacitorsIDProxyParams) bindID(rawData []string, hasKey bool, for
return nil
}
func (o *PatchKapacitorsIDProxyParams) bindPath(rawData []string, hasKey bool, formats strfmt.Registry) error {
func (o *PostSourcesIDKapacitorsKapaIDProxyParams) bindKapaID(rawData []string, hasKey bool, formats strfmt.Registry) error {
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
o.KapaID = raw
return nil
}
func (o *PostSourcesIDKapacitorsKapaIDProxyParams) bindPath(rawData []string, hasKey bool, formats strfmt.Registry) error {
if !hasKey {
return errors.Required("path", "query")
}

View File

@ -0,0 +1,103 @@
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"
)
/*PostSourcesIDKapacitorsKapaIDProxyNotFound Kapacitor ID does not exist.
swagger:response postSourcesIdKapacitorsKapaIdProxyNotFound
*/
type PostSourcesIDKapacitorsKapaIDProxyNotFound struct {
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostSourcesIDKapacitorsKapaIDProxyNotFound creates PostSourcesIDKapacitorsKapaIDProxyNotFound with default headers values
func NewPostSourcesIDKapacitorsKapaIDProxyNotFound() *PostSourcesIDKapacitorsKapaIDProxyNotFound {
return &PostSourcesIDKapacitorsKapaIDProxyNotFound{}
}
// WithPayload adds the payload to the post sources Id kapacitors kapa Id proxy not found response
func (o *PostSourcesIDKapacitorsKapaIDProxyNotFound) WithPayload(payload *models.Error) *PostSourcesIDKapacitorsKapaIDProxyNotFound {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources Id kapacitors kapa Id proxy not found response
func (o *PostSourcesIDKapacitorsKapaIDProxyNotFound) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDKapacitorsKapaIDProxyNotFound) 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
}
}
}
/*PostSourcesIDKapacitorsKapaIDProxyDefault Response directly from kapacitor
swagger:response postSourcesIdKapacitorsKapaIdProxyDefault
*/
type PostSourcesIDKapacitorsKapaIDProxyDefault struct {
_statusCode int
// In: body
Payload models.KapacitorProxyResponse `json:"body,omitempty"`
}
// NewPostSourcesIDKapacitorsKapaIDProxyDefault creates PostSourcesIDKapacitorsKapaIDProxyDefault with default headers values
func NewPostSourcesIDKapacitorsKapaIDProxyDefault(code int) *PostSourcesIDKapacitorsKapaIDProxyDefault {
if code <= 0 {
code = 500
}
return &PostSourcesIDKapacitorsKapaIDProxyDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the post sources ID kapacitors kapa ID proxy default response
func (o *PostSourcesIDKapacitorsKapaIDProxyDefault) WithStatusCode(code int) *PostSourcesIDKapacitorsKapaIDProxyDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the post sources ID kapacitors kapa ID proxy default response
func (o *PostSourcesIDKapacitorsKapaIDProxyDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the post sources ID kapacitors kapa ID proxy default response
func (o *PostSourcesIDKapacitorsKapaIDProxyDefault) WithPayload(payload models.KapacitorProxyResponse) *PostSourcesIDKapacitorsKapaIDProxyDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources ID kapacitors kapa ID proxy default response
func (o *PostSourcesIDKapacitorsKapaIDProxyDefault) SetPayload(payload models.KapacitorProxyResponse) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDKapacitorsKapaIDProxyDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
rw.WriteHeader(o._statusCode)
if err := producer.Produce(rw, o.Payload); err != nil {
panic(err) // let the recovery middleware deal with this
}
}

View File

@ -13,18 +13,18 @@ import (
"github.com/influxdata/mrfusion/models"
)
// NewPostKapacitorsParams creates a new PostKapacitorsParams object
// NewPostSourcesIDKapacitorsParams creates a new PostSourcesIDKapacitorsParams object
// with the default values initialized.
func NewPostKapacitorsParams() PostKapacitorsParams {
func NewPostSourcesIDKapacitorsParams() PostSourcesIDKapacitorsParams {
var ()
return PostKapacitorsParams{}
return PostSourcesIDKapacitorsParams{}
}
// PostKapacitorsParams contains all the bound params for the post kapacitors operation
// PostSourcesIDKapacitorsParams contains all the bound params for the post sources ID kapacitors operation
// typically these are obtained from a http.Request
//
// swagger:parameters PostKapacitors
type PostKapacitorsParams struct {
// swagger:parameters PostSourcesIDKapacitors
type PostSourcesIDKapacitorsParams struct {
// HTTP Request Object
HTTPRequest *http.Request
@ -37,7 +37,7 @@ type PostKapacitorsParams 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 *PostKapacitorsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
func (o *PostSourcesIDKapacitorsParams) BindRequest(r *http.Request, route *middleware.MatchedRoute) error {
var res []error
o.HTTPRequest = r

View File

@ -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"
)
/*PostSourcesIDKapacitorsCreated Successfully created kapacitor source
swagger:response postSourcesIdKapacitorsCreated
*/
type PostSourcesIDKapacitorsCreated struct {
/*Location of the newly created kapacitor resource.
Required: true
*/
Location string `json:"Location"`
// In: body
Payload *models.Kapacitor `json:"body,omitempty"`
}
// NewPostSourcesIDKapacitorsCreated creates PostSourcesIDKapacitorsCreated with default headers values
func NewPostSourcesIDKapacitorsCreated() *PostSourcesIDKapacitorsCreated {
return &PostSourcesIDKapacitorsCreated{}
}
// WithLocation adds the location to the post sources Id kapacitors created response
func (o *PostSourcesIDKapacitorsCreated) WithLocation(location string) *PostSourcesIDKapacitorsCreated {
o.Location = location
return o
}
// SetLocation sets the location to the post sources Id kapacitors created response
func (o *PostSourcesIDKapacitorsCreated) SetLocation(location string) {
o.Location = location
}
// WithPayload adds the payload to the post sources Id kapacitors created response
func (o *PostSourcesIDKapacitorsCreated) WithPayload(payload *models.Kapacitor) *PostSourcesIDKapacitorsCreated {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources Id kapacitors created response
func (o *PostSourcesIDKapacitorsCreated) SetPayload(payload *models.Kapacitor) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDKapacitorsCreated) 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
}
}
}
/*PostSourcesIDKapacitorsDefault A processing or an unexpected error.
swagger:response postSourcesIdKapacitorsDefault
*/
type PostSourcesIDKapacitorsDefault struct {
_statusCode int
// In: body
Payload *models.Error `json:"body,omitempty"`
}
// NewPostSourcesIDKapacitorsDefault creates PostSourcesIDKapacitorsDefault with default headers values
func NewPostSourcesIDKapacitorsDefault(code int) *PostSourcesIDKapacitorsDefault {
if code <= 0 {
code = 500
}
return &PostSourcesIDKapacitorsDefault{
_statusCode: code,
}
}
// WithStatusCode adds the status to the post sources ID kapacitors default response
func (o *PostSourcesIDKapacitorsDefault) WithStatusCode(code int) *PostSourcesIDKapacitorsDefault {
o._statusCode = code
return o
}
// SetStatusCode sets the status to the post sources ID kapacitors default response
func (o *PostSourcesIDKapacitorsDefault) SetStatusCode(code int) {
o._statusCode = code
}
// WithPayload adds the payload to the post sources ID kapacitors default response
func (o *PostSourcesIDKapacitorsDefault) WithPayload(payload *models.Error) *PostSourcesIDKapacitorsDefault {
o.Payload = payload
return o
}
// SetPayload sets the payload to the post sources ID kapacitors default response
func (o *PostSourcesIDKapacitorsDefault) SetPayload(payload *models.Error) {
o.Payload = payload
}
// WriteResponse to the client
func (o *PostSourcesIDKapacitorsDefault) 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
}
}
}

View File

@ -143,6 +143,7 @@ type SourcesStore interface {
type Server struct {
ID int // ID is the unique ID of the server
SrcID int // SrcID of the data soruce
Name string // Name is the user-defined name for the server
Username string // Username is the username to connect to the server
Password string // Password is in CLEARTEXT FIXME

View File

@ -623,8 +623,14 @@ paths:
description: Unexpected internal service error
schema:
$ref: '#/definitions/Error'
/kapacitors:
/sources/{id}/kapacitors:
get:
parameters:
- name: id
in: path
type: string
description: ID of the source
required: true
summary: Configured kapacitors
responses:
200:
@ -636,6 +642,12 @@ paths:
schema:
$ref: '#/definitions/Error'
post:
parameters:
- name: id
in: path
type: string
description: ID of the source
required: true
summary: Create new kapacitor backend
parameters:
- name: kapacitor
@ -657,10 +669,15 @@ paths:
description: A processing or an unexpected error.
schema:
$ref: '#/definitions/Error'
/kapacitors/{id}:
/sources/{id}/kapacitors/{kapa_id}:
get:
parameters:
- name: id
in: path
type: string
description: ID of the source
required: true
- name: kapa_id
in: path
type: string
description: ID of the kapacitor
@ -673,7 +690,7 @@ paths:
schema:
$ref: '#/definitions/Kapacitor'
404:
description: Unknown kapacitor id
description: Unknown data source or kapacitor id
schema:
$ref: '#/definitions/Error'
default:
@ -684,6 +701,11 @@ paths:
summary: Update kapacitor configuration
parameters:
- name: id
in: path
type: string
description: ID of the source
required: true
- name: kapa_id
in: path
type: string
description: ID of a kapacitor backend
@ -698,7 +720,7 @@ paths:
204:
description: Kapacitor's configuration was changed
404:
description: Happens when trying to access a non-existent kapacitor.
description: Happens when trying to access a non-existent data source or kapacitor.
schema:
$ref: '#/definitions/Error'
default:
@ -708,6 +730,11 @@ paths:
delete:
parameters:
- name: id
in: path
type: string
description: ID of the source
required: true
- name: kapa_id
in: path
type: string
description: ID of the kapacitor
@ -717,18 +744,23 @@ paths:
204:
description: kapacitor has been removed.
404:
description: Unknown Kapacitor id
description: Unknown Data source or Kapacitor id
schema:
$ref: '#/definitions/Error'
default:
description: Unexpected internal service error
schema:
$ref: '#/definitions/Error'
/kapacitors/{id}/proxy:
/sources/{id}/kapacitors/{kapa_id}/proxy:
get:
description: GET to `path` of kapacitor. The response and status code from kapacitor is directly returned.
parameters:
- name: id
in: path
type: string
description: ID of the source
required: true
- name: kapa_id
in: path
type: string
description: ID of the kapacitor backend.
@ -742,7 +774,7 @@ paths:
204:
description: Kapacitor returned no content
404:
description: Kapacitor ID does not exist.
description: Data source or Kapacitor ID does not exist.
schema:
$ref: '#/definitions/Error'
default:
@ -753,6 +785,11 @@ paths:
description: DELETE to `path` of kapacitor. The response and status code from kapacitor is directly returned.
parameters:
- name: id
in: path
type: string
description: ID of the source
required: true
- name: kapa_id
in: path
type: string
description: ID of the kapacitor backend.
@ -766,7 +803,7 @@ paths:
204:
description: Kapacitor returned no content
404:
description: Kapacitor ID does not exist.
description: Data source or Kapacitor ID does not exist.
schema:
$ref: '#/definitions/Error'
default:
@ -777,6 +814,11 @@ paths:
description: PATCH body directly to configured kapacitor. The response and status code from kapacitor is directly returned.
parameters:
- name: id
in: path
type: string
description: ID of the source
required: true
- name: kapa_id
in: path
type: string
description: ID of the kapacitor backend.
@ -794,7 +836,7 @@ paths:
required: true
responses:
404:
description: Kapacitor ID does not exist.
description: Data source or Kapacitor ID does not exist.
schema:
$ref: '#/definitions/Error'
default:
@ -806,6 +848,11 @@ paths:
description: POST body directly to configured kapacitor. The response and status code from kapacitor is directly returned.
parameters:
- name: id
in: path
type: string
description: ID of the source
required: true
- name: kapa_id
in: path
type: string
description: ID of the kapacitor backend.