Skip to content

Commit 467ec30

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Support metric filtering in integration azure GET, PUT APIs (#2027)
Co-authored-by: ci.datadog-api-spec <[email protected]> Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
1 parent 7b6fb69 commit 467ec30

14 files changed

+122
-20
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-07-02 18:50:20.936980",
8-
"spec_repo_commit": "fae9d797"
7+
"regenerated": "2024-07-03 18:25:16.853230",
8+
"spec_repo_commit": "ce846cd6"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-07-02 18:50:20.953928",
13-
"spec_repo_commit": "fae9d797"
12+
"regenerated": "2024-07-03 18:25:16.870911",
13+
"spec_repo_commit": "ce846cd6"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,8 @@ components:
840840
Only hosts that match one of the defined tags are imported into Datadog.'
841841
example: key:value,filter:example
842842
type: string
843+
metrics_config:
844+
$ref: '#/components/schemas/AzureAccountMetricsConfig'
843845
new_client_id:
844846
description: Your New Azure web application ID.
845847
example: new1c7f6-1234-5678-9101-3fcbf464test
@@ -864,6 +866,27 @@ components:
864866
items:
865867
$ref: '#/components/schemas/AzureAccount'
866868
type: array
869+
AzureAccountMetricsConfig:
870+
description: 'Dictionary containing the key `excluded_resource_providers` which
871+
has to be a list of Microsoft Azure Resource Provider names.
872+
873+
This feature is currently being beta tested.
874+
875+
In order to enable all resource providers for metric collection, pass:
876+
877+
`metrics_config: {"excluded_resource_providers": []}` (i.e., an empty list
878+
for `excluded_resource_providers`).'
879+
properties:
880+
excluded_resource_providers:
881+
description: List of Microsoft Azure Resource Providers to exclude from
882+
metric collection.
883+
example:
884+
- Microsoft.Sql
885+
- Microsoft.Cdn
886+
items:
887+
type: string
888+
type: array
889+
type: object
867890
CancelDowntimesByScopeRequest:
868891
description: Cancel downtimes according to scope.
869892
properties:

docs/datadog_api_client.v1.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,13 @@ azure\_account\_list\_response
316316
:members:
317317
:show-inheritance:
318318

319+
azure\_account\_metrics\_config
320+
-------------------------------
321+
322+
.. automodule:: datadog_api_client.v1.model.azure_account_metrics_config
323+
:members:
324+
:show-inheritance:
325+
319326
cancel\_downtimes\_by\_scope\_request
320327
-------------------------------------
321328

examples/v1/azure-integration/UpdateAzureHostFilters.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +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
89

910
body = AzureAccount(
1011
app_service_plan_filters="key:value,filter:example",
@@ -18,6 +19,12 @@
1819
"*",
1920
],
2021
host_filters="key:value,filter:example",
22+
metrics_config=AzureAccountMetricsConfig(
23+
excluded_resource_providers=[
24+
"Microsoft.Sql",
25+
"Microsoft.Cdn",
26+
],
27+
),
2128
new_client_id="new1c7f6-1234-5678-9101-3fcbf464test",
2229
new_tenant_name="new1c44-1234-5678-9101-cc00736ftest",
2330
resource_collection_enabled=True,

examples/v1/azure-integration/UpdateAzureIntegration.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +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
89

910
body = AzureAccount(
1011
app_service_plan_filters="key:value,filter:example",
@@ -21,6 +22,12 @@
2122
new_client_id="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
2223
new_tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
2324
resource_collection_enabled=True,
25+
metrics_config=AzureAccountMetricsConfig(
26+
excluded_resource_providers=[
27+
"Microsoft.Sql",
28+
"Microsoft.Cdn",
29+
],
30+
),
2431
tenant_name="9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
2532
)
2633

src/datadog_api_client/v1/model/azure_account.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright 2019-Present Datadog, Inc.
44
from __future__ import annotations
55

6-
from typing import List, Union
6+
from typing import List, Union, TYPE_CHECKING
77

88
from datadog_api_client.model_utils import (
99
ModelNormal,
@@ -13,9 +13,15 @@
1313
)
1414

1515

16+
if TYPE_CHECKING:
17+
from datadog_api_client.v1.model.azure_account_metrics_config import AzureAccountMetricsConfig
18+
19+
1620
class AzureAccount(ModelNormal):
1721
@cached_property
1822
def openapi_types(_):
23+
from datadog_api_client.v1.model.azure_account_metrics_config import AzureAccountMetricsConfig
24+
1925
return {
2026
"app_service_plan_filters": (str,),
2127
"automute": (bool,),
@@ -26,6 +32,7 @@ def openapi_types(_):
2632
"custom_metrics_enabled": (bool,),
2733
"errors": ([str],),
2834
"host_filters": (str,),
35+
"metrics_config": (AzureAccountMetricsConfig,),
2936
"new_client_id": (str,),
3037
"new_tenant_name": (str,),
3138
"resource_collection_enabled": (bool,),
@@ -42,6 +49,7 @@ def openapi_types(_):
4249
"custom_metrics_enabled": "custom_metrics_enabled",
4350
"errors": "errors",
4451
"host_filters": "host_filters",
52+
"metrics_config": "metrics_config",
4553
"new_client_id": "new_client_id",
4654
"new_tenant_name": "new_tenant_name",
4755
"resource_collection_enabled": "resource_collection_enabled",
@@ -59,6 +67,7 @@ def __init__(
5967
custom_metrics_enabled: Union[bool, UnsetType] = unset,
6068
errors: Union[List[str], UnsetType] = unset,
6169
host_filters: Union[str, UnsetType] = unset,
70+
metrics_config: Union[AzureAccountMetricsConfig, UnsetType] = unset,
6271
new_client_id: Union[str, UnsetType] = unset,
6372
new_tenant_name: Union[str, UnsetType] = unset,
6473
resource_collection_enabled: Union[bool, UnsetType] = unset,
@@ -99,6 +108,12 @@ def __init__(
99108
Only hosts that match one of the defined tags are imported into Datadog.
100109
:type host_filters: str, optional
101110
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
116+
102117
:param new_client_id: Your New Azure web application ID.
103118
:type new_client_id: str, optional
104119
@@ -129,6 +144,8 @@ def __init__(
129144
kwargs["errors"] = errors
130145
if host_filters is not unset:
131146
kwargs["host_filters"] = host_filters
147+
if metrics_config is not unset:
148+
kwargs["metrics_config"] = metrics_config
132149
if new_client_id is not unset:
133150
kwargs["new_client_id"] = new_client_id
134151
if new_tenant_name is not unset:
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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 List, Union
7+
8+
from datadog_api_client.model_utils import (
9+
ModelNormal,
10+
cached_property,
11+
unset,
12+
UnsetType,
13+
)
14+
15+
16+
class AzureAccountMetricsConfig(ModelNormal):
17+
@cached_property
18+
def openapi_types(_):
19+
return {
20+
"excluded_resource_providers": ([str],),
21+
}
22+
23+
attribute_map = {
24+
"excluded_resource_providers": "excluded_resource_providers",
25+
}
26+
27+
def __init__(self_, excluded_resource_providers: Union[List[str], UnsetType] = unset, **kwargs):
28+
"""
29+
Dictionary containing the key ``excluded_resource_providers`` which has to be a list of Microsoft Azure Resource Provider names.
30+
This feature is currently being beta tested.
31+
In order to enable all resource providers for metric collection, pass:
32+
``metrics_config: {"excluded_resource_providers": []}`` (i.e., an empty list for ``excluded_resource_providers`` ).
33+
34+
:param excluded_resource_providers: List of Microsoft Azure Resource Providers to exclude from metric collection.
35+
:type excluded_resource_providers: [str], optional
36+
"""
37+
if excluded_resource_providers is not unset:
38+
kwargs["excluded_resource_providers"] = excluded_resource_providers
39+
super().__init__(kwargs)

src/datadog_api_client/v1/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from datadog_api_client.v1.model.authentication_validation_response import AuthenticationValidationResponse
4444
from datadog_api_client.v1.model.azure_account import AzureAccount
4545
from datadog_api_client.v1.model.azure_account_list_response import AzureAccountListResponse
46+
from datadog_api_client.v1.model.azure_account_metrics_config import AzureAccountMetricsConfig
4647
from datadog_api_client.v1.model.cancel_downtimes_by_scope_request import CancelDowntimesByScopeRequest
4748
from datadog_api_client.v1.model.canceled_downtimes_ids import CanceledDowntimesIds
4849
from datadog_api_client.v1.model.change_widget_definition import ChangeWidgetDefinition
@@ -1026,6 +1027,7 @@
10261027
"AuthenticationValidationResponse",
10271028
"AzureAccount",
10281029
"AzureAccountListResponse",
1030+
"AzureAccountMetricsConfig",
10291031
"CancelDowntimesByScopeRequest",
10301032
"CanceledDowntimesIds",
10311033
"ChangeWidgetDefinition",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2024-02-28T20:25:59.931Z
1+
2024-07-01T18:40:05.567Z

tests/v1/cassettes/test_scenarios/test_delete_an_azure_integration_returns_ok_response.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
interactions:
22
- request:
3-
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17091519-0000-0000-0000-170915195900","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","new_client_id":"17091519-0000-0000-0000-170915195900","new_tenant_name":"17091519-0000-0000-0000-170915195900","resource_collection_enabled":true,"tenant_name":"17091519-0000-0000-0000-170915195900"}'
3+
body: '{"app_service_plan_filters":"key:value,filter:example","automute":true,"client_id":"17198592-0000-0000-0000-171985920500","client_secret":"testingx./Sw*g/Y33t..R1cH+hScMDt","container_app_filters":"key:value,filter:example","cspm_enabled":true,"custom_metrics_enabled":true,"errors":["*"],"host_filters":"key:value,filter:example","metrics_config":{"excluded_resource_providers":["Microsoft.Sql","Microsoft.Cdn"]},"new_client_id":"17198592-0000-0000-0000-171985920500","new_tenant_name":"17198592-0000-0000-0000-171985920500","resource_collection_enabled":true,"tenant_name":"17198592-0000-0000-0000-171985920500"}'
44
headers:
55
accept:
66
- application/json
@@ -20,7 +20,7 @@ interactions:
2020
code: 200
2121
message: OK
2222
- request:
23-
body: '{"client_id":"17091519-0000-0000-0000-170915195900","tenant_name":"17091519-0000-0000-0000-170915195900"}'
23+
body: '{"client_id":"17198592-0000-0000-0000-171985920500","tenant_name":"17198592-0000-0000-0000-171985920500"}'
2424
headers:
2525
accept:
2626
- application/json
@@ -40,7 +40,7 @@ interactions:
4040
code: 200
4141
message: OK
4242
- request:
43-
body: '{"client_id":"17091519-0000-0000-0000-170915195900","tenant_name":"17091519-0000-0000-0000-170915195900"}'
43+
body: '{"client_id":"17198592-0000-0000-0000-171985920500","tenant_name":"17198592-0000-0000-0000-171985920500"}'
4444
headers:
4545
accept:
4646
- application/json

0 commit comments

Comments
 (0)