|
@@ -110,6 +110,64 @@ func getClusterRoutes(
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/candidates -> project.NewListClusterCandidatesHandler
|
|
|
|
|
+ listCandidatesEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
+ &types.APIRequestMetadata{
|
|
|
|
|
+ Verb: types.APIVerbList,
|
|
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
|
|
+ Path: &types.Path{
|
|
|
|
|
+ Parent: basePath,
|
|
|
|
|
+ RelativePath: "/clusters/candidates",
|
|
|
|
|
+ },
|
|
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
|
|
+ types.UserScope,
|
|
|
|
|
+ types.ProjectScope,
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ listCandidatesHandler := cluster.NewListClusterCandidatesHandler(
|
|
|
|
|
+ config,
|
|
|
|
|
+ factory.GetResultWriter(),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ routes = append(routes, &Route{
|
|
|
|
|
+ Endpoint: listCandidatesEndpoint,
|
|
|
|
|
+ Handler: listCandidatesHandler,
|
|
|
|
|
+ Router: r,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // POST /api/projects/{project_id}/clusters/candidates/{candidate_id}/resolve -> project.NewResolveClusterCandidateHandler
|
|
|
|
|
+ resolveCandidateEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
+ &types.APIRequestMetadata{
|
|
|
|
|
+ Verb: types.APIVerbCreate,
|
|
|
|
|
+ Method: types.HTTPVerbPost,
|
|
|
|
|
+ Path: &types.Path{
|
|
|
|
|
+ Parent: basePath,
|
|
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
|
|
+ "/clusters/candidates/{%s}/resolve",
|
|
|
|
|
+ types.URLParamCandidateID,
|
|
|
|
|
+ ),
|
|
|
|
|
+ },
|
|
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
|
|
+ types.UserScope,
|
|
|
|
|
+ types.ProjectScope,
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ resolveCandidateHandler := cluster.NewResolveClusterCandidateHandler(
|
|
|
|
|
+ config,
|
|
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
|
|
+ factory.GetResultWriter(),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ routes = append(routes, &Route{
|
|
|
|
|
+ Endpoint: resolveCandidateEndpoint,
|
|
|
|
|
+ Handler: resolveCandidateHandler,
|
|
|
|
|
+ Router: r,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
// GET /api/projects/{project_id}/clusters/{cluster_id} -> project.NewClusterGetHandler
|
|
// GET /api/projects/{project_id}/clusters/{cluster_id} -> project.NewClusterGetHandler
|
|
|
getEndpoint := factory.NewAPIEndpoint(
|
|
getEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|