Skip to content

Fix specification for Azure metric filtering #435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-18 16:21:36.370912",
"spec_repo_commit": "e12aeab9"
"regenerated": "2024-12-18 17:18:31.310793",
"spec_repo_commit": "8cb3faac"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-12-18 16:21:36.385710",
"spec_repo_commit": "e12aeab9"
"regenerated": "2024-12-18 17:18:31.326940",
"spec_repo_commit": "8cb3faac"
}
}
}
55 changes: 32 additions & 23 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,15 @@ components:
Only hosts that match one of the defined tags are imported into Datadog.'
example: key:value,filter:example
type: string
metrics_config:
$ref: '#/components/schemas/AzureAccountMetricsConfig'
metrics_enabled:
description: Enable Azure metrics for your organization.
example: true
type: boolean
metrics_enabled_default:
description: Enable Azure metrics for your organization for resource providers
where no resource provider config is specified.
example: true
type: boolean
new_client_id:
description: Your New Azure web application ID.
example: new1c7f6-1234-5678-9101-3fcbf464test
Expand All @@ -860,37 +867,26 @@ components:
monitored by this app registration.
example: true
type: boolean
resource_provider_configs:
description: Configuration settings applied to resources from the specified
Azure resource providers.
items:
$ref: '#/components/schemas/ResourceProviderConfig'
type: array
tenant_name:
description: Your Azure Active Directory ID.
example: testc44-1234-5678-9101-cc00736ftest
type: string
usage_metrics_enabled:
description: Enable azure.usage metrics for your organization.
example: true
type: boolean
type: object
AzureAccountListResponse:
description: Accounts configured for your organization.
items:
$ref: '#/components/schemas/AzureAccount'
type: array
AzureAccountMetricsConfig:
description: 'Dictionary containing the key `excluded_resource_providers` which
has to be a list of Microsoft Azure Resource Provider names.

This feature is currently being beta tested.

In order to enable all resource providers for metric collection, pass:

`metrics_config: {"excluded_resource_providers": []}` (i.e., an empty list
for `excluded_resource_providers`).'
properties:
excluded_resource_providers:
description: List of Microsoft Azure Resource Providers to exclude from
metric collection.
example:
- Microsoft.Sql
- Microsoft.Cdn
items:
type: string
type: array
type: object
CancelDowntimesByScopeRequest:
description: Cancel downtimes according to scope.
properties:
Expand Down Expand Up @@ -10209,6 +10205,19 @@ components:
- lookup_enrichment_table
- type
type: object
ResourceProviderConfig:
description: Configuration settings applied to resources from the specified
Azure resource provider.
properties:
metrics_enabled:
description: Collect metrics for resources from this provider.
example: true
type: boolean
namespace:
description: The provider namespace to apply this configuration to.
example: Microsoft.Compute
type: string
type: object
ResponseMetaAttributes:
description: Object describing meta attributes of response.
properties:
Expand Down
16 changes: 8 additions & 8 deletions examples/v1_azure-integration_UpdateAzureHostFilters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_azure_integration::AzureIntegrationAPI;
use datadog_api_client::datadogV1::model::AzureAccount;
use datadog_api_client::datadogV1::model::AzureAccountMetricsConfig;
use datadog_api_client::datadogV1::model::ResourceProviderConfig;

