harbor/src/ui/router.go

113 lines
5.9 KiB
Go
Raw Normal View History

2017-04-13 12:54:58 +02:00
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
//
// Licensed 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.
2016-02-26 11:54:14 +01:00
2016-04-07 12:34:12 +02:00
package main
2016-02-01 12:59:10 +01:00
import (
2016-10-19 08:32:00 +02:00
"github.com/vmware/harbor/src/ui/api"
"github.com/vmware/harbor/src/ui/controllers"
"github.com/vmware/harbor/src/ui/service"
"github.com/vmware/harbor/src/ui/service/token"
2016-02-01 12:59:10 +01:00
"github.com/astaxie/beego"
)
2016-04-07 12:34:12 +02:00
func initRouters() {
2016-02-01 12:59:10 +01:00
beego.SetStaticPath("/static", "./static")
beego.SetStaticPath("/i18n", "./static/i18n")
//Page Controllers:
beego.Router("/", &controllers.IndexController{})
beego.Router("/sign-in", &controllers.IndexController{})
beego.Router("/sign-up", &controllers.IndexController{})
2017-03-30 18:51:03 +02:00
beego.Router("/reset_password", &controllers.IndexController{})
beego.Router("/harbor", &controllers.IndexController{})
2017-03-30 18:51:03 +02:00
beego.Router("/harbor/sign-in", &controllers.IndexController{})
beego.Router("/harbor/sign-up", &controllers.IndexController{})
beego.Router("/harbor/dashboard", &controllers.IndexController{})
beego.Router("/harbor/projects", &controllers.IndexController{})
beego.Router("/harbor/projects/:id/repository", &controllers.IndexController{})
beego.Router("/harbor/projects/:id/replication", &controllers.IndexController{})
beego.Router("/harbor/projects/:id/member", &controllers.IndexController{})
beego.Router("/harbor/projects/:id/log", &controllers.IndexController{})
beego.Router("/harbor/tags/:id/*", &controllers.IndexController{})
beego.Router("/harbor/users", &controllers.IndexController{})
beego.Router("/harbor/logs", &controllers.IndexController{})
beego.Router("/harbor/replications", &controllers.IndexController{})
beego.Router("/harbor/replications/endpoints", &controllers.IndexController{})
beego.Router("/harbor/replications/rules", &controllers.IndexController{})
beego.Router("/harbor/tags", &controllers.IndexController{})
beego.Router("/harbor/configs", &controllers.IndexController{})
2016-02-01 12:59:10 +01:00
beego.Router("/login", &controllers.CommonController{}, "post:Login")
beego.Router("/log_out", &controllers.CommonController{}, "get:LogOut")
2016-02-01 12:59:10 +01:00
beego.Router("/reset", &controllers.CommonController{}, "post:ResetPassword")
beego.Router("/userExists", &controllers.CommonController{}, "post:UserExists")
2016-02-01 12:59:10 +01:00
beego.Router("/sendEmail", &controllers.CommonController{}, "get:SendEmail")
//API:
beego.Router("/api/search", &api.SearchAPI{})
beego.Router("/api/projects/:pid([0-9]+)/members/?:mid", &api.ProjectMemberAPI{})
2017-03-22 13:54:22 +01:00
beego.Router("/api/projects/", &api.ProjectAPI{}, "get:List;post:Post;head:Head")
2017-03-21 10:54:02 +01:00
beego.Router("/api/projects/:id([0-9]+)", &api.ProjectAPI{})
beego.Router("/api/projects/:id([0-9]+)/publicity", &api.ProjectAPI{}, "put:ToggleProjectPublic")
2016-05-27 12:46:07 +02:00
beego.Router("/api/projects/:id([0-9]+)/logs/filter", &api.ProjectAPI{}, "post:FilterAccessLog")
2017-03-21 10:54:02 +01:00
beego.Router("/api/statistics", &api.StatisticAPI{})
2016-05-30 09:39:51 +02:00
beego.Router("/api/users/?:id", &api.UserAPI{})
2016-05-27 12:46:07 +02:00
beego.Router("/api/users/:id([0-9]+)/password", &api.UserAPI{}, "put:ChangePassword")
beego.Router("/api/internal/syncregistry", &api.InternalAPI{}, "post:SyncRegistry")
2017-03-24 08:02:46 +01:00
beego.Router("/api/repositories", &api.RepositoryAPI{})
2017-03-21 10:54:02 +01:00
beego.Router("/api/repositories/*/tags/?:tag", &api.RepositoryAPI{}, "delete:Delete")
beego.Router("/api/repositories/*/tags", &api.RepositoryAPI{}, "get:GetTags")
beego.Router("/api/repositories/*/tags/:tag/manifest", &api.RepositoryAPI{}, "get:GetManifests")
beego.Router("/api/repositories/*/signatures", &api.RepositoryAPI{}, "get:GetSignatures")
beego.Router("/api/jobs/replication/", &api.RepJobAPI{}, "get:List")
beego.Router("/api/jobs/replication/:id([0-9]+)", &api.RepJobAPI{})
2016-05-27 12:46:07 +02:00
beego.Router("/api/jobs/replication/:id([0-9]+)/log", &api.RepJobAPI{}, "get:GetLog")
2016-06-13 10:49:46 +02:00
beego.Router("/api/policies/replication/:id([0-9]+)", &api.RepPolicyAPI{})
beego.Router("/api/policies/replication", &api.RepPolicyAPI{}, "get:List")
2016-06-14 12:49:23 +02:00
beego.Router("/api/policies/replication", &api.RepPolicyAPI{}, "post:Post")
2016-05-27 12:46:07 +02:00
beego.Router("/api/policies/replication/:id([0-9]+)/enablement", &api.RepPolicyAPI{}, "put:UpdateEnablement")
2016-06-13 02:31:32 +02:00
beego.Router("/api/targets/", &api.TargetAPI{}, "get:List")
2016-06-14 12:49:23 +02:00
beego.Router("/api/targets/", &api.TargetAPI{}, "post:Post")
2016-06-13 02:31:32 +02:00
beego.Router("/api/targets/:id([0-9]+)", &api.TargetAPI{})
beego.Router("/api/targets/:id([0-9]+)/policies/", &api.TargetAPI{}, "get:ListPolicies")
2016-05-27 12:46:07 +02:00
beego.Router("/api/targets/ping", &api.TargetAPI{}, "post:Ping")
2017-04-08 10:42:17 +02:00
beego.Router("/api/targets/:id([0-9]+)/ping", &api.TargetAPI{}, "post:PingByID")
2016-06-02 11:57:39 +02:00
beego.Router("/api/users/:id/sysadmin", &api.UserAPI{}, "put:ToggleUserAdminRole")
2016-06-02 07:41:52 +02:00
beego.Router("/api/repositories/top", &api.RepositoryAPI{}, "get:GetTopRepos")
2016-06-21 12:43:31 +02:00
beego.Router("/api/logs", &api.LogAPI{})
2016-12-30 11:04:01 +01:00
beego.Router("/api/configurations", &api.ConfigAPI{})
2017-03-14 05:52:44 +01:00
beego.Router("/api/configurations/reset", &api.ConfigAPI{}, "post:Reset")
2016-10-25 06:44:27 +02:00
2017-03-09 13:12:33 +01:00
beego.Router("/api/systeminfo", &api.SystemInfoAPI{}, "get:GetGeneralInfo")
2016-11-02 05:50:53 +01:00
beego.Router("/api/systeminfo/volumes", &api.SystemInfoAPI{}, "get:GetVolumeInfo")
2016-11-18 09:07:18 +01:00
beego.Router("/api/systeminfo/getcert", &api.SystemInfoAPI{}, "get:GetCert")
2017-01-09 11:24:31 +01:00
beego.Router("/api/ldap/ping", &api.LdapAPI{}, "post:Ping")
beego.Router("/api/ldap/users/search", &api.LdapAPI{}, "post:Search")
beego.Router("/api/ldap/users/import", &api.LdapAPI{}, "post:ImportUser")
2017-03-03 09:19:42 +01:00
beego.Router("/api/email/ping", &api.EmailAPI{}, "post:Ping")
2017-01-09 11:24:31 +01:00
2016-02-01 12:59:10 +01:00
//external service that hosted on harbor process:
beego.Router("/service/notifications", &service.NotificationHandler{})
2016-04-15 07:17:32 +02:00
beego.Router("/service/token", &token.Handler{})
2017-04-11 09:05:28 +02:00
//Error pages
beego.ErrorController(&controllers.ErrorController{})
2016-02-01 12:59:10 +01:00
}