Jelajahi Sumber

Add diagnostics API to api-refs

Daniel Vincze 5 tahun lalu
induk
melakukan
acab3ea8c8

+ 127 - 0
coriolis/api-refs/api_samples/diagnostics/diagnostics-get-resp.json

@@ -0,0 +1,127 @@
+{
+    "diagnostics": [
+        {
+            "application": "coriolis-conductor",
+            "packages": [
+                "alembic==1.5.2",
+                "amqp==5.0.5",
+                "argparse==1.4.0",
+                // ...
+            ],
+            "os_info": [
+                "NAME=\"Ubuntu\"",
+                "VERSION=\"18.04.5 LTS (Bionic Beaver)\"",
+                "ID=ubuntu",
+                "ID_LIKE=debian",
+                "PRETTY_NAME=\"Ubuntu 18.04.5 LTS\"",
+                "VERSION_ID=\"18.04\"",
+                "HOME_URL=\"https://www.ubuntu.com/\"",
+                "SUPPORT_URL=\"https://help.ubuntu.com/\"",
+                "BUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"",
+                "PRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"",
+                "VERSION_CODENAME=bionic",
+                "UBUNTU_CODENAME=bionic",
+                ""
+            ],
+            "hostname": "coriolis-conductor",
+            "ip_addresses": [
+                {
+                    "eth0": {
+                        "ipv4": [
+                            {
+                                "addr": "10.107.9.8",
+                                "netmask": "255.255.254.0",
+                                "broadcast": "10.107.9.255"
+                            }
+                        ],
+                        "ipv6": [
+                            {
+                                "addr": "fe80::250:56ff:feb9:73a%eth0",
+                                "netmask": "ffff:ffff:ffff:ffff::/64"
+                            }
+                        ]
+                    }
+                },
+                {
+                    "docker0": {
+                        "ipv4": [
+                            {
+                                "addr": "172.17.0.1",
+                                "netmask": "255.255.0.0",
+                                "broadcast": "172.17.255.255"
+                            }
+                        ],
+                        "ipv6": [
+                            {
+                                "addr": "fe80::42:61ff:fe79:de6f%docker0",
+                                "netmask": "ffff:ffff:ffff:ffff::/64"
+                            }
+                        ]
+                    }
+                }
+            ]
+        },
+        {
+            "application": "coriolis-replica-cron",
+            "packages": [
+                "alembic==1.5.2",
+                "amqp==5.0.5",
+                "argparse==1.4.0",
+                // ...
+            ],
+            "os_info": [
+                "NAME=\"Ubuntu\"",
+                "VERSION=\"18.04.5 LTS (Bionic Beaver)\"",
+                "ID=ubuntu",
+                "ID_LIKE=debian",
+                "PRETTY_NAME=\"Ubuntu 18.04.5 LTS\"",
+                "VERSION_ID=\"18.04\"",
+                "HOME_URL=\"https://www.ubuntu.com/\"",
+                "SUPPORT_URL=\"https://help.ubuntu.com/\"",
+                "BUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"",
+                "PRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"",
+                "VERSION_CODENAME=bionic",
+                "UBUNTU_CODENAME=bionic",
+                ""
+            ],
+            "hostname": "coriolis-replica-cron",
+            "ip_addresses": [
+                {
+                    "eth0": {
+                        "ipv4": [
+                            {
+                                "addr": "10.107.9.8",
+                                "netmask": "255.255.254.0",
+                                "broadcast": "10.107.9.255"
+                            }
+                        ],
+                        "ipv6": [
+                            {
+                                "addr": "fe80::250:56ff:feb9:73a%eth0",
+                                "netmask": "ffff:ffff:ffff:ffff::/64"
+                            }
+                        ]
+                    }
+                },
+                {
+                    "docker0": {
+                        "ipv4": [
+                            {
+                                "addr": "172.17.0.1",
+                                "netmask": "255.255.0.0",
+                                "broadcast": "172.17.255.255"
+                            }
+                        ],
+                        "ipv6": [
+                            {
+                                "addr": "fe80::42:61ff:fe79:de6f%docker0",
+                                "netmask": "ffff:ffff:ffff:ffff::/64"
+                            }
+                        ]
+                    }
+                }
+            ]
+        }
+        // ...
+    ]
+}

+ 38 - 0
coriolis/api-refs/source/diagnostics.inc

@@ -0,0 +1,38 @@
+.. -*- rst -*-
+
+===========
+Diagnostics
+===========
+
+Gets diagnostic info about the Coriolis appliance.
+
+
+List Diagnostics
+================
+
+.. rest_method:: GET /diagnostics
+
+Lists diagnostic data from all Coriolis services.
+
+Normal response codes: 200
+
+Error response codes:   unauthorized(401),
+forbidden(403)
+
+Response
+--------
+
+.. rest_parameters:: parameters.yaml
+
+  - diagnostics : diagnostics_array
+  - application : diagnostic_application
+  - os_info : diagnostic_os_info
+  - hostname : diagnostic_hostname
+  - ip_addresses : diagnostic_ip_addresses
+  - packages : diagnostic_packages
+
+**Example of a Diagnostics List**
+
+  .. literalinclude:: ../api_samples/diagnostics/diagnostics-get-resp.json
+    :language: javascript
+

+ 1 - 0
coriolis/api-refs/source/index.rst

@@ -6,6 +6,7 @@ This is a reference for the Coriolis API.
 
 
 .. rest_expand_all::
 .. rest_expand_all::
 
 
+.. include:: diagnostics.inc
 .. include:: endpoint.inc
 .. include:: endpoint.inc
 .. include:: migration.inc
 .. include:: migration.inc
 .. include:: provider.inc
 .. include:: provider.inc

+ 36 - 0
coriolis/api-refs/source/parameters.yaml

@@ -113,6 +113,42 @@ destination_options:
   in: body
   in: body
   type: object
   type: object
   required: true
   required: true
+diagnostic_application:
+  description: |
+    Name of the Coriolis service.
+  in: body
+  type: string
+  required: true
+diagnostic_hostname:
+  description: |
+    The hostname of the Coriolis service container.
+  in: body
+  type: string
+  required: true
+diagnostic_ip_addresses:
+  description: |
+    IP addresses of all the interfaces attached to the Coriolis appliance.
+  in: body
+  type: object
+  required: true
+diagnostic_os_info:
+  description: |
+    The Coriolis appliance's host OS information.
+  in: body
+  type: array
+  required: true
+diagnostic_packages:
+  description: |
+    The list of PIP packages installed on the Coriolis service container.
+  in: body
+  type: array
+  required: true
+diagnostics_array:
+  description: |
+    Array of diagnostics objects.
+  in: body
+  type: array
+  required: true
 endpoint_created_at:
 endpoint_created_at:
   description: |
   description: |
     ISO 8601 formatted date of endpoint creation.
     ISO 8601 formatted date of endpoint creation.