diff --git a/docs/en/apis/advanced_apis/application/index.mdx b/docs/en/apis/advanced_apis/application/index.mdx new file mode 100644 index 000000000..4cbe87de7 --- /dev/null +++ b/docs/en/apis/advanced_apis/application/index.mdx @@ -0,0 +1,10 @@ +--- +i18n: + title: + en: Application APIs + zh: 应用 API +--- + +# Application APIs + + diff --git a/docs/en/apis/advanced_apis/application/lifecycle.mdx b/docs/en/apis/advanced_apis/application/lifecycle.mdx new file mode 100644 index 000000000..6d7011534 --- /dev/null +++ b/docs/en/apis/advanced_apis/application/lifecycle.mdx @@ -0,0 +1,20 @@ +--- +i18n: + title: + en: Application Lifecycle + zh: 应用生命周期 +--- + +# Application Lifecycle + +This section describes the APIs for managing the lifecycle of applications in the Alauda Container Platform. + + diff --git a/docs/en/apis/advanced_apis/application/management.mdx b/docs/en/apis/advanced_apis/application/management.mdx new file mode 100644 index 000000000..4916038e2 --- /dev/null +++ b/docs/en/apis/advanced_apis/application/management.mdx @@ -0,0 +1,20 @@ +--- +i18n: + title: + en: Application Management Operations + zh: 应用管理操作 +--- + +# Application Management Operations + +This section describes management APIs for application snapshots, exports, and task executions. + + diff --git a/docs/en/apis/advanced_apis/application/query.mdx b/docs/en/apis/advanced_apis/application/query.mdx new file mode 100644 index 000000000..7baf28d36 --- /dev/null +++ b/docs/en/apis/advanced_apis/application/query.mdx @@ -0,0 +1,19 @@ +--- +i18n: + title: + en: Application Query and Resources + zh: 应用查询与资源 +--- + +# Application Query and Resources + +This section describes the APIs for querying application status, resource lists, and related topology information. + + diff --git a/docs/shared/openapis/application.v1.json b/docs/shared/openapis/application.v1.json new file mode 100644 index 000000000..50a54c4f2 --- /dev/null +++ b/docs/shared/openapis/application.v1.json @@ -0,0 +1,598 @@ +{ + "openapi": "3.0.0", + "info": { + "version": "1.0.0", + "title": "Application APIs", + "description": "APIs for managing applications in Alauda Container Platform." + }, + "security": [ + { "bearerAuth": [] } + ], + "paths": { + "/acp/v1/kubernetes/{cluster_name}/namespaces/{namespace}/applications": { + "post": { + "summary": "Create Application", + "description": "Creates a new application resource with a list of component templates.", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "requestBody": { + "required": true, + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/Application" }, + "example": { + "kind": "Application", + "apiVersion": "app.k8s.io/v1beta1", + "metadata": { + "name": "bar", + "namespace": "foo", + "annotations": { + "app.alauda.io/display-name": "Display Name" + } + }, + "spec": { + "componentTemplates": [ + { + "kind": "Service", + "apiVersion": "v1", + "spec": { + "type": "ClusterIP", + "ports": [{ "port": 3306, "targetPort": 3306, "protocol": "TCP" }], + "selector": { "app.cpaas.io/name": "bar.foo" } + } + } + ] + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Application" } + } + } + } + } + } + }, + "/acp/v1/kubernetes/{cluster_name}/namespaces/{namespace}/applications/{name}": { + "put": { + "summary": "Update Application", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "requestBody": { + "required": true, + "content": { + "*/*": { + "schema": { "$ref": "#/components/schemas/Application" } + } + } + }, + "responses": { + "200": { + "description": "Successful update.", + "content": { + "application/json": { "schema": { "$ref": "#/components/schemas/Application" } } + } + } + } + }, + "get": { + "summary": "List Application Resources", + "description": "Lists the application resource itself and its sub-resources.", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "responses": { + "200": { + "description": "Successful", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { "type": "object" } + } + } + } + } + } + }, + "delete": { + "summary": "Delete Application", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "responses": { "204": { "description": "No Content" } } + } + }, + "/acp/v1/kubernetes/{cluster_name}/namespaces/{namespace}/applications/{name}/rollback": { + "post": { + "summary": "Rollback Application", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "requestBody": { + "required": true, + "content": { + "*/*": { + "schema": { + "type": "object", + "properties": { + "kind": { "type": "string", "example": "ApplicationRollback" }, + "apiVersion": { "type": "string", "example": "app.k8s.io/v1beta1" }, + "metadata": { "$ref": "#/components/schemas/ObjectMeta" }, + "spec": { + "type": "object", + "properties": { + "revision": { "type": "integer" }, + "user": { "type": "string" } + } + } + } + } + } + } + }, + "responses": { "204": { "description": "No Content" } } + } + }, + "/acp/v1/kubernetes/{cluster_name}/namespaces/{namespace}/applications/{name}/start": { + "post": { + "summary": "Start Application", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "responses": { "204": { "description": "No Content" } } + } + }, + "/acp/v1/kubernetes/{cluster_name}/namespaces/{namespace}/applications/{name}/stop": { + "post": { + "summary": "Stop Application", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "responses": { "204": { "description": "No Content" } } + } + }, + "/acp/v1/kubernetes/{cluster_name}/namespaces/{namespace}/applications/{name}/address": { + "get": { + "summary": "Get Application Address", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "responses": { + "200": { + "description": "Successful", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "workloads": { "type": "object", "additionalProperties": { "type": "object" } } + } + } + } + } + } + } + } + }, + "/acp/v1/resources/search/{list-url}": { + "get": { + "summary": "Resource Search", + "parameters": [ + { "name": "list-url", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "field", "in": "query", "schema": { "type": "string", "default": "metadata.name" } }, + { "name": "keyword", "in": "query", "required": true, "schema": { "type": "string" } }, + { "name": "limit", "in": "query", "schema": { "type": "integer" } }, + { "name": "continue", "in": "query", "schema": { "type": "string" } } + ], + "responses": { + "200": { + "description": "Successful", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "items": { "type": "array", "items": { "type": "object" } }, + "kind": { "type": "string" }, + "apiVersion": { "type": "string" }, + "metadata": { "type": "object" } + } + } + } + } + } + } + } + }, + "/acp/v1/kubernetes/{cluster}/topology/{namespace}/{kind}/{name}": { + "get": { + "summary": "Get Resource Topology", + "parameters": [ + { "name": "cluster", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "kind", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "depth", "in": "query", "schema": { "type": "string", "default": "2" } } + ], + "responses": { + "200": { + "description": "Successful", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "nodes": { "type": "object" }, + "edges": { "type": "array", "items": { "type": "object" } } + } + } + } + } + } + } + } + }, + "/acp/v1/kubernetes/{cluster}/cronjobs/{namespace}/{name}/exec": { + "post": { + "summary": "Execute CronJob", + "parameters": [ + { "name": "cluster", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "responses": { + "200": { + "description": "Successful", + "content": { + "application/json": { "schema": { "type": "object" } } + } + } + } + } + }, + "/acp/v1/kubernetes/{cluster_name}/namespaces/{namespace}/applications/{name}/snapshot": { + "post": { + "summary": "Application Snapshot", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "requestBody": { + "required": true, + "content": { + "*/*": { + "schema": { + "type": "object", + "properties": { + "kind": { "type": "string", "example": "ApplicationSnapshot" }, + "apiVersion": { "type": "string", "example": "app.k8s.io/v1beta1" }, + "metadata": { "$ref": "#/components/schemas/ObjectMeta" }, + "spec": { + "type": "object", + "properties": { + "changeCause": { "type": "string" }, + "user": { "type": "string" } + } + } + } + } + } + } + }, + "responses": { "200": { "description": "Successful" } } + } + }, + "/acp/v1/resources/{cluster}/resourcetypes": { + "get": { + "summary": "Get Cluster Resource Types", + "parameters": [ + { "name": "cluster", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "responses": { + "200": { + "description": "Successful", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { "type": "object" } + } + } + } + } + } + } + }, + "/acp/v1/kubernetes/{cluster}/namespaces/{namespace}/pods/{podName}/{containerName}/log": { + "get": { + "summary": "Get Container Logs", + "parameters": [ + { "name": "cluster", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "podName", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "containerName", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "responses": { + "200": { + "description": "Successful", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "info": { "type": "object" }, + "selection": { "type": "object" }, + "logs": { "type": "array", "items": { "type": "object" } } + } + } + } + } + } + } + } + }, + "/acp/v1/resources/{cluster}/resources": { + "post": { + "summary": "Batch Create Resources", + "parameters": [ + { "name": "cluster", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "requestBody": { + "required": true, + "content": { + "*/*": { + "schema": { "type": "array", "items": { "type": "object" } } + } + } + }, + "responses": { "204": { "description": "No Content" } } + } + }, + "/kubernetes/{cluster_name}/apis/app.k8s.io/v1beta1/namespaces/{namespace}/applications/{name}": { + "get": { + "summary": "Get Application (K8s API)", + "parameters": [ + { "name": "cluster_name", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "namespace", "in": "path", "required": true, "schema": { "type": "string" } }, + { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } } + ], + "responses": { + "200": { + "description": "Successful", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/Application" } + } + } + } + } + } + }, + "/acp/v1/kubernetes/{cluster}/general-namespaces": { + "post": { + "summary": "Create General Namespaces", + "description": "Creates a namespace with LimitRange and ResourceQuota.", + "parameters": [ + { + "name": "cluster", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "project_name", + "in": "query", + "schema": { "type": "string" }, + "description": "The associated project name." + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/GeneralNamespace" } + } + } + }, + "responses": { + "200": { + "description": "Successful", + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/GeneralNamespace" } + } + } + } + } + } + }, + "/acp/v1/kubernetes/{cluster_name}/namespaces/{namespace}/applications/{name}/chartpackage": { + "post": { + "summary": "Export Application as Chart Package", + "description": "Exports the application as a Helm chart package (.tar.gz).", + "parameters": [ + { + "name": "cluster_name", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "namespace", + "in": "path", + "required": true, + "schema": { "type": "string" } + }, + { + "name": "name", + "in": "path", + "required": true, + "schema": { "type": "string" } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { "$ref": "#/components/schemas/ApplicationChartPackage" } + } + } + }, + "responses": { + "200": { + "description": "Chart package stream.", + "content": { + "application/x-gzip": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "ObjectMeta": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "namespace": { "type": "string" }, + "uid": { "type": "string" }, + "resourceVersion": { "type": "string" }, + "creationTimestamp": { "type": "string" }, + "labels": { "type": "object", "additionalProperties": { "type": "string" } }, + "annotations": { "type": "object", "additionalProperties": { "type": "string" } } + } + }, + "Application": { + "type": "object", + "properties": { + "kind": { "type": "string", "example": "Application" }, + "apiVersion": { "type": "string", "example": "app.k8s.io/v1beta1" }, + "metadata": { "$ref": "#/components/schemas/ObjectMeta" }, + "spec": { "$ref": "#/components/schemas/ApplicationSpec" }, + "status": { "$ref": "#/components/schemas/ApplicationStatus" } + } + }, + "ApplicationSpec": { + "type": "object", + "properties": { + "componentTemplates": { + "type": "array", + "items": { "$ref": "#/components/schemas/KubernetesResource" } + }, + "assemblyPhase": { "type": "string" }, + "componentKinds": { + "type": "array", + "items": { + "type": "object", + "properties": { + "group": { "type": "string" }, + "kind": { "type": "string" } + } + } + }, + "selector": { "type": "object" }, + "descriptor": { "type": "object" } + } + }, + "KubernetesResource": { + "type": "object", + "description": "A generic Kubernetes resource object.", + "required": ["apiVersion", "kind"], + "properties": { + "apiVersion": { "type": "string" }, + "kind": { "type": "string" }, + "metadata": { "$ref": "#/components/schemas/ObjectMeta" }, + "spec": { "type": "object", "description": "The specification of the resource." }, + "status": { "type": "object", "description": "The current status of the resource." } + } + }, + "ApplicationStatus": { + "type": "object", + "properties": { + "state": { "type": "string" }, + "totalComponents": { "type": "integer" }, + "workloadsStatus": { + "type": "object", + "properties": { + "ready": { "type": "integer" }, + "pending": { "type": "integer" }, + "workloads": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "kind": { "type": "string" }, + "group": { "type": "string" }, + "status": { "type": "string" }, + "current": { "type": "integer" }, + "desired": { "type": "integer" }, + "messages": { "type": "array", "items": { "type": "object" } } + } + } + } + } + }, + "conditions": { "type": "array", "items": { "type": "object" } }, + "observedGeneration": { "type": "integer" } + } + }, + "GeneralNamespace": { + "type": "object", + "properties": { + "namespace": { "$ref": "#/components/schemas/KubernetesResource" }, + "resourcequota": { "$ref": "#/components/schemas/KubernetesResource" }, + "limitrange": { "$ref": "#/components/schemas/KubernetesResource" } + } + }, + "ApplicationChartPackage": { + "type": "object", + "properties": { + "kind": { "type": "string", "example": "ApplicationChartPackage" }, + "apiVersion": { "type": "string", "example": "app.k8s.io/v1beta1" }, + "metadata": { "$ref": "#/components/schemas/ObjectMeta" }, + "spec": { + "type": "object", + "properties": { + "name": { "type": "string", "description": "Chart name" }, + "version": { "type": "string", "description": "Chart version" }, + "description": { "type": "string", "description": "Chart description" }, + "revision": { "type": "integer", "description": "Application version number, optional. If omitted, refers to the current version." } + } + } + } + } + } + } +}