starsz commented on a change in pull request #2104:
URL: https://github.com/apache/apisix-dashboard/pull/2104#discussion_r698552334



##########
File path: api/internal/handler/stream_route/stream_route.go
##########
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package stream_route
+
+import (
+       "fmt"
+       "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"
+       "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"
+       "net/http"
+       "reflect"
+       "strings"
+)

Review comment:
       Code style:
   
   ```
   "fmt"
   "net/http"
   "reflect"
   "strings"
   
   "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"
   ```

##########
File path: api/internal/handler/stream_route/stream_route.go
##########
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package stream_route
+
+import (
+       "fmt"
+       "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"
+       "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"
+       "net/http"
+       "reflect"
+       "strings"
+)
+
+type Handler struct {
+       streamRouteStore store.Interface
+       upstreamStore    store.Interface
+}
+
+func NewHandler() (handler.RouteRegister, error) {
+       return &Handler{
+               streamRouteStore: store.GetStore(store.HubKeyStreamRoute),
+               upstreamStore:    store.GetStore(store.HubKeyUpstream),
+       }, nil
+}
+
+func (h *Handler) ApplyRoute(r *gin.Engine) {
+       r.GET("/apisix/admin/stream_routes/:id", wgin.Wraps(h.Get,
+               wrapper.InputType(reflect.TypeOf(GetInput{}))))
+       r.GET("/apisix/admin/stream_routes", wgin.Wraps(h.List,
+               wrapper.InputType(reflect.TypeOf(ListInput{}))))
+       r.POST("/apisix/admin/stream_routes", wgin.Wraps(h.Create,
+               wrapper.InputType(reflect.TypeOf(entity.StreamRoute{}))))
+       r.PUT("/apisix/admin/stream_routes", wgin.Wraps(h.Update,
+               wrapper.InputType(reflect.TypeOf(UpdateInput{}))))

Review comment:
       I think we don't need this handler.

##########
File path: api/internal/handler/stream_route/stream_route_test.go
##########
@@ -0,0 +1,580 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package stream_route
+
+import (
+       "errors"
+       "fmt"
+       "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/shiningrush/droplet"
+       "github.com/shiningrush/droplet/data"
+       "github.com/stretchr/testify/assert"
+       "github.com/stretchr/testify/mock"
+       "net/http"
+       "testing"
+)

Review comment:
       Ditto.

##########
File path: api/internal/route.go
##########
@@ -18,6 +18,7 @@ package internal
 
 import (
        "fmt"
+       "github.com/apisix/manager-api/internal/handler/stream_route"

Review comment:
       Ditto.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to