Skip to content

Commit 00824e6

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add metric_namespace_configs to GCP v2 API (#2248)
* Regenerate client from commit 2db17c21 of spec repo * pre-commit fixes --------- Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 6002a4b commit 00824e6

File tree

7 files changed

+97
-9
lines changed

7 files changed

+97
-9
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-11-05 21:07:14.133850",
8-
"spec_repo_commit": "6c0fa1b6"
7+
"regenerated": "2024-11-05 22:28:18.913806",
8+
"spec_repo_commit": "2db17c21"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-11-05 21:07:14.151593",
13-
"spec_repo_commit": "6c0fa1b6"
12+
"regenerated": "2024-11-05 22:28:18.931370",
13+
"spec_repo_commit": "2db17c21"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9623,6 +9623,20 @@ components:
96239623
nullable: true
96249624
type: array
96259625
type: object
9626+
GCPMetricNamespaceConfig:
9627+
description: Configuration for a GCP metric namespace.
9628+
properties:
9629+
disabled:
9630+
default: false
9631+
description: When disabled, Datadog does not collect metrics that are related
9632+
to this GCP metric namespace.
9633+
example: true
9634+
type: boolean
9635+
id:
9636+
description: The id of the GCP metric namespace.
9637+
example: aiplatform
9638+
type: string
9639+
type: object
96269640
GCPSTSDelegateAccount:
96279641
description: Datadog principal service account info.
96289642
properties:
@@ -9725,6 +9739,14 @@ components:
97259739
account.'
97269740
example: true
97279741
type: boolean
9742+
metric_namespace_configs:
9743+
description: Configurations for GCP metric namespaces.
9744+
example:
9745+
- disabled: true
9746+
id: aiplatform
9747+
items:
9748+
$ref: '#/components/schemas/GCPMetricNamespaceConfig'
9749+
type: array
97289750
resource_collection_enabled:
97299751
description: When enabled, Datadog scans for all resources in your GCP environment.
97309752
type: boolean

docs/datadog_api_client.v2.model.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3868,6 +3868,13 @@ datadog\_api\_client.v2.model.full\_application\_key\_attributes module
38683868
:members:
38693869
:show-inheritance:
38703870

3871+
datadog\_api\_client.v2.model.gcp\_metric\_namespace\_config module
3872+
-------------------------------------------------------------------
3873+
3874+
.. automodule:: datadog_api_client.v2.model.gcp_metric_namespace_config
3875+
:members:
3876+
:show-inheritance:
3877+
38713878
datadog\_api\_client.v2.model.gcp\_service\_account\_meta module
38723879
----------------------------------------------------------------
38733880

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 GCPMetricNamespaceConfig(ModelNormal):
17+
@cached_property
18+
def openapi_types(_):
19+
return {
20+
"disabled": (bool,),
21+
"id": (str,),
22+
}
23+
24+
attribute_map = {
25+
"disabled": "disabled",
26+
"id": "id",
27+
}
28+
29+
def __init__(self_, disabled: Union[bool, UnsetType] = unset, id: Union[str, UnsetType] = unset, **kwargs):
30+
"""
31+
Configuration for a GCP metric namespace.
32+
33+
:param disabled: When disabled, Datadog does not collect metrics that are related to this GCP metric namespace.
34+
:type disabled: bool, optional
35+
36+
:param id: The id of the GCP metric namespace.
37+
:type id: str, optional
38+
"""
39+
if disabled is not unset:
40+
kwargs["disabled"] = disabled
41+
if id is not unset:
42+
kwargs["id"] = id
43+
super().__init__(kwargs)

src/datadog_api_client/v2/model/gcpsts_service_account_attributes.py

Lines changed: 15 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.v2.model.gcp_metric_namespace_config import GCPMetricNamespaceConfig
18+
19+
1620
class GCPSTSServiceAccountAttributes(ModelNormal):
1721
@cached_property
1822
def openapi_types(_):
23+
from datadog_api_client.v2.model.gcp_metric_namespace_config import GCPMetricNamespaceConfig
24+
1925
return {
2026
"account_tags": ([str],),
2127
"automute": (bool,),
@@ -25,6 +31,7 @@ def openapi_types(_):
2531
"is_cspm_enabled": (bool,),
2632
"is_resource_change_collection_enabled": (bool,),
2733
"is_security_command_center_enabled": (bool,),
34+
"metric_namespace_configs": ([GCPMetricNamespaceConfig],),
2835
"resource_collection_enabled": (bool,),
2936
}
3037

@@ -37,6 +44,7 @@ def openapi_types(_):
3744
"is_cspm_enabled": "is_cspm_enabled",
3845
"is_resource_change_collection_enabled": "is_resource_change_collection_enabled",
3946
"is_security_command_center_enabled": "is_security_command_center_enabled",
47+
"metric_namespace_configs": "metric_namespace_configs",
4048
"resource_collection_enabled": "resource_collection_enabled",
4149
}
4250

