feat: 接入swagger功能
This commit is contained in:
294
swagger2docs/docs.go
Normal file
294
swagger2docs/docs.go
Normal file
@@ -0,0 +1,294 @@
|
||||
// Package swagger2docs Code generated by swaggo/swag. DO NOT EDIT
|
||||
package swagger2docs
|
||||
|
||||
import "github.com/swaggo/swag"
|
||||
|
||||
const docTemplate = `{
|
||||
"schemes": {{ marshal .Schemes }},
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "{{escape .Description}}",
|
||||
"title": "{{.Title}}",
|
||||
"contact": {},
|
||||
"version": "{{.Version}}"
|
||||
},
|
||||
"host": "{{.Host}}",
|
||||
"basePath": "{{.BasePath}}",
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"description": "Root Route",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"common"
|
||||
],
|
||||
"summary": "Root Route",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/chart/graph": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Getting Relationship Map Data",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"chart"
|
||||
],
|
||||
"summary": "Getting Relationship Map Data",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Group",
|
||||
"name": "group",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"node",
|
||||
"edge",
|
||||
"combo"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "Type oneof=node edge combo",
|
||||
"name": "type",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/chart/graph/": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Saving Relationship Diagram Data",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"chart"
|
||||
],
|
||||
"summary": "Saving Relationship Diagram Data",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "{group:'',data:{nodes:[],edges:[],combos:[]}}",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/chart/graph/:group": {
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Deleting Relationship Diagram Data",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"chart"
|
||||
],
|
||||
"summary": "Deleting Relationship Diagram Data",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Group",
|
||||
"name": "group",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/chart/graph/groups": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Get relationship graph group name",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"chart"
|
||||
],
|
||||
"summary": "Get relationship graph group name",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ne/action/pushFile": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Sending files from local to network elements",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"network_element"
|
||||
],
|
||||
"summary": "Sending files from local to network elements",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"ApiKeyAuth": {
|
||||
"description": "Get the key through the login interface, fill in e.g. Bearer \u003caccess_token\u003e",
|
||||
"type": "apiKey",
|
||||
"name": "Authorization",
|
||||
"in": "header"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"description": "chart interface",
|
||||
"name": "chart"
|
||||
},
|
||||
{
|
||||
"description": "common interface",
|
||||
"name": "common"
|
||||
},
|
||||
{
|
||||
"description": "monitor interface",
|
||||
"name": "monitor"
|
||||
},
|
||||
{
|
||||
"description": "network data interface",
|
||||
"name": "network_data"
|
||||
},
|
||||
{
|
||||
"description": "network element interface",
|
||||
"name": "network_element"
|
||||
},
|
||||
{
|
||||
"description": "system interface",
|
||||
"name": "system"
|
||||
},
|
||||
{
|
||||
"description": "tool interface",
|
||||
"name": "tool"
|
||||
},
|
||||
{
|
||||
"description": "trace interface",
|
||||
"name": "trace"
|
||||
},
|
||||
{
|
||||
"description": "ws interface",
|
||||
"name": "ws"
|
||||
}
|
||||
]
|
||||
}`
|
||||
|
||||
// SwaggerInfo holds exported Swagger Info so clients can modify it
|
||||
var SwaggerInfo = &swag.Spec{
|
||||
Version: "1.0.5",
|
||||
Host: "127.0.0.1:33040",
|
||||
BasePath: "/",
|
||||
Schemes: []string{"http", "https"},
|
||||
Title: "OMC Swagger API",
|
||||
Description: "OMC Service Interface Info",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
RightDelim: "}}",
|
||||
}
|
||||
|
||||
func init() {
|
||||
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
|
||||
}
|
||||
274
swagger2docs/swagger.json
Normal file
274
swagger2docs/swagger.json
Normal file
@@ -0,0 +1,274 @@
|
||||
{
|
||||
"schemes": [
|
||||
"http",
|
||||
"https"
|
||||
],
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "OMC Service Interface Info",
|
||||
"title": "OMC Swagger API",
|
||||
"contact": {},
|
||||
"version": "1.0.5"
|
||||
},
|
||||
"host": "127.0.0.1:33040",
|
||||
"basePath": "/",
|
||||
"paths": {
|
||||
"/": {
|
||||
"get": {
|
||||
"description": "Root Route",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"common"
|
||||
],
|
||||
"summary": "Root Route",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/chart/graph": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Getting Relationship Map Data",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"chart"
|
||||
],
|
||||
"summary": "Getting Relationship Map Data",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Group",
|
||||
"name": "group",
|
||||
"in": "query",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"node",
|
||||
"edge",
|
||||
"combo"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "Type oneof=node edge combo",
|
||||
"name": "type",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/chart/graph/": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Saving Relationship Diagram Data",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"chart"
|
||||
],
|
||||
"summary": "Saving Relationship Diagram Data",
|
||||
"parameters": [
|
||||
{
|
||||
"description": "{group:'',data:{nodes:[],edges:[],combos:[]}}",
|
||||
"name": "data",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/chart/graph/:group": {
|
||||
"delete": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Deleting Relationship Diagram Data",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"chart"
|
||||
],
|
||||
"summary": "Deleting Relationship Diagram Data",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Group",
|
||||
"name": "group",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/chart/graph/groups": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Get relationship graph group name",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"chart"
|
||||
],
|
||||
"summary": "Get relationship graph group name",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/ne/action/pushFile": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Sending files from local to network elements",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"network_element"
|
||||
],
|
||||
"summary": "Sending files from local to network elements",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "data",
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"additionalProperties": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
"ApiKeyAuth": {
|
||||
"description": "Get the key through the login interface, fill in e.g. Bearer \u003caccess_token\u003e",
|
||||
"type": "apiKey",
|
||||
"name": "Authorization",
|
||||
"in": "header"
|
||||
}
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"description": "chart interface",
|
||||
"name": "chart"
|
||||
},
|
||||
{
|
||||
"description": "common interface",
|
||||
"name": "common"
|
||||
},
|
||||
{
|
||||
"description": "monitor interface",
|
||||
"name": "monitor"
|
||||
},
|
||||
{
|
||||
"description": "network data interface",
|
||||
"name": "network_data"
|
||||
},
|
||||
{
|
||||
"description": "network element interface",
|
||||
"name": "network_element"
|
||||
},
|
||||
{
|
||||
"description": "system interface",
|
||||
"name": "system"
|
||||
},
|
||||
{
|
||||
"description": "tool interface",
|
||||
"name": "tool"
|
||||
},
|
||||
{
|
||||
"description": "trace interface",
|
||||
"name": "trace"
|
||||
},
|
||||
{
|
||||
"description": "ws interface",
|
||||
"name": "ws"
|
||||
}
|
||||
]
|
||||
}
|
||||
172
swagger2docs/swagger.yaml
Normal file
172
swagger2docs/swagger.yaml
Normal file
@@ -0,0 +1,172 @@
|
||||
basePath: /
|
||||
host: 127.0.0.1:33040
|
||||
info:
|
||||
contact: {}
|
||||
description: OMC Service Interface Info
|
||||
title: OMC Swagger API
|
||||
version: 1.0.5
|
||||
paths:
|
||||
/:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Root Route
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: data
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
summary: Root Route
|
||||
tags:
|
||||
- common
|
||||
/chart/graph:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Getting Relationship Map Data
|
||||
parameters:
|
||||
- description: Group
|
||||
in: query
|
||||
name: group
|
||||
required: true
|
||||
type: string
|
||||
- description: Type oneof=node edge combo
|
||||
enum:
|
||||
- node
|
||||
- edge
|
||||
- combo
|
||||
in: query
|
||||
name: type
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: data
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Getting Relationship Map Data
|
||||
tags:
|
||||
- chart
|
||||
/chart/graph/:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Saving Relationship Diagram Data
|
||||
parameters:
|
||||
- description: '{group:'''',data:{nodes:[],edges:[],combos:[]}}'
|
||||
in: body
|
||||
name: data
|
||||
required: true
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: data
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Saving Relationship Diagram Data
|
||||
tags:
|
||||
- chart
|
||||
/chart/graph/:group:
|
||||
delete:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Deleting Relationship Diagram Data
|
||||
parameters:
|
||||
- description: Group
|
||||
in: path
|
||||
name: group
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: data
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Deleting Relationship Diagram Data
|
||||
tags:
|
||||
- chart
|
||||
/chart/graph/groups:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Get relationship graph group name
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: data
|
||||
schema:
|
||||
additionalProperties: true
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Get relationship graph group name
|
||||
tags:
|
||||
- chart
|
||||
/ne/action/pushFile:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Sending files from local to network elements
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: data
|
||||
schema:
|
||||
additionalProperties: {}
|
||||
type: object
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Sending files from local to network elements
|
||||
tags:
|
||||
- network_element
|
||||
schemes:
|
||||
- http
|
||||
- https
|
||||
securityDefinitions:
|
||||
ApiKeyAuth:
|
||||
description: Get the key through the login interface, fill in e.g. Bearer <access_token>
|
||||
in: header
|
||||
name: Authorization
|
||||
type: apiKey
|
||||
swagger: "2.0"
|
||||
tags:
|
||||
- description: chart interface
|
||||
name: chart
|
||||
- description: common interface
|
||||
name: common
|
||||
- description: monitor interface
|
||||
name: monitor
|
||||
- description: network data interface
|
||||
name: network_data
|
||||
- description: network element interface
|
||||
name: network_element
|
||||
- description: system interface
|
||||
name: system
|
||||
- description: tool interface
|
||||
name: tool
|
||||
- description: trace interface
|
||||
name: trace
|
||||
- description: ws interface
|
||||
name: ws
|
||||
Reference in New Issue
Block a user