MCPcopy Create free account
hub / github.com/apache/kvrocks-controller / Create

Method Create

server/api/namespace.go:62–81  ·  view source on GitHub ↗
(c *gin.Context)

Source from the content-addressed store, hash-verified

60}
61
62func (handler *NamespaceHandler) Create(c *gin.Context) {
63 var request struct {
64 Namespace string `json:"namespace" validate:"required"`
65 }
66 if err := c.BindJSON(&request); err != nil {
67 helper.ResponseBadRequest(c, err)
68 return
69 }
70
71 if len(request.Namespace) == 0 {
72 helper.ResponseBadRequest(c, errors.New("namespace should NOT be empty"))
73 return
74 }
75
76 if err := handler.s.CreateNamespace(c, request.Namespace); err != nil {
77 helper.ResponseError(c, err)
78 return
79 }
80 helper.ResponseCreated(c, gin.H{"namespace": request.Namespace})
81}
82
83func (handler *NamespaceHandler) Remove(c *gin.Context) {
84 namespace := c.Param("namespace")

Callers 1

TestNamespaceBasicsFunction · 0.95

Calls 4

ResponseBadRequestFunction · 0.92
ResponseErrorFunction · 0.92
ResponseCreatedFunction · 0.92
CreateNamespaceMethod · 0.65

Tested by 1

TestNamespaceBasicsFunction · 0.76