@@ -50,6 +58,7 @@ def __init__(
5058
is_cspm_enabled: Union[bool, UnsetType] = unset,
5159
is_resource_change_collection_enabled: Union[bool, UnsetType] = unset,
5260
is_security_command_center_enabled: Union[bool, UnsetType] = unset,
61+
metric_namespace_configs: Union[List[GCPMetricNamespaceConfig], UnsetType] = unset,
5362
resource_collection_enabled: Union[bool, UnsetType] = unset,
5463
**kwargs,
5564
):
@@ -81,6 +90,9 @@ def __init__(
8190
:param is_security_command_center_enabled: When enabled, Datadog will attempt to collect Security Command Center Findings. Note: This requires additional permissions on the service account.
8291
:type is_security_command_center_enabled: bool, optional
8392
93+
:param metric_namespace_configs: Configurations for GCP metric namespaces.
94+
:type metric_namespace_configs: [GCPMetricNamespaceConfig], optional
95+
8496
:param resource_collection_enabled: When enabled, Datadog scans for all resources in your GCP environment.
8597
:type resource_collection_enabled: bool, optional
8698
"""
@@ -100,6 +112,8 @@ def __init__(
100112
kwargs["is_resource_change_collection_enabled"] = is_resource_change_collection_enabled
101113
if is_security_command_center_enabled is not unset:
102114
kwargs["is_security_command_center_enabled"] = is_security_command_center_enabled
115+
if metric_namespace_configs is not unset:
116+
kwargs["metric_namespace_configs"] = metric_namespace_configs
103117
if resource_collection_enabled is not unset:
104118
kwargs["resource_collection_enabled"] = resource_collection_enabled
105119
super().__init__(kwargs)

src/datadog_api_client/v2/models/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@
689689
from datadog_api_client.v2.model.full_api_key_attributes import FullAPIKeyAttributes
690690
from datadog_api_client.v2.model.full_application_key import FullApplicationKey
691691
from datadog_api_client.v2.model.full_application_key_attributes import FullApplicationKeyAttributes
692+
from datadog_api_client.v2.model.gcp_metric_namespace_config import GCPMetricNamespaceConfig
692693
from datadog_api_client.v2.model.gcpsts_delegate_account import GCPSTSDelegateAccount
693694
from datadog_api_client.v2.model.gcpsts_delegate_account_attributes import GCPSTSDelegateAccountAttributes
694695
from datadog_api_client.v2.model.gcpsts_delegate_account_response import GCPSTSDelegateAccountResponse
@@ -2610,6 +2611,7 @@
26102611
"FullAPIKeyAttributes",
26112612
"FullApplicationKey",
26122613
"FullApplicationKeyAttributes",
2614+
"GCPMetricNamespaceConfig",
26132615
"GCPSTSDelegateAccount",
26142616
"GCPSTSDelegateAccountAttributes",
26152617
"GCPSTSDelegateAccountResponse",

tests/v2/features/gcp_integration.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ Feature: GCP Integration
3434
@generated @skip @team:DataDog/gcp-integrations
3535
Scenario: Create a new entry for your service account returns "Bad Request" response
3636
Given new "CreateGCPSTSAccount" request
37-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "type": "gcp_service_account"}}
37+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "type": "gcp_service_account"}}
3838
When the request is sent
3939
Then the response status is 400 Bad Request
4040

4141
@generated @skip @team:DataDog/gcp-integrations
4242
Scenario: Create a new entry for your service account returns "Conflict" response
4343
Given new "CreateGCPSTSAccount" request
44-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "type": "gcp_service_account"}}
44+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "type": "gcp_service_account"}}
4545
When the request is sent
4646
Then the response status is 409 Conflict
4747

@@ -151,15 +151,15 @@ Feature: GCP Integration
151151
Scenario: Update STS Service Account returns "Bad Request" response
152152
Given new "UpdateGCPSTSAccount" request
153153
And request contains "account_id" parameter from "REPLACE.ME"
154-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
154+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
155155
When the request is sent
156156
Then the response status is 400 Bad Request
157157

158158
@generated @skip @team:DataDog/gcp-integrations
159159
Scenario: Update STS Service Account returns "Not Found" response
160160
Given new "UpdateGCPSTSAccount" request
161161
And request contains "account_id" parameter from "REPLACE.ME"
162-
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
162+
And body with value {"data": {"attributes": {"account_tags": [], "client_email": "[email protected]", "cloud_run_revision_filters": ["$KEY:$VALUE"], "host_filters": [], "is_resource_change_collection_enabled": true, "is_security_command_center_enabled": true, "metric_namespace_configs": [{"disabled": true, "id": "aiplatform"}]}, "id": "d291291f-12c2-22g4-j290-123456678897", "type": "gcp_service_account"}}
163163
When the request is sent
164164
Then the response status is 404 Not Found
165165

0 commit comments

Comments
 (0)