Skip to content

Commit 64ef00d

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 8145d25b of spec repo
1 parent c506830 commit 64ef00d

File tree

6 files changed

+177
-8
lines changed

6 files changed

+177
-8
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-04 21:14:31.327488",
8-
"spec_repo_commit": "08338fd1"
7+
"regenerated": "2024-11-05 18:51:44.943363",
8+
"spec_repo_commit": "8145d25b"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-11-04 21:14:31.346210",
13-
"spec_repo_commit": "08338fd1"
12+
"regenerated": "2024-11-05 18:51:44.962476",
13+
"spec_repo_commit": "8145d25b"
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

src/datadogV2/model/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,8 @@ pub mod model_gcpsts_service_account;
12961296
pub use self::model_gcpsts_service_account::GCPSTSServiceAccount;
12971297
pub mod model_gcpsts_service_account_attributes;
12981298
pub use self::model_gcpsts_service_account_attributes::GCPSTSServiceAccountAttributes;
1299+
pub mod model_gcp_metric_namespace_config;
1300+
pub use self::model_gcp_metric_namespace_config::GCPMetricNamespaceConfig;
12991301
pub mod model_gcp_service_account_meta;
13001302
pub use self::model_gcp_service_account_meta::GCPServiceAccountMeta;
13011303
pub mod model_gcp_service_account_type;
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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+
use serde::de::{Error, MapAccess, Visitor};
5+
use serde::{Deserialize, Deserializer, Serialize};
6+
use serde_with::skip_serializing_none;
7+
use std::fmt::{self, Formatter};
8+
9+
/// Configuration for a GCP metric namespace.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct GCPMetricNamespaceConfig {
14+
/// When disabled, Datadog does not collect metrics that are related to this GCP metric namespace.
15+
#[serde(rename = "disabled")]
16+
pub disabled: Option<bool>,
17+
/// The id of the GCP metric namespace.
18+
#[serde(rename = "id")]
19+
pub id: Option<String>,
20+
#[serde(flatten)]
21+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
22+
#[serde(skip)]
23+
#[serde(default)]
24+
pub(crate) _unparsed: bool,
25+
}
26+
27+
impl GCPMetricNamespaceConfig {
28+
pub fn new() -> GCPMetricNamespaceConfig {
29+
GCPMetricNamespaceConfig {
30+
disabled: None,
31+
id: None,
32+
additional_properties: std::collections::BTreeMap::new(),
33+
_unparsed: false,
34+
}
35+
}
36+
37+
pub fn disabled(mut self, value: bool) -> Self {
38+
self.disabled = Some(value);
39+
self
40+
}
41+
42+
pub fn id(mut self, value: String) -> Self {
43+
self.id = Some(value);
44+
self
45+
}
46+
47+
pub fn additional_properties(
48+
mut self,
49+
value: std::collections::BTreeMap<String, serde_json::Value>,
50+
) -> Self {
51+
self.additional_properties = value;
52+
self
53+
}
54+
}
55+
56+
impl Default for GCPMetricNamespaceConfig {
57+
fn default() -> Self {
58+
Self::new()
59+
}
60+
}
61+
62+
impl<'de> Deserialize<'de> for GCPMetricNamespaceConfig {
63+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
64+
where
65+
D: Deserializer<'de>,
66+
{
67+
struct GCPMetricNamespaceConfigVisitor;
68+
impl<'a> Visitor<'a> for GCPMetricNamespaceConfigVisitor {
69+
type Value = GCPMetricNamespaceConfig;
70+
71+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
72+
f.write_str("a mapping")
73+
}
74+
75+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
76+
where
77+
M: MapAccess<'a>,
78+
{
79+
let mut disabled: Option<bool> = None;
80+
let mut id: Option<String> = None;
81+
let mut additional_properties: std::collections::BTreeMap<
82+
String,
83+
serde_json::Value,
84+
> = std::collections::BTreeMap::new();
85+
let mut _unparsed = false;
86+
87+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
88+
match k.as_str() {
89+
"disabled" => {
90+
if v.is_null() {
91+
continue;
92+
}
93+
disabled = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
94+
}
95+
"id" => {
96+
if v.is_null() {
97+
continue;
98+
}
99+
id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
100+
}
101+
&_ => {
102+
if let Ok(value) = serde_json::from_value(v.clone()) {
103+
additional_properties.insert(k, value);
104+
}
105+
}
106+
}
107+
}
108+
109+
let content = GCPMetricNamespaceConfig {
110+
disabled,
111+
id,
112+
additional_properties,
113+
_unparsed,
114+
};
115+
116+
Ok(content)
117+
}
118+
}
119+
120+
deserializer.deserialize_any(GCPMetricNamespaceConfigVisitor)
121+
}
122+
}

