mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-09 09:31:49 -05:00
Co-authored-by: Christopher Wang <cwang@ansible.com> Co-authored-by: Jake McDermott <jmcdermott@ansible.com> Co-authored-by: Jim Ladd <jladd@redhat.com> Co-authored-by: Elijah DeLee <kdelee@redhat.com> Co-authored-by: Alan Rominger <arominge@redhat.com> Co-authored-by: Yanis Guenane <yanis@guenane.org>
55 lines
1.3 KiB
Python
55 lines
1.3 KiB
Python
from awxkit.api.pages import UnifiedJob
|
|
from awxkit.api.resources import resources
|
|
import awxkit.exceptions as exc
|
|
from awxkit.utils import suppress
|
|
from . import page
|
|
from . import base
|
|
|
|
|
|
class Schedule(UnifiedJob):
|
|
|
|
pass
|
|
|
|
|
|
page.register_page([resources.schedule,
|
|
resources.related_schedule], Schedule)
|
|
|
|
|
|
class Schedules(page.PageList, Schedule):
|
|
|
|
def get_zoneinfo(self):
|
|
return SchedulesZoneInfo(self.connection).get()
|
|
|
|
def preview(self, rrule=''):
|
|
payload = dict(rrule=rrule)
|
|
return SchedulesPreview(self.connection).post(payload)
|
|
|
|
def add_credential(self, cred):
|
|
with suppress(exc.NoContent):
|
|
self.related.credentials.post(dict(id=cred.id))
|
|
|
|
def remove_credential(self, cred):
|
|
with suppress(exc.NoContent):
|
|
self.related.credentials.post(dict(id=cred.id, disassociate=True))
|
|
|
|
|
|
page.register_page([resources.schedules,
|
|
resources.related_schedules], Schedules)
|
|
|
|
|
|
class SchedulesPreview(base.Base):
|
|
|
|
pass
|
|
|
|
|
|
page.register_page(((resources.schedules_preview, 'post'),), SchedulesPreview)
|
|
|
|
|
|
class SchedulesZoneInfo(base.Base):
|
|
|
|
def __getitem__(self, idx):
|
|
return self.json[idx]
|
|
|
|
|
|
page.register_page(((resources.schedules_zoneinfo, 'get'),), SchedulesZoneInfo)
|