Skip to content

Commit f8fc189

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Fix specification for Azure metric filtering (#2327)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 27e6800 commit f8fc189

15 files changed

+148
-116
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-12-18 16:21:35.283327",
8-
"spec_repo_commit": "e12aeab9"
7+
"regenerated": "2024-12-18 17:18:32.703322",
8+
"spec_repo_commit": "8cb3faac"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-12-18 16:21:35.297169",
13-
"spec_repo_commit": "e12aeab9"
12+
"regenerated": "2024-12-18 17:18:32.717421",
13+
"spec_repo_commit": "8cb3faac"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,15 @@ components:
844844
Only hosts that match one of the defined tags are imported into Datadog.'
845845
example: key:value,filter:example
846846
type: string
847-
metrics_config:
848-
$ref: '#/components/schemas/AzureAccountMetricsConfig'
847+
metrics_enabled:
848+
description: Enable Azure metrics for your organization.
849+
example: true
850+
type: boolean
851+
metrics_enabled_default:
852+
description: Enable Azure metrics for your organization for resource providers
853+
where no resource provider config is specified.
854+
example: true
855+
type: boolean
849856
new_client_id:
850857
description: Your New Azure web application ID.
851858
example: new1c7f6-1234-5678-9101-3fcbf464test
@@ -860,37 +867,26 @@ components:
860867
monitored by this app registration.
861868
example: true
862869
type: boolean
870+
resource_provider_configs:
871+
description: Configuration settings applied to resources from the specified
872+
Azure resource providers.
873+
items:
874+
$ref: '#/components/schemas/ResourceProviderConfig'
875+
type: array
863876
tenant_name:
864877
description: Your Azure Active Directory ID.
865878
example: testc44-1234-5678-9101-cc00736ftest
866879
type: string
880+
usage_metrics_enabled:
881+
description: Enable azure.usage metrics for your organization.
882+
example: true
883+
type: boolean
867884
type: object
868885
AzureAccountListResponse:
869886
description: Accounts configured for your organization.
870887
items:
871888
$ref: '#/components/schemas/AzureAccount'
872889
type: array
873-
AzureAccountMetricsConfig:
874-
description: 'Dictionary containing the key `excluded_resource_providers` which
875-
has to be a list of Microsoft Azure Resource Provider names.
876-
877-
This feature is currently being beta tested.
878-
879-
In order to enable all resource providers for metric collection, pass:
880-
881-
`metrics_config: {"excluded_resource_providers": []}` (i.e., an empty list
882-
for `excluded_resource_providers`).'
883-
properties:
884-
excluded_resource_providers:
885-
description: List of Microsoft Azure Resource Providers to exclude from
886-
metric collection.
887-
example:
888-
- Microsoft.Sql
889-
- Microsoft.Cdn
890-
items:
891-
type: string
892-
type: array
893-
type: object
894890
CancelDowntimesByScopeRequest:
895891
description: Cancel downtimes according to scope.
896892
properties:
@@ -10209,6 +10205,19 @@ components:
1020910205
- lookup_enrichment_table
1021010206
- type
1021110207
type: object
10208+
ResourceProviderConfig:
10209+
description: Configuration settings applied to resources from the specified
10210+
Azure resource provider.
10211+
properties:
10212+
metrics_enabled:
10213+
description: Collect metrics for resources from this provider.
10214+
example: true
10215+
type: boolean
10216+
namespace:
10217+
description: The provider namespace to apply this configuration to.
10218+
example: Microsoft.Compute
10219+
type: string
10220+
type: object
1021210221
ResponseMetaAttributes:
1021310222
description: Object describing meta attributes of response.
1021410223
properties:

docs/datadog_api_client.v1.model.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,13 +319,6 @@ datadog\_api\_client.v1.model.azure\_account\_list\_response module
319319
:members:
320320
:show-inheritance:
321321

322-
datadog\_api\_client.v1.model.azure\_account\_metrics\_config module
323-
--------------------------------------------------------------------
324-
325-
.. automodule:: datadog_api_client.v1.model.azure_account_metrics_config
326-
:members:
327-
:show-inheritance:
328-
329322
datadog\_api\_client.v1.model.cancel\_downtimes\_by\_scope\_request module
330323
--------------------------------------------------------------------------
331324

@@ -2839,6 +2832,13 @@ datadog\_api\_client.v1.model.reference\_table\_logs\_lookup\_processor module
28392832
:members:
28402833
:show-inheritance:
28412834

2835+
datadog\_api\_client.v1.model.resource\_provider\_config module
2836+
---------------------------------------------------------------
2837+
2838+
.. automodule:: datadog_api_client.v1.model.resource_provider_config
2839+
:members:
2840+
:show-inheritance:
2841+
28422842
datadog\_api\_client.v1.model.response\_meta\_attributes module
28432843
---------------------------------------------------------------
28442844

examples/v1/azure-integration/UpdateAzureHostFilters.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from datadog_api_client import ApiClient, Configuration
66
from datadog_api_client.v1.api.azure_integration_api import AzureIntegrationApi
77
from datadog_api_client.v1.model.azure_account import AzureAccount
8-
from datadog_api_client.v1.model.azure_account_metrics_config import AzureAccountMetricsConfig
8+
from datadog_api_client.v1.model.resource_provider_config import ResourceProviderConfig
99

1010
body = AzureAccount(
1111
app_service_plan_filters="key:value,filter:example",
@@ -19,16 +19,19 @@
1919
"*",
2020
],
2121
host_filters="key:value,filter:example",
22-
metrics_config=AzureAccountMetricsConfig(
23-
excluded_resource_providers=[
24-
"Microsoft.Sql",
25-
"Microsoft.Cdn",
26-
],
27-
),
22+
metrics_enabled=True,
23+
metrics_enabled_default=True,
2824
new_client_id="new1c7f6-1234-5678-9101-3fcbf464test",
2925
new_tenant_name="new1c44-1234-5678-9101-cc00736ftest",
3026
resource_collection_enabled=True,
27+
resource_provider_configs=[
28+
ResourceProviderConfig(
29+
metrics_enabled=True,
30+
namespace="Microsoft.Compute",
31+
),
32+
],
3133
tenant_name="testc44-1234-5678-9101-cc00736ftest",
34+
usage_metrics_enabled=True,
3235
)
3336

