|
|
@@ -4,6 +4,7 @@ import (
|
|
|
"github.com/go-chi/chi"
|
|
|
"github.com/porter-dev/porter/api/server/handlers/cluster"
|
|
|
"github.com/porter-dev/porter/api/server/handlers/gitinstallation"
|
|
|
+ "github.com/porter-dev/porter/api/server/handlers/invite"
|
|
|
"github.com/porter-dev/porter/api/server/handlers/project"
|
|
|
"github.com/porter-dev/porter/api/server/handlers/registry"
|
|
|
"github.com/porter-dev/porter/api/server/shared"
|
|
|
@@ -190,6 +191,60 @@ func getProjectRoutes(
|
|
|
Router: r,
|
|
|
})
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/collaborators -> project.NewProjectListCollaboratorsHandler
|
|
|
+ listCollaboratorsEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbList,
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: relPath + "/collaborators",
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ listCollaboratorsHandler := project.NewProjectListCollaboratorsHandler(
|
|
|
+ config,
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: listCollaboratorsEndpoint,
|
|
|
+ Handler: listCollaboratorsHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
+
|
|
|
+ // GET /api/projects/{project_id}/roles -> project.NewProjectListRolesHandler
|
|
|
+ listRolesEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbList,
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: relPath + "/roles",
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ listRolesHandler := project.NewProjectListRolesHandler(
|
|
|
+ config,
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: listRolesEndpoint,
|
|
|
+ Handler: listRolesHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
+
|
|
|
// GET /api/projects/{project_id}/registries -> registry.NewRegistryListHandler
|
|
|
listRegistriesEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
|
@@ -357,5 +412,60 @@ func getProjectRoutes(
|
|
|
Router: r,
|
|
|
})
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/invites -> invite.NewCreateInviteHandler
|
|
|
+ listInvitesEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbGet,
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: relPath + "/invites",
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ listInvitesHandler := invite.NewListInvitesHandler(
|
|
|
+ config,
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: listInvitesEndpoint,
|
|
|
+ Handler: listInvitesHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
+
|
|
|
+ // POST /api/projects/{project_id}/invites -> invite.NewCreateInviteHandler
|
|
|
+ createInviteEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbCreate,
|
|
|
+ Method: types.HTTPVerbPost,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: relPath + "/invites",
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ createInviteHandler := invite.NewCreateInviteHandler(
|
|
|
+ config,
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: createInviteEndpoint,
|
|
|
+ Handler: createInviteHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
+
|
|
|
return routes, newPath
|
|
|
}
|