pub struct MonitorClient<'a> { /* private fields */ }Expand description
Client for the Azure Monitor ARM management plane.
All methods use direct HTTP calls with operation-appropriate API versions:
- Metrics / MetricDefinitions:
2023-10-01 - MetricAlerts:
2018-03-01 - Activity Logs:
2015-04-01
Implementations§
Source§impl<'a> MonitorClient<'a>
impl<'a> MonitorClient<'a>
Sourcepub async fn list_metric_definitions(
&self,
resource_uri: &str,
metric_namespace: &str,
) -> Result<MetricDefinitionCollection>
pub async fn list_metric_definitions( &self, resource_uri: &str, metric_namespace: &str, ) -> Result<MetricDefinitionCollection>
Lists the metric definitions for a resource.
resource_uri is the ARM resource path without the leading /,
e.g. subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Compute/virtualMachines/{vm}.
metric_namespace is required by the Azure API, e.g. Microsoft.Compute/virtualMachines.
Sourcepub async fn get_metrics(
&self,
resource_uri: &str,
metric_names: &str,
timespan: &str,
) -> Result<MetricsResponse>
pub async fn get_metrics( &self, resource_uri: &str, metric_names: &str, timespan: &str, ) -> Result<MetricsResponse>
Lists the metric values for a resource.
resource_uri is the ARM resource path without the leading /.
metric_names is a comma-separated list of metric names.
timespan is ISO 8601 duration, e.g. PT1H for last hour.
Sourcepub async fn list_alert_rules(
&self,
resource_group_name: &str,
) -> Result<MetricAlertResourceCollection>
pub async fn list_alert_rules( &self, resource_group_name: &str, ) -> Result<MetricAlertResourceCollection>
Retrieve alert rule definitions in a resource group.
Sourcepub async fn get_alert_rule(
&self,
resource_group_name: &str,
rule_name: &str,
) -> Result<MetricAlertResource>
pub async fn get_alert_rule( &self, resource_group_name: &str, rule_name: &str, ) -> Result<MetricAlertResource>
Retrieve an alert rule definition.
Sourcepub async fn create_alert_rule(
&self,
resource_group_name: &str,
rule_name: &str,
body: &MetricAlertCreateRequest,
) -> Result<MetricAlertResource>
pub async fn create_alert_rule( &self, resource_group_name: &str, rule_name: &str, body: &MetricAlertCreateRequest, ) -> Result<MetricAlertResource>
Create or update an alert rule definition.
Sourcepub async fn delete_alert_rule(
&self,
resource_group_name: &str,
rule_name: &str,
) -> Result<()>
pub async fn delete_alert_rule( &self, resource_group_name: &str, rule_name: &str, ) -> Result<()>
Delete an alert rule definition.
Sourcepub async fn list_activity_logs(
&self,
filter: &str,
) -> Result<EventDataCollection>
pub async fn list_activity_logs( &self, filter: &str, ) -> Result<EventDataCollection>
Provides the list of records from the activity logs.
filter is an OData filter string, e.g. "eventTimestamp ge '2024-01-01T00:00:00Z'".