summaryrefslogtreecommitdiffstats
path: root/awxkit
diff options
context:
space:
mode:
authorOleksii Baranov <olebaran@redhat.com>2022-09-15 12:28:07 +0200
committerAlan Rominger <arominge@redhat.com>2022-09-22 21:58:16 +0200
commit4579ab0d60831ca3272dc91d7f34f492008665dc (patch)
treea49af7a6bcbd69b25aa73d522a6c884529c3990d /awxkit
parentRemoving labels and instance_groups from the job serializer page as top level... (diff)
downloadawx-4579ab0d60831ca3272dc91d7f34f492008665dc.tar.xz
awx-4579ab0d60831ca3272dc91d7f34f492008665dc.zip
Add new add_label method to the wfjt node and schedules awxkit models
Diffstat (limited to 'awxkit')
-rw-r--r--awxkit/awxkit/api/pages/schedules.py6
-rw-r--r--awxkit/awxkit/api/pages/workflow_job_template_nodes.py6
2 files changed, 12 insertions, 0 deletions
diff --git a/awxkit/awxkit/api/pages/schedules.py b/awxkit/awxkit/api/pages/schedules.py
index af58d59548..34a81f878b 100644
--- a/awxkit/awxkit/api/pages/schedules.py
+++ b/awxkit/awxkit/api/pages/schedules.py
@@ -47,6 +47,12 @@ class Schedules(page.PageList, Schedule):
with suppress(exc.NoContent):
self.related.credentials.post(dict(id=cred.id, disassociate=True))
+ def add_label(self, label):
+ if isinstance(label, page.Page):
+ label = label.json
+ with suppress(exc.NoContent):
+ self.related.labels.post(label)
+
page.register_page([resources.schedules, resources.related_schedules], Schedules)
diff --git a/awxkit/awxkit/api/pages/workflow_job_template_nodes.py b/awxkit/awxkit/api/pages/workflow_job_template_nodes.py
index bb568af9af..aa312cc837 100644
--- a/awxkit/awxkit/api/pages/workflow_job_template_nodes.py
+++ b/awxkit/awxkit/api/pages/workflow_job_template_nodes.py
@@ -92,6 +92,12 @@ class WorkflowJobTemplateNode(HasCreate, base.Base):
candidates = workflow_job.get_related('workflow_nodes', identifier=self.identifier)
return candidates.results.pop()
+ def add_label(self, label):
+ if isinstance(label, page.Page):
+ label = label.json
+ with suppress(exc.NoContent):
+ self.related.labels.post(label)
+
page.register_page(
[resources.workflow_job_template_node, (resources.workflow_job_template_nodes, 'post'), (resources.workflow_job_template_workflow_nodes, 'post')],