From e930e0ffaf1ff2ef63783e0850149bedaf93c396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Daher?= Date: Fri, 28 Jun 2019 18:25:51 -0300 Subject: [PATCH] Add support to Platform resource --- tsuru/__init__.py | 2 ++ tsuru/models/__init__.py | 2 ++ tsuru/models/platform.py | 14 ++++++++++++++ 3 files changed, 18 insertions(+) create mode 100644 tsuru/models/platform.py diff --git a/tsuru/__init__.py b/tsuru/__init__.py index 3282ca2..f840a91 100644 --- a/tsuru/__init__.py +++ b/tsuru/__init__.py @@ -5,6 +5,7 @@ Lock, Log, Plan, + Platform, ) from tsuru.exceptions import ( DoesNotExist, @@ -23,6 +24,7 @@ 'Lock', 'Log', 'Plan', + 'Platform', 'DoesNotExist', 'UnexpectedDataFormat', 'UnsupportedModelException', diff --git a/tsuru/models/__init__.py b/tsuru/models/__init__.py index c30dc22..534c25c 100644 --- a/tsuru/models/__init__.py +++ b/tsuru/models/__init__.py @@ -4,6 +4,7 @@ from tsuru.models.lock import Lock from tsuru.models.log import Log from tsuru.models.plan import Plan +from tsuru.models.platform import Platform __all__ = ( 'App', 'Deploy', @@ -11,4 +12,5 @@ 'Lock', 'Log', 'Plan', + 'Platform', ) diff --git a/tsuru/models/platform.py b/tsuru/models/platform.py new file mode 100644 index 0000000..106a4a2 --- /dev/null +++ b/tsuru/models/platform.py @@ -0,0 +1,14 @@ +from tsuru.models.base import BaseModel + + +class Platform(BaseModel): + _RESOURCE_NAME = 'platforms' + _PK_FIELD = 'Name' + + @property + def name(self): + return self._get('Name') + + @property + def is_enabled(self): + return not self._get('Disabled')