You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/09/19 12:04:50 UTC

[GitHub] [apisix-dashboard] nic-chen opened a new pull request #488: feat: add SSL refactoring

nic-chen opened a new pull request #488:
URL: https://github.com/apache/apisix-dashboard/pull/488


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   
    SSL refactoring
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] nic-chen commented on a change in pull request #488: feat: add SSL refactoring

Posted by GitBox <gi...@apache.org>.
nic-chen commented on a change in pull request #488:
URL: https://github.com/apache/apisix-dashboard/pull/488#discussion_r491637228



##########
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:
       @juzhiyuan we should keep the same uri with 'admin api' currently 




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on pull request #488: feat: add SSL refactoring

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #488:
URL: https://github.com/apache/apisix-dashboard/pull/488#issuecomment-695756396


   There has 1 conflict


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] juzhiyuan commented on a change in pull request #488: feat: add SSL refactoring

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org



[GitHub] [apisix-dashboard] ShiningRush merged pull request #488: feat: add SSL refactoring

Posted by GitBox <gi...@apache.org>.
ShiningRush merged pull request #488:
URL: https://github.com/apache/apisix-dashboard/pull/488


   


----------------------------------------------------------------
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:
users@infra.apache.org