yats.git

commit 1e54ba25ec19c5c02ec9411a37f4c8dbb434e12b

Author: Paolo Lulli <paolo@lulli.net>

Better rest comments

 server/docs/docs.go | 43 +++++++++++++++++++++++++++++++++++
 server/docs/swagger.json | 43 +++++++++++++++++++++++++++++++++++
 server/docs/swagger.yaml | 28 ++++++++++++++++++++++
 server/rest/rest-permissions.go | 5 ++-
 server/rest/rest-position.go | 10 ++++++++


diff --git a/server/docs/docs.go b/server/docs/docs.go
index c735c1ee11603508ba371fcda844ce67229da903..1a7ba359b00d1c22624cbab7e49423996ca92db5 100644
--- a/server/docs/docs.go
+++ b/server/docs/docs.go
@@ -279,6 +279,38 @@                     }
                 }
             }
         },
+        "/perms": {
+            "get": {
+                "description": "Show available Metrics and Event for current user",
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "Permissions"
+                ],
+                "summary": "Show available Metrics and Event for current user",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "clientCN",
+                        "name": "X-SSL-Client-CN",
+                        "in": "header",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/model.AvailableMetric"
+                            }
+                        }
+                    }
+                }
+            }
+        },
         "/position": {
             "post": {
                 "description": "store position",
@@ -411,6 +443,17 @@             }
         }
     },
     "definitions": {
+        "model.AvailableMetric": {
+            "type": "object",
+            "properties": {
+                "description": {
+                    "type": "string"
+                },
+                "name": {
+                    "type": "string"
+                }
+            }
+        },
         "model.EventRequest": {
             "type": "object",
             "properties": {




diff --git a/server/docs/swagger.json b/server/docs/swagger.json
index 0f327c01427f9e4d077366546dbc865dcdf847ef..0d6ada2410adc7f9e8e4c017290762adb3bb495f 100755
--- a/server/docs/swagger.json
+++ b/server/docs/swagger.json
@@ -272,6 +272,38 @@                     }
                 }
             }
         },
+        "/perms": {
+            "get": {
+                "description": "Show available Metrics and Event for current user",
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "Permissions"
+                ],
+                "summary": "Show available Metrics and Event for current user",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "clientCN",
+                        "name": "X-SSL-Client-CN",
+                        "in": "header",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/model.AvailableMetric"
+                            }
+                        }
+                    }
+                }
+            }
+        },
         "/position": {
             "post": {
                 "description": "store position",
@@ -404,6 +436,17 @@             }
         }
     },
     "definitions": {
+        "model.AvailableMetric": {
+            "type": "object",
+            "properties": {
+                "description": {
+                    "type": "string"
+                },
+                "name": {
+                    "type": "string"
+                }
+            }
+        },
         "model.EventRequest": {
             "type": "object",
             "properties": {




diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml
index 7e5f2ffb7037f57064f3237d259ebb4b0ef3a204..c0829f81d6967dda7f72cf76b413b9046af83143 100755
--- a/server/docs/swagger.yaml
+++ b/server/docs/swagger.yaml
@@ -1,5 +1,12 @@
 basePath: /
 definitions:
+  model.AvailableMetric:
+    properties:
+      description:
+        type: string
+      name:
+        type: string
+    type: object
   model.EventRequest:
     properties:
       etime:
@@ -243,6 +250,27 @@             type: string
       summary: Get the metrics From ... and To when present
       tags:
       - Metrics
+  /perms:
+    get:
+      description: Show available Metrics and Event for current user
+      parameters:
+      - description: clientCN
+        in: header
+        name: X-SSL-Client-CN
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/model.AvailableMetric'
+            type: array
+      summary: Show available Metrics and Event for current user
+      tags:
+      - Permissions
   /position:
     post:
       consumes:




diff --git a/server/rest/rest-permissions.go b/server/rest/rest-permissions.go
index 2d4077d49211c998617201992c18bd9348b99d9f..bae88af0c28b5932dffc0d83a79d6cbb4275dfa3 100644
--- a/server/rest/rest-permissions.go
+++ b/server/rest/rest-permissions.go
@@ -7,6 +7,7 @@  *
  * @author Paolo Lulli <kevwe.com>
  * @copyright Paolo Lulli 2024
  */
+
 package rest
 
 import (
@@ -21,9 +22,9 @@ // @Param X-SSL-Client-CN header string true "clientCN"
 // @Summary Show available Metrics and Event for current user
 // @Schemes
 // @Description Show available Metrics and Event for current user
-// @Tags Metrics
+// @Tags Permissions
 // @Produce json
-// @Success 200 {string} []model.PermsResponse
+// @Success 200 {object} []model.AvailableMetric
 // @Router /perms [get]
 func ShowPermissions(cfg config.Configuration) gin.HandlerFunc {
 	return func(c *gin.Context) {




diff --git a/server/rest/rest-position.go b/server/rest/rest-position.go
index 9676c9ededd40ce7aedefaec83cbc2e2f730aea2..6814bae186c1897de4e2d0ec13f9bf05c1ba4cb2 100644
--- a/server/rest/rest-position.go
+++ b/server/rest/rest-position.go
@@ -1,3 +1,13 @@
+/**
+ * Yats - yats
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Paolo Lulli <kevwe.com>
+ * @copyright Paolo Lulli 2024
+ */
+
 package rest
 
 import (