From 85041acf8a81b558490bf222ba1ac54bae1ff342 Mon Sep 17 00:00:00 2001 From: mikameyer Date: Tue, 17 Nov 2020 10:06:35 +0100 Subject: [PATCH] updated documentation --- api/request_handler.go | 6 +- core/request/base_request.go | 6 +- core/value/value.go | 4 + doc/api_doc.json | 139 +++++++++++++++++++++++++++++++++-- go.mod | 2 +- go.sum | 4 +- 6 files changed, 147 insertions(+), 14 deletions(-) diff --git a/api/request_handler.go b/api/request_handler.go index dabdd07..d3f93a8 100644 --- a/api/request_handler.go +++ b/api/request_handler.go @@ -77,7 +77,7 @@ func StartAPI() { // swagger:operation POST /check/identify check checkIdentify // --- - // summary: Check mode for identify. + // summary: Checks if identify matches the expectations. // consumes: // - application/json // - application/xml @@ -104,7 +104,7 @@ func StartAPI() { // swagger:operation POST /check/snmp check checkSNMP // --- - // summary: Check mode for SNMP. + // summary: Checks SNMP availability. // consumes: // - application/json // - application/xml @@ -266,7 +266,7 @@ func StartAPI() { // swagger:operation POST /read/count-interfaces read readCountInterfaces // --- - // summary: Counts interface of a device. + // summary: Counts the interfaces of a device. // consumes: // - application/json // - application/xml diff --git a/core/request/base_request.go b/core/request/base_request.go index 68ded14..8de82fa 100644 --- a/core/request/base_request.go +++ b/core/request/base_request.go @@ -285,7 +285,11 @@ func (r *BaseRequest) setupHTTPConnection() (*network.RequestDeviceConnectionHTT return con, nil } -// Base Response defines attributes every response has. +// BaseResponse +// +// BaseResponse defines attributes every response has. +// +// swagger:model type BaseResponse struct { } diff --git a/core/value/value.go b/core/value/value.go index 4dd9dfd..c8105ca 100644 --- a/core/value/value.go +++ b/core/value/value.go @@ -7,7 +7,11 @@ import ( "strconv" ) +// Value +// // Value represents a value that was read out from a device. +// +// swagger:model type Value string // New creates a new value diff --git a/doc/api_doc.json b/doc/api_doc.json index 10fd128..d324f13 100644 --- a/doc/api_doc.json +++ b/doc/api_doc.json @@ -36,7 +36,7 @@ "tags": [ "check" ], - "summary": "Check mode for identify.", + "summary": "Checks if identify matches the expectations.", "operationId": "checkIdentify", "parameters": [ { @@ -162,7 +162,7 @@ "tags": [ "check" ], - "summary": "Check mode for SNMP.", + "summary": "Checks SNMP availability.", "operationId": "checkSNMP", "parameters": [ { @@ -372,7 +372,7 @@ "tags": [ "read" ], - "summary": "Counts interface of a device.", + "summary": "Counts the interfaces of a device.", "operationId": "readCountInterfaces", "parameters": [ { @@ -504,8 +504,9 @@ "x-go-package": "github.com/inexio/thola/core/request" }, "BaseResponse": { + "description": "BaseResponse defines attributes every response has.", "type": "object", - "title": "Base Response defines attributes every response has.", + "title": "BaseResponse", "x-go-package": "github.com/inexio/thola/core/request" }, "CheckDeviceRequest": { @@ -818,6 +819,23 @@ }, "x-go-package": "github.com/inexio/thola/core/network" }, + "DWDMInterface": { + "description": "DWDMInterface represents a DWDM interface", + "type": "object", + "properties": { + "rx_level": { + "type": "number", + "format": "double", + "x-go-name": "RXLevel" + }, + "tx_level": { + "type": "number", + "format": "double", + "x-go-name": "TXLevel" + } + }, + "x-go-package": "github.com/inexio/thola/core/device" + }, "Device": { "description": "Device represents a device and has the same structure as Response.\nResponse can possibly be removed and replaced by Device.", "type": "object", @@ -852,6 +870,83 @@ }, "x-go-package": "github.com/inexio/thola/core/request" }, + "EthernetLikeInterface": { + "description": "EthernetLikeInterface represents an ethernet like interface", + "type": "object", + "properties": { + "dot3HCStatsFCSErrors": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3HCStatsFCSErrors" + }, + "dot3StatsAlignmentErrors": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsAlignmentErrors" + }, + "dot3StatsCarrierSenseErrors": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsCarrierSenseErrors" + }, + "dot3StatsDeferredTransmissions": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsDeferredTransmissions" + }, + "dot3StatsExcessiveCollisions": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsExcessiveCollisions" + }, + "dot3StatsFCSErrors": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsFCSErrors" + }, + "dot3StatsFrameTooLongs": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsFrameTooLongs" + }, + "dot3StatsInternalMacReceiveErrors": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsInternalMacReceiveErrors" + }, + "dot3StatsInternalMacTransmitErrors": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsInternalMacTransmitErrors" + }, + "dot3StatsLateCollisions": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsLateCollisions" + }, + "dot3StatsMultipleCollisionFrames": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsMultipleCollisionFrames" + }, + "dot3StatsSQETestErrors": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsSQETestErrors" + }, + "dot3StatsSingleCollisionFrames": { + "type": "integer", + "format": "uint64", + "x-go-name": "Dot3StatsSingleCollisionFrames" + }, + "etherStatsCRCAlignErrors": { + "type": "integer", + "format": "uint64", + "x-go-name": "EtherStatsCRCAlignErrors" + } + }, + "x-go-package": "github.com/inexio/thola/core/device" + }, "HTTPConnectionData": { "description": "HTTPConnectionData includes all http connection data for a device", "type": "object", @@ -1222,7 +1317,8 @@ }, "OutputMessage": { "type": "object", - "title": "OutputMessage represents a message of the response.", + "description": "OutputMessage represents a message of the response. It contains a message and a status code.", + "title": "OutputMessage", "properties": { "message": { "type": "string", @@ -1313,6 +1409,33 @@ }, "x-go-package": "github.com/inexio/thola/core/device" }, + "RadioInterface": { + "description": "RadioInterface represents a radio interface", + "type": "object", + "properties": { + "level_in": { + "type": "integer", + "format": "int64", + "x-go-name": "LevelIn" + }, + "level_out": { + "type": "integer", + "format": "int64", + "x-go-name": "LevelOut" + }, + "maxbitrate_in": { + "type": "integer", + "format": "uint64", + "x-go-name": "MaxbitrateIn" + }, + "maxbitrate_out": { + "type": "integer", + "format": "uint64", + "x-go-name": "MaxbitrateOut" + } + }, + "x-go-package": "github.com/inexio/thola/core/device" + }, "ReadAvailableComponentsRequest": { "description": "ReadAvailableComponentsRequest is a the request struct for the read available-components request.", "type": "object", @@ -1460,7 +1583,8 @@ }, "ResponseInfo": { "type": "object", - "title": "ResponseInfo has all available information for a response.", + "description": "ResponseInfo has all available information for a response. It also contains the RawOutput.", + "title": "ResponseInfo", "properties": { "messages": { "type": "array", @@ -1612,8 +1736,9 @@ "x-go-package": "github.com/inexio/thola/core/device" }, "Value": { + "description": "Value represents a value that was read out from a device.", "type": "string", - "title": "Value represents a value that was read out from a device.", + "title": "Value", "x-go-package": "github.com/inexio/thola/core/value" } }, diff --git a/go.mod b/go.mod index f2d1c29..eb98697 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/go-sql-driver/mysql v1.5.0 github.com/google/go-cmp v0.3.0 github.com/huandu/go-sqlbuilder v1.8.0 - github.com/inexio/go-monitoringplugin v0.0.0-20201106104905-c348723557ba + github.com/inexio/go-monitoringplugin v0.0.0-20201117085742-ec06ef4904fe github.com/jmoiron/sqlx v1.2.0 github.com/labstack/echo v3.3.10+incompatible github.com/labstack/gommon v0.3.0 // indirect diff --git a/go.sum b/go.sum index cbe9881..5df3609 100644 --- a/go.sum +++ b/go.sum @@ -127,8 +127,8 @@ github.com/huandu/go-sqlbuilder v1.8.0 h1:1KP21dzROt03II0aoX/rD2Y6TX1VCIixSX5mvk github.com/huandu/go-sqlbuilder v1.8.0/go.mod h1:cM38aLPrMXaGxsUkHFh1e2skthPnQRPK7h8//X5LQMc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inexio/go-monitoringplugin v0.0.0-20201106104905-c348723557ba h1:FJo6aIyoUUrjdHj2zzjQk+DZToZY0IeV6z7R5HHvs4Y= -github.com/inexio/go-monitoringplugin v0.0.0-20201106104905-c348723557ba/go.mod h1:kzHRJGZ2iE/0IElB4NYI38h3h0HM5wqTTH7KyUCjkM8= +github.com/inexio/go-monitoringplugin v0.0.0-20201117085742-ec06ef4904fe h1:08N/oNUAKUjMFb406F4mcJUZwZsWy9NyKrpauWgGfyU= +github.com/inexio/go-monitoringplugin v0.0.0-20201117085742-ec06ef4904fe/go.mod h1:kzHRJGZ2iE/0IElB4NYI38h3h0HM5wqTTH7KyUCjkM8= github.com/jmoiron/sqlx v1.2.0 h1:41Ip0zITnmWNR/vHV+S4m+VoUivnWY5E4OJfLZjCJMA= github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=