From d5d40443e6263173dfe115012fc914063030fc41 Mon Sep 17 00:00:00 2001 From: wangzhengkun Date: Tue, 14 Jun 2022 14:57:10 +0800 Subject: [PATCH] =?UTF-8?q?feat=20:=20=E4=BF=AE=E6=94=B9=20api=20=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/server/docs/docs.go | 413 ++++++++++++++++++----------- cmd/server/docs/swagger.json | 413 ++++++++++++++++++----------- cmd/server/docs/swagger.yaml | 275 +++++++++++-------- internal/api/v1/session/session.go | 8 + 4 files changed, 684 insertions(+), 425 deletions(-) diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 4531df1a..78487391 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -79,7 +79,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/internal_api_v1_cluster.Cluster" + "$ref": "#/definitions/internal_model_v1_cluster.Cluster" } } ], @@ -87,7 +87,7 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/internal_api_v1_cluster.Cluster" + "$ref": "#/definitions/internal_model_v1_cluster.Cluster" } } } @@ -1233,6 +1233,33 @@ const docTemplate = `{ } } }, + "/sessions": { + "post": { + "description": "User Login", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "sessions" + ], + "summary": "User Login", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/session.LoginCredential" + } + } + ], + "responses": {} + } + }, "/users": { "get": { "security": [ @@ -1447,54 +1474,6 @@ const docTemplate = `{ } } }, - "cluster.Authentication": { - "type": "object", - "properties": { - "bearerToken": { - "type": "string" - }, - "certificate": { - "$ref": "#/definitions/cluster.Certificate" - }, - "configFileContent": { - "type": "array", - "items": { - "type": "integer" - } - }, - "mode": { - "type": "string" - } - } - }, - "cluster.Certificate": { - "type": "object", - "properties": { - "certData": { - "type": "array", - "items": { - "type": "integer" - } - }, - "keyData": { - "type": "array", - "items": { - "type": "integer" - } - } - } - }, - "cluster.Connect": { - "type": "object", - "properties": { - "direction": { - "type": "string" - }, - "forward": { - "$ref": "#/definitions/cluster.Forward" - } - } - }, "cluster.CreateRepo": { "type": "object", "properties": { @@ -1509,46 +1488,6 @@ const docTemplate = `{ } } }, - "cluster.ExtraClusterInfo": { - "type": "object", - "properties": { - "cpuAllocatable": { - "type": "number" - }, - "cpuRequested": { - "type": "number" - }, - "health": { - "type": "boolean" - }, - "memoryAllocatable": { - "type": "number" - }, - "memoryRequested": { - "type": "number" - }, - "message": { - "type": "string" - }, - "readyNodeNum": { - "type": "integer" - }, - "totalNodeNum": { - "type": "integer" - } - } - }, - "cluster.Forward": { - "type": "object", - "properties": { - "apiServer": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/cluster.Proxy" - } - } - }, "cluster.Member": { "type": "object", "properties": { @@ -1589,48 +1528,6 @@ const docTemplate = `{ } } }, - "cluster.Proxy": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "url": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "cluster.Spec": { - "type": "object", - "properties": { - "authentication": { - "$ref": "#/definitions/cluster.Authentication" - }, - "connect": { - "$ref": "#/definitions/cluster.Connect" - }, - "local": { - "type": "boolean" - } - } - }, - "cluster.Status": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "phase": { - "type": "string" - }, - "version": { - "type": "string" - } - } - }, "cluster.UpdateCluster": { "type": "object", "properties": { @@ -1725,6 +1622,43 @@ const docTemplate = `{ } } }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Authentication": { + "type": "object", + "properties": { + "bearerToken": { + "type": "string" + }, + "certificate": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Certificate" + }, + "configFileContent": { + "type": "array", + "items": { + "type": "integer" + } + }, + "mode": { + "type": "string" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Certificate": { + "type": "object", + "properties": { + "certData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "keyData": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster": { "type": "object", "properties": { @@ -1735,7 +1669,7 @@ const docTemplate = `{ "type": "boolean" }, "caCertificate": { - "$ref": "#/definitions/cluster.Certificate" + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Certificate" }, "createAt": { "type": "string" @@ -1765,10 +1699,10 @@ const docTemplate = `{ } }, "spec": { - "$ref": "#/definitions/cluster.Spec" + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Spec" }, "status": { - "$ref": "#/definitions/cluster.Status" + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Status" }, "updateAt": { "type": "string" @@ -1778,6 +1712,70 @@ const docTemplate = `{ } } }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Connect": { + "type": "object", + "properties": { + "direction": { + "type": "string" + }, + "forward": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Forward" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Forward": { + "type": "object", + "properties": { + "apiServer": { + "type": "string" + }, + "proxy": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Proxy" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Proxy": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "url": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Spec": { + "type": "object", + "properties": { + "authentication": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Authentication" + }, + "connect": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Connect" + }, + "local": { + "type": "boolean" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Status": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "phase": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, "imagerepo.Credential": { "type": "object", "properties": { @@ -1931,12 +1929,46 @@ const docTemplate = `{ } } }, - "internal_api_v1_cluster.Cluster": { + "internal_model_v1_cluster.Authentication": { "type": "object", "properties": { - "accessable": { - "type": "boolean" + "bearerToken": { + "type": "string" }, + "certificate": { + "$ref": "#/definitions/internal_model_v1_cluster.Certificate" + }, + "configFileContent": { + "type": "array", + "items": { + "type": "integer" + } + }, + "mode": { + "type": "string" + } + } + }, + "internal_model_v1_cluster.Certificate": { + "type": "object", + "properties": { + "certData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "keyData": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "internal_model_v1_cluster.Cluster": { + "type": "object", + "properties": { "apiVersion": { "type": "string" }, @@ -1944,16 +1976,7 @@ const docTemplate = `{ "type": "boolean" }, "caCertificate": { - "$ref": "#/definitions/cluster.Certificate" - }, - "caDataStr": { - "type": "string" - }, - "certDataStr": { - "type": "string" - }, - "configContentStr": { - "type": "string" + "$ref": "#/definitions/internal_model_v1_cluster.Certificate" }, "createAt": { "type": "string" @@ -1964,12 +1987,6 @@ const docTemplate = `{ "description": { "type": "string" }, - "extraClusterInfo": { - "$ref": "#/definitions/cluster.ExtraClusterInfo" - }, - "keyDataStr": { - "type": "string" - }, "kind": { "type": "string" }, @@ -1979,9 +1996,6 @@ const docTemplate = `{ "type": "string" } }, - "memberCount": { - "type": "integer" - }, "name": { "type": "string" }, @@ -1992,10 +2006,10 @@ const docTemplate = `{ } }, "spec": { - "$ref": "#/definitions/cluster.Spec" + "$ref": "#/definitions/internal_model_v1_cluster.Spec" }, "status": { - "$ref": "#/definitions/cluster.Status" + "$ref": "#/definitions/internal_model_v1_cluster.Status" }, "updateAt": { "type": "string" @@ -2005,6 +2019,70 @@ const docTemplate = `{ } } }, + "internal_model_v1_cluster.Connect": { + "type": "object", + "properties": { + "direction": { + "type": "string" + }, + "forward": { + "$ref": "#/definitions/internal_model_v1_cluster.Forward" + } + } + }, + "internal_model_v1_cluster.Forward": { + "type": "object", + "properties": { + "apiServer": { + "type": "string" + }, + "proxy": { + "$ref": "#/definitions/internal_model_v1_cluster.Proxy" + } + } + }, + "internal_model_v1_cluster.Proxy": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "url": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "internal_model_v1_cluster.Spec": { + "type": "object", + "properties": { + "authentication": { + "$ref": "#/definitions/internal_model_v1_cluster.Authentication" + }, + "connect": { + "$ref": "#/definitions/internal_model_v1_cluster.Connect" + }, + "local": { + "type": "boolean" + } + } + }, + "internal_model_v1_cluster.Status": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "phase": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, "role.PolicyRule": { "type": "object", "properties": { @@ -2066,6 +2144,23 @@ const docTemplate = `{ } } }, + "session.LoginCredential": { + "type": "object", + "properties": { + "authMethod": { + "type": "string" + }, + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "user.Authenticate": { "type": "object", "properties": { diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json index d56d3abf..08675258 100644 --- a/cmd/server/docs/swagger.json +++ b/cmd/server/docs/swagger.json @@ -69,7 +69,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/internal_api_v1_cluster.Cluster" + "$ref": "#/definitions/internal_model_v1_cluster.Cluster" } } ], @@ -77,7 +77,7 @@ "200": { "description": "OK", "schema": { - "$ref": "#/definitions/internal_api_v1_cluster.Cluster" + "$ref": "#/definitions/internal_model_v1_cluster.Cluster" } } } @@ -1223,6 +1223,33 @@ } } }, + "/sessions": { + "post": { + "description": "User Login", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "tags": [ + "sessions" + ], + "summary": "User Login", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/session.LoginCredential" + } + } + ], + "responses": {} + } + }, "/users": { "get": { "security": [ @@ -1437,54 +1464,6 @@ } } }, - "cluster.Authentication": { - "type": "object", - "properties": { - "bearerToken": { - "type": "string" - }, - "certificate": { - "$ref": "#/definitions/cluster.Certificate" - }, - "configFileContent": { - "type": "array", - "items": { - "type": "integer" - } - }, - "mode": { - "type": "string" - } - } - }, - "cluster.Certificate": { - "type": "object", - "properties": { - "certData": { - "type": "array", - "items": { - "type": "integer" - } - }, - "keyData": { - "type": "array", - "items": { - "type": "integer" - } - } - } - }, - "cluster.Connect": { - "type": "object", - "properties": { - "direction": { - "type": "string" - }, - "forward": { - "$ref": "#/definitions/cluster.Forward" - } - } - }, "cluster.CreateRepo": { "type": "object", "properties": { @@ -1499,46 +1478,6 @@ } } }, - "cluster.ExtraClusterInfo": { - "type": "object", - "properties": { - "cpuAllocatable": { - "type": "number" - }, - "cpuRequested": { - "type": "number" - }, - "health": { - "type": "boolean" - }, - "memoryAllocatable": { - "type": "number" - }, - "memoryRequested": { - "type": "number" - }, - "message": { - "type": "string" - }, - "readyNodeNum": { - "type": "integer" - }, - "totalNodeNum": { - "type": "integer" - } - } - }, - "cluster.Forward": { - "type": "object", - "properties": { - "apiServer": { - "type": "string" - }, - "proxy": { - "$ref": "#/definitions/cluster.Proxy" - } - } - }, "cluster.Member": { "type": "object", "properties": { @@ -1579,48 +1518,6 @@ } } }, - "cluster.Proxy": { - "type": "object", - "properties": { - "password": { - "type": "string" - }, - "url": { - "type": "string" - }, - "username": { - "type": "string" - } - } - }, - "cluster.Spec": { - "type": "object", - "properties": { - "authentication": { - "$ref": "#/definitions/cluster.Authentication" - }, - "connect": { - "$ref": "#/definitions/cluster.Connect" - }, - "local": { - "type": "boolean" - } - } - }, - "cluster.Status": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "phase": { - "type": "string" - }, - "version": { - "type": "string" - } - } - }, "cluster.UpdateCluster": { "type": "object", "properties": { @@ -1715,6 +1612,43 @@ } } }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Authentication": { + "type": "object", + "properties": { + "bearerToken": { + "type": "string" + }, + "certificate": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Certificate" + }, + "configFileContent": { + "type": "array", + "items": { + "type": "integer" + } + }, + "mode": { + "type": "string" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Certificate": { + "type": "object", + "properties": { + "certData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "keyData": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster": { "type": "object", "properties": { @@ -1725,7 +1659,7 @@ "type": "boolean" }, "caCertificate": { - "$ref": "#/definitions/cluster.Certificate" + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Certificate" }, "createAt": { "type": "string" @@ -1755,10 +1689,10 @@ } }, "spec": { - "$ref": "#/definitions/cluster.Spec" + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Spec" }, "status": { - "$ref": "#/definitions/cluster.Status" + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Status" }, "updateAt": { "type": "string" @@ -1768,6 +1702,70 @@ } } }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Connect": { + "type": "object", + "properties": { + "direction": { + "type": "string" + }, + "forward": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Forward" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Forward": { + "type": "object", + "properties": { + "apiServer": { + "type": "string" + }, + "proxy": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Proxy" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Proxy": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "url": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Spec": { + "type": "object", + "properties": { + "authentication": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Authentication" + }, + "connect": { + "$ref": "#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Connect" + }, + "local": { + "type": "boolean" + } + } + }, + "github.com_KubeOperator_kubepi_internal_model_v1_cluster.Status": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "phase": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, "imagerepo.Credential": { "type": "object", "properties": { @@ -1921,12 +1919,46 @@ } } }, - "internal_api_v1_cluster.Cluster": { + "internal_model_v1_cluster.Authentication": { "type": "object", "properties": { - "accessable": { - "type": "boolean" + "bearerToken": { + "type": "string" }, + "certificate": { + "$ref": "#/definitions/internal_model_v1_cluster.Certificate" + }, + "configFileContent": { + "type": "array", + "items": { + "type": "integer" + } + }, + "mode": { + "type": "string" + } + } + }, + "internal_model_v1_cluster.Certificate": { + "type": "object", + "properties": { + "certData": { + "type": "array", + "items": { + "type": "integer" + } + }, + "keyData": { + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + "internal_model_v1_cluster.Cluster": { + "type": "object", + "properties": { "apiVersion": { "type": "string" }, @@ -1934,16 +1966,7 @@ "type": "boolean" }, "caCertificate": { - "$ref": "#/definitions/cluster.Certificate" - }, - "caDataStr": { - "type": "string" - }, - "certDataStr": { - "type": "string" - }, - "configContentStr": { - "type": "string" + "$ref": "#/definitions/internal_model_v1_cluster.Certificate" }, "createAt": { "type": "string" @@ -1954,12 +1977,6 @@ "description": { "type": "string" }, - "extraClusterInfo": { - "$ref": "#/definitions/cluster.ExtraClusterInfo" - }, - "keyDataStr": { - "type": "string" - }, "kind": { "type": "string" }, @@ -1969,9 +1986,6 @@ "type": "string" } }, - "memberCount": { - "type": "integer" - }, "name": { "type": "string" }, @@ -1982,10 +1996,10 @@ } }, "spec": { - "$ref": "#/definitions/cluster.Spec" + "$ref": "#/definitions/internal_model_v1_cluster.Spec" }, "status": { - "$ref": "#/definitions/cluster.Status" + "$ref": "#/definitions/internal_model_v1_cluster.Status" }, "updateAt": { "type": "string" @@ -1995,6 +2009,70 @@ } } }, + "internal_model_v1_cluster.Connect": { + "type": "object", + "properties": { + "direction": { + "type": "string" + }, + "forward": { + "$ref": "#/definitions/internal_model_v1_cluster.Forward" + } + } + }, + "internal_model_v1_cluster.Forward": { + "type": "object", + "properties": { + "apiServer": { + "type": "string" + }, + "proxy": { + "$ref": "#/definitions/internal_model_v1_cluster.Proxy" + } + } + }, + "internal_model_v1_cluster.Proxy": { + "type": "object", + "properties": { + "password": { + "type": "string" + }, + "url": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, + "internal_model_v1_cluster.Spec": { + "type": "object", + "properties": { + "authentication": { + "$ref": "#/definitions/internal_model_v1_cluster.Authentication" + }, + "connect": { + "$ref": "#/definitions/internal_model_v1_cluster.Connect" + }, + "local": { + "type": "boolean" + } + } + }, + "internal_model_v1_cluster.Status": { + "type": "object", + "properties": { + "message": { + "type": "string" + }, + "phase": { + "type": "string" + }, + "version": { + "type": "string" + } + } + }, "role.PolicyRule": { "type": "object", "properties": { @@ -2056,6 +2134,23 @@ } } }, + "session.LoginCredential": { + "type": "object", + "properties": { + "authMethod": { + "type": "string" + }, + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "username": { + "type": "string" + } + } + }, "user.Authenticate": { "type": "object", "properties": { diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml index fb32236a..1243eb5c 100644 --- a/cmd/server/docs/swagger.yaml +++ b/cmd/server/docs/swagger.yaml @@ -6,37 +6,6 @@ definitions: total: type: integer type: object - cluster.Authentication: - properties: - bearerToken: - type: string - certificate: - $ref: '#/definitions/cluster.Certificate' - configFileContent: - items: - type: integer - type: array - mode: - type: string - type: object - cluster.Certificate: - properties: - certData: - items: - type: integer - type: array - keyData: - items: - type: integer - type: array - type: object - cluster.Connect: - properties: - direction: - type: string - forward: - $ref: '#/definitions/cluster.Forward' - type: object cluster.CreateRepo: properties: cluster: @@ -46,32 +15,6 @@ definitions: type: string type: array type: object - cluster.ExtraClusterInfo: - properties: - cpuAllocatable: - type: number - cpuRequested: - type: number - health: - type: boolean - memoryAllocatable: - type: number - memoryRequested: - type: number - message: - type: string - readyNodeNum: - type: integer - totalNodeNum: - type: integer - type: object - cluster.Forward: - properties: - apiServer: - type: string - proxy: - $ref: '#/definitions/cluster.Proxy' - type: object cluster.Member: properties: bindingName: @@ -98,33 +41,6 @@ definitions: type: string type: array type: object - cluster.Proxy: - properties: - password: - type: string - url: - type: string - username: - type: string - type: object - cluster.Spec: - properties: - authentication: - $ref: '#/definitions/cluster.Authentication' - connect: - $ref: '#/definitions/cluster.Connect' - local: - type: boolean - type: object - cluster.Status: - properties: - message: - type: string - phase: - type: string - version: - type: string - type: object cluster.UpdateCluster: properties: labels: @@ -186,6 +102,30 @@ definitions: type: string type: array type: object + github.com_KubeOperator_kubepi_internal_model_v1_cluster.Authentication: + properties: + bearerToken: + type: string + certificate: + $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Certificate' + configFileContent: + items: + type: integer + type: array + mode: + type: string + type: object + github.com_KubeOperator_kubepi_internal_model_v1_cluster.Certificate: + properties: + certData: + items: + type: integer + type: array + keyData: + items: + type: integer + type: array + type: object github.com_KubeOperator_kubepi_internal_model_v1_cluster.Cluster: properties: apiVersion: @@ -193,7 +133,7 @@ definitions: builtIn: type: boolean caCertificate: - $ref: '#/definitions/cluster.Certificate' + $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Certificate' createAt: type: string createdBy: @@ -213,14 +153,55 @@ definitions: type: integer type: array spec: - $ref: '#/definitions/cluster.Spec' + $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Spec' status: - $ref: '#/definitions/cluster.Status' + $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Status' updateAt: type: string uuid: type: string type: object + github.com_KubeOperator_kubepi_internal_model_v1_cluster.Connect: + properties: + direction: + type: string + forward: + $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Forward' + type: object + github.com_KubeOperator_kubepi_internal_model_v1_cluster.Forward: + properties: + apiServer: + type: string + proxy: + $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Proxy' + type: object + github.com_KubeOperator_kubepi_internal_model_v1_cluster.Proxy: + properties: + password: + type: string + url: + type: string + username: + type: string + type: object + github.com_KubeOperator_kubepi_internal_model_v1_cluster.Spec: + properties: + authentication: + $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Authentication' + connect: + $ref: '#/definitions/github.com_KubeOperator_kubepi_internal_model_v1_cluster.Connect' + local: + type: boolean + type: object + github.com_KubeOperator_kubepi_internal_model_v1_cluster.Status: + properties: + message: + type: string + phase: + type: string + version: + type: string + type: object imagerepo.Credential: properties: password: @@ -322,40 +303,50 @@ definitions: type: string type: array type: object - internal_api_v1_cluster.Cluster: + internal_model_v1_cluster.Authentication: + properties: + bearerToken: + type: string + certificate: + $ref: '#/definitions/internal_model_v1_cluster.Certificate' + configFileContent: + items: + type: integer + type: array + mode: + type: string + type: object + internal_model_v1_cluster.Certificate: + properties: + certData: + items: + type: integer + type: array + keyData: + items: + type: integer + type: array + type: object + internal_model_v1_cluster.Cluster: properties: - accessable: - type: boolean apiVersion: type: string builtIn: type: boolean caCertificate: - $ref: '#/definitions/cluster.Certificate' - caDataStr: - type: string - certDataStr: - type: string - configContentStr: - type: string + $ref: '#/definitions/internal_model_v1_cluster.Certificate' createAt: type: string createdBy: type: string description: type: string - extraClusterInfo: - $ref: '#/definitions/cluster.ExtraClusterInfo' - keyDataStr: - type: string kind: type: string labels: items: type: string type: array - memberCount: - type: integer name: type: string privateKey: @@ -363,14 +354,55 @@ definitions: type: integer type: array spec: - $ref: '#/definitions/cluster.Spec' + $ref: '#/definitions/internal_model_v1_cluster.Spec' status: - $ref: '#/definitions/cluster.Status' + $ref: '#/definitions/internal_model_v1_cluster.Status' updateAt: type: string uuid: type: string type: object + internal_model_v1_cluster.Connect: + properties: + direction: + type: string + forward: + $ref: '#/definitions/internal_model_v1_cluster.Forward' + type: object + internal_model_v1_cluster.Forward: + properties: + apiServer: + type: string + proxy: + $ref: '#/definitions/internal_model_v1_cluster.Proxy' + type: object + internal_model_v1_cluster.Proxy: + properties: + password: + type: string + url: + type: string + username: + type: string + type: object + internal_model_v1_cluster.Spec: + properties: + authentication: + $ref: '#/definitions/internal_model_v1_cluster.Authentication' + connect: + $ref: '#/definitions/internal_model_v1_cluster.Connect' + local: + type: boolean + type: object + internal_model_v1_cluster.Status: + properties: + message: + type: string + phase: + type: string + version: + type: string + type: object role.PolicyRule: properties: resource: @@ -411,6 +443,17 @@ definitions: uuid: type: string type: object + session.LoginCredential: + properties: + authMethod: + type: string + email: + type: string + password: + type: string + username: + type: string + type: object user.Authenticate: properties: password: @@ -907,14 +950,14 @@ paths: name: request required: true schema: - $ref: '#/definitions/internal_api_v1_cluster.Cluster' + $ref: '#/definitions/internal_model_v1_cluster.Cluster' produces: - application/json responses: "200": description: OK schema: - $ref: '#/definitions/internal_api_v1_cluster.Cluster' + $ref: '#/definitions/internal_model_v1_cluster.Cluster' security: - ApiKeyAuth: [] summary: Create Cluster @@ -1639,6 +1682,24 @@ paths: summary: Update role by name tags: - roles + /sessions: + post: + consumes: + - application/json + description: User Login + parameters: + - description: request + in: body + name: request + required: true + schema: + $ref: '#/definitions/session.LoginCredential' + produces: + - application/json + responses: {} + summary: User Login + tags: + - sessions /users: get: consumes: diff --git a/internal/api/v1/session/session.go b/internal/api/v1/session/session.go index 9a6e39df..08cae0d1 100644 --- a/internal/api/v1/session/session.go +++ b/internal/api/v1/session/session.go @@ -82,6 +82,14 @@ func (h *Handler) IsLogin() iris.Handler { } } +// Auth +// @Tags sessions +// @Summary User Login +// @Description User Login +// @Accept json +// @Produce json +// @Param request body LoginCredential true "request" +// @Router /sessions [post] func (h *Handler) Login() iris.Handler { return func(ctx *context.Context) { var loginCredential LoginCredential