Source code for tenable.tenableone.exposure_view.cards.api
"""Cards=====Methods described in this section relate to the exposure view cards API.These methods can be accessed at ``TenableExposureManagement.exposure_view.cards``... rst-class:: hide-signature.. autoclass:: CardsAPI :members:"""fromtypingimportOptionalfromrestflyimportAPIEndpointfromtenable.tenableone.exposure_view.cards.schemaimport(Cards,CardDetails,SlaBreakdownFilter,Timeframe,)fromtenable.tenableone.inventory.schemaimportSortDirection
[docs]deflist(self,is_global_card:Optional[bool]=None,query_text:Optional[str]=None,offset:Optional[int]=0,limit:Optional[int]=25,sorting_order:Optional[SortDirection]=SortDirection.ASC,)->Cards:""" List cards based on filter criteria Args: is_global_card: Filter cards by is_global flag query_text: Text query to filter cards offset: The number of items to skip before starting to collect the result set limit: Max number of items to return sorting_order: Sorting direction (ASC or DESC) Returns: Cards object containing the list of cards and pagination info """params={'offset':offset,'limit':limit,'sorting_order':sorting_order.value,}ifis_global_cardisnotNone:params['is_global_card']=is_global_cardifquery_textisnotNone:params['text_query']=query_textcards_response=self._get(path='api/v1/t1/exposure-view/cards',params=params,box=False)returnCards.model_validate(cards_response.json())
[docs]defget_by_id(self,card_id:str,trend_timeframe:Optional[Timeframe]=None,sla_efficiency_timeframe:Optional[Timeframe]=None,sla_breakdown_filter:Optional[SlaBreakdownFilter]=SlaBreakdownFilter.ANY,include_trend_events:Optional[bool]=False)->CardDetails:""" Get a specific card by its ID with optional filters Args: card_id: The ID of the card to retrieve trend_timeframe: Optional timeframe for trend data sla_efficiency_timeframe: Optional timeframe for SLA efficiency data sla_breakdown_filter: Optional filter for SLA breakdown (ANY, REMEDIATED, NON_REMEDIATED) include_trend_events: Whether to include trend events in the response Returns: CardDetails object containing the card details """params={"sla_breakdown_filter":sla_breakdown_filter.value,"include_trend_events":include_trend_events}iftrend_timeframe:params["trend_start_date"]=trend_timeframe.start_date.isoformat()params["trend_end_date"]=trend_timeframe.end_date.isoformat()ifsla_efficiency_timeframe:params["sla_efficiency_start_date"]=sla_efficiency_timeframe.start_date.isoformat()params["sla_efficiency_end_date"]=sla_efficiency_timeframe.end_date.isoformat()card_response=self._get(path=f"api/v1/t1/exposure-view/cards/{card_id}",params=params,box=False)returnCardDetails.model_validate(card_response.json())