Skip to content

Commit

Permalink
Merge pull request #245 from openinfradev/project_k8s_info
Browse files Browse the repository at this point in the history
feature. add interface project-namespace-k8s-resources
  • Loading branch information
ktkfree authored Feb 26, 2024
2 parents d44ad7f + 9c0a525 commit ec7eca1
Show file tree
Hide file tree
Showing 8 changed files with 358 additions and 0 deletions.
98 changes: 98 additions & 0 deletions api/swagger/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -4297,6 +4297,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 @@ -7413,6 +7471,14 @@ const docTemplate = `{
}
}
},
"domain.GetProjectNamespaceK8sResourcesResponse": {
"type": "object",
"properties": {
"k8sResources": {
"$ref": "#/definitions/domain.ProjectNamespaceK8sResources"
}
}
},
"domain.GetProjectNamespaceResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -7960,6 +8026,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 @@ -4291,6 +4291,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 @@ -7407,6 +7465,14 @@
}
}
},
"domain.GetProjectNamespaceK8sResourcesResponse": {
"type": "object",
"properties": {
"k8sResources": {
"$ref": "#/definitions/domain.ProjectNamespaceK8sResources"
}
}
},
"domain.GetProjectNamespaceResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -7954,6 +8020,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 @@ -1385,6 +1385,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 @@ -1750,6 +1755,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 @@ -5118,6 +5144,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

// Audit
GetAudits
Expand Down Expand Up @@ -618,6 +619,10 @@ var ApiMap = map[Endpoint]EndpointInfo{
Name: "GetProjectKubeconfig",
Group: "Project",
},
GetProjectNamespaceK8sResources: {
Name: "GetProjectNamespaceK8sResources",
Group: "Project",
},
GetAudits: {
Name: "GetAudits",
Group: "Audit",
Expand Down Expand Up @@ -864,6 +869,8 @@ func (e Endpoint) String() string {
return "UnSetFavoriteProjectNamespace"
case GetProjectKubeconfig:
return "GetProjectKubeconfig"
case GetProjectNamespaceK8sResources:
return "GetProjectNamespaceK8sResources"
case GetAudits:
return "GetAudits"
case GetAudit:
Expand Down Expand Up @@ -1106,6 +1113,8 @@ func GetEndpoint(name string) Endpoint {
return UnSetFavoriteProjectNamespace
case "GetProjectKubeconfig":
return GetProjectKubeconfig
case "GetProjectNamespaceK8sResources":
return GetProjectNamespaceK8sResources
case "GetAudits":
return GetAudits
case "GetAudit":
Expand Down
Loading

0 comments on commit ec7eca1

Please sign in to comment.