2016-02-01 12:59:10 +01:00
|
|
|
/*
|
|
|
|
Copyright (c) 2016 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 (
|
|
|
|
"github.com/vmware/harbor/api"
|
|
|
|
"github.com/vmware/harbor/controllers"
|
|
|
|
"github.com/vmware/harbor/service"
|
2016-04-15 07:17:32 +02:00
|
|
|
"github.com/vmware/harbor/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
|
|
|
|
2016-06-16 08:10:35 +02:00
|
|
|
beego.SetStaticPath("static/resources", "static/resources")
|
|
|
|
beego.SetStaticPath("static/vendors", "static/vendors")
|
|
|
|
|
|
|
|
//Page Controllers:
|
|
|
|
beego.Router("/", &controllers.IndexController{})
|
|
|
|
beego.Router("/dashboard", &controllers.DashboardController{})
|
|
|
|
beego.Router("/project", &controllers.ProjectController{})
|
|
|
|
beego.Router("/repository", &controllers.RepositoryController{})
|
|
|
|
beego.Router("/sign_up", &controllers.SignUpController{})
|
|
|
|
beego.Router("/account_setting", &controllers.AccountSettingController{})
|
|
|
|
beego.Router("/admin_option", &controllers.AdminOptionController{})
|
|
|
|
beego.Router("/forgot_password", &controllers.ForgotPasswordController{})
|
|
|
|
beego.Router("/reset_password", &controllers.ResetPasswordController{})
|
|
|
|
beego.Router("/search", &controllers.SearchController{})
|
2016-02-01 12:59:10 +01:00
|
|
|
|
|
|
|
beego.Router("/login", &controllers.CommonController{}, "post:Login")
|
2016-06-16 08:10:35 +02:00
|
|
|
beego.Router("/log_out", &controllers.CommonController{}, "get:LogOut")
|
2016-02-01 12:59:10 +01:00
|
|
|
beego.Router("/reset", &controllers.CommonController{}, "post:ResetPassword")
|
2016-06-16 08:10:35 +02:00
|
|
|
beego.Router("/userExists", &controllers.CommonController{}, "post:UserExists")
|
2016-02-01 12:59:10 +01:00
|
|
|
beego.Router("/sendEmail", &controllers.CommonController{}, "get:SendEmail")
|
2016-06-16 08:10:35 +02:00
|
|
|
beego.Router("/language", &controllers.CommonController{}, "get:SwitchLanguage")
|
2016-02-01 12:59:10 +01:00
|
|
|
|
2016-06-16 08:10:35 +02:00
|
|
|
beego.Router("/optional_menu", &controllers.OptionalMenuController{})
|
|
|
|
beego.Router("/navigation_header", &controllers.NavigationHeaderController{})
|
|
|
|
beego.Router("/navigation_detail", &controllers.NavigationDetailController{})
|
|
|
|
beego.Router("/sign_in", &controllers.SignInController{})
|
2016-02-01 12:59:10 +01:00
|
|
|
|
|
|
|
//API:
|
|
|
|
beego.Router("/api/search", &api.SearchAPI{})
|
2016-05-31 09:03:45 +02:00
|
|
|
beego.Router("/api/projects/:pid([0-9]+)/members/?:mid", &api.ProjectMemberAPI{})
|
2016-05-26 07:59:03 +02:00
|
|
|
beego.Router("/api/projects/", &api.ProjectAPI{}, "get:List")
|
2016-05-30 09:39:51 +02:00
|
|
|
beego.Router("/api/projects/?:id", &api.ProjectAPI{})
|
2016-06-02 11:33:10 +02:00
|
|
|
beego.Router("/api/projects/:id/publicity", &api.ProjectAPI{}, "put:ToggleProjectPublic")
|
2016-05-10 09:10:19 +02:00
|
|
|
beego.Router("/api/statistics", &api.StatisticAPI{})
|
2016-05-27 12:46:07 +02:00
|
|
|
beego.Router("/api/projects/:id([0-9]+)/logs/filter", &api.ProjectAPI{}, "post:FilterAccessLog")
|
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")
|
2016-02-01 12:59:10 +01:00
|
|
|
beego.Router("/api/repositories", &api.RepositoryAPI{})
|
|
|
|
beego.Router("/api/repositories/tags", &api.RepositoryAPI{}, "get:GetTags")
|
|
|
|
beego.Router("/api/repositories/manifests", &api.RepositoryAPI{}, "get:GetManifests")
|
2016-05-27 12:46:07 +02:00
|
|
|
beego.Router("/api/jobs/replication/?:id([0-9]+)", &api.RepJobAPI{})
|
|
|
|
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{})
|
2016-05-27 12:46:07 +02:00
|
|
|
beego.Router("/api/targets/ping", &api.TargetAPI{}, "post:Ping")
|
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-05-20 10:56:12 +02:00
|
|
|
beego.Router("api/logs", &api.LogAPI{})
|
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{})
|
2016-02-01 12:59:10 +01:00
|
|
|
}
|