def delete(self, datasource_id): """Delete a datasource :param datasource_id: Id number of datasource :type datasource_id: int :raises Exception: if datasource failed to delete """ url = utils.urljoin(self.url, str(datasource_id)) self.session.delete(url) if self.get(datasource_id): raise Exception("datasource[%s] failed to delete" % datasource_id)
def delete(self, name): """Delete a dashboard :param name: URL friendly title of the dashboard :type name: str :raises Exception: if dashboard failed to delete """ url = utils.urljoin(self.url, name) self.session.delete(url) if self.is_dashboard(name): raise Exception('dashboard[%s] failed to delete' % name)
def delete(self, name): """Delete a dashboard :param name: URL friendly title of the dashboard :type name: str :raises Exception: if dashboard failed to delete """ url = utils.urljoin(self.url, name) self.session.delete(url) if self.is_dashboard(name): raise Exception('dashboard[%s] failed to delete' % name)
def delete(self, name): """Delete a dashboard :param name: URL friendly title of the dashboard :type name: str :raises Exception: if dashboard failed to delete """ url = utils.urljoin(self.url, name) try: res = self.session.delete(url) res.raise_for_status() except exceptions.HTTPError: return None
def get(self, datasource_id): """Get a datasource :param datasource_id: Id number of datasource :type datasource_id: int :rtype: dict or None """ url = utils.urljoin(self.url, str(datasource_id)) try: res = self.session.get(url) res.raise_for_status() except exceptions.HTTPError: return None return res.json()
def get(self, name): """Get a dashboard :param name: URL friendly title of the dashboard :type name: str :rtype: dict or None """ url = utils.urljoin(self.url, name) try: res = self.session.get(url) res.raise_for_status() except exceptions.HTTPError: return None return res.json()
def get(self, name): """Get a dashboard :param name: URL friendly title of the dashboard :type name: str :rtype: dict or None """ url = utils.urljoin(self.url, name) try: res = self.session.get(url) res.raise_for_status() except exceptions.HTTPError: return None return res.json()
def update(self, datasource_id, data): """Update an existing datasource :param datasource_id: URL friendly title of the dashboard :type datasource_id: int :param data: Datasource model :type data: dict :param overwrite: Overwrite existing dashboard with newer version or with the same dashboard title :type overwrite: bool :raises Exception: if datasource already exists """ url = utils.urljoin(self.url, str(datasource_id)) res = self.session.put(url, data=json.dumps(data)) res.raise_for_status() return res.json()
def __init__(self, url, session): self.url = utils.urljoin(url, "api/datasources/") self.session = session
def __init__(self, url, session): self.url = utils.urljoin(url, 'api/dashboards/db/') self.session = session
def __init__(self, url, session): self.url = utils.urljoin(url, 'api/dashboards/db/') self.session = session