Repository: linode/linode_api4-python

Issue:
Linode plan types do not include gpu count

Discussion:

Patch:
diff --git a/linode_api4/objects/linode.py b/linode_api4/objects/linode.py
index b9c0d52..1bba3b3 100644
--- a/linode_api4/objects/linode.py
+++ b/linode_api4/objects/linode.py
@@ -145,6 +145,7 @@ class Type(Base):
         'memory': Property(filterable=True),
         'transfer': Property(filterable=True),
         'vcpus': Property(filterable=True),
+        'gpus': Property(filterable=True),
         # type_class is populated from the 'class' attribute of the returned JSON
     }
 


Test patch:
diff --git a/test/fixtures/linode_types.json b/test/fixtures/linode_types.json
index 918c18a..9de6a7d 100644
--- a/test/fixtures/linode_types.json
+++ b/test/fixtures/linode_types.json
@@ -18,6 +18,7 @@
       "class": "nanode",
       "network_out": 1000,
       "vcpus": 1,
+      "gpus": 0,
       "id": "g5-nanode-1",
       "label": "Linode 1024",
       "price": {
@@ -40,6 +41,7 @@
       "class": "highmem",
       "network_out": 1000,
       "vcpus": 1,
+      "gpus": 0,
       "id": "g5-highmem-1",
       "label": "Linode 16384",
       "price": {
@@ -62,6 +64,7 @@
       "class": "standard",
       "network_out": 1000,
       "vcpus": 1,
+      "gpus": 0,
       "id": "g5-standard-1",
       "label": "Linode 2048",
       "price": {
@@ -81,10 +84,11 @@
           }
         }
       },
-      "class": "standard",
+      "class": "gpu",
       "network_out": 1000,
       "vcpus": 2,
-      "id": "g5-standard-2",
+      "gpus": 1,
+      "id": "g5-gpu-2",
       "label": "Linode 4096",
       "price": {
         "hourly": 0.03,
diff --git a/test/objects/linode_test.py b/test/objects/linode_test.py
index 653a768..7e02c6b 100644
--- a/test/objects/linode_test.py
+++ b/test/objects/linode_test.py
@@ -272,6 +272,7 @@ class TypeTest(ClientBaseCase):
             self.assertIsNotNone(t.label)
             self.assertIsNotNone(t.disk)
             self.assertIsNotNone(t.type_class)
+            self.assertIsNotNone(t.gpus)
 
     def test_get_type_by_id(self):
         """
@@ -281,6 +282,17 @@ class TypeTest(ClientBaseCase):
         self.assertEqual(t._populated, False)
 
         self.assertEqual(t.vcpus, 1)
+        self.assertEqual(t.gpus, 0)
         self.assertEqual(t.label, "Linode 1024")
         self.assertEqual(t.disk, 20480)
         self.assertEqual(t.type_class, 'nanode')
+
+    def test_get_type_gpu(self):
+        """
+        Tests that gpu types load up right
+        """
+        t = Type(self.client, "g5-gpu-2")
+        self.assertEqual(t._populated, False)
+
+        self.assertEqual(t.gpus, 1)
+        self.assertEqual(t._populated, True)