# Slas ## List Data Sources `client.slas.listDataSources(stringslaUrn, RequestOptionsoptions?): SlaListDataSourcesResponse` **get** `/v1/slas/{sla_urn}/data-sources` List all data sources for an SLA. There is never more than one status page source, and the monitor data sources are sorted alphabetically by name (case-insensitive). ### Parameters - `slaUrn: string` ### Returns - `SlaListDataSourcesResponse` - `monitor_data_sources: Array` A list of any monitor data sources associated with the SLA - `description: string | null` The monitor's description - `name: string` The monitor's display name - `urn: string` A unique identifier for the data source - `data_source_type?: "MONITOR"` The type of the data source - `"MONITOR"` - `sla_urn: string` A unique identifier for the SLA associated with this data source - `status_page_data_source: StatusPageDataSource | null` The SLA's data source for incidents pulled from vendor status pages, if applicable - `excluded_product_tags: Array` A list of incident tags that are excluded from the SLA's calculations - `included_product_tags: Array` A list of incident tags that are included in the SLA's calculations - `urn: string` A unique identifier for the data source - `data_source_type?: "STATUS_PAGE"` The type of the data source - `"STATUS_PAGE"` - `vendor_urn: string` A unique identifier for the vendor associated with this data source ### Example ```typescript import Clarative from 'clarative'; const client = new Clarative({ apiKey: process.env['CLARATIVE_API_KEY'], // This is the default and can be omitted }); const response = await client.slas.listDataSources('sla_urn'); console.log(response.monitor_data_sources); ``` ## List Violations `client.slas.listViolations(stringslaUrn, SlaListViolationsParamsquery?, RequestOptionsoptions?): SlaListViolationsResponse` **get** `/v1/slas/{sla_urn}/violations` List all violations for an SLA, sorted first by timestamp (oldest first) and second by total downtime (longest first). ### Parameters - `slaUrn: string` - `query: SlaListViolationsParams` - `data_source_urn?: string | null` An SLA data source's unique identifier - `end_month?: string | null` Year and month landing within the last SLA evaluation period to include in the result, in the format YYYY-MM. Defaults to the current time. - `start_month?: string` Year and month landing within the first SLA evaluation period to include in the result, in the format YYYY-MM. Defaults to 2024-01. ### Returns - `SlaListViolationsResponse = Array` - `allowable_downtime_hours: number` The total number of allowable downtime hours during the evaluation period, as defined by the SLA's terms - `data_source_type: "STATUS_PAGE" | "MONITOR"` The type of data source used to determine the violation. - `"STATUS_PAGE"` - `"MONITOR"` - `data_source_urn: string` The unique identifier of the data source used to determine the violation - `downtime_hours: number` 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: EndMonth` The month in which the SLA violation ended. Null if the violation is ongoing. - `month: number` The month number (1-12) - `year: number` The year of the month - `start_month: StartMonth` The month in which the SLA violation started - `month: number` The month number (1-12) - `year: number` The year of the month - `uptime_percentage: number` The percentage of uptime during the evaluation period - `urn: string` A unique identifier composed of the SLA URN and the evaluation period ### Example ```typescript import Clarative from 'clarative'; const client = new Clarative({ apiKey: process.env['CLARATIVE_API_KEY'], // This is the default and can be omitted }); const response = await client.slas.listViolations('sla_urn'); console.log(response); ``` ## List `client.slas.list(SlaListParamsquery?, RequestOptionsoptions?): SlaListResponse` **get** `/v1/slas` List all SLAs, sorted by name alphabetically (case-insensitive) ### Parameters - `query: SlaListParams` - `vendor_urn?: string | null` A vendor's unique identifier ### Returns - `SlaListResponse = Array` - `description: string` A description of the SLA - `name: string` The name of the SLA - `urn: string` A unique identifier for the SLA - `vendor_urn: string` A unique identifier for the vendor associated with the SLA ### Example ```typescript import Clarative from 'clarative'; const client = new Clarative({ apiKey: process.env['CLARATIVE_API_KEY'], // This is the default and can be omitted }); const slas = await client.slas.list(); console.log(slas); ``` ## Retrieve Violation `client.slas.retrieveViolation(stringviolationUrn, SlaRetrieveViolationParamsparams, RequestOptionsoptions?): SlaRetrieveViolationResponse` **get** `/v1/slas/{sla_urn}/violations/{violation_urn}` Get details on a specific SLA violation ### Parameters - `violationUrn: string` - `params: SlaRetrieveViolationParams` - `sla_urn: string` ### Returns - `SlaRetrieveViolationResponse` - `allowable_downtime_hours: number` The total number of allowable downtime hours during the evaluation period, as defined by the SLA's terms - `data_source: APIStatusPageSlaDataSource | APIMonitorSlaDataSource` The data source used to determine the violation. - `APIStatusPageSlaDataSource` - `excluded_product_tags: Array` A list of incident tags that are excluded from the SLA's calculations - `included_product_tags: Array` A list of incident tags that are included in the SLA's calculations - `urn: string` A unique identifier for the data source - `data_source_type?: "STATUS_PAGE"` The type of the data source - `"STATUS_PAGE"` - `APIMonitorSlaDataSource` - `description: string | null` The monitor's description - `name: string` The monitor's display name - `urn: string` A unique identifier for the data source - `data_source_type?: "MONITOR"` The type of the data source - `"MONITOR"` - `data_source_type: "STATUS_PAGE" | "MONITOR"` The type of data source used to determine the violation. - `"STATUS_PAGE"` - `"MONITOR"` - `data_source_urn: string` The unique identifier of the data source used to determine the violation - `downtime_events: Array` A list of downtime events that occurred during the evaluation period and contributed to the SLA violation - `duration_hours: number` The duration of the downtime event in hours - `end_time: string` The end time of the downtime event - `name: string` The display name of the downtime event - `start_time: string` The start time of the downtime event - `downtime_hours: number` 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: EndMonth` The month in which the SLA violation ended. Null if the violation is ongoing. - `month: number` The month number (1-12) - `year: number` The year of the month - `start_month: StartMonth` The month in which the SLA violation started - `month: number` The month number (1-12) - `year: number` The year of the month - `sla: Sla` The SLA that was violated - `description: string` A description of the SLA - `name: string` The name of the SLA - `urn: string` A unique identifier for the SLA - `vendor_urn: string` A unique identifier for the vendor associated with the SLA - `uptime_percentage: number` The percentage of uptime during the evaluation period - `urn: string` A unique identifier composed of the SLA URN and the evaluation period - `vendor: Vendor` The vendor responsible for the violation - `created_at: string` An ISO-8601-formatted timestamp representing when the vendor was created (UTC) - `description: string | null` The vendor's description - `name: string` The vendor's display name - `urn: string` A unique identifier for the vendor ### Example ```typescript import Clarative from 'clarative'; const client = new Clarative({ apiKey: process.env['CLARATIVE_API_KEY'], // This is the default and can be omitted }); const response = await client.slas.retrieveViolation('violation_urn', { sla_urn: 'sla_urn' }); console.log(response.allowable_downtime_hours); ``` ## Retrieve `client.slas.retrieve(stringurn, RequestOptionsoptions?): SlaRetrieveResponse` **get** `/v1/slas/{urn}` Fetch in-depth information about a single SLA ### Parameters - `urn: string` ### Returns - `SlaRetrieveResponse` - `description: string` A description of the SLA - `name: string` The name of the SLA - `urn: string` A unique identifier for the SLA - `vendor_urn: string` A unique identifier for the vendor associated with the SLA ### Example ```typescript import Clarative from 'clarative'; const client = new Clarative({ apiKey: process.env['CLARATIVE_API_KEY'], // This is the default and can be omitted }); const sla = await client.slas.retrieve('urn'); console.log(sla.description); ``` ## Get Uptime Metrics `client.slas.getUptimeMetrics(stringdataSourceUrn, SlaGetUptimeMetricsParamsparams, RequestOptionsoptions?): SlaGetUptimeMetricsResponse` **get** `/v1/slas/{sla_urn}/data-sources/{data_source_urn}/uptime-metrics` Get uptime metrics for an SLA data source ### Parameters - `dataSourceUrn: string` - `params: SlaGetUptimeMetricsParams` - `sla_urn: string` Path param - `end: string` Query param: ISO-formatted datetime for the end of the evaluation period (e.g. 2024-01-31, 2024-01-31T23:59:59Z) - `start: string` Query param: ISO-formatted datetime for the start of the evaluation period (e.g. 2024-01-01, 2024-01-15T08:00:00Z) ### Returns - `SlaGetUptimeMetricsResponse` - `data_source_urn: string` The unique identifier of the data source - `downtime_events: Array` A non-deduplicated list of downtime events that occurred during the timeframe - `duration_hours: number` The duration of the downtime event in hours - `end_time: string` The end time of the downtime event - `name: string` The display name of the downtime event - `start_time: string` The start time of the downtime event - `metrics: Metrics` The uptime metrics for the data source during the timeframe - `downtime_hours: number` The total number of downtime hours during the timeframe - `uptime_percentage: number` The percentage of uptime during the timeframe - `metrics_deduplicated: MetricsDeduplicated` The uptime metrics for the data source during the timeframe, with overlapping windows of downtime (such as from different incidents that occurred simultaneously) counted only once - `downtime_hours: number` The total number of downtime hours during the timeframe - `uptime_percentage: number` The percentage of uptime during the timeframe - `sla_urn: string` The unique identifier of the SLA - `timeframe: Timeframe` The timeframe for which the uptime metrics are calculated - `end: string` The ISO-formatted end datetime of the timeframe for which the metrics are calculated - `start: string` The ISO-formatted start datetime of the timeframe for which the metrics are calculated - `vendor_urn: string` The unique identifier of the vendor ### Example ```typescript import Clarative from 'clarative'; const client = new Clarative({ apiKey: process.env['CLARATIVE_API_KEY'], // This is the default and can be omitted }); const response = await client.slas.getUptimeMetrics('data_source_urn', { sla_urn: 'sla_urn', end: '2019-12-27T18:11:19.117Z', start: '2019-12-27T18:11:19.117Z', }); console.log(response.data_source_urn); ```