Struct ServiceLevelObjectivesAPI

Source
pub struct ServiceLevelObjectivesAPI { /* private fields */ }
Expand description

Service Level Objectives (or SLOs) are a key part of the site reliability engineering toolkit. SLOs provide a framework for defining clear targets around application performance, which ultimately help teams provide a consistent customer experience, balance feature development with platform stability, and improve communication with internal and external users.

Implementations§

Source§

impl ServiceLevelObjectivesAPI

Source

pub fn new() -> Self

Source

pub fn with_config(config: Configuration) -> Self

Examples found in repository?
examples/v1_service-level-objectives_CheckCanDeleteSLO.rs (line 8)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = ServiceLevelObjectivesAPI::with_config(configuration);
9    let resp = api.check_can_delete_slo("ids".to_string()).await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
More examples
Hide additional examples
examples/v1_service-level-objectives_GetSLOCorrections.rs (line 10)
6async fn main() {
7    // there is a valid "slo" in the system
8    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = ServiceLevelObjectivesAPI::with_config(configuration);
11    let resp = api.get_slo_corrections(slo_data_0_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
examples/v1_service-level-objectives_ListSLOs_3036942817.rs (line 11)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let response = api.list_slos_with_pagination(ListSLOsOptionalParams::default().limit(2));
13    pin_mut!(response);
14    while let Some(resp) = response.next().await {
15        if let Ok(value) = resp {
16            println!("{:#?}", value);
17        } else {
18            println!("{:#?}", resp.unwrap_err());
19        }
20    }
21}
examples/v1_service-level-objectives_GetSLO.rs (line 11)
7async fn main() {
8    // there is a valid "slo" in the system
9    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let resp = api
13        .get_slo(slo_data_0_id.clone(), GetSLOOptionalParams::default())
14        .await;
15    if let Ok(value) = resp {
16        println!("{:#?}", value);
17    } else {
18        println!("{:#?}", resp.unwrap_err());
19    }
20}
examples/v1_service-level-objectives_DeleteSLO.rs (line 11)
7async fn main() {
8    // there is a valid "slo" in the system
9    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let resp = api
13        .delete_slo(slo_data_0_id.clone(), DeleteSLOOptionalParams::default())
14        .await;
15    if let Ok(value) = resp {
16        println!("{:#?}", value);
17    } else {
18        println!("{:#?}", resp.unwrap_err());
19    }
20}
examples/v1_service-level-objectives_ListSLOs.rs (line 11)
7async fn main() {
8    // there is a valid "slo" in the system
9    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let resp = api
13        .list_slos(ListSLOsOptionalParams::default().ids(slo_data_0_id.clone()))
14        .await;
15    if let Ok(value) = resp {
16        println!("{:#?}", value);
17    } else {
18        println!("{:#?}", resp.unwrap_err());
19    }
20}
Source

pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self

Source

pub async fn check_can_delete_slo( &self, ids: String, ) -> Result<CheckCanDeleteSLOResponse, Error<CheckCanDeleteSLOError>>

Check if an SLO can be safely deleted. For example, assure an SLO can be deleted without disrupting a dashboard.

Examples found in repository?
examples/v1_service-level-objectives_CheckCanDeleteSLO.rs (line 9)
6async fn main() {
7    let configuration = datadog::Configuration::new();
8    let api = ServiceLevelObjectivesAPI::with_config(configuration);
9    let resp = api.check_can_delete_slo("ids".to_string()).await;
10    if let Ok(value) = resp {
11        println!("{:#?}", value);
12    } else {
13        println!("{:#?}", resp.unwrap_err());
14    }
15}
Source

pub async fn check_can_delete_slo_with_http_info( &self, ids: String, ) -> Result<ResponseContent<CheckCanDeleteSLOResponse>, Error<CheckCanDeleteSLOError>>

Check if an SLO can be safely deleted. For example, assure an SLO can be deleted without disrupting a dashboard.

Source

pub async fn create_slo( &self, body: ServiceLevelObjectiveRequest, ) -> Result<SLOListResponse, Error<CreateSLOError>>

Create a service level objective object.

Examples found in repository?
examples/v1_service-level-objectives_CreateSLO.rs (line 33)
11async fn main() {
12    let body = ServiceLevelObjectiveRequest::new(
13        "Example-Service-Level-Objective".to_string(),
14        vec![SLOThreshold::new(97.0, SLOTimeframe::SEVEN_DAYS)
15            .target_display("97.0".to_string())
16            .warning(98.0 as f64)
17            .warning_display("98.0".to_string())],
18        SLOType::METRIC,
19    )
20    .description(Some("string".to_string()))
21    .groups(vec!["env:test".to_string(), "role:mysql".to_string()])
22    .monitor_ids(vec![])
23    .query(ServiceLevelObjectiveQuery::new(
24        "sum:httpservice.hits{!code:3xx}.as_count()".to_string(),
25        "sum:httpservice.hits{code:2xx}.as_count()".to_string(),
26    ))
27    .tags(vec!["env:prod".to_string(), "app:core".to_string()])
28    .target_threshold(97.0 as f64)
29    .timeframe(SLOTimeframe::SEVEN_DAYS)
30    .warning_threshold(98.0 as f64);
31    let configuration = datadog::Configuration::new();
32    let api = ServiceLevelObjectivesAPI::with_config(configuration);
33    let resp = api.create_slo(body).await;
34    if let Ok(value) = resp {
35        println!("{:#?}", value);
36    } else {
37        println!("{:#?}", resp.unwrap_err());
38    }
39}
More examples
Hide additional examples
examples/v1_service-level-objectives_CreateSLO_3765703239.rs (line 53)
19async fn main() {
20    let body = ServiceLevelObjectiveRequest::new(
21        "Example-Service-Level-Objective".to_string(),
22        vec![SLOThreshold::new(97.0, SLOTimeframe::SEVEN_DAYS)
23            .target_display("97.0".to_string())
24            .warning(98.0 as f64)
25            .warning_display("98.0".to_string())],
26        SLOType::TIME_SLICE,
27    )
28    .description(Some("string".to_string()))
29    .sli_specification(SLOSliSpec::SLOTimeSliceSpec(Box::new(
30        SLOTimeSliceSpec::new(SLOTimeSliceCondition::new(
31            SLOTimeSliceComparator::GREATER,
32            SLOTimeSliceQuery::new(
33                vec![SLOFormula::new("query1".to_string())],
34                vec![
35                    SLODataSourceQueryDefinition::FormulaAndFunctionMetricQueryDefinition(
36                        Box::new(FormulaAndFunctionMetricQueryDefinition::new(
37                            FormulaAndFunctionMetricDataSource::METRICS,
38                            "query1".to_string(),
39                            "trace.servlet.request{env:prod}".to_string(),
40                        )),
41                    ),
42                ],
43            ),
44            5.0,
45        )),
46    )))
47    .tags(vec!["env:prod".to_string()])
48    .target_threshold(97.0 as f64)
49    .timeframe(SLOTimeframe::SEVEN_DAYS)
50    .warning_threshold(98.0 as f64);
51    let configuration = datadog::Configuration::new();
52    let api = ServiceLevelObjectivesAPI::with_config(configuration);
53    let resp = api.create_slo(body).await;
54    if let Ok(value) = resp {
55        println!("{:#?}", value);
56    } else {
57        println!("{:#?}", resp.unwrap_err());
58    }
59}
Source

pub async fn create_slo_with_http_info( &self, body: ServiceLevelObjectiveRequest, ) -> Result<ResponseContent<SLOListResponse>, Error<CreateSLOError>>

Create a service level objective object.

Source

pub async fn delete_slo( &self, slo_id: String, params: DeleteSLOOptionalParams, ) -> Result<SLODeleteResponse, Error<DeleteSLOError>>

Permanently delete the specified service level objective object.

If an SLO is used in a dashboard, the DELETE /v1/slo/ endpoint returns a 409 conflict error because the SLO is referenced in a dashboard.

Examples found in repository?
examples/v1_service-level-objectives_DeleteSLO.rs (line 13)
7async fn main() {
8    // there is a valid "slo" in the system
9    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let resp = api
13        .delete_slo(slo_data_0_id.clone(), DeleteSLOOptionalParams::default())
14        .await;
15    if let Ok(value) = resp {
16        println!("{:#?}", value);
17    } else {
18        println!("{:#?}", resp.unwrap_err());
19    }
20}
Source

pub async fn delete_slo_with_http_info( &self, slo_id: String, params: DeleteSLOOptionalParams, ) -> Result<ResponseContent<SLODeleteResponse>, Error<DeleteSLOError>>

Permanently delete the specified service level objective object.

If an SLO is used in a dashboard, the DELETE /v1/slo/ endpoint returns a 409 conflict error because the SLO is referenced in a dashboard.

Source

pub async fn delete_slo_timeframe_in_bulk( &self, body: BTreeMap<String, Vec<SLOTimeframe>>, ) -> Result<SLOBulkDeleteResponse, Error<DeleteSLOTimeframeInBulkError>>

Delete (or partially delete) multiple service level objective objects.

This endpoint facilitates deletion of one or more thresholds for one or more service level objective objects. If all thresholds are deleted, the service level objective object is deleted as well.

Examples found in repository?
examples/v1_service-level-objectives_DeleteSLOTimeframeInBulk.rs (line 21)
8async fn main() {
9    let body = BTreeMap::from([
10        (
11            "id1".to_string(),
12            vec![SLOTimeframe::SEVEN_DAYS, SLOTimeframe::THIRTY_DAYS],
13        ),
14        (
15            "id2".to_string(),
16            vec![SLOTimeframe::SEVEN_DAYS, SLOTimeframe::THIRTY_DAYS],
17        ),
18    ]);
19    let configuration = datadog::Configuration::new();
20    let api = ServiceLevelObjectivesAPI::with_config(configuration);
21    let resp = api.delete_slo_timeframe_in_bulk(body).await;
22    if let Ok(value) = resp {
23        println!("{:#?}", value);
24    } else {
25        println!("{:#?}", resp.unwrap_err());
26    }
27}
Source

pub async fn delete_slo_timeframe_in_bulk_with_http_info( &self, body: BTreeMap<String, Vec<SLOTimeframe>>, ) -> Result<ResponseContent<SLOBulkDeleteResponse>, Error<DeleteSLOTimeframeInBulkError>>

Delete (or partially delete) multiple service level objective objects.

This endpoint facilitates deletion of one or more thresholds for one or more service level objective objects. If all thresholds are deleted, the service level objective object is deleted as well.

Source

pub async fn get_slo( &self, slo_id: String, params: GetSLOOptionalParams, ) -> Result<SLOResponse, Error<GetSLOError>>

Get a service level objective object.

Examples found in repository?
examples/v1_service-level-objectives_GetSLO.rs (line 13)
7async fn main() {
8    // there is a valid "slo" in the system
9    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let resp = api
13        .get_slo(slo_data_0_id.clone(), GetSLOOptionalParams::default())
14        .await;
15    if let Ok(value) = resp {
16        println!("{:#?}", value);
17    } else {
18        println!("{:#?}", resp.unwrap_err());
19    }
20}
Source

pub async fn get_slo_with_http_info( &self, slo_id: String, params: GetSLOOptionalParams, ) -> Result<ResponseContent<SLOResponse>, Error<GetSLOError>>

Get a service level objective object.

Source

pub async fn get_slo_corrections( &self, slo_id: String, ) -> Result<SLOCorrectionListResponse, Error<GetSLOCorrectionsError>>

Get corrections applied to an SLO

Examples found in repository?
examples/v1_service-level-objectives_GetSLOCorrections.rs (line 11)
6async fn main() {
7    // there is a valid "slo" in the system
8    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
9    let configuration = datadog::Configuration::new();
10    let api = ServiceLevelObjectivesAPI::with_config(configuration);
11    let resp = api.get_slo_corrections(slo_data_0_id.clone()).await;
12    if let Ok(value) = resp {
13        println!("{:#?}", value);
14    } else {
15        println!("{:#?}", resp.unwrap_err());
16    }
17}
Source

pub async fn get_slo_corrections_with_http_info( &self, slo_id: String, ) -> Result<ResponseContent<SLOCorrectionListResponse>, Error<GetSLOCorrectionsError>>

Get corrections applied to an SLO

Source

pub async fn get_slo_history( &self, slo_id: String, from_ts: i64, to_ts: i64, params: GetSLOHistoryOptionalParams, ) -> Result<SLOHistoryResponse, Error<GetSLOHistoryError>>

Get a specific SLO’s history, regardless of its SLO type.

The detailed history data is structured according to the source data type. For example, metric data is included for event SLOs that use the metric source, and monitor SLO types include the monitor transition history.

Note: There are different response formats for event based and time based SLOs. Examples of both are shown.

Examples found in repository?
examples/v1_service-level-objectives_GetSLOHistory.rs (lines 13-18)
7async fn main() {
8    // there is a valid "slo" in the system
9    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let resp = api
13        .get_slo_history(
14            slo_data_0_id.clone(),
15            1636542671,
16            1636629071,
17            GetSLOHistoryOptionalParams::default(),
18        )
19        .await;
20    if let Ok(value) = resp {
21        println!("{:#?}", value);
22    } else {
23        println!("{:#?}", resp.unwrap_err());
24    }
25}
Source

pub async fn get_slo_history_with_http_info( &self, slo_id: String, from_ts: i64, to_ts: i64, params: GetSLOHistoryOptionalParams, ) -> Result<ResponseContent<SLOHistoryResponse>, Error<GetSLOHistoryError>>

Get a specific SLO’s history, regardless of its SLO type.

The detailed history data is structured according to the source data type. For example, metric data is included for event SLOs that use the metric source, and monitor SLO types include the monitor transition history.

Note: There are different response formats for event based and time based SLOs. Examples of both are shown.

Source

pub async fn list_slos( &self, params: ListSLOsOptionalParams, ) -> Result<SLOListResponse, Error<ListSLOsError>>

Get a list of service level objective objects for your organization.

Examples found in repository?
examples/v1_service-level-objectives_ListSLOs.rs (line 13)
7async fn main() {
8    // there is a valid "slo" in the system
9    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let resp = api
13        .list_slos(ListSLOsOptionalParams::default().ids(slo_data_0_id.clone()))
14        .await;
15    if let Ok(value) = resp {
16        println!("{:#?}", value);
17    } else {
18        println!("{:#?}", resp.unwrap_err());
19    }
20}
Source

pub fn list_slos_with_pagination( &self, params: ListSLOsOptionalParams, ) -> impl Stream<Item = Result<ServiceLevelObjective, Error<ListSLOsError>>> + '_

Examples found in repository?
examples/v1_service-level-objectives_ListSLOs_3036942817.rs (line 12)
9async fn main() {
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let response = api.list_slos_with_pagination(ListSLOsOptionalParams::default().limit(2));
13    pin_mut!(response);
14    while let Some(resp) = response.next().await {
15        if let Ok(value) = resp {
16            println!("{:#?}", value);
17        } else {
18            println!("{:#?}", resp.unwrap_err());
19        }
20    }
21}
Source

pub async fn list_slos_with_http_info( &self, params: ListSLOsOptionalParams, ) -> Result<ResponseContent<SLOListResponse>, Error<ListSLOsError>>

Get a list of service level objective objects for your organization.

Source

pub async fn search_slo( &self, params: SearchSLOOptionalParams, ) -> Result<SearchSLOResponse, Error<SearchSLOError>>

Get a list of service level objective objects for your organization.

Examples found in repository?
examples/v1_service-level-objectives_SearchSLO.rs (lines 13-18)
7async fn main() {
8    // there is a valid "slo" in the system
9    let slo_data_0_name = std::env::var("SLO_DATA_0_NAME").unwrap();
10    let configuration = datadog::Configuration::new();
11    let api = ServiceLevelObjectivesAPI::with_config(configuration);
12    let resp = api
13        .search_slo(
14            SearchSLOOptionalParams::default()
15                .query(slo_data_0_name.clone())
16                .page_size(20)
17                .page_number(0),
18        )
19        .await;
20    if let Ok(value) = resp {
21        println!("{:#?}", value);
22    } else {
23        println!("{:#?}", resp.unwrap_err());
24    }
25}
Source

pub async fn search_slo_with_http_info( &self, params: SearchSLOOptionalParams, ) -> Result<ResponseContent<SearchSLOResponse>, Error<SearchSLOError>>

Get a list of service level objective objects for your organization.

Source

pub async fn update_slo( &self, slo_id: String, body: ServiceLevelObjective, ) -> Result<SLOListResponse, Error<UpdateSLOError>>

Update the specified service level objective object.

Examples found in repository?
examples/v1_service-level-objectives_UpdateSLO.rs (line 29)
11async fn main() {
12    // there is a valid "slo" in the system
13    let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
14    let slo_data_0_name = std::env::var("SLO_DATA_0_NAME").unwrap();
15    let body = ServiceLevelObjective::new(
16        slo_data_0_name.clone(),
17        vec![SLOThreshold::new(97.0, SLOTimeframe::SEVEN_DAYS).warning(98.0 as f64)],
18        SLOType::METRIC,
19    )
20    .query(ServiceLevelObjectiveQuery::new(
21        "sum:httpservice.hits{!code:3xx}.as_count()".to_string(),
22        "sum:httpservice.hits{code:2xx}.as_count()".to_string(),
23    ))
24    .target_threshold(97.0 as f64)
25    .timeframe(SLOTimeframe::SEVEN_DAYS)
26    .warning_threshold(98.0 as f64);
27    let configuration = datadog::Configuration::new();
28    let api = ServiceLevelObjectivesAPI::with_config(configuration);
29    let resp = api.update_slo(slo_data_0_id.clone(), body).await;
30    if let Ok(value) = resp {
31        println!("{:#?}", value);
32    } else {
33        println!("{:#?}", resp.unwrap_err());
34    }
35}
Source

pub async fn update_slo_with_http_info( &self, slo_id: String, body: ServiceLevelObjective, ) -> Result<ResponseContent<SLOListResponse>, Error<UpdateSLOError>>

Update the specified service level objective object.

Trait Implementations§

Source§

impl Clone for ServiceLevelObjectivesAPI

Source§

fn clone(&self) -> ServiceLevelObjectivesAPI

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ServiceLevelObjectivesAPI

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ServiceLevelObjectivesAPI

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,