#![doc = "generated by AutoRust"]
#![allow(non_camel_case_types)]
#![allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[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 = "The localizable string class."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LocalizableString {
#[doc = "the invariant value."]
pub value: String,
#[doc = "the locale specific value."]
#[serde(rename = "localizedValue", default, skip_serializing_if = "Option::is_none")]
pub localized_value: Option<String>,
}
impl LocalizableString {
pub fn new(value: String) -> Self {
Self {
value,
localized_value: None,
}
}
}
#[doc = "Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct LogSettings {
#[doc = "Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub category: Option<String>,
#[doc = "a value indicating whether this log is enabled."]
pub enabled: bool,
#[doc = "Specifies the retention policy for the log."]
#[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")]
pub retention_policy: Option<RetentionPolicy>,
}
impl LogSettings {
pub fn new(enabled: bool) -> Self {
Self {
category: None,
enabled,
retention_policy: None,
}
}
}
#[doc = "A set of metric values in a time range."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct Metric {
#[doc = "the id, resourceId, of the metric."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<String>,
#[doc = "the resource type of the metric resource."]
#[serde(rename = "type", default, skip_serializing_if = "Option::is_none")]
pub type_: Option<String>,
#[doc = "The localizable string class."]
pub name: LocalizableString,
#[doc = "The unit of the metric."]
pub unit: Unit,
#[doc = "Array of data points representing the metric values."]
pub data: Vec<MetricValue>,
}
impl Metric {
pub fn new(name: LocalizableString, unit: Unit, data: Vec<MetricValue>) -> Self {
Self {
id: None,
type_: None,
name,
unit,
data,
}
}
}
#[doc = "The collection of metric value sets."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricCollection {
#[doc = "the value of the collection."]
pub value: Vec<Metric>,
}
impl MetricCollection {
pub fn new(value: Vec<Metric>) -> Self {
Self { value }
}
}
#[doc = "Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricSettings {
#[doc = "the timegrain of the metric in ISO8601 format."]
#[serde(rename = "timeGrain")]
pub time_grain: String,
#[doc = "a value indicating whether this timegrain is enabled."]
pub enabled: bool,
#[doc = "Specifies the retention policy for the log."]
#[serde(rename = "retentionPolicy", default, skip_serializing_if = "Option::is_none")]
pub retention_policy: Option<RetentionPolicy>,
}
impl MetricSettings {
pub fn new(time_grain: String, enabled: bool) -> Self {
Self {
time_grain,
enabled,
retention_policy: None,
}
}
}
#[doc = "Represents a metric value."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct MetricValue {
#[doc = "the timestamp for the metric value in ISO 8601 format."]
#[serde(rename = "timeStamp")]
pub time_stamp: String,
#[doc = "the average value in the time range."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub average: Option<f64>,
#[doc = "the least value in the time range."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub minimum: Option<f64>,
#[doc = "the greatest value in the time range."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub maximum: Option<f64>,
#[doc = "the sum of all of the values in the time range."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub total: Option<f64>,
#[doc = "the number of samples in the time range. Can be used to determine the number of values that contributed to the average value."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub count: Option<i64>,
}
impl MetricValue {
pub fn new(time_stamp: String) -> Self {
Self {
time_stamp,
average: None,
minimum: None,
maximum: None,
total: None,
count: None,
}
}
}
#[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 = "Specifies the retention policy for the log."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct RetentionPolicy {
#[doc = "a value indicating whether the retention policy is enabled."]
pub enabled: bool,
#[doc = "the number of days for the retention in days. A value of 0 will retain the events indefinitely."]
pub days: i32,
}
impl RetentionPolicy {
pub fn new(enabled: bool, days: i32) -> Self {
Self { enabled, days }
}
}
#[doc = "The diagnostic settings for service."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct ServiceDiagnosticSettings {
#[doc = "The resource ID of the storage account to which you would like to send Diagnostic Logs."]
#[serde(rename = "storageAccountId", default, skip_serializing_if = "Option::is_none")]
pub storage_account_id: Option<String>,
#[doc = "The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming Diagnostic Logs. The rule ID is of the format: '{service bus resource ID}/authorizationrules/{key name}'."]
#[serde(rename = "serviceBusRuleId", default, skip_serializing_if = "Option::is_none")]
pub service_bus_rule_id: Option<String>,
#[doc = "The resource Id for the event hub namespace authorization rule."]
#[serde(rename = "eventHubAuthorizationRuleId", default, skip_serializing_if = "Option::is_none")]
pub event_hub_authorization_rule_id: Option<String>,
#[doc = "the list of metric settings."]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub metrics: Vec<MetricSettings>,
#[doc = "the list of logs settings."]
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub logs: Vec<LogSettings>,
#[doc = "The workspace ID (resource ID of a Log Analytics workspace) for a Log Analytics workspace to which you would like to send Diagnostic Logs. Example: /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2"]
#[serde(rename = "workspaceId", default, skip_serializing_if = "Option::is_none")]
pub workspace_id: Option<String>,
}
impl ServiceDiagnosticSettings {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "Description of a service diagnostic setting"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ServiceDiagnosticSettingsResource {
#[serde(flatten)]
pub resource: Resource,
#[doc = "The diagnostic settings for service."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub properties: Option<ServiceDiagnosticSettings>,
}
impl ServiceDiagnosticSettingsResource {
pub fn new(resource: Resource) -> Self {
Self {
resource,
properties: None,
}
}
}
#[doc = "Service diagnostic setting resource for patch operations"]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, Default)]
pub struct ServiceDiagnosticSettingsResourcePatch {
#[doc = "Resource tags"]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tags: Option<serde_json::Value>,
#[doc = "The diagnostic settings for service."]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub properties: Option<ServiceDiagnosticSettings>,
}
impl ServiceDiagnosticSettingsResourcePatch {
pub fn new() -> Self {
Self::default()
}
}
#[doc = "The unit of the metric."]
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum Unit {
Count,
Bytes,
Seconds,
CountPerSecond,
BytesPerSecond,
Percent,
MilliSeconds,
ByteSeconds,
Unspecified,
Cores,
MilliCores,
NanoCores,
BitsPerSecond,
}