From aae0b290088ba42007d7f3a4673375e05b25e976 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ely=C3=A9zer=20Rezende?= Date: Tue, 27 Oct 2020 14:51:00 -0400 Subject: [PATCH] Separate page object for config/attach endpoint --- awxkit/awxkit/api/pages/config.py | 7 +++++++ awxkit/awxkit/api/pages/subscriptions.py | 3 --- awxkit/awxkit/api/resources.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/awxkit/awxkit/api/pages/config.py b/awxkit/awxkit/api/pages/config.py index 92be01d631..56a620da7f 100644 --- a/awxkit/awxkit/api/pages/config.py +++ b/awxkit/awxkit/api/pages/config.py @@ -36,4 +36,11 @@ class Config(base.Base): return [k for k, v in self.license_info.get('features', {}).items() if v] +class ConfigAttach(page.Page): + + def attach(self, **kwargs): + return self.post(json=kwargs).json + + page.register_page(resources.config, Config) +page.register_page(resources.config_attach, ConfigAttach) diff --git a/awxkit/awxkit/api/pages/subscriptions.py b/awxkit/awxkit/api/pages/subscriptions.py index ad0cded9bb..749776c000 100644 --- a/awxkit/awxkit/api/pages/subscriptions.py +++ b/awxkit/awxkit/api/pages/subscriptions.py @@ -7,8 +7,5 @@ class Subscriptions(page.Page): def get_possible_licenses(self, **kwargs): return self.post(json=kwargs).json - def attach(self, **kwargs): - return self.connection.post(resources.subscriptions_attach, json=kwargs).json - page.register_page(resources.subscriptions, Subscriptions) diff --git a/awxkit/awxkit/api/resources.py b/awxkit/awxkit/api/resources.py index ee48399b0c..d6340cd2d7 100644 --- a/awxkit/awxkit/api/resources.py +++ b/awxkit/awxkit/api/resources.py @@ -16,6 +16,7 @@ class Resources(object): _auth = 'auth/' _authtoken = 'authtoken/' _config = 'config/' + _config_attach = 'config/attach/' _credential = r'credentials/\d+/' _credential_access_list = r'credentials/\d+/access_list/' _credential_copy = r'credentials/\d+/copy/' @@ -267,7 +268,6 @@ class Resources(object): _workflow_job_templates = 'workflow_job_templates/' _workflow_job_workflow_nodes = r'workflow_jobs/\d+/workflow_nodes/' _subscriptions = 'config/subscriptions/' - _subscriptions_attach = 'config/attach/' _workflow_jobs = 'workflow_jobs/' api = '/api/' common = api + r'v\d+/'