|
|
@@ -112,329 +112,297 @@ func getGitInstallationRoutes(
|
|
|
Router: r,
|
|
|
})
|
|
|
|
|
|
- // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id} ->
|
|
|
- // environment.NewCreateEnvironmentHandler
|
|
|
- createEnvironmentEndpoint := factory.NewAPIEndpoint(
|
|
|
- &types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbCreate,
|
|
|
- Method: types.HTTPVerbPost,
|
|
|
- Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
- "%s/{%s}/{%s}/clusters/{cluster_id}/environment",
|
|
|
- relPath,
|
|
|
- types.URLParamGitRepoOwner,
|
|
|
- types.URLParamGitRepoName,
|
|
|
- ),
|
|
|
- },
|
|
|
- Scopes: []types.PermissionScope{
|
|
|
- types.UserScope,
|
|
|
- types.ProjectScope,
|
|
|
- types.GitInstallationScope,
|
|
|
- types.ClusterScope,
|
|
|
- },
|
|
|
- },
|
|
|
- )
|
|
|
-
|
|
|
- createEnvironmentHandler := environment.NewCreateEnvironmentHandler(
|
|
|
- config,
|
|
|
- factory.GetDecoderValidator(),
|
|
|
- factory.GetResultWriter(),
|
|
|
- )
|
|
|
-
|
|
|
- routes = append(routes, &Route{
|
|
|
- Endpoint: createEnvironmentEndpoint,
|
|
|
- Handler: createEnvironmentHandler,
|
|
|
- Router: r,
|
|
|
- })
|
|
|
-
|
|
|
- // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment ->
|
|
|
- // environment.NewCreateDeploymentHandler
|
|
|
- createDeploymentEndpoint := factory.NewAPIEndpoint(
|
|
|
- &types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbCreate,
|
|
|
- Method: types.HTTPVerbPost,
|
|
|
- Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
- "%s/{%s}/{%s}/clusters/{cluster_id}/deployment",
|
|
|
- relPath,
|
|
|
- types.URLParamGitRepoOwner,
|
|
|
- types.URLParamGitRepoName,
|
|
|
- ),
|
|
|
- },
|
|
|
- Scopes: []types.PermissionScope{
|
|
|
- types.UserScope,
|
|
|
- types.ProjectScope,
|
|
|
- types.GitInstallationScope,
|
|
|
- types.ClusterScope,
|
|
|
- },
|
|
|
- },
|
|
|
- )
|
|
|
-
|
|
|
- createDeploymentHandler := environment.NewCreateDeploymentHandler(
|
|
|
- config,
|
|
|
- factory.GetDecoderValidator(),
|
|
|
- factory.GetResultWriter(),
|
|
|
- )
|
|
|
-
|
|
|
- routes = append(routes, &Route{
|
|
|
- Endpoint: createDeploymentEndpoint,
|
|
|
- Handler: createDeploymentHandler,
|
|
|
- Router: r,
|
|
|
- })
|
|
|
-
|
|
|
- // GET /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment ->
|
|
|
- // environment.NewCreateDeploymentHandler
|
|
|
- getDeploymentEndpoint := factory.NewAPIEndpoint(
|
|
|
- &types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbGet,
|
|
|
- Method: types.HTTPVerbGet,
|
|
|
- Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
- "%s/{%s}/{%s}/clusters/{cluster_id}/deployment",
|
|
|
- relPath,
|
|
|
- types.URLParamGitRepoOwner,
|
|
|
- types.URLParamGitRepoName,
|
|
|
- ),
|
|
|
- },
|
|
|
- Scopes: []types.PermissionScope{
|
|
|
- types.UserScope,
|
|
|
- types.ProjectScope,
|
|
|
- types.GitInstallationScope,
|
|
|
- types.ClusterScope,
|
|
|
- },
|
|
|
- },
|
|
|
- )
|
|
|
-
|
|
|
- getDeploymentHandler := environment.NewGetDeploymentHandler(
|
|
|
- config,
|
|
|
- factory.GetDecoderValidator(),
|
|
|
- factory.GetResultWriter(),
|
|
|
- )
|
|
|
-
|
|
|
- routes = append(routes, &Route{
|
|
|
- Endpoint: getDeploymentEndpoint,
|
|
|
- Handler: getDeploymentHandler,
|
|
|
- Router: r,
|
|
|
- })
|
|
|
-
|
|
|
- // GET /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployments ->
|
|
|
- // environment.NewCreateDeploymentHandler
|
|
|
- listDeploymentsEndpoint := factory.NewAPIEndpoint(
|
|
|
- &types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbGet,
|
|
|
- Method: types.HTTPVerbGet,
|
|
|
- Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
- "%s/{%s}/{%s}/clusters/{cluster_id}/deployments",
|
|
|
- relPath,
|
|
|
- types.URLParamGitRepoOwner,
|
|
|
- types.URLParamGitRepoName,
|
|
|
- ),
|
|
|
- },
|
|
|
- Scopes: []types.PermissionScope{
|
|
|
- types.UserScope,
|
|
|
- types.ProjectScope,
|
|
|
- types.GitInstallationScope,
|
|
|
- types.ClusterScope,
|
|
|
- },
|
|
|
- },
|
|
|
- )
|
|
|
-
|
|
|
- listDeploymentsHandler := environment.NewListDeploymentsHandler(
|
|
|
- config,
|
|
|
- factory.GetDecoderValidator(),
|
|
|
- factory.GetResultWriter(),
|
|
|
- )
|
|
|
-
|
|
|
- routes = append(routes, &Route{
|
|
|
- Endpoint: listDeploymentsEndpoint,
|
|
|
- Handler: listDeploymentsHandler,
|
|
|
- Router: r,
|
|
|
- })
|
|
|
-
|
|
|
- // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment/finalize ->
|
|
|
- // environment.NewFinalizeDeploymentHandler
|
|
|
- finalizeDeploymentEndpoint := factory.NewAPIEndpoint(
|
|
|
- &types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbCreate,
|
|
|
- Method: types.HTTPVerbPost,
|
|
|
- Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
- "%s/{%s}/{%s}/clusters/{cluster_id}/deployment/finalize",
|
|
|
- relPath,
|
|
|
- types.URLParamGitRepoOwner,
|
|
|
- types.URLParamGitRepoName,
|
|
|
- ),
|
|
|
- },
|
|
|
- Scopes: []types.PermissionScope{
|
|
|
- types.UserScope,
|
|
|
- types.ProjectScope,
|
|
|
- types.GitInstallationScope,
|
|
|
- types.ClusterScope,
|
|
|
- },
|
|
|
- },
|
|
|
- )
|
|
|
-
|
|
|
- finalizeDeploymentHandler := environment.NewFinalizeDeploymentHandler(
|
|
|
- config,
|
|
|
- factory.GetDecoderValidator(),
|
|
|
- factory.GetResultWriter(),
|
|
|
- )
|
|
|
-
|
|
|
- routes = append(routes, &Route{
|
|
|
- Endpoint: finalizeDeploymentEndpoint,
|
|
|
- Handler: finalizeDeploymentHandler,
|
|
|
- Router: r,
|
|
|
- })
|
|
|
-
|
|
|
- // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment/update ->
|
|
|
- // environment.NewFinalizeDeploymentHandler
|
|
|
- updateDeploymentEndpoint := factory.NewAPIEndpoint(
|
|
|
- &types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbUpdate,
|
|
|
- Method: types.HTTPVerbPost,
|
|
|
- Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
- "%s/{%s}/{%s}/clusters/{cluster_id}/deployment/update",
|
|
|
- relPath,
|
|
|
- types.URLParamGitRepoOwner,
|
|
|
- types.URLParamGitRepoName,
|
|
|
- ),
|
|
|
- },
|
|
|
- Scopes: []types.PermissionScope{
|
|
|
- types.UserScope,
|
|
|
- types.ProjectScope,
|
|
|
- types.GitInstallationScope,
|
|
|
- types.ClusterScope,
|
|
|
- },
|
|
|
- },
|
|
|
- )
|
|
|
-
|
|
|
- updateDeploymentHandler := environment.NewUpdateDeploymentHandler(
|
|
|
- config,
|
|
|
- factory.GetDecoderValidator(),
|
|
|
- factory.GetResultWriter(),
|
|
|
- )
|
|
|
-
|
|
|
- routes = append(routes, &Route{
|
|
|
- Endpoint: updateDeploymentEndpoint,
|
|
|
- Handler: updateDeploymentHandler,
|
|
|
- Router: r,
|
|
|
- })
|
|
|
-
|
|
|
- // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment/update/status ->
|
|
|
- // environment.NewUpdateDeploymentStatusHandler
|
|
|
- updateDeploymentStatusEndpoint := factory.NewAPIEndpoint(
|
|
|
- &types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbUpdate,
|
|
|
- Method: types.HTTPVerbPost,
|
|
|
- Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
- "%s/{%s}/{%s}/clusters/{cluster_id}/deployment/update/status",
|
|
|
- relPath,
|
|
|
- types.URLParamGitRepoOwner,
|
|
|
- types.URLParamGitRepoName,
|
|
|
- ),
|
|
|
- },
|
|
|
- Scopes: []types.PermissionScope{
|
|
|
- types.UserScope,
|
|
|
- types.ProjectScope,
|
|
|
- types.GitInstallationScope,
|
|
|
- types.ClusterScope,
|
|
|
- },
|
|
|
- },
|
|
|
- )
|
|
|
+ if config.ServerConf.GithubIncomingWebhookSecret != "" {
|
|
|
+
|
|
|
+ // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id} ->
|
|
|
+ // environment.NewCreateEnvironmentHandler
|
|
|
+ createEnvironmentEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbCreate,
|
|
|
+ Method: types.HTTPVerbPost,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
+ "%s/{%s}/{%s}/clusters/{cluster_id}/environment",
|
|
|
+ relPath,
|
|
|
+ types.URLParamGitRepoOwner,
|
|
|
+ types.URLParamGitRepoName,
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ types.GitInstallationScope,
|
|
|
+ types.ClusterScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ createEnvironmentHandler := environment.NewCreateEnvironmentHandler(
|
|
|
+ config,
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: createEnvironmentEndpoint,
|
|
|
+ Handler: createEnvironmentHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
|
|
|
- updateDeploymentStatusHandler := environment.NewUpdateDeploymentStatusHandler(
|
|
|
- config,
|
|
|
- factory.GetDecoderValidator(),
|
|
|
- factory.GetResultWriter(),
|
|
|
- )
|
|
|
+ // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment ->
|
|
|
+ // environment.NewCreateDeploymentHandler
|
|
|
+ createDeploymentEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbCreate,
|
|
|
+ Method: types.HTTPVerbPost,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
+ "%s/{%s}/{%s}/clusters/{cluster_id}/deployment",
|
|
|
+ relPath,
|
|
|
+ types.URLParamGitRepoOwner,
|
|
|
+ types.URLParamGitRepoName,
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ types.GitInstallationScope,
|
|
|
+ types.ClusterScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ createDeploymentHandler := environment.NewCreateDeploymentHandler(
|
|
|
+ config,
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: createDeploymentEndpoint,
|
|
|
+ Handler: createDeploymentHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
|
|
|
- routes = append(routes, &Route{
|
|
|
- Endpoint: updateDeploymentStatusEndpoint,
|
|
|
- Handler: updateDeploymentStatusHandler,
|
|
|
- Router: r,
|
|
|
- })
|
|
|
+ // GET /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment ->
|
|
|
+ // environment.NewCreateDeploymentHandler
|
|
|
+ getDeploymentEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbGet,
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
+ "%s/{%s}/{%s}/clusters/{cluster_id}/deployment",
|
|
|
+ relPath,
|
|
|
+ types.URLParamGitRepoOwner,
|
|
|
+ types.URLParamGitRepoName,
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ types.GitInstallationScope,
|
|
|
+ types.ClusterScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ getDeploymentHandler := environment.NewGetDeploymentHandler(
|
|
|
+ config,
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: getDeploymentEndpoint,
|
|
|
+ Handler: getDeploymentHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
|
|
|
- // DELETE /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/environment ->
|
|
|
- // environment.NewDeleteEnvironmentHandler
|
|
|
- deleteEnvironmentEndpoint := factory.NewAPIEndpoint(
|
|
|
- &types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbDelete,
|
|
|
- Method: types.HTTPVerbDelete,
|
|
|
- Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
- "%s/{%s}/{%s}/clusters/{cluster_id}/environment",
|
|
|
- relPath,
|
|
|
- types.URLParamGitRepoOwner,
|
|
|
- types.URLParamGitRepoName,
|
|
|
- ),
|
|
|
- },
|
|
|
- Scopes: []types.PermissionScope{
|
|
|
- types.UserScope,
|
|
|
- types.ProjectScope,
|
|
|
- types.GitInstallationScope,
|
|
|
- types.ClusterScope,
|
|
|
- },
|
|
|
- },
|
|
|
- )
|
|
|
+ // GET /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployments ->
|
|
|
+ // environment.NewCreateDeploymentHandler
|
|
|
+ listDeploymentsEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbGet,
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
+ "%s/{%s}/{%s}/clusters/{cluster_id}/deployments",
|
|
|
+ relPath,
|
|
|
+ types.URLParamGitRepoOwner,
|
|
|
+ types.URLParamGitRepoName,
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ types.GitInstallationScope,
|
|
|
+ types.ClusterScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ listDeploymentsHandler := environment.NewListDeploymentsHandler(
|
|
|
+ config,
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: listDeploymentsEndpoint,
|
|
|
+ Handler: listDeploymentsHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
|
|
|
- deleteEnvironmentHandler := environment.NewDeleteEnvironmentHandler(
|
|
|
- config,
|
|
|
- factory.GetDecoderValidator(),
|
|
|
- factory.GetResultWriter(),
|
|
|
- )
|
|
|
+ // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment/finalize ->
|
|
|
+ // environment.NewFinalizeDeploymentHandler
|
|
|
+ finalizeDeploymentEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbCreate,
|
|
|
+ Method: types.HTTPVerbPost,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
+ "%s/{%s}/{%s}/clusters/{cluster_id}/deployment/finalize",
|
|
|
+ relPath,
|
|
|
+ types.URLParamGitRepoOwner,
|
|
|
+ types.URLParamGitRepoName,
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ types.GitInstallationScope,
|
|
|
+ types.ClusterScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ finalizeDeploymentHandler := environment.NewFinalizeDeploymentHandler(
|
|
|
+ config,
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: finalizeDeploymentEndpoint,
|
|
|
+ Handler: finalizeDeploymentHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
|
|
|
- routes = append(routes, &Route{
|
|
|
- Endpoint: deleteEnvironmentEndpoint,
|
|
|
- Handler: deleteEnvironmentHandler,
|
|
|
- Router: r,
|
|
|
- })
|
|
|
+ // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment/update ->
|
|
|
+ // environment.NewFinalizeDeploymentHandler
|
|
|
+ updateDeploymentEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbUpdate,
|
|
|
+ Method: types.HTTPVerbPost,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
+ "%s/{%s}/{%s}/clusters/{cluster_id}/deployment/update",
|
|
|
+ relPath,
|
|
|
+ types.URLParamGitRepoOwner,
|
|
|
+ types.URLParamGitRepoName,
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ types.GitInstallationScope,
|
|
|
+ types.ClusterScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ updateDeploymentHandler := environment.NewUpdateDeploymentHandler(
|
|
|
+ config,
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: updateDeploymentEndpoint,
|
|
|
+ Handler: updateDeploymentHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
|
|
|
- // DELETE /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment ->
|
|
|
- // environment.NewDeleteDeploymentHandler
|
|
|
- deleteDeploymentEndpoint := factory.NewAPIEndpoint(
|
|
|
- &types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbDelete,
|
|
|
- Method: types.HTTPVerbDelete,
|
|
|
- Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
- "%s/{%s}/{%s}/clusters/{cluster_id}/deployment",
|
|
|
- relPath,
|
|
|
- types.URLParamGitRepoOwner,
|
|
|
- types.URLParamGitRepoName,
|
|
|
- ),
|
|
|
- },
|
|
|
- Scopes: []types.PermissionScope{
|
|
|
- types.UserScope,
|
|
|
- types.ProjectScope,
|
|
|
- types.GitInstallationScope,
|
|
|
- types.ClusterScope,
|
|
|
- },
|
|
|
- },
|
|
|
- )
|
|
|
+ // POST /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/deployment/update/status ->
|
|
|
+ // environment.NewUpdateDeploymentStatusHandler
|
|
|
+ updateDeploymentStatusEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbUpdate,
|
|
|
+ Method: types.HTTPVerbPost,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
+ "%s/{%s}/{%s}/clusters/{cluster_id}/deployment/update/status",
|
|
|
+ relPath,
|
|
|
+ types.URLParamGitRepoOwner,
|
|
|
+ types.URLParamGitRepoName,
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ types.GitInstallationScope,
|
|
|
+ types.ClusterScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ updateDeploymentStatusHandler := environment.NewUpdateDeploymentStatusHandler(
|
|
|
+ config,
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: updateDeploymentStatusEndpoint,
|
|
|
+ Handler: updateDeploymentStatusHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
|
|
|
- deleteDeploymentHandler := environment.NewDeleteDeploymentHandler(
|
|
|
- config,
|
|
|
- factory.GetDecoderValidator(),
|
|
|
- factory.GetResultWriter(),
|
|
|
- )
|
|
|
+ // DELETE /api/projects/{project_id}/gitrepos/{git_installation_id}/{owner}/{name}/clusters/{cluster_id}/environment ->
|
|
|
+ // environment.NewDeleteEnvironmentHandler
|
|
|
+ deleteEnvironmentEndpoint := factory.NewAPIEndpoint(
|
|
|
+ &types.APIRequestMetadata{
|
|
|
+ Verb: types.APIVerbDelete,
|
|
|
+ Method: types.HTTPVerbDelete,
|
|
|
+ Path: &types.Path{
|
|
|
+ Parent: basePath,
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
+ "%s/{%s}/{%s}/clusters/{cluster_id}/environment",
|
|
|
+ relPath,
|
|
|
+ types.URLParamGitRepoOwner,
|
|
|
+ types.URLParamGitRepoName,
|
|
|
+ ),
|
|
|
+ },
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
+ types.UserScope,
|
|
|
+ types.ProjectScope,
|
|
|
+ types.GitInstallationScope,
|
|
|
+ types.ClusterScope,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ deleteEnvironmentHandler := environment.NewDeleteEnvironmentHandler(
|
|
|
+ config,
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
+ factory.GetResultWriter(),
|
|
|
+ )
|
|
|
+
|
|
|
+ routes = append(routes, &Route{
|
|
|
+ Endpoint: deleteEnvironmentEndpoint,
|
|
|
+ Handler: deleteEnvironmentHandler,
|
|
|
+ Router: r,
|
|
|
+ })
|
|
|
|
|
|
- routes = append(routes, &Route{
|
|
|
- Endpoint: deleteDeploymentEndpoint,
|
|
|
- Handler: deleteDeploymentHandler,
|
|
|
- Router: r,
|
|
|
- })
|
|
|
+ }
|
|
|
|
|
|
// GET /api/projects/{project_id}/gitrepos/{git_installation_id}/repos ->
|
|
|
// gitinstallation.GithubListReposHandler
|