Struct datadog_api_client::datadogV1::api::api_service_level_objectives::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
impl ServiceLevelObjectivesAPI
pub fn new() -> Self
sourcepub fn with_config(config: Configuration) -> Self
pub fn with_config(config: Configuration) -> Self
Examples found in repository?
More examples
6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api.get_slo_corrections(slo_data_0_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
9 10 11 12 13 14 15 16 17 18 19 20 21
async fn main() {
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let response = api.list_slos_with_pagination(ListSLOsOptionalParams::default().limit(2));
pin_mut!(response);
while let Some(resp) = response.next().await {
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
}
7 8 9 10 11 12 13 14 15 16 17 18 19 20
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api
.get_slo(slo_data_0_id.clone(), GetSLOOptionalParams::default())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
7 8 9 10 11 12 13 14 15 16 17 18 19 20
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api
.delete_slo(slo_data_0_id.clone(), DeleteSLOOptionalParams::default())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
7 8 9 10 11 12 13 14 15 16 17 18 19 20
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api
.list_slos(ListSLOsOptionalParams::default().ids(slo_data_0_id.clone()))
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
- examples/v1_service-level-objectives_get_slo_history.rs
- examples/v1_service-level-objectives_search_slo.rs
- examples/v1_service-level-objectives_delete_slo_timeframe_in_bulk.rs
- examples/v1_service-level-objectives_update_slo.rs
- examples/v1_service-level-objectives_create_slo.rs
- examples/v1_service-level-objectives_create_slo_3765703239.rs
pub fn with_client_and_config( config: Configuration, client: ClientWithMiddleware, ) -> Self
sourcepub async fn check_can_delete_slo(
&self,
ids: String,
) -> Result<CheckCanDeleteSLOResponse, Error<CheckCanDeleteSLOError>>
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.
sourcepub async fn check_can_delete_slo_with_http_info(
&self,
ids: String,
) -> Result<ResponseContent<CheckCanDeleteSLOResponse>, Error<CheckCanDeleteSLOError>>
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.
sourcepub async fn create_slo(
&self,
body: ServiceLevelObjectiveRequest,
) -> Result<SLOListResponse, Error<CreateSLOError>>
pub async fn create_slo( &self, body: ServiceLevelObjectiveRequest, ) -> Result<SLOListResponse, Error<CreateSLOError>>
Create a service level objective object.
Examples found in repository?
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
async fn main() {
let body = ServiceLevelObjectiveRequest::new(
"Example-Service-Level-Objective".to_string(),
vec![SLOThreshold::new(97.0, SLOTimeframe::SEVEN_DAYS)
.target_display("97.0".to_string())
.warning(98.0 as f64)
.warning_display("98.0".to_string())],
SLOType::METRIC,
)
.description(Some("string".to_string()))
.groups(vec!["env:test".to_string(), "role:mysql".to_string()])
.monitor_ids(vec![])
.query(ServiceLevelObjectiveQuery::new(
"sum:httpservice.hits{!code:3xx}.as_count()".to_string(),
"sum:httpservice.hits{code:2xx}.as_count()".to_string(),
))
.tags(vec!["env:prod".to_string(), "app:core".to_string()])
.target_threshold(97.0 as f64)
.timeframe(SLOTimeframe::SEVEN_DAYS)
.warning_threshold(98.0 as f64);
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api.create_slo(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
More examples
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
async fn main() {
let body = ServiceLevelObjectiveRequest::new(
"Example-Service-Level-Objective".to_string(),
vec![SLOThreshold::new(97.0, SLOTimeframe::SEVEN_DAYS)
.target_display("97.0".to_string())
.warning(98.0 as f64)
.warning_display("98.0".to_string())],
SLOType::TIME_SLICE,
)
.description(Some("string".to_string()))
.sli_specification(SLOSliSpec::SLOTimeSliceSpec(Box::new(
SLOTimeSliceSpec::new(SLOTimeSliceCondition::new(
SLOTimeSliceComparator::GREATER,
SLOTimeSliceQuery::new(
vec![SLOFormula::new("query1".to_string())],
vec![
SLODataSourceQueryDefinition::FormulaAndFunctionMetricQueryDefinition(
Box::new(FormulaAndFunctionMetricQueryDefinition::new(
FormulaAndFunctionMetricDataSource::METRICS,
"query1".to_string(),
"trace.servlet.request{env:prod}".to_string(),
)),
),
],
),
5.0,
)),
)))
.tags(vec!["env:prod".to_string()])
.target_threshold(97.0 as f64)
.timeframe(SLOTimeframe::SEVEN_DAYS)
.warning_threshold(98.0 as f64);
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api.create_slo(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
sourcepub async fn create_slo_with_http_info(
&self,
body: ServiceLevelObjectiveRequest,
) -> Result<ResponseContent<SLOListResponse>, Error<CreateSLOError>>
pub async fn create_slo_with_http_info( &self, body: ServiceLevelObjectiveRequest, ) -> Result<ResponseContent<SLOListResponse>, Error<CreateSLOError>>
Create a service level objective object.
sourcepub async fn delete_slo(
&self,
slo_id: String,
params: DeleteSLOOptionalParams,
) -> Result<SLODeleteResponse, Error<DeleteSLOError>>
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?
7 8 9 10 11 12 13 14 15 16 17 18 19 20
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api
.delete_slo(slo_data_0_id.clone(), DeleteSLOOptionalParams::default())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
sourcepub async fn delete_slo_with_http_info(
&self,
slo_id: String,
params: DeleteSLOOptionalParams,
) -> Result<ResponseContent<SLODeleteResponse>, Error<DeleteSLOError>>
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.
sourcepub async fn delete_slo_timeframe_in_bulk(
&self,
body: BTreeMap<String, Vec<SLOTimeframe>>,
) -> Result<SLOBulkDeleteResponse, Error<DeleteSLOTimeframeInBulkError>>
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?
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
async fn main() {
let body = BTreeMap::from([
(
"id1".to_string(),
vec![SLOTimeframe::SEVEN_DAYS, SLOTimeframe::THIRTY_DAYS],
),
(
"id2".to_string(),
vec![SLOTimeframe::SEVEN_DAYS, SLOTimeframe::THIRTY_DAYS],
),
]);
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api.delete_slo_timeframe_in_bulk(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
sourcepub async fn delete_slo_timeframe_in_bulk_with_http_info(
&self,
body: BTreeMap<String, Vec<SLOTimeframe>>,
) -> Result<ResponseContent<SLOBulkDeleteResponse>, Error<DeleteSLOTimeframeInBulkError>>
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.
sourcepub async fn get_slo(
&self,
slo_id: String,
params: GetSLOOptionalParams,
) -> Result<SLOResponse, Error<GetSLOError>>
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?
7 8 9 10 11 12 13 14 15 16 17 18 19 20
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api
.get_slo(slo_data_0_id.clone(), GetSLOOptionalParams::default())
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
sourcepub async fn get_slo_with_http_info(
&self,
slo_id: String,
params: GetSLOOptionalParams,
) -> Result<ResponseContent<SLOResponse>, Error<GetSLOError>>
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.
sourcepub async fn get_slo_corrections(
&self,
slo_id: String,
) -> Result<SLOCorrectionListResponse, Error<GetSLOCorrectionsError>>
pub async fn get_slo_corrections( &self, slo_id: String, ) -> Result<SLOCorrectionListResponse, Error<GetSLOCorrectionsError>>
Get corrections applied to an SLO
Examples found in repository?
6 7 8 9 10 11 12 13 14 15 16 17
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api.get_slo_corrections(slo_data_0_id.clone()).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
sourcepub async fn get_slo_corrections_with_http_info(
&self,
slo_id: String,
) -> Result<ResponseContent<SLOCorrectionListResponse>, Error<GetSLOCorrectionsError>>
pub async fn get_slo_corrections_with_http_info( &self, slo_id: String, ) -> Result<ResponseContent<SLOCorrectionListResponse>, Error<GetSLOCorrectionsError>>
Get corrections applied to an SLO
sourcepub async fn get_slo_history(
&self,
slo_id: String,
from_ts: i64,
to_ts: i64,
params: GetSLOHistoryOptionalParams,
) -> Result<SLOHistoryResponse, Error<GetSLOHistoryError>>
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?
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api
.get_slo_history(
slo_data_0_id.clone(),
1636542671,
1636629071,
GetSLOHistoryOptionalParams::default(),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
sourcepub 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>>
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.
sourcepub async fn list_slos(
&self,
params: ListSLOsOptionalParams,
) -> Result<SLOListResponse, Error<ListSLOsError>>
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?
7 8 9 10 11 12 13 14 15 16 17 18 19 20
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api
.list_slos(ListSLOsOptionalParams::default().ids(slo_data_0_id.clone()))
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
sourcepub fn list_slos_with_pagination(
&self,
params: ListSLOsOptionalParams,
) -> impl Stream<Item = Result<ServiceLevelObjective, Error<ListSLOsError>>> + '_
pub fn list_slos_with_pagination( &self, params: ListSLOsOptionalParams, ) -> impl Stream<Item = Result<ServiceLevelObjective, Error<ListSLOsError>>> + '_
Examples found in repository?
9 10 11 12 13 14 15 16 17 18 19 20 21
async fn main() {
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let response = api.list_slos_with_pagination(ListSLOsOptionalParams::default().limit(2));
pin_mut!(response);
while let Some(resp) = response.next().await {
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
}
sourcepub async fn list_slos_with_http_info(
&self,
params: ListSLOsOptionalParams,
) -> Result<ResponseContent<SLOListResponse>, Error<ListSLOsError>>
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.
sourcepub async fn search_slo(
&self,
params: SearchSLOOptionalParams,
) -> Result<SearchSLOResponse, Error<SearchSLOError>>
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?
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_name = std::env::var("SLO_DATA_0_NAME").unwrap();
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api
.search_slo(
SearchSLOOptionalParams::default()
.query(slo_data_0_name.clone())
.page_size(20)
.page_number(0),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
sourcepub async fn search_slo_with_http_info(
&self,
params: SearchSLOOptionalParams,
) -> Result<ResponseContent<SearchSLOResponse>, Error<SearchSLOError>>
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.
sourcepub async fn update_slo(
&self,
slo_id: String,
body: ServiceLevelObjective,
) -> Result<SLOListResponse, Error<UpdateSLOError>>
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?
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
async fn main() {
// there is a valid "slo" in the system
let slo_data_0_id = std::env::var("SLO_DATA_0_ID").unwrap();
let slo_data_0_name = std::env::var("SLO_DATA_0_NAME").unwrap();
let body = ServiceLevelObjective::new(
slo_data_0_name.clone(),
vec![SLOThreshold::new(97.0, SLOTimeframe::SEVEN_DAYS).warning(98.0 as f64)],
SLOType::METRIC,
)
.query(ServiceLevelObjectiveQuery::new(
"sum:httpservice.hits{!code:3xx}.as_count()".to_string(),
"sum:httpservice.hits{code:2xx}.as_count()".to_string(),
))
.target_threshold(97.0 as f64)
.timeframe(SLOTimeframe::SEVEN_DAYS)
.warning_threshold(98.0 as f64);
let configuration = datadog::Configuration::new();
let api = ServiceLevelObjectivesAPI::with_config(configuration);
let resp = api.update_slo(slo_data_0_id.clone(), body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
sourcepub async fn update_slo_with_http_info(
&self,
slo_id: String,
body: ServiceLevelObjective,
) -> Result<ResponseContent<SLOListResponse>, Error<UpdateSLOError>>
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
impl Clone for ServiceLevelObjectivesAPI
source§fn clone(&self) -> ServiceLevelObjectivesAPI
fn clone(&self) -> ServiceLevelObjectivesAPI
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for ServiceLevelObjectivesAPI
impl Debug for ServiceLevelObjectivesAPI
Auto Trait Implementations§
impl Freeze for ServiceLevelObjectivesAPI
impl !RefUnwindSafe for ServiceLevelObjectivesAPI
impl Send for ServiceLevelObjectivesAPI
impl Sync for ServiceLevelObjectivesAPI
impl Unpin for ServiceLevelObjectivesAPI
impl !UnwindSafe for ServiceLevelObjectivesAPI
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)