3437
configuration = Configuration()

examples/v1/azure-integration/UpdateAzureIntegration.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from datadog_api_client import ApiClient, Configuration
66
from datadog_api_client.v1.api.azure_integration_api import AzureIntegrationApi
77
from datadog_api_client.v1.model.azure_account import AzureAccount
8-
from datadog_api_client.v1.model.azure_account_metrics_config import AzureAccountMetricsConfig
98

109
body = AzureAccount(
1110
app_service_plan_filters="key:value,filter:example",
@@ -22,12 +21,6 @@
2221
new_client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
2322
new_tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
2423
resource_collection_enabled=True,
25-
metrics_config=AzureAccountMetricsConfig(
26-
excluded_resource_providers=[
27-
"Microsoft.Sql",
28-
"Microsoft.Cdn",
29-
],
30-
),
3124
tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
3225
)
3326

src/datadog_api_client/v1/model/azure_account.py

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414

1515

1616
if TYPE_CHECKING:
17-
from datadog_api_client.v1.model.azure_account_metrics_config import AzureAccountMetricsConfig
17+
from datadog_api_client.v1.model.resource_provider_config import ResourceProviderConfig
1818

1919

2020
class AzureAccount(ModelNormal):
2121
@cached_property
2222
def openapi_types(_):
23-
from datadog_api_client.v1.model.azure_account_metrics_config import AzureAccountMetricsConfig
23+
from datadog_api_client.v1.model.resource_provider_config import ResourceProviderConfig
2424

2525
return {
2626
"app_service_plan_filters": (str,),
@@ -32,11 +32,14 @@ def openapi_types(_):
3232
"custom_metrics_enabled": (bool,),
3333
"errors": ([str],),
3434
"host_filters": (str,),
35-
"metrics_config": (AzureAccountMetricsConfig,),
35+
"metrics_enabled": (bool,),
36+
"metrics_enabled_default": (bool,),
3637
"new_client_id": (str,),
3738
"new_tenant_name": (str,),
3839
"resource_collection_enabled": (bool,),
40+
"resource_provider_configs": ([ResourceProviderConfig],),
3941
"tenant_name": (str,),
42+
"usage_metrics_enabled": (bool,),
4043
}
4144

4245
attribute_map = {
@@ -49,11 +52,14 @@ def openapi_types(_):
4952
"custom_metrics_enabled": "custom_metrics_enabled",
5053
"errors": "errors",
5154
"host_filters": "host_filters",
52-
"metrics_config": "metrics_config",
55+
"metrics_enabled": "metrics_enabled",
56+
"metrics_enabled_default": "metrics_enabled_default",
5357
"new_client_id": "new_client_id",
5458
"new_tenant_name": "new_tenant_name",
5559
"resource_collection_enabled": "resource_collection_enabled",
60+
"resource_provider_configs": "resource_provider_configs",
5661
"tenant_name": "tenant_name",
62+
"usage_metrics_enabled": "usage_metrics_enabled",
5763
}
5864

