#![doc = "generated by AutoRust"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[doc = "An Azure action group."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ActionGroup {
#[doc = "The short name of the action group. This will be used in SMS messages."]
#[serde(rename = "groupShortName")]
pub group_short_name: String,
#[doc = "Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers will receive communications."]
pub enabled: bool,
#[doc = "The list of email receivers that are part of this action group."]
#[serde(rename = "emailReceivers", default, skip_serializing_if = "Vec::is_empty")]
pub email_receivers: Vec<EmailReceiver>,
#[doc = "The list of SMS receivers that are part of this action group."]
#[serde(rename = "smsReceivers", default, skip_serializing_if = "Vec::is_empty")]
pub sms_receivers: Vec<SmsReceiver>,
#[doc = "The list of webhook receivers that are part of this action group."]
#[serde(rename = "webhookReceivers", default, skip_serializing_if = "Vec::is_empty")]
pub webhook_receivers: Vec<WebhookReceiver>,
#[doc = "The list of ITSM receivers that are part of this action group."]
#[serde(rename = "itsmReceivers", default, skip_serializing_if = "Vec::is_empty")]
pub itsm_receivers: Vec<ItsmReceiver>,
#[doc = "The list of AzureAppPush receivers that are part of this action group."]
#[serde(rename = "azureAppPushReceivers", default, skip_serializing_if = "Vec::is_empty")]
pub azure_app_push_receivers: Vec<AzureAppPushReceiver>,
#[doc = "The list of AutomationRunbook receivers that are part of this action group."]
#[serde(rename = "automationRunbookReceivers", default, skip_serializing_if = "Vec::is_empty")]
pub automation_runbook_receivers: Vec<AutomationRunbookReceiver>,
#[doc = "The list of voice receivers that are part of this action group."]
#[serde(rename = "voiceReceivers", default, skip_serializing_if = "Vec::is_empty")]
pub voice_receivers: Vec<VoiceReceiver>,
#[doc = "The list of logic app receivers that are part of this action group."]
#[serde(rename = "logicAppReceivers", default, skip_serializing_if = "Vec::is_empty")]
pub logic_app_receivers: Vec<LogicAppReceiver>,
#[doc = "The list of azure function receivers that are part of this action group."]
#[serde(rename = "azureFunctionReceivers", default, skip_serializing_if = "Vec::is_empty")]
pub azure_function_receivers: Vec<AzureFunctionReceiver>,
}
impl ActionGroup {
pub fn new(group_short_name: String, enabled: bool) -> Self {
Self {
group_short_name,
enabled,
email_receivers: Vec::new(),
sms_receivers: Vec::new(),
webhook_receivers: Vec::new(),
itsm_receivers: Vec::new(),
azure_app_push_receivers: Vec::new(),
automation_runbook_receivers: Vec::new(),
voice_receivers: Vec::new(),
logic_app_receivers: Vec::new(),
azure_function_receivers: Vec::new(),
}
}
}
#[doc = "A list of action groups."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct ActionGroupList {
#[doc = "The list of action groups."]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub value: Vec<ActionGroupResource>,
#[doc = "Provides the link to retrieve the next set of elements."]
#[serde(rename = "nextLink", default, skip_serializing_if = "Option::is_none")]
pub next_link: Option<String>,
}
impl ActionGroupList {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "An Azure action group for patch operations."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct ActionGroupPatch {
#[doc = "Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will be activated."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
}
impl ActionGroupPatch {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "An action group object for the body of patch operations."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct ActionGroupPatchBody {
#[doc = "Resource tags"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tags: Option<serde_json::Value>,
#[doc = "An Azure action group for patch operations."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub properties: Option<ActionGroupPatch>,
}
impl ActionGroupPatchBody {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "An action group resource."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ActionGroupResource {
#[serde(flatten)]
pub resource: Resource,
#[doc = "An Azure action group."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub properties: Option<ActionGroup>,
}
impl ActionGroupResource {
pub fn new(resource: Resource) -> Self {
Self {
resource,
properties: None,
}
}
}
#[doc = "The Azure Automation Runbook notification receiver."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AutomationRunbookReceiver {
#[doc = "The Azure automation account Id which holds this runbook and authenticate to Azure resource."]
#[serde(rename = "automationAccountId")]
pub automation_account_id: String,
#[doc = "The name for this runbook."]
#[serde(rename = "runbookName")]
pub runbook_name: String,
#[doc = "The resource id for webhook linked to this runbook."]
#[serde(rename = "webhookResourceId")]
pub webhook_resource_id: String,
#[doc = "Indicates whether this instance is global runbook."]
#[serde(rename = "isGlobalRunbook")]
pub is_global_runbook: bool,
#[doc = "Indicates name of the webhook."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[doc = "The URI where webhooks should be sent."]
#[serde(rename = "serviceUri", default, skip_serializing_if = "Option::is_none")]
pub service_uri: Option<String>,
}
impl AutomationRunbookReceiver {
pub fn new(automation_account_id: String, runbook_name: String, webhook_resource_id: String, is_global_runbook: bool) -> Self {
Self {
automation_account_id,
runbook_name,
webhook_resource_id,
is_global_runbook,
name: None,
service_uri: None,
}
}
}
#[doc = "The Azure mobile App push notification receiver."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AzureAppPushReceiver {
#[doc = "The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action group."]
pub name: String,
#[doc = "The email address registered for the Azure mobile app."]
#[serde(rename = "emailAddress")]
pub email_address: String,
}
impl AzureAppPushReceiver {
pub fn new(name: String, email_address: String) -> Self {
Self { name, email_address }
}
}
#[doc = "An azure function receiver."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AzureFunctionReceiver {
#[doc = "The name of the azure function receiver. Names must be unique across all receivers within an action group."]
pub name: String,
#[doc = "The azure resource id of the function app."]
#[serde(rename = "functionAppResourceId")]
pub function_app_resource_id: String,
#[doc = "The function name in the function app."]
#[serde(rename = "functionName")]
pub function_name: String,
#[doc = "The http trigger url where http request sent to."]
#[serde(rename = "httpTriggerUrl")]
pub http_trigger_url: String,
}
impl AzureFunctionReceiver {
pub fn new(name: String, function_app_resource_id: String, function_name: String, http_trigger_url: String) -> Self {
Self {
name,
function_app_resource_id,
function_name,
http_trigger_url,
}
}
}
#[doc = "Criterion for dynamic threshold."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DynamicMetricCriteria {
#[serde(flatten)]
pub multi_metric_criteria: MultiMetricCriteria,
#[doc = "The operator used to compare the metric value against the threshold."]
pub operator: dynamic_metric_criteria::Operator,
#[doc = "The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern."]
#[serde(rename = "alertSensitivity")]
pub alert_sensitivity: dynamic_metric_criteria::AlertSensitivity,
#[doc = "The minimum number of violations required within the selected lookback time window required to raise an alert."]
#[serde(rename = "failingPeriods")]
pub failing_periods: DynamicThresholdFailingPeriods,
#[doc = "Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds (in ISO8601 format)"]
#[serde(rename = "ignoreDataBefore", default, skip_serializing_if = "Option::is_none")]
pub ignore_data_before: Option<String>,
}
impl DynamicMetricCriteria {
pub fn new(
multi_metric_criteria: MultiMetricCriteria,
operator: dynamic_metric_criteria::Operator,
alert_sensitivity: dynamic_metric_criteria::AlertSensitivity,
failing_periods: DynamicThresholdFailingPeriods,
) -> Self {
Self {
multi_metric_criteria,
operator,
alert_sensitivity,
failing_periods,
ignore_data_before: None,
}
}
}
pub mod dynamic_metric_criteria {
use super::*;
#[doc = "The operator used to compare the metric value against the threshold."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum Operator {
GreaterThan,
LessThan,
GreaterOrLessThan,
}
#[doc = "The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric series pattern."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum AlertSensitivity {
Low,
Medium,
High,
}
}
#[doc = "The minimum number of violations required within the selected lookback time window required to raise an alert."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct DynamicThresholdFailingPeriods {
#[doc = "The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points."]
#[serde(rename = "numberOfEvaluationPeriods")]
pub number_of_evaluation_periods: f64,
#[doc = "The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods."]
#[serde(rename = "minFailingPeriodsToAlert")]
pub min_failing_periods_to_alert: f64,
}
impl DynamicThresholdFailingPeriods {
pub fn new(number_of_evaluation_periods: f64, min_failing_periods_to_alert: f64) -> Self {
Self {
number_of_evaluation_periods,
min_failing_periods_to_alert,
}
}
}
#[doc = "An email receiver."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct EmailReceiver {
#[doc = "The name of the email receiver. Names must be unique across all receivers within an action group."]
pub name: String,
#[doc = "The email address of this receiver."]
#[serde(rename = "emailAddress")]
pub email_address: String,
#[doc = "Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status: Option<ReceiverStatus>,
}
impl EmailReceiver {
pub fn new(name: String, email_address: String) -> Self {
Self {
name,
email_address,
status: None,
}
}
}
#[doc = "Describes a receiver that should be resubscribed."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct EnableRequest {
#[doc = "The name of the receiver to resubscribe."]
#[serde(rename = "receiverName")]
pub receiver_name: String,
}
impl EnableRequest {
pub fn new(receiver_name: String) -> Self {
Self { receiver_name }
}
}
#[doc = "Describes the format of Error response."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct ErrorResponse {
#[doc = "Error code"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub code: Option<String>,
#[doc = "Error message indicating why the operation failed."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub message: Option<String>,
}
impl ErrorResponse {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "An Itsm receiver."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ItsmReceiver {
#[doc = "The name of the Itsm receiver. Names must be unique across all receivers within an action group."]
pub name: String,
#[doc = "OMS LA instance identifier."]
#[serde(rename = "workspaceId")]
pub workspace_id: String,
#[doc = "Unique identification of ITSM connection among multiple defined in above workspace."]
#[serde(rename = "connectionId")]
pub connection_id: String,
#[doc = "JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as well."]
#[serde(rename = "ticketConfiguration")]
pub ticket_configuration: String,
#[doc = "Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'"]
pub region: String,
}
impl ItsmReceiver {
pub fn new(name: String, workspace_id: String, connection_id: String, ticket_configuration: String, region: String) -> Self {
Self {
name,
workspace_id,
connection_id,
ticket_configuration,
region,
}
}
}
#[doc = "A logic app receiver."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogicAppReceiver {
#[doc = "The name of the logic app receiver. Names must be unique across all receivers within an action group."]
pub name: String,
#[doc = "The azure resource id of the logic app receiver."]
#[serde(rename = "resourceId")]
pub resource_id: String,
#[doc = "The callback url where http request sent to."]
#[serde(rename = "callbackUrl")]
pub callback_url: String,
}
impl LogicAppReceiver {
pub fn new(name: String, resource_id: String, callback_url: String) -> Self {
Self {
name,
resource_id,
callback_url,
}
}
}
#[doc = "An alert action."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct MetricAlertAction {
#[doc = "the id of the action group to use."]
#[serde(rename = "actionGroupId", default, skip_serializing_if = "Option::is_none")]
pub action_group_id: Option<String>,
#[doc = "This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook."]
#[serde(rename = "webHookProperties", default, skip_serializing_if = "Option::is_none")]
pub web_hook_properties: Option<serde_json::Value>,
}
impl MetricAlertAction {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "The rule criteria that defines the conditions of the alert rule."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricAlertCriteria {
#[doc = "specifies the type of the alert criteria."]
#[serde(rename = "odata.type")]
pub odata_type: metric_alert_criteria::OdataType,
}
impl MetricAlertCriteria {
pub fn new(odata_type: metric_alert_criteria::OdataType) -> Self {
Self { odata_type }
}
}
pub mod metric_alert_criteria {
use super::*;
#[doc = "specifies the type of the alert criteria."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum OdataType {
#[serde(rename = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria")]
MicrosoftAzureMonitorSingleResourceMultipleMetricCriteria,
#[serde(rename = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")]
MicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria,
#[serde(rename = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria")]
MicrosoftAzureMonitorWebtestLocationAvailabilityCriteria,
}
}
#[doc = "Specifies the metric alert criteria for multiple resource that has multiple metric criteria."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricAlertMultipleResourceMultipleMetricCriteria {
#[serde(flatten)]
pub metric_alert_criteria: MetricAlertCriteria,
#[doc = "the list of multiple metric criteria for this 'all of' operation. "]
#[serde(rename = "allOf", default, skip_serializing_if = "Vec::is_empty")]
pub all_of: Vec<MultiMetricCriteria>,
}
impl MetricAlertMultipleResourceMultipleMetricCriteria {
pub fn new(metric_alert_criteria: MetricAlertCriteria) -> Self {
Self {
metric_alert_criteria,
all_of: Vec::new(),
}
}
}
#[doc = "An alert rule."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricAlertProperties {
#[doc = "the description of the metric alert that will be included in the alert email."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Alert severity {0, 1, 2, 3, 4}"]
pub severity: i32,
#[doc = "the flag that indicates whether the metric alert is enabled."]
pub enabled: bool,
#[doc = "the list of resource id's that this metric alert is scoped to."]
pub scopes: Vec<String>,
#[doc = "how often the metric alert is evaluated represented in ISO 8601 duration format."]
#[serde(rename = "evaluationFrequency")]
pub evaluation_frequency: String,
#[doc = "the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold."]
#[serde(rename = "windowSize")]
pub window_size: String,
#[doc = "the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource."]
#[serde(rename = "targetResourceType", default, skip_serializing_if = "Option::is_none")]
pub target_resource_type: Option<String>,
#[doc = "the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource."]
#[serde(rename = "targetResourceRegion", default, skip_serializing_if = "Option::is_none")]
pub target_resource_region: Option<String>,
#[doc = "The rule criteria that defines the conditions of the alert rule."]
pub criteria: MetricAlertCriteria,
#[doc = "the flag that indicates whether the alert should be auto resolved or not. The default is true."]
#[serde(rename = "autoMitigate", default, skip_serializing_if = "Option::is_none")]
pub auto_mitigate: Option<bool>,
#[doc = "the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved."]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub actions: Vec<MetricAlertAction>,
#[doc = "Last time the rule was updated in ISO8601 format."]
#[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")]
pub last_updated_time: Option<String>,
#[doc = "the value indicating whether this alert rule is migrated."]
#[serde(rename = "isMigrated", default, skip_serializing_if = "Option::is_none")]
pub is_migrated: Option<bool>,
}
impl MetricAlertProperties {
pub fn new(
severity: i32,
enabled: bool,
scopes: Vec<String>,
evaluation_frequency: String,
window_size: String,
criteria: MetricAlertCriteria,
) -> Self {
Self {
description: None,
severity,
enabled,
scopes,
evaluation_frequency,
window_size,
target_resource_type: None,
target_resource_region: None,
criteria,
auto_mitigate: None,
actions: Vec::new(),
last_updated_time: None,
is_migrated: None,
}
}
}
#[doc = "An alert rule properties for patch."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct MetricAlertPropertiesPatch {
#[doc = "the description of the metric alert that will be included in the alert email."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[doc = "Alert severity {0, 1, 2, 3, 4}"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub severity: Option<i32>,
#[doc = "the flag that indicates whether the metric alert is enabled."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub enabled: Option<bool>,
#[doc = "the list of resource id's that this metric alert is scoped to."]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub scopes: Vec<String>,
#[doc = "how often the metric alert is evaluated represented in ISO 8601 duration format."]
#[serde(rename = "evaluationFrequency", default, skip_serializing_if = "Option::is_none")]
pub evaluation_frequency: Option<String>,
#[doc = "the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold."]
#[serde(rename = "windowSize", default, skip_serializing_if = "Option::is_none")]
pub window_size: Option<String>,
#[doc = "the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria."]
#[serde(rename = "targetResourceType", default, skip_serializing_if = "Option::is_none")]
pub target_resource_type: Option<String>,
#[doc = "the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria."]
#[serde(rename = "targetResourceRegion", default, skip_serializing_if = "Option::is_none")]
pub target_resource_region: Option<String>,
#[doc = "The rule criteria that defines the conditions of the alert rule."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub criteria: Option<MetricAlertCriteria>,
#[doc = "the flag that indicates whether the alert should be auto resolved or not. The default is true."]
#[serde(rename = "autoMitigate", default, skip_serializing_if = "Option::is_none")]
pub auto_mitigate: Option<bool>,
#[doc = "the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved."]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub actions: Vec<MetricAlertAction>,
#[doc = "Last time the rule was updated in ISO8601 format."]
#[serde(rename = "lastUpdatedTime", default, skip_serializing_if = "Option::is_none")]
pub last_updated_time: Option<String>,
#[doc = "the value indicating whether this alert rule is migrated."]
#[serde(rename = "isMigrated", default, skip_serializing_if = "Option::is_none")]
pub is_migrated: Option<bool>,
}
impl MetricAlertPropertiesPatch {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "The metric alert resource."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricAlertResource {
#[serde(flatten)]
pub resource: Resource,
#[doc = "An alert rule."]
pub properties: MetricAlertProperties,
}
impl MetricAlertResource {
pub fn new(resource: Resource, properties: MetricAlertProperties) -> Self {
Self { resource, properties }
}
}
#[doc = "Represents a collection of alert rule resources."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct MetricAlertResourceCollection {
#[doc = "the values for the alert rule resources."]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub value: Vec<MetricAlertResource>,
}
impl MetricAlertResourceCollection {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "The metric alert resource for patch operations."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct MetricAlertResourcePatch {
#[doc = "Resource tags"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tags: Option<serde_json::Value>,
#[doc = "An alert rule properties for patch."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub properties: Option<MetricAlertPropertiesPatch>,
}
impl MetricAlertResourcePatch {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "Specifies the metric alert criteria for a single resource that has multiple metric criteria."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricAlertSingleResourceMultipleMetricCriteria {
#[serde(flatten)]
pub metric_alert_criteria: MetricAlertCriteria,
#[doc = "The list of metric criteria for this 'all of' operation. "]
#[serde(rename = "allOf", default, skip_serializing_if = "Vec::is_empty")]
pub all_of: Vec<MetricCriteria>,
}
impl MetricAlertSingleResourceMultipleMetricCriteria {
pub fn new(metric_alert_criteria: MetricAlertCriteria) -> Self {
Self {
metric_alert_criteria,
all_of: Vec::new(),
}
}
}
#[doc = "An alert status."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct MetricAlertStatus {
#[doc = "The status name."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[doc = "The alert rule arm id."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[doc = "The extended resource type name."]
#[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[doc = "An alert status properties."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub properties: Option<MetricAlertStatusProperties>,
}
impl MetricAlertStatus {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "Represents a collection of alert rule resources."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct MetricAlertStatusCollection {
#[doc = "the values for the alert rule resources."]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub value: Vec<MetricAlertStatus>,
}
impl MetricAlertStatusCollection {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "An alert status properties."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct MetricAlertStatusProperties {
#[doc = "An object describing the type of the dimensions."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub dimensions: Option<serde_json::Value>,
#[doc = "status value"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status: Option<String>,
#[doc = "UTC time when the status was checked."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub timestamp: Option<String>,
}
impl MetricAlertStatusProperties {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "Criterion to filter metrics."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricCriteria {
#[serde(flatten)]
pub multi_metric_criteria: MultiMetricCriteria,
#[doc = "the criteria operator."]
pub operator: metric_criteria::Operator,
#[doc = "the criteria threshold value that activates the alert."]
pub threshold: f64,
}
impl MetricCriteria {
pub fn new(multi_metric_criteria: MultiMetricCriteria, operator: metric_criteria::Operator, threshold: f64) -> Self {
Self {
multi_metric_criteria,
operator,
threshold,
}
}
}
pub mod metric_criteria {
use super::*;
#[doc = "the criteria operator."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum Operator {
Equals,
GreaterThan,
GreaterThanOrEqual,
LessThan,
LessThanOrEqual,
}
}
#[doc = "Specifies a metric dimension."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricDimension {
#[doc = "Name of the dimension."]
pub name: String,
#[doc = "the dimension operator. Only 'Include' and 'Exclude' are supported"]
pub operator: String,
#[doc = "list of dimension values."]
pub values: Vec<String>,
}
impl MetricDimension {
pub fn new(name: String, operator: String, values: Vec<String>) -> Self {
Self { name, operator, values }
}
}
#[doc = "The types of conditions for a multi resource alert."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MultiMetricCriteria {
#[doc = "Specifies the type of threshold criteria"]
#[serde(rename = "criterionType")]
pub criterion_type: multi_metric_criteria::CriterionType,
#[doc = "Name of the criteria."]
pub name: String,
#[doc = "Name of the metric."]
#[serde(rename = "metricName")]
pub metric_name: String,
#[doc = "Namespace of the metric."]
#[serde(rename = "metricNamespace", default, skip_serializing_if = "Option::is_none")]
pub metric_namespace: Option<String>,
#[doc = "the criteria time aggregation types."]
#[serde(rename = "timeAggregation")]
pub time_aggregation: multi_metric_criteria::TimeAggregation,
#[doc = "List of dimension conditions."]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub dimensions: Vec<MetricDimension>,
#[doc = "Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped."]
#[serde(rename = "skipMetricValidation", default, skip_serializing_if = "Option::is_none")]
pub skip_metric_validation: Option<bool>,
}
impl MultiMetricCriteria {
pub fn new(
criterion_type: multi_metric_criteria::CriterionType,
name: String,
metric_name: String,
time_aggregation: multi_metric_criteria::TimeAggregation,
) -> Self {
Self {
criterion_type,
name,
metric_name,
metric_namespace: None,
time_aggregation,
dimensions: Vec::new(),
skip_metric_validation: None,
}
}
}
pub mod multi_metric_criteria {
use super::*;
#[doc = "Specifies the type of threshold criteria"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum CriterionType {
StaticThresholdCriterion,
DynamicThresholdCriterion,
}
#[doc = "the criteria time aggregation types."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum TimeAggregation {
Average,
Count,
Minimum,
Maximum,
Total,
}
}
#[doc = "Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum ReceiverStatus {
NotSpecified,
Enabled,
Disabled,
}
#[doc = "An azure resource object"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Resource {
#[doc = "Azure resource Id"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[doc = "Azure resource name"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
#[doc = "Azure resource type"]
#[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[doc = "Resource location"]
pub location: String,
#[doc = "Resource tags"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tags: Option<serde_json::Value>,
}
impl Resource {
pub fn new(location: String) -> Self {
Self {
id: None,
name: None,
type_: None,
location,
tags: None,
}
}
}
#[doc = "An SMS receiver."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct SmsReceiver {
#[doc = "The name of the SMS receiver. Names must be unique across all receivers within an action group."]
pub name: String,
#[doc = "The country code of the SMS receiver."]
#[serde(rename = "countryCode")]
pub country_code: String,
#[doc = "The phone number of the SMS receiver."]
#[serde(rename = "phoneNumber")]
pub phone_number: String,
#[doc = "Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub status: Option<ReceiverStatus>,
}
impl SmsReceiver {
pub fn new(name: String, country_code: String, phone_number: String) -> Self {
Self {
name,
country_code,
phone_number,
status: None,
}
}
}
#[doc = "A voice receiver."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct VoiceReceiver {
#[doc = "The name of the voice receiver. Names must be unique across all receivers within an action group."]
pub name: String,
#[doc = "The country code of the voice receiver."]
#[serde(rename = "countryCode")]
pub country_code: String,
#[doc = "The phone number of the voice receiver."]
#[serde(rename = "phoneNumber")]
pub phone_number: String,
}
impl VoiceReceiver {
pub fn new(name: String, country_code: String, phone_number: String) -> Self {
Self {
name,
country_code,
phone_number,
}
}
}
#[doc = "A webhook receiver."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebhookReceiver {
#[doc = "The name of the webhook receiver. Names must be unique across all receivers within an action group."]
pub name: String,
#[doc = "The URI where webhooks should be sent."]
#[serde(rename = "serviceUri")]
pub service_uri: String,
}
impl WebhookReceiver {
pub fn new(name: String, service_uri: String) -> Self {
Self { name, service_uri }
}
}
#[doc = "Specifies the metric alert rule criteria for a web test resource."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct WebtestLocationAvailabilityCriteria {
#[serde(flatten)]
pub metric_alert_criteria: MetricAlertCriteria,
#[doc = "The Application Insights web test Id."]
#[serde(rename = "webTestId")]
pub web_test_id: String,
#[doc = "The Application Insights resource Id."]
#[serde(rename = "componentId")]
pub component_id: String,
#[doc = "The number of failed locations."]
#[serde(rename = "failedLocationCount")]
pub failed_location_count: f64,
}
impl WebtestLocationAvailabilityCriteria {
pub fn new(metric_alert_criteria: MetricAlertCriteria, web_test_id: String, component_id: String, failed_location_count: f64) -> Self {
Self {
metric_alert_criteria,
web_test_id,
component_id,
failed_location_count,
}
}
}