src/datadogV2/model/model_gcpsts_service_account_attributes.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ pub struct GCPSTSServiceAccountAttributes {
3636
/// When enabled, Datadog will attempt to collect Security Command Center Findings. Note: This requires additional permissions on the service account.
3737
#[serde(rename = "is_security_command_center_enabled")]
3838
pub is_security_command_center_enabled: Option<bool>,
39+
/// Configurations for GCP metric namespaces.
40+
#[serde(rename = "metric_namespace_configs")]
41+
pub metric_namespace_configs: Option<Vec<crate::datadogV2::model::GCPMetricNamespaceConfig>>,
3942
/// When enabled, Datadog scans for all resources in your GCP environment.
4043
#[serde(rename = "resource_collection_enabled")]
4144
pub resource_collection_enabled: Option<bool>,
@@ -57,6 +60,7 @@ impl GCPSTSServiceAccountAttributes {
5760
is_cspm_enabled: None,
5861
is_resource_change_collection_enabled: None,
5962
is_security_command_center_enabled: None,
63+
metric_namespace_configs: None,
6064
resource_collection_enabled: None,
6165
additional_properties: std::collections::BTreeMap::new(),
6266
_unparsed: false,
@@ -103,6 +107,14 @@ impl GCPSTSServiceAccountAttributes {
103107
self
104108
}
105109

110+
pub fn metric_namespace_configs(
111+
mut self,
112+
value: Vec<crate::datadogV2::model::GCPMetricNamespaceConfig>,
113+
) -> Self {
114+
self.metric_namespace_configs = Some(value);
115+
self
116+
}
117+
106118
pub fn resource_collection_enabled(mut self, value: bool) -> Self {
107119
self.resource_collection_enabled = Some(value);
108120
self
@@ -148,6 +160,9 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
148160
let mut is_cspm_enabled: Option<bool> = None;
149161
let mut is_resource_change_collection_enabled: Option<bool> = None;
150162
let mut is_security_command_center_enabled: Option<bool> = None;
163+
let mut metric_namespace_configs: Option<
164+
Vec<crate::datadogV2::model::GCPMetricNamespaceConfig>,
165+
> = None;
151166
let mut resource_collection_enabled: Option<bool> = None;
152167
let mut additional_properties: std::collections::BTreeMap<
153168
String,
@@ -212,6 +227,13 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
212227
is_security_command_center_enabled =
213228
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
214229
}
230+
"metric_namespace_configs" => {
231+
if v.is_null() {
232+
continue;
233+
}
234+
metric_namespace_configs =
235+
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
236+
}
215237
"resource_collection_enabled" => {
216238
if v.is_null() {
217239
continue;
@@ -236,6 +258,7 @@ impl<'de> Deserialize<'de> for GCPSTSServiceAccountAttributes {
236258
is_cspm_enabled,
237259
is_resource_change_collection_enabled,
238260
is_security_command_center_enabled,
261+
metric_namespace_configs,
239262
resource_collection_enabled,
240263
additional_properties,
241264
_unparsed,

tests/scenarios/features/v2/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)