#[tokio::main]
async fn main() {
Expand All @@ -16,16 +16,16 @@ async fn main() {
.custom_metrics_enabled(true)
.errors(vec!["*".to_string()])
.host_filters("key:value,filter:example".to_string())
.metrics_config(
AzureAccountMetricsConfig::new().excluded_resource_providers(vec![
"Microsoft.Sql".to_string(),
"Microsoft.Cdn".to_string(),
]),
)
.metrics_enabled(true)
.metrics_enabled_default(true)
.new_client_id("new1c7f6-1234-5678-9101-3fcbf464test".to_string())
.new_tenant_name("new1c44-1234-5678-9101-cc00736ftest".to_string())
.resource_collection_enabled(true)
.tenant_name("testc44-1234-5678-9101-cc00736ftest".to_string());
.resource_provider_configs(vec![ResourceProviderConfig::new()
.metrics_enabled(true)
.namespace("Microsoft.Compute".to_string())])
.tenant_name("testc44-1234-5678-9101-cc00736ftest".to_string())
.usage_metrics_enabled(true);
let configuration = datadog::Configuration::new();
let api = AzureIntegrationAPI::with_config(configuration);
let resp = api.update_azure_host_filters(body).await;
Expand Down
7 changes: 0 additions & 7 deletions examples/v1_azure-integration_UpdateAzureIntegration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_azure_integration::AzureIntegrationAPI;
use datadog_api_client::datadogV1::model::AzureAccount;
use datadog_api_client::datadogV1::model::AzureAccountMetricsConfig;

#[tokio::main]
async fn main() {
Expand All @@ -16,12 +15,6 @@ async fn main() {
.custom_metrics_enabled(true)
.errors(vec!["*".to_string()])
.host_filters("key:value,filter:example".to_string())
.metrics_config(
AzureAccountMetricsConfig::new().excluded_resource_providers(vec![
"Microsoft.Sql".to_string(),
"Microsoft.Cdn".to_string(),
]),
)
.new_client_id("".to_string())
.new_tenant_name("".to_string())
.resource_collection_enabled(true)
Expand Down
4 changes: 2 additions & 2 deletions src/datadogV1/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,8 @@ pub mod model_aws_logs_services_request;
pub use self::model_aws_logs_services_request::AWSLogsServicesRequest;
pub mod model_azure_account;
pub use self::model_azure_account::AzureAccount;
pub mod model_azure_account_metrics_config;
pub use self::model_azure_account_metrics_config::AzureAccountMetricsConfig;
pub mod model_resource_provider_config;
pub use self::model_resource_provider_config::ResourceProviderConfig;
pub mod model_gcp_account;
pub use self::model_gcp_account::GCPAccount;
pub mod model_pager_duty_service;
Expand Down
86 changes: 69 additions & 17 deletions src/datadogV1/model/model_azure_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ pub struct AzureAccount {
/// Only hosts that match one of the defined tags are imported into Datadog.
#[serde(rename = "host_filters")]
pub host_filters: Option<String>,
/// Dictionary containing the key `excluded_resource_providers` which has to be a list of Microsoft Azure Resource Provider names.
/// This feature is currently being beta tested.
/// In order to enable all resource providers for metric collection, pass:
/// `metrics_config: {"excluded_resource_providers": []}` (i.e., an empty list for `excluded_resource_providers`).
#[serde(rename = "metrics_config")]
pub metrics_config: Option<crate::datadogV1::model::AzureAccountMetricsConfig>,
/// Enable Azure metrics for your organization.
#[serde(rename = "metrics_enabled")]
pub metrics_enabled: Option<bool>,
/// Enable Azure metrics for your organization for resource providers where no resource provider config is specified.
#[serde(rename = "metrics_enabled_default")]
pub metrics_enabled_default: Option<bool>,
/// Your New Azure web application ID.
#[serde(rename = "new_client_id")]
pub new_client_id: Option<String>,
Expand All @@ -57,9 +57,15 @@ pub struct AzureAccount {
/// When enabled, Datadog collects metadata and configuration info from cloud resources (compute instances, databases, load balancers, etc.) monitored by this app registration.
#[serde(rename = "resource_collection_enabled")]
pub resource_collection_enabled: Option<bool>,
/// Configuration settings applied to resources from the specified Azure resource providers.
#[serde(rename = "resource_provider_configs")]
pub resource_provider_configs: Option<Vec<crate::datadogV1::model::ResourceProviderConfig>>,
/// Your Azure Active Directory ID.
#[serde(rename = "tenant_name")]
pub tenant_name: Option<String>,
/// Enable azure.usage metrics for your organization.
#[serde(rename = "usage_metrics_enabled")]
pub usage_metrics_enabled: Option<bool>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
Expand All @@ -79,11 +85,14 @@ impl AzureAccount {
custom_metrics_enabled: None,
errors: None,
host_filters: None,
metrics_config: None,
metrics_enabled: None,
metrics_enabled_default: None,
new_client_id: None,
new_tenant_name: None,
resource_collection_enabled: None,
resource_provider_configs: None,
tenant_name: None,
usage_metrics_enabled: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
Expand Down Expand Up @@ -134,11 +143,13 @@ impl AzureAccount {
self
}

pub fn metrics_config(
mut self,
value: crate::datadogV1::model::AzureAccountMetricsConfig,
) -> Self {
self.metrics_config = Some(value);
pub fn metrics_enabled(mut self, value: bool) -> Self {
self.metrics_enabled = Some(value);
self
}

pub fn metrics_enabled_default(mut self, value: bool) -> Self {
self.metrics_enabled_default = Some(value);
self
}

Expand All @@ -157,11 +168,24 @@ impl AzureAccount {
self
}

pub fn resource_provider_configs(
mut self,
value: Vec<crate::datadogV1::model::ResourceProviderConfig>,
) -> Self {
self.resource_provider_configs = Some(value);
self
}

pub fn tenant_name(mut self, value: String) -> Self {
self.tenant_name = Some(value);
self
}

pub fn usage_metrics_enabled(mut self, value: bool) -> Self {
self.usage_metrics_enabled = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
Expand Down Expand Up @@ -203,12 +227,16 @@ impl<'de> Deserialize<'de> for AzureAccount {
let mut custom_metrics_enabled: Option<bool> = None;
let mut errors: Option<Vec<String>> = None;
let mut host_filters: Option<String> = None;
let mut metrics_config: Option<crate::datadogV1::model::AzureAccountMetricsConfig> =
None;
let mut metrics_enabled: Option<bool> = None;
let mut metrics_enabled_default: Option<bool> = None;
let mut new_client_id: Option<String> = None;
let mut new_tenant_name: Option<String> = None;
let mut resource_collection_enabled: Option<bool> = None;
let mut resource_provider_configs: Option<
Vec<crate::datadogV1::model::ResourceProviderConfig>,
> = None;
let mut tenant_name: Option<String> = None;
let mut usage_metrics_enabled: Option<bool> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
Expand Down Expand Up @@ -277,11 +305,18 @@ impl<'de> Deserialize<'de> for AzureAccount {
host_filters =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"metrics_config" => {
"metrics_enabled" => {
if v.is_null() {
continue;
}
metrics_enabled =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"metrics_enabled_default" => {
if v.is_null() {
continue;
}
metrics_config =
metrics_enabled_default =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"new_client_id" => {
Expand All @@ -305,13 +340,27 @@ impl<'de> Deserialize<'de> for AzureAccount {
resource_collection_enabled =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"resource_provider_configs" => {
if v.is_null() {
continue;
}
resource_provider_configs =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"tenant_name" => {
if v.is_null() {
continue;
}
tenant_name =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"usage_metrics_enabled" => {
if v.is_null() {
continue;
}
usage_metrics_enabled =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
additional_properties.insert(k, value);
Expand All @@ -330,11 +379,14 @@ impl<'de> Deserialize<'de> for AzureAccount {
custom_metrics_enabled,
errors,
host_filters,
metrics_config,
metrics_enabled,
metrics_enabled_default,
new_client_id,
new_tenant_name,
resource_collection_enabled,
resource_provider_configs,
tenant_name,
usage_metrics_enabled,
additional_properties,
_unparsed,
};
Expand Down
Loading
Loading