juzhiyuan commented on a change in pull request #488:
URL: https://github.com/apache/apisix-dashboard/pull/488#discussion_r491588924
##########
File path: api/internal/handler/ssl/ssl.go
##########
@@ -0,0 +1,252 @@
+package ssl
+
+import (
+ "crypto/tls"
+ "crypto/x509"
+ "encoding/pem"
+ "errors"
+ "fmt"
+ "reflect"
+ "strings"
+
+ "github.com/api7/go-jsonpatch"
+ "github.com/gin-gonic/gin"
+ "github.com/shiningrush/droplet"
+ "github.com/shiningrush/droplet/data"
+ "github.com/shiningrush/droplet/wrapper"
+ wgin "github.com/shiningrush/droplet/wrapper/gin"
+
+ "github.com/apisix/manager-api/internal/core/entity"
+ "github.com/apisix/manager-api/internal/core/store"
+ "github.com/apisix/manager-api/internal/handler"
+ "github.com/apisix/manager-api/internal/utils"
+)
+
+type Handler struct {
+ sslStore *store.GenericStore
+}
+
+func NewHandler() (handler.RouteRegister, error) {
+ s, err := store.NewGenericStore(store.GenericStoreOption{
+ BasePath: "/apisix/ssl",
+ ObjType: reflect.TypeOf(entity.SSL{}),
+ KeyFunc: func(obj interface{}) string {
+ r := obj.(*entity.SSL)
+ return r.ID
+ },
+ })
+ if err != nil {
+ return nil, err
+ }
+ if err := s.Init(); err != nil {
+ return nil, err
+ }
+
+ utils.AppendToClosers(s.Close)
+ return &Handler{
+ sslStore: s,
+ }, nil
+}
+
+func (h *Handler) ApplyRoute(r *gin.Engine) {
+ r.GET("/apisix/admin/ssl/:id", wgin.Wraps(h.Get,
+ wrapper.InputType(reflect.TypeOf(GetInput{}))))
+ r.GET("/apisix/admin/ssl", wgin.Wraps(h.List,
Review comment:
we may use `ssl/list` or `ssls` here.
##########
File path: api/internal/handler/ssl/ssl.go
##########
@@ -0,0 +1,252 @@
+package ssl
+
+import (
+ "crypto/tls"
+ "crypto/x509"
+ "encoding/pem"
+ "errors"
+ "fmt"
+ "reflect"
+ "strings"
+
+ "github.com/api7/go-jsonpatch"
+ "github.com/gin-gonic/gin"
+ "github.com/shiningrush/droplet"
+ "github.com/shiningrush/droplet/data"
+ "github.com/shiningrush/droplet/wrapper"
+ wgin "github.com/shiningrush/droplet/wrapper/gin"
+
+ "github.com/apisix/manager-api/internal/core/entity"
+ "github.com/apisix/manager-api/internal/core/store"
+ "github.com/apisix/manager-api/internal/handler"
+ "github.com/apisix/manager-api/internal/utils"
+)
+
+type Handler struct {
+ sslStore *store.GenericStore
+}
+
+func NewHandler() (handler.RouteRegister, error) {
+ s, err := store.NewGenericStore(store.GenericStoreOption{
+ BasePath: "/apisix/ssl",
+ ObjType: reflect.TypeOf(entity.SSL{}),
+ KeyFunc: func(obj interface{}) string {
+ r := obj.(*entity.SSL)
+ return r.ID
+ },
+ })
+ if err != nil {
+ return nil, err
+ }
+ if err := s.Init(); err != nil {
+ return nil, err
+ }
+
+ utils.AppendToClosers(s.Close)
+ return &Handler{
+ sslStore: s,
+ }, nil
+}
+
+func (h *Handler) ApplyRoute(r *gin.Engine) {
+ r.GET("/apisix/admin/ssl/:id", wgin.Wraps(h.Get,
+ wrapper.InputType(reflect.TypeOf(GetInput{}))))
+ r.GET("/apisix/admin/ssl", wgin.Wraps(h.List,
+ wrapper.InputType(reflect.TypeOf(ListInput{}))))
+ r.POST("/apisix/admin/ssl", wgin.Wraps(h.Create,
+ wrapper.InputType(reflect.TypeOf(entity.SSL{}))))
+ r.POST("/apisix/admin/ssl/validate", wgin.Wraps(h.Validate,
+ wrapper.InputType(reflect.TypeOf(entity.SSL{}))))
+ r.PUT("/apisix/admin/ssl/:id", wgin.Wraps(h.Update,
+ wrapper.InputType(reflect.TypeOf(UpdateInput{}))))
+ r.PATCH("/apisix/admin/ssl/:id", wgin.Wraps(h.Patch,
+ wrapper.InputType(reflect.TypeOf(UpdateInput{}))))
+ r.DELETE("/apisix/admin/ssl", wgin.Wraps(h.BatchDelete,
Review comment:
ssls
##########
File path: api/internal/handler/ssl/ssl.go
##########
@@ -0,0 +1,252 @@
+package ssl
+
+import (
+ "crypto/tls"
+ "crypto/x509"
+ "encoding/pem"
+ "errors"
+ "fmt"
+ "reflect"
+ "strings"
+
+ "github.com/api7/go-jsonpatch"
+ "github.com/gin-gonic/gin"
+ "github.com/shiningrush/droplet"
+ "github.com/shiningrush/droplet/data"
+ "github.com/shiningrush/droplet/wrapper"
+ wgin "github.com/shiningrush/droplet/wrapper/gin"
+
+ "github.com/apisix/manager-api/internal/core/entity"
+ "github.com/apisix/manager-api/internal/core/store"
+ "github.com/apisix/manager-api/internal/handler"
+ "github.com/apisix/manager-api/internal/utils"
+)
+
+type Handler struct {
+ sslStore *store.GenericStore
+}
+
+func NewHandler() (handler.RouteRegister, error) {
+ s, err := store.NewGenericStore(store.GenericStoreOption{
+ BasePath: "/apisix/ssl",
+ ObjType: reflect.TypeOf(entity.SSL{}),
+ KeyFunc: func(obj interface{}) string {
+ r := obj.(*entity.SSL)
+ return r.ID
+ },
+ })
+ if err != nil {
+ return nil, err
+ }
+ if err := s.Init(); err != nil {
+ return nil, err
+ }
+
+ utils.AppendToClosers(s.Close)
+ return &Handler{
+ sslStore: s,
+ }, nil
+}
+
+func (h *Handler) ApplyRoute(r *gin.Engine) {
+ r.GET("/apisix/admin/ssl/:id", wgin.Wraps(h.Get,
+ wrapper.InputType(reflect.TypeOf(GetInput{}))))
+ r.GET("/apisix/admin/ssl", wgin.Wraps(h.List,
+ wrapper.InputType(reflect.TypeOf(ListInput{}))))
+ r.POST("/apisix/admin/ssl", wgin.Wraps(h.Create,
+ wrapper.InputType(reflect.TypeOf(entity.SSL{}))))
+ r.POST("/apisix/admin/ssl/validate", wgin.Wraps(h.Validate,
+ wrapper.InputType(reflect.TypeOf(entity.SSL{}))))
+ r.PUT("/apisix/admin/ssl/:id", wgin.Wraps(h.Update,
+ wrapper.InputType(reflect.TypeOf(UpdateInput{}))))
+ r.PATCH("/apisix/admin/ssl/:id", wgin.Wraps(h.Patch,
Review comment:
ssls
##########
File path: api/internal/handler/ssl/ssl.go
##########
@@ -0,0 +1,252 @@
+package ssl
+
+import (
+ "crypto/tls"
+ "crypto/x509"
+ "encoding/pem"
+ "errors"
+ "fmt"
+ "reflect"
+ "strings"
+
+ "github.com/api7/go-jsonpatch"
+ "github.com/gin-gonic/gin"
+ "github.com/shiningrush/droplet"
+ "github.com/shiningrush/droplet/data"
+ "github.com/shiningrush/droplet/wrapper"
+ wgin "github.com/shiningrush/droplet/wrapper/gin"
+
+ "github.com/apisix/manager-api/internal/core/entity"
+ "github.com/apisix/manager-api/internal/core/store"
+ "github.com/apisix/manager-api/internal/handler"
+ "github.com/apisix/manager-api/internal/utils"
+)
+
+type Handler struct {
+ sslStore *store.GenericStore
+}
+
+func NewHandler() (handler.RouteRegister, error) {
+ s, err := store.NewGenericStore(store.GenericStoreOption{
+ BasePath: "/apisix/ssl",
+ ObjType: reflect.TypeOf(entity.SSL{}),
+ KeyFunc: func(obj interface{}) string {
+ r := obj.(*entity.SSL)
+ return r.ID
+ },
+ })
+ if err != nil {
+ return nil, err
+ }
+ if err := s.Init(); err != nil {
+ return nil, err
+ }
+
+ utils.AppendToClosers(s.Close)
+ return &Handler{
+ sslStore: s,
+ }, nil
+}
+
+func (h *Handler) ApplyRoute(r *gin.Engine) {
+ r.GET("/apisix/admin/ssl/:id", wgin.Wraps(h.Get,
+ wrapper.InputType(reflect.TypeOf(GetInput{}))))
+ r.GET("/apisix/admin/ssl", wgin.Wraps(h.List,
+ wrapper.InputType(reflect.TypeOf(ListInput{}))))
+ r.POST("/apisix/admin/ssl", wgin.Wraps(h.Create,
+ wrapper.InputType(reflect.TypeOf(entity.SSL{}))))
+ r.POST("/apisix/admin/ssl/validate", wgin.Wraps(h.Validate,
+ wrapper.InputType(reflect.TypeOf(entity.SSL{}))))
+ r.PUT("/apisix/admin/ssl/:id", wgin.Wraps(h.Update,
Review comment:
ssls
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]