# Slas ## List Data Sources `slas.list_data_sources(strsla_urn) -> SlaListDataSourcesResponse` **get** `/v1/slas/{sla_urn}/data-sources` List all data sources for an SLA ### Parameters - `sla_urn: str` ### Returns - `class SlaListDataSourcesResponse: …` - `monitor_data_sources: List[MonitorDataSource]` A list of any monitor data sources associated with the SLA - `description: Optional[str]` The monitor's description - `name: str` The monitor's display name - `urn: str` A unique identifier for the data source - `data_source_type: Optional[Literal["MONITOR"]]` The type of the data source - `"MONITOR"` - `sla_urn: str` A unique identifier for the SLA associated with this data source - `status_page_data_source: Optional[StatusPageDataSource]` The SLA's data source for incidents pulled from vendor status pages, if applicable - `excluded_product_tags: List[str]` A list of incident tags that are excluded from the SLA's calculations - `included_product_tags: List[str]` A list of incident tags that are included in the SLA's calculations - `urn: str` A unique identifier for the data source - `data_source_type: Optional[Literal["STATUS_PAGE"]]` The type of the data source - `"STATUS_PAGE"` - `vendor_urn: str` A unique identifier for the vendor associated with this data source ### Example ```python import os from clarative import Clarative client = Clarative( api_key=os.environ.get("CLARATIVE_API_KEY"), # This is the default and can be omitted ) response = client.slas.list_data_sources( "sla_urn", ) print(response.monitor_data_sources) ``` ## List Violations `slas.list_violations(strsla_urn, SlaListViolationsParams**kwargs) -> SlaListViolationsResponse` **get** `/v1/slas/{sla_urn}/violations` List all violations for an SLA ### Parameters - `sla_urn: str` - `data_source_urn: Optional[str]` An SLA data source's unique identifier - `timeframe_end: Optional[str]` Year and month landing within the last SLA evaluation period to include in the result, in the format YYYY-MM - `timeframe_start: Optional[str]` Year and month landing within the first SLA evaluation period to include in the result, in the format YYYY-MM ### Returns - `List[SlaListViolationsResponseItem]` - `allowable_downtime_hours: float` The total number of allowable downtime hours during the evaluation period, as defined by the SLA's terms - `data_source_type: Literal["STATUS_PAGE", "MONITOR"]` The type of data source used to determine the violation. - `"STATUS_PAGE"` - `"MONITOR"` - `downtime_hours: float` The total number of downtime hours during the evaluation period - `evaluation_period: SlaListViolationsResponseItemEvaluationPeriod` The evaluation period during which the SLA violation occurred. The length of the period is determined by the SLA's configured evaluation window (for example: monthly or quarterly). - `end_month: SlaListViolationsResponseItemEvaluationPeriodEndMonth` The month in which the SLA violation ended. Null if the violation is ongoing. - `month: int` The month number (1-12) - `year: int` The year of the month - `start_month: SlaListViolationsResponseItemEvaluationPeriodStartMonth` The month in which the SLA violation started - `month: int` The month number (1-12) - `year: int` The year of the month - `uptime_percentage: float` The percentage of uptime during the evaluation period - `urn: str` A unique identifier composed of the SLA URN and the evaluation period ### Example ```python import os from clarative import Clarative client = Clarative( api_key=os.environ.get("CLARATIVE_API_KEY"), # This is the default and can be omitted ) response = client.slas.list_violations( sla_urn="sla_urn", ) print(response) ``` ## List `slas.list() -> SlaListResponse` **get** `/v1/slas` List all SLAs ### Returns - `List[SlaListResponseItem]` - `description: str` A description of the SLA - `name: str` The name of the SLA - `urn: str` A unique identifier for the SLA - `vendor_urn: str` A unique identifier for the vendor associated with the SLA ### Example ```python import os from clarative import Clarative client = Clarative( api_key=os.environ.get("CLARATIVE_API_KEY"), # This is the default and can be omitted ) slas = client.slas.list() print(slas) ``` ## Retrieve Violation `slas.retrieve_violation(strviolation_urn, SlaRetrieveViolationParams**kwargs) -> SlaRetrieveViolationResponse` **get** `/v1/slas/{sla_urn}/violations/{violation_urn}` Get details on a specific SLA violation ### Parameters - `sla_urn: str` - `violation_urn: str` ### Returns - `class SlaRetrieveViolationResponse: …` - `allowable_downtime_hours: float` The total number of allowable downtime hours during the evaluation period, as defined by the SLA's terms - `data_source: DataSource` The data source used to determine the violation. - `class DataSourceAPIStatusPageSlaDataSource: …` - `excluded_product_tags: List[str]` A list of incident tags that are excluded from the SLA's calculations - `included_product_tags: List[str]` A list of incident tags that are included in the SLA's calculations - `urn: str` A unique identifier for the data source - `data_source_type: Optional[Literal["STATUS_PAGE"]]` The type of the data source - `"STATUS_PAGE"` - `class DataSourceAPIMonitorSlaDataSource: …` - `description: Optional[str]` The monitor's description - `name: str` The monitor's display name - `urn: str` A unique identifier for the data source - `data_source_type: Optional[Literal["MONITOR"]]` The type of the data source - `"MONITOR"` - `data_source_type: Literal["STATUS_PAGE", "MONITOR"]` The type of data source used to determine the violation. - `"STATUS_PAGE"` - `"MONITOR"` - `downtime_events: List[DowntimeEvent]` A list of downtime events that occurred during the evaluation period and contributed to the SLA violation - `duration_hours: float` The duration of the downtime event in hours - `end_time: datetime` The end time of the downtime event - `name: str` The display name of the downtime event - `start_time: datetime` The start time of the downtime event - `downtime_hours: float` The total number of downtime hours during the evaluation period - `evaluation_period: EvaluationPeriod` The evaluation period during which the SLA violation occurred. The length of the period is determined by the SLA's configured evaluation window (for example: monthly or quarterly). - `end_month: EvaluationPeriodEndMonth` The month in which the SLA violation ended. Null if the violation is ongoing. - `month: int` The month number (1-12) - `year: int` The year of the month - `start_month: EvaluationPeriodStartMonth` The month in which the SLA violation started - `month: int` The month number (1-12) - `year: int` The year of the month - `sla: Sla` The SLA that was violated - `description: str` A description of the SLA - `name: str` The name of the SLA - `urn: str` A unique identifier for the SLA - `vendor_urn: str` A unique identifier for the vendor associated with the SLA - `uptime_percentage: float` The percentage of uptime during the evaluation period - `urn: str` A unique identifier composed of the SLA URN and the evaluation period - `vendor: Vendor` The vendor responsible for the violation - `created_at: datetime` An ISO-8601-formatted timestamp representing when the vendor was created (UTC) - `description: Optional[str]` The vendor's description - `name: str` The vendor's display name - `urn: str` A unique identifier for the vendor ### Example ```python import os from clarative import Clarative client = Clarative( api_key=os.environ.get("CLARATIVE_API_KEY"), # This is the default and can be omitted ) response = client.slas.retrieve_violation( violation_urn="violation_urn", sla_urn="sla_urn", ) print(response.allowable_downtime_hours) ``` ## Retrieve `slas.retrieve(strurn) -> SlaRetrieveResponse` **get** `/v1/slas/{urn}` Fetch in-depth information about a single SLA ### Parameters - `urn: str` ### Returns - `class SlaRetrieveResponse: …` - `description: str` A description of the SLA - `name: str` The name of the SLA - `urn: str` A unique identifier for the SLA - `vendor_urn: str` A unique identifier for the vendor associated with the SLA ### Example ```python import os from clarative import Clarative client = Clarative( api_key=os.environ.get("CLARATIVE_API_KEY"), # This is the default and can be omitted ) sla = client.slas.retrieve( "urn", ) print(sla.description) ``` ## Get Uptime Metrics `slas.get_uptime_metrics(strdata_source_urn, SlaGetUptimeMetricsParams**kwargs) -> SlaGetUptimeMetricsResponse` **get** `/v1/slas/{sla_urn}/data-sources/{data_source_urn}/uptime-metrics` Get uptime metrics for an SLA data source ### Parameters - `sla_urn: str` - `data_source_urn: str` - `timeframe_end: Optional[str]` Year and month landing within the last SLA evaluation period to include in the result, in the format YYYY-MM - `timeframe_start: Optional[str]` Year and month landing within the first SLA evaluation period to include in the result, in the format YYYY-MM ### Returns - `List[SlaGetUptimeMetricsResponseItem]` - `data_source_urn: str` The unique identifier of the data source - `downtime_events: List[SlaGetUptimeMetricsResponseItemDowntimeEvent]` A list of downtime events that occurred during the timeframe - `duration_hours: float` The duration of the downtime event in hours - `end_time: datetime` The end time of the downtime event - `name: str` The display name of the downtime event - `start_time: datetime` The start time of the downtime event - `downtime_hours: float` The total number of downtime hours during the timeframe - `sla_urn: str` The unique identifier of the SLA - `timeframe: SlaGetUptimeMetricsResponseItemTimeframe` The timeframe for which the uptime metrics are calculated - `end: datetime` The ISO-formatted end datetime of the timeframe for which the metrics are calculated - `start: datetime` The ISO-formatted start datetime of the timeframe for which the metrics are calculated - `uptime_percentage: float` The percentage of uptime during the timeframe - `vendor_urn: str` The unique identifier of the vendor ### Example ```python import os from clarative import Clarative client = Clarative( api_key=os.environ.get("CLARATIVE_API_KEY"), # This is the default and can be omitted ) response = client.slas.get_uptime_metrics( data_source_urn="data_source_urn", sla_urn="sla_urn", ) print(response) ```