From 1e48d773aed5fa20dce2798c6fb41ff1f95bf244 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Mon, 23 Mar 2020 14:33:40 -0400 Subject: [PATCH 1/3] Add job_templates to the set of related endpoints for organizations --- awx/api/serializers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/awx/api/serializers.py b/awx/api/serializers.py index e66233cd529a..3289e6a4bd1b 100644 --- a/awx/api/serializers.py +++ b/awx/api/serializers.py @@ -1251,6 +1251,7 @@ def get_related(self, obj): res.update(dict( projects = self.reverse('api:organization_projects_list', kwargs={'pk': obj.pk}), inventories = self.reverse('api:organization_inventories_list', kwargs={'pk': obj.pk}), + job_templates = self.reverse('api:organization_job_templates_list', kwargs={'pk': obj.pk}), workflow_job_templates = self.reverse('api:organization_workflow_job_templates_list', kwargs={'pk': obj.pk}), users = self.reverse('api:organization_users_list', kwargs={'pk': obj.pk}), admins = self.reverse('api:organization_admins_list', kwargs={'pk': obj.pk}), From e4e2d48f53c1ed34926221984647bdd97a77b5eb Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Mon, 23 Mar 2020 14:34:41 -0400 Subject: [PATCH 2/3] Register some missing related endpoints in awxkit - the newer varieties of notification templates - organization workflow job templates - credential owner users and owner teams this allows the endpoints to get wrapped in appropriate Page types, not just the Base page type. --- awxkit/awxkit/api/pages/notification_templates.py | 9 +++++++-- awxkit/awxkit/api/pages/teams.py | 1 + awxkit/awxkit/api/pages/users.py | 1 + awxkit/awxkit/api/pages/workflow_job_templates.py | 3 ++- awxkit/awxkit/api/resources.py | 4 ++++ 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/awxkit/awxkit/api/pages/notification_templates.py b/awxkit/awxkit/api/pages/notification_templates.py index 60d7af7893d9..e9016e0b949d 100644 --- a/awxkit/awxkit/api/pages/notification_templates.py +++ b/awxkit/awxkit/api/pages/notification_templates.py @@ -209,8 +209,10 @@ def _associate(self, resource, job_result='any', disassociate=False): (resources.notification_templates, 'post'), (resources.notification_template_copy, 'post'), resources.notification_template_any, + resources.notification_template_started, resources.notification_template_error, - resources.notification_template_success], NotificationTemplate) + resources.notification_template_success, + resources.notification_template_approval], NotificationTemplate) class NotificationTemplates(page.PageList, NotificationTemplate): @@ -219,9 +221,12 @@ class NotificationTemplates(page.PageList, NotificationTemplate): page.register_page([resources.notification_templates, + resources.related_notification_templates, resources.notification_templates_any, + resources.notification_templates_started, resources.notification_templates_error, - resources.notification_templates_success], + resources.notification_templates_success, + resources.notification_templates_approvals], NotificationTemplates) diff --git a/awxkit/awxkit/api/pages/teams.py b/awxkit/awxkit/api/pages/teams.py index 95ab8e6a85cb..fc1e9de3f8e6 100644 --- a/awxkit/awxkit/api/pages/teams.py +++ b/awxkit/awxkit/api/pages/teams.py @@ -45,4 +45,5 @@ class Teams(page.PageList, Team): page.register_page([resources.teams, + resources.credential_owner_teams, resources.related_teams], Teams) diff --git a/awxkit/awxkit/api/pages/users.py b/awxkit/awxkit/api/pages/users.py index 2c25950e4c24..4039ef2e9df2 100644 --- a/awxkit/awxkit/api/pages/users.py +++ b/awxkit/awxkit/api/pages/users.py @@ -64,6 +64,7 @@ class Users(page.PageList, User): page.register_page([resources.users, resources.organization_admins, resources.related_users, + resources.credential_owner_users, resources.user_admin_organizations], Users) diff --git a/awxkit/awxkit/api/pages/workflow_job_templates.py b/awxkit/awxkit/api/pages/workflow_job_templates.py index 1d67a0a171a8..8814a13d5944 100644 --- a/awxkit/awxkit/api/pages/workflow_job_templates.py +++ b/awxkit/awxkit/api/pages/workflow_job_templates.py @@ -99,7 +99,8 @@ class WorkflowJobTemplates(page.PageList, WorkflowJobTemplate): pass -page.register_page([resources.workflow_job_templates], WorkflowJobTemplates) +page.register_page([resources.workflow_job_templates, + resources.related_workflow_job_templates], WorkflowJobTemplates) class WorkflowJobTemplateLaunch(base.Base): diff --git a/awxkit/awxkit/api/resources.py b/awxkit/awxkit/api/resources.py index 97a9c31c90a7..31b671df6800 100644 --- a/awxkit/awxkit/api/resources.py +++ b/awxkit/awxkit/api/resources.py @@ -122,14 +122,18 @@ class Resources(object): _notification = r'notifications/\d+/' _notification_template = r'notification_templates/\d+/' _notification_template_any = r'\w+/\d+/notification_templates_any/\d+/' + _notification_template_started = r'\w+/\d+/notification_templates_started/\d+/' _notification_template_copy = r'notification_templates/\d+/copy/' _notification_template_error = r'\w+/\d+/notification_templates_error/\d+/' _notification_template_success = r'\w+/\d+/notification_templates_success/\d+/' + _notification_template_approval = r'\w+/\d+/notification_templates_approvals/\d+/' _notification_template_test = r'notification_templates/\d+/test/' _notification_templates = 'notification_templates/' _notification_templates_any = r'\w+/\d+/notification_templates_any/' + _notification_templates_started = r'\w+/\d+/notification_templates_started/' _notification_templates_error = r'\w+/\d+/notification_templates_error/' _notification_templates_success = r'\w+/\d+/notification_templates_success/' + _notification_templates_approvals = r'\w+/\d+/notification_templates_approvals/' _notifications = 'notifications/' _object_activity_stream = r'[^/]+/\d+/activity_stream/' _org_projects = r'organizations/\d+/projects/' From e3ea4e2398af35a4d162ee6690e4092ec8153442 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Mon, 23 Mar 2020 15:19:48 -0400 Subject: [PATCH 3/3] Register the resource copy endpoints as awxkit page types --- awxkit/awxkit/api/pages/credentials.py | 8 ++++++++ awxkit/awxkit/api/pages/inventory.py | 8 ++++++++ awxkit/awxkit/api/pages/job_templates.py | 8 ++++++++ awxkit/awxkit/api/pages/notification_templates.py | 8 ++++++++ awxkit/awxkit/api/pages/projects.py | 8 ++++++++ 5 files changed, 40 insertions(+) diff --git a/awxkit/awxkit/api/pages/credentials.py b/awxkit/awxkit/api/pages/credentials.py index 7d3ca009eca8..2ef8a7c05cf9 100644 --- a/awxkit/awxkit/api/pages/credentials.py +++ b/awxkit/awxkit/api/pages/credentials.py @@ -366,3 +366,11 @@ class Credentials(page.PageList, Credential): resources.job_extra_credentials, resources.job_template_extra_credentials], Credentials) + + +class CredentialCopy(base.Base): + + pass + + +page.register_page(resources.credential_copy, CredentialCopy) diff --git a/awxkit/awxkit/api/pages/inventory.py b/awxkit/awxkit/api/pages/inventory.py index b9fc0178fbfb..2b057153d3f8 100644 --- a/awxkit/awxkit/api/pages/inventory.py +++ b/awxkit/awxkit/api/pages/inventory.py @@ -682,3 +682,11 @@ class InventoryUpdateCancel(base.Base): page.register_page(resources.inventory_update_cancel, InventoryUpdateCancel) + + +class InventoryCopy(base.Base): + + pass + + +page.register_page(resources.inventory_copy, InventoryCopy) diff --git a/awxkit/awxkit/api/pages/job_templates.py b/awxkit/awxkit/api/pages/job_templates.py index 11d46cfbfa12..929383fd55b8 100644 --- a/awxkit/awxkit/api/pages/job_templates.py +++ b/awxkit/awxkit/api/pages/job_templates.py @@ -244,3 +244,11 @@ class JobTemplateLaunch(base.Base): page.register_page(resources.job_template_launch, JobTemplateLaunch) + + +class JobTemplateCopy(base.Base): + + pass + + +page.register_page([resources.job_template_copy], JobTemplateCopy) diff --git a/awxkit/awxkit/api/pages/notification_templates.py b/awxkit/awxkit/api/pages/notification_templates.py index e9016e0b949d..f69bb7b8a715 100644 --- a/awxkit/awxkit/api/pages/notification_templates.py +++ b/awxkit/awxkit/api/pages/notification_templates.py @@ -230,6 +230,14 @@ class NotificationTemplates(page.PageList, NotificationTemplate): NotificationTemplates) +class NotificationTemplateCopy(base.Base): + + pass + + +page.register_page(resources.notification_template_copy, NotificationTemplateCopy) + + class NotificationTemplateTest(base.Base): pass diff --git a/awxkit/awxkit/api/pages/projects.py b/awxkit/awxkit/api/pages/projects.py index 31808e891f22..584c151f78e7 100644 --- a/awxkit/awxkit/api/pages/projects.py +++ b/awxkit/awxkit/api/pages/projects.py @@ -202,6 +202,14 @@ class ProjectUpdateCancel(base.Base): page.register_page(resources.project_update_cancel, ProjectUpdateCancel) +class ProjectCopy(base.Base): + + pass + + +page.register_page(resources.project_copy, ProjectCopy) + + class Playbooks(base.Base): pass