format code
This commit is contained in:
@@ -17,11 +17,13 @@ limitations under the License.
|
||||
package components
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
"kubesphere.io/kubesphere/pkg/filter/route"
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
"net/http"
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
)
|
||||
|
||||
func Register(ws *restful.WebService, subPath string) {
|
||||
|
||||
@@ -13,19 +13,21 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
package iam
|
||||
|
||||
import (
|
||||
"github.com/emicklei/go-restful"
|
||||
"kubesphere.io/kubesphere/pkg/filter/route"
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
"net/http"
|
||||
"strings"
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
"k8s.io/api/rbac/v1"
|
||||
"k8s.io/kubernetes/pkg/util/slice"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/constants"
|
||||
"kubesphere.io/kubesphere/pkg/filter/route"
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
)
|
||||
|
||||
func Register(ws *restful.WebService) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
package iam
|
||||
|
||||
|
||||
@@ -13,13 +13,14 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
*/
|
||||
|
||||
package iam
|
||||
|
||||
import (
|
||||
"k8s.io/api/rbac/v1"
|
||||
"k8s.io/kubernetes/pkg/util/slice"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
)
|
||||
|
||||
@@ -121,7 +122,7 @@ func getClusterRoleRules(name string) ([]rule, error) {
|
||||
|
||||
rules := make([]rule, 0)
|
||||
|
||||
for i := 0; i < len(clusterRoleRuleGroup); i ++ {
|
||||
for i := 0; i < len(clusterRoleRuleGroup); i++ {
|
||||
rule := rule{Name: clusterRoleRuleGroup[i].Name}
|
||||
rule.Actions = make([]action, 0)
|
||||
for j := 0; j < (len(clusterRoleRuleGroup[i].Actions)); j++ {
|
||||
@@ -143,7 +144,7 @@ func getRoleRules(namespace string, name string) ([]rule, error) {
|
||||
return nil, err
|
||||
}
|
||||
rules := make([]rule, 0)
|
||||
for i := 0; i < len(roleRuleGroup); i ++ {
|
||||
for i := 0; i < len(roleRuleGroup); i++ {
|
||||
rule := rule{Name: roleRuleGroup[i].Name}
|
||||
rule.Actions = make([]action, 0)
|
||||
for j := 0; j < len(roleRuleGroup[i].Actions); j++ {
|
||||
|
||||
@@ -18,17 +18,18 @@ package v1alpha
|
||||
|
||||
import (
|
||||
"github.com/emicklei/go-restful"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/components"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/containers"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/iam"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/kubeconfig"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/kubectl"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/nodes"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/pods"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/registries"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/routes"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/storage"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/volumes"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/iam"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/components"
|
||||
"kubesphere.io/kubesphere/pkg/apis/v1alpha/routes"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -45,7 +46,7 @@ func init() {
|
||||
pods.Register(ws)
|
||||
containers.Register(ws)
|
||||
iam.Register(ws)
|
||||
components.Register(ws,"/components")
|
||||
components.Register(ws, "/components")
|
||||
|
||||
routes.Register(ws)
|
||||
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
package kubeconfig
|
||||
|
||||
import (
|
||||
"github.com/emicklei/go-restful"
|
||||
"net/http"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
)
|
||||
|
||||
@@ -24,12 +26,11 @@ const DefaultServiceAccount = "default"
|
||||
|
||||
type Config struct {
|
||||
Certificate string
|
||||
Server string
|
||||
User string
|
||||
Token string
|
||||
Server string
|
||||
User string
|
||||
Token string
|
||||
}
|
||||
|
||||
|
||||
func Register(ws *restful.WebService, subPath string) {
|
||||
|
||||
ws.Route(ws.GET(subPath).To(handleKubeconfig))
|
||||
|
||||
@@ -17,16 +17,18 @@ limitations under the License.
|
||||
package kubectl
|
||||
|
||||
import (
|
||||
"github.com/emicklei/go-restful"
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
"net/http"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
)
|
||||
|
||||
func Register(ws *restful.WebService, subPath string) {
|
||||
|
||||
ws.Route(ws.GET(subPath).Consumes("*/*").Produces(restful.MIME_JSON).To(handleKubectl).Doc("use to " +
|
||||
ws.Route(ws.GET(subPath).Consumes("*/*").Produces(restful.MIME_JSON).To(handleKubectl).Doc("use to "+
|
||||
"get a kubectl pod in specified namespaces").Param(ws.PathParameter("namespace",
|
||||
"namespace").DataType("string")).Do(returns200,returns500))
|
||||
"namespace").DataType("string")).Do(returns200, returns500))
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -103,4 +103,4 @@ func handleQueryRegistries(request *restful.Request, response *restful.Response)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ func GetAllRouters(request *restful.Request, response *restful.Response) {
|
||||
if err != nil {
|
||||
glog.Error(err)
|
||||
response.WriteHeaderAndEntity(http.StatusInternalServerError, constants.MessageResponse{Message: err.Error()})
|
||||
} else {
|
||||
} else {
|
||||
response.WriteAsJson(routers)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package storage
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/filter/route"
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Register(ws *restful.WebService, subPath string) {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package volumes
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/emicklei/go-restful"
|
||||
|
||||
"kubesphere.io/kubesphere/pkg/filter/route"
|
||||
"kubesphere.io/kubesphere/pkg/models"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Register(ws *restful.WebService, subPath string) {
|
||||
|
||||
Reference in New Issue
Block a user