feat : user api 文档

This commit is contained in:
wangzhengkun
2022-06-06 12:19:50 +08:00
parent 4644b84e07
commit 07ca05a495
6 changed files with 1032 additions and 5 deletions

380
cmd/server/docs/docs.go Normal file
View File

@@ -0,0 +1,380 @@
// Package docs GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"termsOfService": "http://kubeoperator.io",
"contact": {
"name": "Fit2cloud Support",
"url": "https://www.fit2cloud.com",
"email": "support@fit2cloud.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/users": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "List all users",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "List all users",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/user.User"
}
}
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Create user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Create user",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/docs.UserCreate"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/user.User"
}
}
}
}
},
"/users/search": {
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Search users by Condition",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Search users",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.Page"
}
}
}
}
},
"/users/{name}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Get user by name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Get user by name",
"parameters": [
{
"type": "string",
"description": "用户名称",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/user.User"
}
}
}
},
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Update user by name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Update user by name",
"parameters": [
{
"type": "string",
"description": "用户名称",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/user.User"
}
}
}
},
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Delete user by name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Delete user by name",
"parameters": [
{
"type": "string",
"description": "用户名称",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/user.User"
}
}
}
}
}
},
"definitions": {
"api.Page": {
"type": "object",
"properties": {
"items": {},
"total": {
"type": "integer"
}
}
},
"docs.Authenticate": {
"type": "object",
"properties": {
"password": {
"type": "string"
}
}
},
"docs.Mfa": {
"type": "object",
"properties": {
"enable": {
"type": "boolean"
}
}
},
"docs.UserCreate": {
"type": "object",
"properties": {
"authenticate": {
"$ref": "#/definitions/docs.Authenticate"
},
"email": {
"type": "string"
},
"isAdmin": {
"type": "boolean"
},
"mfa": {
"$ref": "#/definitions/docs.Mfa"
},
"name": {
"type": "string"
},
"nickName": {
"type": "string"
}
}
},
"user.Authenticate": {
"type": "object",
"properties": {
"password": {
"type": "string"
},
"token": {
"type": "string"
}
}
},
"user.Mfa": {
"type": "object",
"properties": {
"enable": {
"type": "boolean"
},
"secret": {
"type": "string"
}
}
},
"user.User": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
},
"authenticate": {
"$ref": "#/definitions/user.Authenticate"
},
"builtIn": {
"type": "boolean"
},
"createAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"description": {
"type": "string"
},
"email": {
"type": "string"
},
"isAdmin": {
"type": "boolean"
},
"kind": {
"type": "string"
},
"language": {
"type": "string"
},
"mfa": {
"$ref": "#/definitions/user.Mfa"
},
"name": {
"type": "string"
},
"nickName": {
"type": "string"
},
"type": {
"type": "string"
},
"updateAt": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "",
Host: "",
BasePath: "/kubepi/api/v1",
Schemes: []string{},
Title: "KubePi Restful API",
Description: "",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}