#[cfg(any(test, feature = "test-support"))]
use crate::mock_client::{ExpectationBuilder, MockClient};
#[cfg(any(test, feature = "test-support"))]
pub trait CostMockHelpers {
fn expect_list_budgets(&mut self, subscription_id: &str) -> ExpectationBuilder<'_>;
fn expect_get_budget(
&mut self,
subscription_id: &str,
budget_name: &str,
) -> ExpectationBuilder<'_>;
fn expect_create_budget(
&mut self,
subscription_id: &str,
budget_name: &str,
) -> ExpectationBuilder<'_>;
fn expect_delete_budget(
&mut self,
subscription_id: &str,
budget_name: &str,
) -> ExpectationBuilder<'_>;
fn expect_list_cost_by_resource(&mut self, subscription_id: &str) -> ExpectationBuilder<'_>;
fn expect_get_forecast(&mut self, subscription_id: &str) -> ExpectationBuilder<'_>;
fn expect_get_usage_details(&mut self, subscription_id: &str) -> ExpectationBuilder<'_>;
}
#[cfg(any(test, feature = "test-support"))]
impl CostMockHelpers for MockClient {
fn expect_list_budgets(
&mut self,
subscription_id: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path =
format!("/subscriptions/{subscription_id}/providers/Microsoft.Consumption/budgets");
self.expect_get(&path)
}
fn expect_get_budget(
&mut self,
subscription_id: &str,
budget_name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/providers/Microsoft.Consumption/budgets/{budget_name}"
);
self.expect_get(&path)
}
fn expect_create_budget(
&mut self,
subscription_id: &str,
budget_name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/providers/Microsoft.Consumption/budgets/{budget_name}"
);
self.expect_put(&path)
}
fn expect_delete_budget(
&mut self,
subscription_id: &str,
budget_name: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/providers/Microsoft.Consumption/budgets/{budget_name}"
);
self.expect_delete(&path)
}
fn expect_list_cost_by_resource(
&mut self,
subscription_id: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path =
format!("/subscriptions/{subscription_id}/providers/Microsoft.CostManagement/query");
self.expect_post(&path)
}
fn expect_get_forecast(
&mut self,
subscription_id: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path =
format!("/subscriptions/{subscription_id}/providers/Microsoft.CostManagement/forecast");
self.expect_post(&path)
}
fn expect_get_usage_details(
&mut self,
subscription_id: &str,
) -> crate::mock_client::ExpectationBuilder<'_> {
let path = format!(
"/subscriptions/{subscription_id}/providers/Microsoft.Consumption/usageDetails"
);
self.expect_get(&path)
}
}