Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature. add interface project-namespace-k8s-resources #245

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions api/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4117,6 +4117,64 @@ const docTemplate = `{
}
}
},
"/organizations/{organizationId}/projects/{projectId}/namespaces/{projectNamespace}/stacks/{stackId}/k8s-resources": {
"get": {
"security": [
{
"JWT": []
}
],
"description": "Get k8s resources for project namespace",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Projects"
],
"summary": "Get k8s resources for project namespace",
"parameters": [
{
"type": "string",
"description": "Organization ID",
"name": "organizationId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Project ID",
"name": "projectId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Stack ID",
"name": "stackId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Project Namespace",
"name": "projectNamespace",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.GetProjectNamespaceK8sResourcesResponse"
}
}
}
}
},
"/organizations/{organizationId}/stacks": {
"get": {
"security": [
Expand Down Expand Up @@ -7167,6 +7225,14 @@ const docTemplate = `{
}
}
},
"domain.GetProjectNamespaceK8sResourcesResponse": {
"type": "object",
"properties": {
"k8sResources": {
"$ref": "#/definitions/domain.ProjectNamespaceK8sResources"
}
}
},
"domain.GetProjectNamespaceResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -7714,6 +7780,38 @@ const docTemplate = `{
}
}
},
"domain.ProjectNamespaceK8sResources": {
"type": "object",
"properties": {
"cronjobs": {
"type": "integer"
},
"demonsets": {
"type": "integer"
},
"deployments": {
"type": "integer"
},
"ingresses": {
"type": "integer"
},
"jobs": {
"type": "integer"
},
"pods": {
"type": "integer"
},
"pvcs": {
"type": "integer"
},
"services": {
"type": "integer"
},
"statefulsets": {
"type": "integer"
}
}
},
"domain.ProjectNamespaceResponse": {
"type": "object",
"properties": {
Expand Down
98 changes: 98 additions & 0 deletions api/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4111,6 +4111,64 @@
}
}
},
"/organizations/{organizationId}/projects/{projectId}/namespaces/{projectNamespace}/stacks/{stackId}/k8s-resources": {
"get": {
"security": [
{
"JWT": []
}
],
"description": "Get k8s resources for project namespace",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Projects"
],
"summary": "Get k8s resources for project namespace",
"parameters": [
{
"type": "string",
"description": "Organization ID",
"name": "organizationId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Project ID",
"name": "projectId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Stack ID",
"name": "stackId",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Project Namespace",
"name": "projectNamespace",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.GetProjectNamespaceK8sResourcesResponse"
}
}
}
}
},
"/organizations/{organizationId}/stacks": {
"get": {
"security": [
Expand Down Expand Up @@ -7161,6 +7219,14 @@
}
}
},
"domain.GetProjectNamespaceK8sResourcesResponse": {
"type": "object",
"properties": {
"k8sResources": {
"$ref": "#/definitions/domain.ProjectNamespaceK8sResources"
}
}
},
"domain.GetProjectNamespaceResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -7708,6 +7774,38 @@
}
}
},
"domain.ProjectNamespaceK8sResources": {
"type": "object",
"properties": {
"cronjobs": {
"type": "integer"
},
"demonsets": {
"type": "integer"
},
"deployments": {
"type": "integer"
},
"ingresses": {
"type": "integer"
},
"jobs": {
"type": "integer"
},
"pods": {
"type": "integer"
},
"pvcs": {
"type": "integer"
},
"services": {
"type": "integer"
},
"statefulsets": {
"type": "integer"
}
}
},
"domain.ProjectNamespaceResponse": {
"type": "object",
"properties": {
Expand Down
64 changes: 64 additions & 0 deletions api/swagger/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1342,6 +1342,11 @@ definitions:
$ref: '#/definitions/domain.ProjectMemberResponse'
type: array
type: object
domain.GetProjectNamespaceK8sResourcesResponse:
properties:
k8sResources:
$ref: '#/definitions/domain.ProjectNamespaceK8sResources'
type: object
domain.GetProjectNamespaceResponse:
properties:
projectNamespace:
Expand Down Expand Up @@ -1707,6 +1712,27 @@ definitions:
updatedAt:
type: string
type: object
domain.ProjectNamespaceK8sResources:
properties:
cronjobs:
type: integer
demonsets:
type: integer
deployments:
type: integer
ingresses:
type: integer
jobs:
type: integer
pods:
type: integer
pvcs:
type: integer
services:
type: integer
statefulsets:
type: integer
type: object
domain.ProjectNamespaceResponse:
properties:
appCount:
Expand Down Expand Up @@ -4941,6 +4967,44 @@ paths:
summary: Check project namespace exist
tags:
- Projects
/organizations/{organizationId}/projects/{projectId}/namespaces/{projectNamespace}/stacks/{stackId}/k8s-resources:
get:
consumes:
- application/json
description: Get k8s resources for project namespace
parameters:
- description: Organization ID
in: path
name: organizationId
required: true
type: string
- description: Project ID
in: path
name: projectId
required: true
type: string
- description: Stack ID
in: path
name: stackId
required: true
type: string
- description: Project Namespace
in: path
name: projectNamespace
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/domain.GetProjectNamespaceK8sResourcesResponse'
security:
- JWT: []
summary: Get k8s resources for project namespace
tags:
- Projects
/organizations/{organizationId}/projects/existence:
get:
consumes:
Expand Down
9 changes: 9 additions & 0 deletions internal/delivery/api/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ const (
UnSetFavoriteProject
UnSetFavoriteProjectNamespace
GetProjectKubeconfig
GetProjectNamespaceK8sResources
)

var ApiMap = map[Endpoint]EndpointInfo{
Expand Down Expand Up @@ -613,6 +614,10 @@ var ApiMap = map[Endpoint]EndpointInfo{
Name: "GetProjectKubeconfig",
Group: "Project",
},
GetProjectNamespaceK8sResources: {
Name: "GetProjectNamespaceK8sResources",
Group: "Project",
},
}

func (e Endpoint) String() string {
Expand Down Expand Up @@ -847,6 +852,8 @@ func (e Endpoint) String() string {
return "UnSetFavoriteProjectNamespace"
case GetProjectKubeconfig:
return "GetProjectKubeconfig"
case GetProjectNamespaceK8sResources:
return "GetProjectNamespaceK8sResources"
default:
return ""
}
Expand Down Expand Up @@ -1083,6 +1090,8 @@ func GetEndpoint(name string) Endpoint {
return UnSetFavoriteProjectNamespace
case "GetProjectKubeconfig":
return GetProjectKubeconfig
case "GetProjectNamespaceK8sResources":
return GetProjectNamespaceK8sResources
default:
return -1
}
Expand Down
Loading
Loading