diff --git a/gso/services/kentik_client.py b/gso/services/kentik_client.py index 95d55e22d53f056d08bd9376956808c9a11785c0..7849adeeec4f6347f2545c5ec76fffaf5f6ee0e1 100644 --- a/gso/services/kentik_client.py +++ b/gso/services/kentik_client.py @@ -109,7 +109,42 @@ class KentikClient: return {} def get_plans(self) -> list[dict[str, Any]]: - """Get all Kentik plans available.""" + """Get all Kentik plans available. + + Returns a list of ``plans`` that each have the following shape: + + .. vale off + .. code-block:: json + + "plan": { + "active": true, + "bgp_enabled": true, + "cdate" "1970-01-01T01:01:01.000Z", + "company_id": 111111, + "description": "A description of this plan", + "deviceTypes": [ + {"device_type": "router"}, + {"device_type": "host-nprobe-dns-www"} + ], + "devices": [ + { + "id": "111111", + "device_name": "rt0.city.tld.internal", + "device_type": "router" + }, + ], + "edate": "2999-01-01T09:09:09.000Z", + "fast_retention": 10, + "full_retention": 5, + "id": 11111, + "max_bigdata_fps": 100, + "max_devices": 9001, + "max_fps": 200, + "name": "KENTIK-PLAN-01", + "metadata": {}, + } + .. vale on + """ return self._send_request("GET", "v5/plans")["plans"] def get_plan(self, plan_id: int) -> dict[str, Any]: diff --git a/gso/services/lso_client.py b/gso/services/lso_client.py index 6eca3f6559943df80660b3f71ba50e9c1feb1d64..77c2264798a009c79fb5a28dcd15a317e17b87c5 100644 --- a/gso/services/lso_client.py +++ b/gso/services/lso_client.py @@ -60,6 +60,7 @@ def execute_playbook( For example, an inventory consisting of two hosts, which each a unique host variable assigned to them looks as follows: + .. vale off .. code-block:: json "inventory": { @@ -74,6 +75,7 @@ def execute_playbook( } } } + .. vale on .. warning:: Note the fact that the collection of all hosts is a dictionary, and not a list of strings. Ansible expects each diff --git a/gso/workflows/router/modify_kentik_license.py b/gso/workflows/router/modify_kentik_license.py index 28d9d21f945a55001f5b1601227f26c5494067ec..bd97b9c04605ed475fb7800a6cf965b5c3c895a1 100644 --- a/gso/workflows/router/modify_kentik_license.py +++ b/gso/workflows/router/modify_kentik_license.py @@ -22,7 +22,11 @@ logger = logging.getLogger() def _initial_input_form(subscription_id: UUIDstr) -> FormGenerator: router = Router.from_subscription(subscription_id) - active_kentik_plans = {str(plan["id"]): plan["name"] for plan in KentikClient().get_plans() if plan["active"]} + active_kentik_plans = { + str(plan["id"]): f"{plan["name"]} - ({len(plan["devices"])}/{plan["max_devices"]})" + for plan in KentikClient().get_plans() + if plan["active"] + } available_kentik_plans = Choice( "Select a Kentik license", zip(active_kentik_plans.keys(), active_kentik_plans.items(), strict=True), # type: ignore[arg-type]