|
@@ -7,7 +7,6 @@ import (
|
|
|
"github.com/porter-dev/porter/api/server/handlers/cluster"
|
|
"github.com/porter-dev/porter/api/server/handlers/cluster"
|
|
|
"github.com/porter-dev/porter/api/server/handlers/database"
|
|
"github.com/porter-dev/porter/api/server/handlers/database"
|
|
|
"github.com/porter-dev/porter/api/server/handlers/environment"
|
|
"github.com/porter-dev/porter/api/server/handlers/environment"
|
|
|
- "github.com/porter-dev/porter/api/server/handlers/kube_events"
|
|
|
|
|
"github.com/porter-dev/porter/api/server/shared"
|
|
"github.com/porter-dev/porter/api/server/shared"
|
|
|
"github.com/porter-dev/porter/api/server/shared/config"
|
|
"github.com/porter-dev/porter/api/server/shared/config"
|
|
|
"github.com/porter-dev/porter/api/server/shared/router"
|
|
"github.com/porter-dev/porter/api/server/shared/router"
|
|
@@ -347,7 +346,7 @@ func getClusterRoutes(
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // PATCH /api/projects/{project_id}/clusters/{cluster_id}/environment/{environment_id}/toggle_new_comment -> environment.NewToggleNewCommentHandler
|
|
|
|
|
|
|
+ // PATCH /api/projects/{project_id}/clusters/{cluster_id}/environments/{environment_id}/toggle_new_comment -> environment.NewToggleNewCommentHandler
|
|
|
toggleNewCommentEndpoint := factory.NewAPIEndpoint(
|
|
toggleNewCommentEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbUpdate,
|
|
Verb: types.APIVerbUpdate,
|
|
@@ -376,6 +375,35 @@ func getClusterRoutes(
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/environments/{environment_id}/validate_porter_yaml -> environment.NewValidatePorterYAMLHandler
|
|
|
|
|
+ validtatePorterYAMLEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
+ &types.APIRequestMetadata{
|
|
|
|
|
+ Verb: types.APIVerbGet,
|
|
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
|
|
+ Path: &types.Path{
|
|
|
|
|
+ Parent: basePath,
|
|
|
|
|
+ RelativePath: relPath + "/environments/{environment_id}/validate_porter_yaml",
|
|
|
|
|
+ },
|
|
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
|
|
+ types.UserScope,
|
|
|
|
|
+ types.ProjectScope,
|
|
|
|
|
+ types.ClusterScope,
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ validatePorterYAMLHandler := environment.NewValidatePorterYAMLHandler(
|
|
|
|
|
+ config,
|
|
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
|
|
+ factory.GetResultWriter(),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ routes = append(routes, &router.Route{
|
|
|
|
|
+ Endpoint: validtatePorterYAMLEndpoint,
|
|
|
|
|
+ Handler: validatePorterYAMLHandler,
|
|
|
|
|
+ Router: r,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
// GET /api/projects/{project_id}/clusters/{cluster_id}/deployments -> environment.NewListDeploymentsByClusterHandler
|
|
// GET /api/projects/{project_id}/clusters/{cluster_id}/deployments -> environment.NewListDeploymentsByClusterHandler
|
|
|
listDeploymentsEndpoint := factory.NewAPIEndpoint(
|
|
listDeploymentsEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
@@ -801,6 +829,31 @@ func getClusterRoutes(
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/agent/status -> cluster.NewGetAgentStatusHandler
|
|
|
|
|
+ getAgentStatusEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
+ &types.APIRequestMetadata{
|
|
|
|
|
+ Verb: types.APIVerbGet,
|
|
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
|
|
+ Path: &types.Path{
|
|
|
|
|
+ Parent: basePath,
|
|
|
|
|
+ RelativePath: relPath + "/agent/status",
|
|
|
|
|
+ },
|
|
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
|
|
+ types.UserScope,
|
|
|
|
|
+ types.ProjectScope,
|
|
|
|
|
+ types.ClusterScope,
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ getAgentStatusHandler := cluster.NewGetAgentStatusHandler(config, factory.GetResultWriter())
|
|
|
|
|
+
|
|
|
|
|
+ routes = append(routes, &router.Route{
|
|
|
|
|
+ Endpoint: getAgentStatusEndpoint,
|
|
|
|
|
+ Handler: getAgentStatusHandler,
|
|
|
|
|
+ Router: r,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
// POST /api/projects/{project_id}/clusters/{cluster_id}/agent/upgrade -> cluster.NewInstallAgentHandler
|
|
// POST /api/projects/{project_id}/clusters/{cluster_id}/agent/upgrade -> cluster.NewInstallAgentHandler
|
|
|
upgradeAgentEndpoint := factory.NewAPIEndpoint(
|
|
upgradeAgentEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
@@ -830,14 +883,42 @@ func getClusterRoutes(
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/kube_events -> kube_events.NewGetKubeEventHandler
|
|
|
|
|
- listKubeEventsEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/prometheus/ingresses -> cluster.NewListNGINXIngressesHandler
|
|
|
|
|
+ listNGINXIngressesEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
+ &types.APIRequestMetadata{
|
|
|
|
|
+ Verb: types.APIVerbGet,
|
|
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
|
|
+ Path: &types.Path{
|
|
|
|
|
+ Parent: basePath,
|
|
|
|
|
+ RelativePath: relPath + "/prometheus/ingresses",
|
|
|
|
|
+ },
|
|
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
|
|
+ types.UserScope,
|
|
|
|
|
+ types.ProjectScope,
|
|
|
|
|
+ types.ClusterScope,
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ listNGINXIngressesHandler := cluster.NewListNGINXIngressesHandler(
|
|
|
|
|
+ config,
|
|
|
|
|
+ factory.GetResultWriter(),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ routes = append(routes, &router.Route{
|
|
|
|
|
+ Endpoint: listNGINXIngressesEndpoint,
|
|
|
|
|
+ Handler: listNGINXIngressesHandler,
|
|
|
|
|
+ Router: r,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/metrics -> cluster.NewGetPodMetricsHandler
|
|
|
|
|
+ getPodMetricsEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: relPath + "/kube_events",
|
|
|
|
|
|
|
+ RelativePath: relPath + "/metrics",
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
@@ -847,55 +928,90 @@ func getClusterRoutes(
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- listKubeEventsHandler := kube_events.NewListKubeEventsHandler(
|
|
|
|
|
|
|
+ getPodMetricsHandler := cluster.NewGetPodMetricsHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: listKubeEventsEndpoint,
|
|
|
|
|
- Handler: listKubeEventsHandler,
|
|
|
|
|
|
|
+ Endpoint: getPodMetricsEndpoint,
|
|
|
|
|
+ Handler: getPodMetricsHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/kube_events -> kube_events.NewGetKubeEventHandler
|
|
|
|
|
- getKubeEventEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/helm_release -> cluster.NewStreamHelmReleaseHandler
|
|
|
|
|
+ streamHelmReleaseEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf("%s/kube_events/{%s}", relPath, types.URLParamKubeEventID),
|
|
|
|
|
|
|
+ RelativePath: relPath + "/helm_release",
|
|
|
|
|
+ },
|
|
|
|
|
+ Scopes: []types.PermissionScope{
|
|
|
|
|
+ types.UserScope,
|
|
|
|
|
+ types.ProjectScope,
|
|
|
|
|
+ types.ClusterScope,
|
|
|
|
|
+ },
|
|
|
|
|
+ IsWebsocket: true,
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ streamHelmReleaseHandler := cluster.NewStreamHelmReleaseHandler(
|
|
|
|
|
+ config,
|
|
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
|
|
+ factory.GetResultWriter(),
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ routes = append(routes, &router.Route{
|
|
|
|
|
+ Endpoint: streamHelmReleaseEndpoint,
|
|
|
|
|
+ Handler: streamHelmReleaseHandler,
|
|
|
|
|
+ Router: r,
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/{kind}/status -> cluster.NewStreamStatusHandler
|
|
|
|
|
+ streamStatusEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
+ &types.APIRequestMetadata{
|
|
|
|
|
+ Verb: types.APIVerbGet,
|
|
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
|
|
+ Path: &types.Path{
|
|
|
|
|
+ Parent: basePath,
|
|
|
|
|
+ RelativePath: fmt.Sprintf(
|
|
|
|
|
+ "%s/{%s}/status",
|
|
|
|
|
+ relPath,
|
|
|
|
|
+ types.URLParamKind,
|
|
|
|
|
+ ),
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
|
types.ProjectScope,
|
|
types.ProjectScope,
|
|
|
types.ClusterScope,
|
|
types.ClusterScope,
|
|
|
},
|
|
},
|
|
|
|
|
+ IsWebsocket: true,
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- getKubeEventHandler := kube_events.NewGetKubeEventHandler(
|
|
|
|
|
|
|
+ streamStatusHandler := cluster.NewStreamStatusHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: getKubeEventEndpoint,
|
|
|
|
|
- Handler: getKubeEventHandler,
|
|
|
|
|
|
|
+ Endpoint: streamStatusEndpoint,
|
|
|
|
|
+ Handler: streamStatusHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/kube_events/{kube_event_id}/logs -> kube_events.NewGetKubeEventLogsHandler
|
|
|
|
|
- getKubeEventLogsEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/pods -> cluster.NewGetPodsHandler
|
|
|
|
|
+ getPodsEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf("%s/kube_events/{%s}/logs", relPath, types.URLParamKubeEventID),
|
|
|
|
|
|
|
+ RelativePath: relPath + "/pods",
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
@@ -905,26 +1021,26 @@ func getClusterRoutes(
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- getKubeEventLogsHandler := kube_events.NewGetKubeEventLogsHandler(
|
|
|
|
|
|
|
+ getPodsHandler := cluster.NewGetPodsHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: getKubeEventLogsEndpoint,
|
|
|
|
|
- Handler: getKubeEventLogsHandler,
|
|
|
|
|
|
|
+ Endpoint: getPodsEndpoint,
|
|
|
|
|
+ Handler: getPodsHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/kube_events/{kube_event_id}/log_buckets -> kube_events.NewGetKubeEventLogBucketsHandler
|
|
|
|
|
- getKubeEventLogBucketsEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/incidents -> cluster.NewListIncidentsHandler
|
|
|
|
|
+ listIncidentsEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: fmt.Sprintf("%s/kube_events/{%s}/log_buckets", relPath, types.URLParamKubeEventID),
|
|
|
|
|
|
|
+ RelativePath: relPath + "/incidents",
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
@@ -934,26 +1050,26 @@ func getClusterRoutes(
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- getKubeEventLogBucketsHandler := kube_events.NewGetKubeEventLogBucketsHandler(
|
|
|
|
|
|
|
+ listIncidentsHandler := cluster.NewListIncidentsHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: getKubeEventLogBucketsEndpoint,
|
|
|
|
|
- Handler: getKubeEventLogBucketsHandler,
|
|
|
|
|
|
|
+ Endpoint: listIncidentsEndpoint,
|
|
|
|
|
+ Handler: listIncidentsHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // POST /api/projects/{project_id}/clusters/{cluster_id}/kube_events -> kube_events.NewCreateKubeEventHandler
|
|
|
|
|
- createKubeEventsEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/incidents/{incident_id} -> cluster.NewGetIncidentHandler
|
|
|
|
|
+ getIncidentEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
- Verb: types.APIVerbCreate,
|
|
|
|
|
- Method: types.HTTPVerbPost,
|
|
|
|
|
|
|
+ Verb: types.APIVerbGet,
|
|
|
|
|
+ Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: relPath + "/kube_events",
|
|
|
|
|
|
|
+ RelativePath: fmt.Sprintf("%s/incidents/{%s}", relPath, types.URLParamIncidentID),
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
@@ -963,26 +1079,26 @@ func getClusterRoutes(
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- createKubeEventsHandler := kube_events.NewCreateKubeEventHandler(
|
|
|
|
|
|
|
+ getIncidentHandler := cluster.NewGetIncidentHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: createKubeEventsEndpoint,
|
|
|
|
|
- Handler: createKubeEventsHandler,
|
|
|
|
|
|
|
+ Endpoint: getIncidentEndpoint,
|
|
|
|
|
+ Handler: getIncidentHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/prometheus/ingresses -> cluster.NewListNGINXIngressesHandler
|
|
|
|
|
- listNGINXIngressesEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/incidents/events -> cluster.NewListIncidentEventsHandler
|
|
|
|
|
+ listIncidentEventsEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: relPath + "/prometheus/ingresses",
|
|
|
|
|
|
|
+ RelativePath: fmt.Sprintf("%s/incidents/events", relPath),
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
@@ -992,25 +1108,26 @@ func getClusterRoutes(
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- listNGINXIngressesHandler := cluster.NewListNGINXIngressesHandler(
|
|
|
|
|
|
|
+ listIncidentEventsHandler := cluster.NewListIncidentEventsHandler(
|
|
|
config,
|
|
config,
|
|
|
|
|
+ factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: listNGINXIngressesEndpoint,
|
|
|
|
|
- Handler: listNGINXIngressesHandler,
|
|
|
|
|
|
|
+ Endpoint: listIncidentEventsEndpoint,
|
|
|
|
|
+ Handler: listIncidentEventsHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/metrics -> cluster.NewGetPodMetricsHandler
|
|
|
|
|
- getPodMetricsEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/logs -> cluster.NewGetLogsHandler
|
|
|
|
|
+ getLogsEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: relPath + "/metrics",
|
|
|
|
|
|
|
+ RelativePath: fmt.Sprintf("%s/logs", relPath),
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
@@ -1020,90 +1137,84 @@ func getClusterRoutes(
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- getPodMetricsHandler := cluster.NewGetPodMetricsHandler(
|
|
|
|
|
|
|
+ getLogsHandler := cluster.NewGetLogsHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: getPodMetricsEndpoint,
|
|
|
|
|
- Handler: getPodMetricsHandler,
|
|
|
|
|
|
|
+ Endpoint: getLogsEndpoint,
|
|
|
|
|
+ Handler: getLogsHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/helm_release -> cluster.NewStreamHelmReleaseHandler
|
|
|
|
|
- streamHelmReleaseEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/logs/pod_values -> cluster.NewGetLogPodValuesHandler
|
|
|
|
|
+ getLogPodValuesEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: relPath + "/helm_release",
|
|
|
|
|
|
|
+ RelativePath: fmt.Sprintf("%s/logs/pod_values", relPath),
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
|
types.ProjectScope,
|
|
types.ProjectScope,
|
|
|
types.ClusterScope,
|
|
types.ClusterScope,
|
|
|
},
|
|
},
|
|
|
- IsWebsocket: true,
|
|
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- streamHelmReleaseHandler := cluster.NewStreamHelmReleaseHandler(
|
|
|
|
|
|
|
+ getLogPodValuesHandler := cluster.NewGetLogPodValuesHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: streamHelmReleaseEndpoint,
|
|
|
|
|
- Handler: streamHelmReleaseHandler,
|
|
|
|
|
|
|
+ Endpoint: getLogPodValuesEndpoint,
|
|
|
|
|
+ Handler: getLogPodValuesHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/{kind}/status -> cluster.NewStreamStatusHandler
|
|
|
|
|
- streamStatusEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/logs/revision_values -> cluster.NewGetLogPodValuesHandler
|
|
|
|
|
+ getLogRevisionValuesEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
- Parent: basePath,
|
|
|
|
|
- RelativePath: fmt.Sprintf(
|
|
|
|
|
- "%s/{%s}/status",
|
|
|
|
|
- relPath,
|
|
|
|
|
- types.URLParamKind,
|
|
|
|
|
- ),
|
|
|
|
|
|
|
+ Parent: basePath,
|
|
|
|
|
+ RelativePath: fmt.Sprintf("%s/logs/revision_values", relPath),
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
|
types.ProjectScope,
|
|
types.ProjectScope,
|
|
|
types.ClusterScope,
|
|
types.ClusterScope,
|
|
|
},
|
|
},
|
|
|
- IsWebsocket: true,
|
|
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- streamStatusHandler := cluster.NewStreamStatusHandler(
|
|
|
|
|
|
|
+ getLogRevisionValuesHandler := cluster.NewGetLogRevisionValuesHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: streamStatusEndpoint,
|
|
|
|
|
- Handler: streamStatusHandler,
|
|
|
|
|
|
|
+ Endpoint: getLogRevisionValuesEndpoint,
|
|
|
|
|
+ Handler: getLogRevisionValuesHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/pods -> cluster.NewGetPodsHandler
|
|
|
|
|
- getPodsEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/events -> cluster.NewGetEventsHandler
|
|
|
|
|
+ getPorterEventsEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: relPath + "/pods",
|
|
|
|
|
|
|
+ RelativePath: fmt.Sprintf("%s/events", relPath),
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
@@ -1113,26 +1224,26 @@ func getClusterRoutes(
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- getPodsHandler := cluster.NewGetPodsHandler(
|
|
|
|
|
|
|
+ getPorterEventsHandler := cluster.NewGetPorterEventsHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: getPodsEndpoint,
|
|
|
|
|
- Handler: getPodsHandler,
|
|
|
|
|
|
|
+ Endpoint: getPorterEventsEndpoint,
|
|
|
|
|
+ Handler: getPorterEventsHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/incidents -> cluster.NewGetIncidentsHandler
|
|
|
|
|
- getIncidentsEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/events/job -> cluster.NewGetPorterJobEventsHandler
|
|
|
|
|
+ getPorterJobEventsEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: relPath + "/incidents",
|
|
|
|
|
|
|
+ RelativePath: fmt.Sprintf("%s/events/job", relPath),
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
@@ -1142,26 +1253,26 @@ func getClusterRoutes(
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- getIncidentsHandler := cluster.NewGetIncidentsHandler(
|
|
|
|
|
|
|
+ getPorterJobEventsHandler := cluster.NewGetPorterJobEventsHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: getIncidentsEndpoint,
|
|
|
|
|
- Handler: getIncidentsHandler,
|
|
|
|
|
|
|
+ Endpoint: getPorterJobEventsEndpoint,
|
|
|
|
|
+ Handler: getPorterJobEventsHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- // GET /api/projects/{project_id}/clusters/{cluster_id}/incidents/logs -> cluster.NewGetIncidentsHandler
|
|
|
|
|
- getIncidentEventLogsEndpoint := factory.NewAPIEndpoint(
|
|
|
|
|
|
|
+ // GET /api/projects/{project_id}/clusters/{cluster_id}/k8s_events -> cluster.NewGetEventsHandler
|
|
|
|
|
+ getK8sEventsEndpoint := factory.NewAPIEndpoint(
|
|
|
&types.APIRequestMetadata{
|
|
&types.APIRequestMetadata{
|
|
|
Verb: types.APIVerbGet,
|
|
Verb: types.APIVerbGet,
|
|
|
Method: types.HTTPVerbGet,
|
|
Method: types.HTTPVerbGet,
|
|
|
Path: &types.Path{
|
|
Path: &types.Path{
|
|
|
Parent: basePath,
|
|
Parent: basePath,
|
|
|
- RelativePath: relPath + "/incidents/logs",
|
|
|
|
|
|
|
+ RelativePath: fmt.Sprintf("%s/k8s_events", relPath),
|
|
|
},
|
|
},
|
|
|
Scopes: []types.PermissionScope{
|
|
Scopes: []types.PermissionScope{
|
|
|
types.UserScope,
|
|
types.UserScope,
|
|
@@ -1171,15 +1282,15 @@ func getClusterRoutes(
|
|
|
},
|
|
},
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- getIncidentEventLogsHandler := cluster.NewGetIncidentEventLogsHandler(
|
|
|
|
|
|
|
+ getK8sEventsHandler := cluster.NewGetKubernetesEventsHandler(
|
|
|
config,
|
|
config,
|
|
|
factory.GetDecoderValidator(),
|
|
factory.GetDecoderValidator(),
|
|
|
factory.GetResultWriter(),
|
|
factory.GetResultWriter(),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
routes = append(routes, &router.Route{
|
|
routes = append(routes, &router.Route{
|
|
|
- Endpoint: getIncidentEventLogsEndpoint,
|
|
|
|
|
- Handler: getIncidentEventLogsHandler,
|
|
|
|
|
|
|
+ Endpoint: getK8sEventsEndpoint,
|
|
|
|
|
+ Handler: getK8sEventsHandler,
|
|
|
Router: r,
|
|
Router: r,
|
|
|
})
|
|
})
|
|
|
|
|
|