def __init__(self, api_key, page_id, org_id=None): ''' Constructor for OpenshiftCLI ''' self.api_key = api_key self.page_id = page_id self.org_id = org_id self.client = statuspageio.Client(api_key=self.api_key, page_id=self.page_id, organization_id=self.org_id)
def enable(self, workflow: Workflow): params = dict((x.name, x.value) for x in workflow.parameters.all()) required = ['STATUSPAGEIO_API_KEY', 'STATUSPAGEIO_PAGE_ID'] if not all([ params[x] for x in params.keys() & required]): logger.warn("Not all required parameters are set for statuspage workflow.") return set_status_page_conn(statuspageio.Client(api_key=params['STATUSPAGEIO_API_KEY'], page_id=params['STATUSPAGEIO_PAGE_ID'])) incident_command(STATUS_PAGE_COMMANDS, handle_statuspage, helptext='Update the statuspage for this incident') action_handler(OPEN_STATUS_PAGE_DIALOG, handle_open_status_page_dialog) dialog_handler(STATUS_PAGE_UPDATE, handle_status_page_update)
def _client(self): return statuspageio.Client(api_key=self.token, page_id=self.page_id, organization_id="unset")