Skip to content

Commit

Permalink
Move API into nextmn/json-api
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Feb 14, 2024
1 parent 9c21e87 commit 733ec58
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 106 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/gin-gonic/gin v1.9.1 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/louisroyer/go-pfcp-networking v0.0.24-0.20230113122010-1b98989277a2
github.com/nextmn/json-api v0.0.2 // indirect
github.com/twinj/uuid v1.0.0 // indirect
github.com/urfave/cli/v2 v2.3.0
gopkg.in/yaml.v3 v3.0.1
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nextmn/json-api v0.0.2 h1:Xo18bv+eWPc+BBfjNP5MdA0bWokaupzEGW5kt1BwYxg=
github.com/nextmn/json-api v0.0.2/go.mod h1:gi9IhsD+FFg7iEnJaZtEaY1WlZkQ75KBBk0z5FmSJBU=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ=
Expand Down
24 changes: 0 additions & 24 deletions json_api/backbone_ip.go

This file was deleted.

30 changes: 0 additions & 30 deletions json_api/control_url.go

This file was deleted.

28 changes: 0 additions & 28 deletions json_api/locator.go

This file was deleted.

11 changes: 0 additions & 11 deletions json_api/router.go

This file was deleted.

9 changes: 0 additions & 9 deletions json_api/router_map.go

This file was deleted.

8 changes: 4 additions & 4 deletions runtime/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/gin-gonic/gin"
"github.com/gofrs/uuid"
"github.com/nextmn/srv6-ctrl/json_api"
"github.com/nextmn/json-api/jsonapi"
)

type HttpServerEntity struct {
Expand All @@ -24,12 +24,12 @@ type HttpServerEntity struct {

type RouterRegistry struct {
sync.RWMutex
routers json_api.RouterMap
routers jsonapi.RouterMap
}

func NewHttpServerEntity(addr string, port string) *HttpServerEntity {
rr := RouterRegistry{
routers: make(json_api.RouterMap),
routers: make(jsonapi.RouterMap),
}
r := gin.Default()
r.GET("/status", rr.Status)
Expand Down Expand Up @@ -91,7 +91,7 @@ func (r *RouterRegistry) GetRouter(c *gin.Context) {

// post a router infos
func (r *RouterRegistry) PostRouter(c *gin.Context) {
var router json_api.Router
var router jsonapi.Router
if err := c.BindJSON(&router); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"message": "could not deserialize", "error": fmt.Sprintf("%v", err)})
return
Expand Down

0 comments on commit 733ec58

Please sign in to comment.