5965
def __init__(
@@ -67,11 +73,14 @@ def __init__(
6773
custom_metrics_enabled: Union[bool, UnsetType] = unset,
6874
errors: Union[List[str], UnsetType] = unset,
6975
host_filters: Union[str, UnsetType] = unset,
70-
metrics_config: Union[AzureAccountMetricsConfig, UnsetType] = unset,
76+
metrics_enabled: Union[bool, UnsetType] = unset,
77+
metrics_enabled_default: Union[bool, UnsetType] = unset,
7178
new_client_id: Union[str, UnsetType] = unset,
7279
new_tenant_name: Union[str, UnsetType] = unset,
7380
resource_collection_enabled: Union[bool, UnsetType] = unset,
81+
resource_provider_configs: Union[List[ResourceProviderConfig], UnsetType] = unset,
7482
tenant_name: Union[str, UnsetType] = unset,
83+
usage_metrics_enabled: Union[bool, UnsetType] = unset,
7584
**kwargs,
7685
):
7786
"""
@@ -108,11 +117,11 @@ def __init__(
108117
Only hosts that match one of the defined tags are imported into Datadog.
109118
:type host_filters: str, optional
110119
111-
:param metrics_config: Dictionary containing the key ``excluded_resource_providers`` which has to be a list of Microsoft Azure Resource Provider names.
112-
This feature is currently being beta tested.
113-
In order to enable all resource providers for metric collection, pass:
114-
``metrics_config: {"excluded_resource_providers": []}`` (i.e., an empty list for ``excluded_resource_providers`` ).
115-
:type metrics_config: AzureAccountMetricsConfig, optional
120+
:param metrics_enabled: Enable Azure metrics for your organization.
121+
:type metrics_enabled: bool, optional
122+
123+
:param metrics_enabled_default: Enable Azure metrics for your organization for resource providers where no resource provider config is specified.
124+
:type metrics_enabled_default: bool, optional
116125
117126
:param new_client_id: Your New Azure web application ID.
118127
:type new_client_id: str, optional
@@ -123,8 +132,14 @@ def __init__(
123132
:param resource_collection_enabled: When enabled, Datadog collects metadata and configuration info from cloud resources (compute instances, databases, load balancers, etc.) monitored by this app registration.
124133
:type resource_collection_enabled: bool, optional
125134
135+
:param resource_provider_configs: Configuration settings applied to resources from the specified Azure resource providers.
136+
:type resource_provider_configs: [ResourceProviderConfig], optional
137+
126138
:param tenant_name: Your Azure Active Directory ID.
127139
:type tenant_name: str, optional
140+
141+
:param usage_metrics_enabled: Enable azure.usage metrics for your organization.
142+
:type usage_metrics_enabled: bool, optional
128143
"""
129144
if app_service_plan_filters is not unset:
130145
kwargs["app_service_plan_filters"] = app_service_plan_filters
@@ -144,14 +159,20 @@ def __init__(
144159
kwargs["errors"] = errors
145160
if host_filters is not unset:
146161
kwargs["host_filters"] = host_filters
147-
if metrics_config is not unset:
148-
kwargs["metrics_config"] = metrics_config
162+
if metrics_enabled is not unset:
163+
kwargs["metrics_enabled"] = metrics_enabled
164+
if metrics_enabled_default is not unset:
165+
kwargs["metrics_enabled_default"] = metrics_enabled_default
149166
if new_client_id is not unset:
150167
kwargs["new_client_id"] = new_client_id
151168
if new_tenant_name is not unset:
152169
kwargs["new_tenant_name"] = new_tenant_name
153170
if resource_collection_enabled is not unset:
154171
kwargs["resource_collection_enabled"] = resource_collection_enabled
172+
if resource_provider_configs is not unset:
173+
kwargs["resource_provider_configs"] = resource_provider_configs
155174
if tenant_name is not unset:
156175
kwargs["tenant_name"] = tenant_name
176+
if usage_metrics_enabled is not unset:
177+
kwargs["usage_metrics_enabled"] = usage_metrics_enabled
157178
super().__init__(kwargs)

src/datadog_api_client/v1/model/azure_account_metrics_config.py

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
2+
# This product includes software developed at Datadog (https://www.datadoghq.com/).
3+
# Copyright 2019-Present Datadog, Inc.
4+
from __future__ import annotations
5+
6+
from typing import Union
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
class ResourceProviderConfig(ModelNormal):
17+
@cached_property
18+
def openapi_types(_):
19+
return {
20+
"metrics_enabled": (bool,),
21+
"namespace": (str,),
22+
}
23+
24+
attribute_map = {
25+
"metrics_enabled": "metrics_enabled",
26+
"namespace": "namespace",
27+
}
28+
29+
def __init__(
30+
self_, metrics_enabled: Union[bool, UnsetType] = unset, namespace: Union[str, UnsetType] = unset, **kwargs
31+
):
32+
"""
33+
Configuration settings applied to resources from the specified Azure resource provider.
34+
35+
:param metrics_enabled: Collect metrics for resources from this provider.
36+
:type metrics_enabled: bool, optional
37+
38+
:param namespace: The provider namespace to apply this configuration to.
39+
:type namespace: str, optional
40+
"""
41+
if metrics_enabled is not unset:
42+
kwargs["metrics_enabled"] = metrics_enabled
43+
if namespace is not unset:
44+
kwargs["namespace"] = namespace
45+
super().__init__(kwargs)

0 commit comments

Comments
 (0)