'''Dashboard=========Methods described in this section relate to the dashboard API.These methods can be accessed at ``TenableIE.dashboard``... rst-class:: hide-signature.. autoclass:: DashboardAPI :members:'''fromtypingimportList,Dictfromtenable.ie.dashboard.schemaimportDashboardSchemafromtenable.base.endpointimportAPIEndpoint
[docs]deflist(self)->List[Dict]:''' Retrieve all dashboard instances. Returns: list: The list of dashboard objects. Examples: >>> tie.dashboard.list() '''returnself._schema.load(self._get(),many=True)
[docs]defcreate(self,name:str,order:int)->Dict:''' Create a new dashboard instance. Args: name (str): The name of the new dashboard. order (int): order of the dashboard. Returns: dict: The created dashboard instance. Examples: >>> tie.dashboard.create( ... name='new_dashboard', ... order=10) '''payload={'name':name,'order':order}returnself._schema.load(self._post(json=payload))
[docs]defdetails(self,dashboard_id:str)->Dict:''' Retrieves the details for a specific dashboard instance. Args: dashboard_id (str): The dashboard instance identifier. Returns: dict: The details of the dashboard object of specified dashboard_id. Examples: >>> tie.dashboard.details(dashboard_id='1') '''returnself._schema.load(self._get(f'{dashboard_id}'))
[docs]defupdate(self,dashboard_id:str,**kwargs):''' Updates the dashboard instance based on ``dashboard_id``. Args: dashboard_id (str): The dashboard instance identifier. name (optional, str): The updated name. order (optional, int): The order of the dashboard. Examples: >>> tie.dashboard.update( ... dashboard_id='23', ... name='updated_dashboard_name', ... order=1) '''payload=self._schema.dump(self._schema.load(kwargs))returnself._schema.load(self._patch(f'{dashboard_id}',json=payload),many=True)
[docs]defdelete(self,dashboard_id:str)->None:''' Deletes the dashboard instance Args: dashboard_id (str): The dashboard instance identifier. Examples: >>> tie.dashboard.delete(dashboard_id='22') '''self._delete(f'{dashboard_id}')