Skip to content

Commit e5b1d05

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Adding Datadog Connection to Connection API (#790)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 57e31eb commit e5b1d05

13 files changed

+874
-2
lines changed

.generated-info

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"spec_repo_commit": "dc49df4",
3-
"generated": "2025-07-18 14:02:24.862"
2+
"spec_repo_commit": "0f24b8e",
3+
"generated": "2025-07-18 16:58:06.791"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,11 +2016,13 @@ components:
20162016
description: The definition of `ActionConnectionIntegration` object.
20172017
oneOf:
20182018
- $ref: '#/components/schemas/AWSIntegration'
2019+
- $ref: '#/components/schemas/DatadogIntegration'
20192020
- $ref: '#/components/schemas/HTTPIntegration'
20202021
ActionConnectionIntegrationUpdate:
20212022
description: The definition of `ActionConnectionIntegrationUpdate` object.
20222023
oneOf:
20232024
- $ref: '#/components/schemas/AWSIntegrationUpdate'
2025+
- $ref: '#/components/schemas/DatadogIntegrationUpdate'
20242026
- $ref: '#/components/schemas/HTTPIntegrationUpdate'
20252027
ActionQuery:
20262028
description: An action query. This query type is used to trigger an action,
@@ -12378,6 +12380,103 @@ components:
1237812380
required:
1237912381
- databaseMonitoringTrigger
1238012382
type: object
12383+
DatadogAPIKey:
12384+
description: The definition of the `DatadogAPIKey` object.
12385+
properties:
12386+
api_key:
12387+
description: The `DatadogAPIKey` `api_key`.
12388+
example: ''
12389+
type: string
12390+
app_key:
12391+
description: The `DatadogAPIKey` `app_key`.
12392+
example: ''
12393+
type: string
12394+
datacenter:
12395+
description: The `DatadogAPIKey` `datacenter`.
12396+
example: ''
12397+
type: string
12398+
subdomain:
12399+
description: Custom subdomain used for Datadog URLs generated with this
12400+
Connection. For example, if this org uses `https://acme.datadoghq.com`
12401+
to access Datadog, set this field to `acme`. If this field is omitted,
12402+
generated URLs will use the default site URL for its datacenter (see [https://docs.datadoghq.com/getting_started/site](https://docs.datadoghq.com/getting_started/site)).
12403+
type: string
12404+
type:
12405+
$ref: '#/components/schemas/DatadogAPIKeyType'
12406+
required:
12407+
- type
12408+
- datacenter
12409+
- api_key
12410+
- app_key
12411+
type: object
12412+
DatadogAPIKeyType:
12413+
description: The definition of the `DatadogAPIKey` object.
12414+
enum:
12415+
- DatadogAPIKey
12416+
example: DatadogAPIKey
12417+
type: string
12418+
x-enum-varnames:
12419+
- DATADOGAPIKEY
12420+
DatadogAPIKeyUpdate:
12421+
description: The definition of the `DatadogAPIKey` object.
12422+
properties:
12423+
api_key:
12424+
description: The `DatadogAPIKeyUpdate` `api_key`.
12425+
type: string
12426+
app_key:
12427+
description: The `DatadogAPIKeyUpdate` `app_key`.
12428+
type: string
12429+
datacenter:
12430+
description: The `DatadogAPIKeyUpdate` `datacenter`.
12431+
type: string
12432+
subdomain:
12433+
description: Custom subdomain used for Datadog URLs generated with this
12434+
Connection. For example, if this org uses `https://acme.datadoghq.com`
12435+
to access Datadog, set this field to `acme`. If this field is omitted,
12436+
generated URLs will use the default site URL for its datacenter (see [https://docs.datadoghq.com/getting_started/site](https://docs.datadoghq.com/getting_started/site)).
12437+
type: string
12438+
type:
12439+
$ref: '#/components/schemas/DatadogAPIKeyType'
12440+
required:
12441+
- type
12442+
type: object
12443+
DatadogCredentials:
12444+
description: The definition of the `DatadogCredentials` object.
12445+
oneOf:
12446+
- $ref: '#/components/schemas/DatadogAPIKey'
12447+
DatadogCredentialsUpdate:
12448+
description: The definition of the `DatadogCredentialsUpdate` object.
12449+
oneOf:
12450+
- $ref: '#/components/schemas/DatadogAPIKeyUpdate'
12451+
DatadogIntegration:
12452+
description: The definition of the `DatadogIntegration` object.
12453+
properties:
12454+
credentials:
12455+
$ref: '#/components/schemas/DatadogCredentials'
12456+
type:
12457+
$ref: '#/components/schemas/DatadogIntegrationType'
12458+
required:
12459+
- type
12460+
- credentials
12461+
type: object
12462+
DatadogIntegrationType:
12463+
description: The definition of the `DatadogIntegrationType` object.
12464+
enum:
12465+
- Datadog
12466+
example: Datadog
12467+
type: string
12468+
x-enum-varnames:
12469+
- DATADOG
12470+
DatadogIntegrationUpdate:
12471+
description: The definition of the `DatadogIntegrationUpdate` object.
12472+
properties:
12473+
credentials:
12474+
$ref: '#/components/schemas/DatadogCredentialsUpdate'
12475+
type:
12476+
$ref: '#/components/schemas/DatadogIntegrationType'
12477+
required:
12478+
- type
12479+
type: object
1238112480
Dataset:
1238212481
description: Dataset object.
1238312482
properties:

src/datadogV2/model/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ pub mod model_aws_credentials;
3636
pub use self::model_aws_credentials::AWSCredentials;
3737
pub mod model_aws_integration_type;
3838
pub use self::model_aws_integration_type::AWSIntegrationType;
39+
pub mod model_datadog_integration;
40+
pub use self::model_datadog_integration::DatadogIntegration;
41+
pub mod model_datadog_api_key;
42+
pub use self::model_datadog_api_key::DatadogAPIKey;
43+
pub mod model_datadog_api_key_type;
44+
pub use self::model_datadog_api_key_type::DatadogAPIKeyType;
45+
pub mod model_datadog_credentials;
46+
pub use self::model_datadog_credentials::DatadogCredentials;
47+
pub mod model_datadog_integration_type;
48+
pub use self::model_datadog_integration_type::DatadogIntegrationType;
3949
pub mod model_http_integration;
4050
pub use self::model_http_integration::HTTPIntegration;
4151
pub mod model_http_token_auth;
@@ -76,6 +86,12 @@ pub mod model_aws_assume_role_update;
7686
pub use self::model_aws_assume_role_update::AWSAssumeRoleUpdate;
7787
pub mod model_aws_credentials_update;
7888
pub use self::model_aws_credentials_update::AWSCredentialsUpdate;
89+
pub mod model_datadog_integration_update;
90+
pub use self::model_datadog_integration_update::DatadogIntegrationUpdate;
91+
pub mod model_datadog_api_key_update;
92+
pub use self::model_datadog_api_key_update::DatadogAPIKeyUpdate;
93+
pub mod model_datadog_credentials_update;
94+
pub use self::model_datadog_credentials_update::DatadogCredentialsUpdate;
7995
pub mod model_http_integration_update;
8096
pub use self::model_http_integration_update::HTTPIntegrationUpdate;
8197
pub mod model_http_token_auth_update;

src/datadogV2/model/model_action_connection_integration.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use serde::{Deserialize, Deserializer, Serialize};
99
#[serde(untagged)]
1010
pub enum ActionConnectionIntegration {
1111
AWSIntegration(Box<crate::datadogV2::model::AWSIntegration>),
12+
DatadogIntegration(Box<crate::datadogV2::model::DatadogIntegration>),
1213
HTTPIntegration(Box<crate::datadogV2::model::HTTPIntegration>),
1314
UnparsedObject(crate::datadog::UnparsedObject),
1415
}
@@ -26,6 +27,13 @@ impl<'de> Deserialize<'de> for ActionConnectionIntegration {
2627
return Ok(ActionConnectionIntegration::AWSIntegration(_v));
2728
}
2829
}
30+
if let Ok(_v) = serde_json::from_value::<Box<crate::datadogV2::model::DatadogIntegration>>(
31+
value.clone(),
32+
) {
33+
if !_v._unparsed {
34+
return Ok(ActionConnectionIntegration::DatadogIntegration(_v));
35+
}
36+
}
2937
if let Ok(_v) =
3038
serde_json::from_value::<Box<crate::datadogV2::model::HTTPIntegration>>(value.clone())
3139
{

src/datadogV2/model/model_action_connection_integration_update.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use serde::{Deserialize, Deserializer, Serialize};
99
#[serde(untagged)]
1010
pub enum ActionConnectionIntegrationUpdate {
1111
AWSIntegrationUpdate(Box<crate::datadogV2::model::AWSIntegrationUpdate>),
12+
DatadogIntegrationUpdate(Box<crate::datadogV2::model::DatadogIntegrationUpdate>),
1213
HTTPIntegrationUpdate(Box<crate::datadogV2::model::HTTPIntegrationUpdate>),
1314
UnparsedObject(crate::datadog::UnparsedObject),
1415
}
@@ -26,6 +27,16 @@ impl<'de> Deserialize<'de> for ActionConnectionIntegrationUpdate {
2627
return Ok(ActionConnectionIntegrationUpdate::AWSIntegrationUpdate(_v));
2728
}
2829
}
30+
if let Ok(_v) = serde_json::from_value::<
31+
Box<crate::datadogV2::model::DatadogIntegrationUpdate>,
32+
>(value.clone())
33+
{
34+
if !_v._unparsed {
35+
return Ok(ActionConnectionIntegrationUpdate::DatadogIntegrationUpdate(
36+
_v,
37+
));
38+
}
39+
}
2940
if let Ok(_v) = serde_json::from_value::<Box<crate::datadogV2::model::HTTPIntegrationUpdate>>(
3041
value.clone(),
3142
) {
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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+
/// The definition of the `DatadogAPIKey` object.
10+
#[non_exhaustive]
11+
#[skip_serializing_none]
12+
#[derive(Clone, Debug, PartialEq, Serialize)]
13+
pub struct DatadogAPIKey {
14+
/// The `DatadogAPIKey` `api_key`.
15+
#[serde(rename = "api_key")]
16+
pub api_key: String,
17+
/// The `DatadogAPIKey` `app_key`.
18+
#[serde(rename = "app_key")]
19+
pub app_key: String,
20+
/// The `DatadogAPIKey` `datacenter`.
21+
#[serde(rename = "datacenter")]
22+
pub datacenter: String,
23+
/// Custom subdomain used for Datadog URLs generated with this Connection. For example, if this org uses `<https://acme.datadoghq.com`> to access Datadog, set this field to `acme`. If this field is omitted, generated URLs will use the default site URL for its datacenter (see [<https://docs.datadoghq.com/getting_started/site]>(<https://docs.datadoghq.com/getting_started/site>)).
24+
#[serde(rename = "subdomain")]
25+
pub subdomain: Option<String>,
26+
/// The definition of the `DatadogAPIKey` object.
27+
#[serde(rename = "type")]
28+
pub type_: crate::datadogV2::model::DatadogAPIKeyType,
29+
#[serde(flatten)]
30+
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
31+
#[serde(skip)]
32+
#[serde(default)]
33+
pub(crate) _unparsed: bool,
34+
}
35+
36+
impl DatadogAPIKey {
37+
pub fn new(
38+
api_key: String,
39+
app_key: String,
40+
datacenter: String,
41+
type_: crate::datadogV2::model::DatadogAPIKeyType,
42+
) -> DatadogAPIKey {
43+
DatadogAPIKey {
44+
api_key,
45+
app_key,
46+
datacenter,
47+
subdomain: None,
48+
type_,
49+
additional_properties: std::collections::BTreeMap::new(),
50+
_unparsed: false,
51+
}
52+
}
53+
54+
pub fn subdomain(mut self, value: String) -> Self {
55+
self.subdomain = Some(value);
56+
self
57+
}
58+
59+
pub fn additional_properties(
60+
mut self,
61+
value: std::collections::BTreeMap<String, serde_json::Value>,
62+
) -> Self {
63+
self.additional_properties = value;
64+
self
65+
}
66+
}
67+
68+
impl<'de> Deserialize<'de> for DatadogAPIKey {
69+
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
70+
where
71+
D: Deserializer<'de>,
72+
{
73+
struct DatadogAPIKeyVisitor;
74+
impl<'a> Visitor<'a> for DatadogAPIKeyVisitor {
75+
type Value = DatadogAPIKey;
76+
77+
fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
78+
f.write_str("a mapping")
79+
}
80+
81+
fn visit_map<M>(self, mut map: M) -> Result<Self::Value, M::Error>
82+
where
83+
M: MapAccess<'a>,
84+
{
85+
let mut api_key: Option<String> = None;
86+
let mut app_key: Option<String> = None;
87+
let mut datacenter: Option<String> = None;
88+
let mut subdomain: Option<String> = None;
89+
let mut type_: Option<crate::datadogV2::model::DatadogAPIKeyType> = None;
90+
let mut additional_properties: std::collections::BTreeMap<
91+
String,
92+
serde_json::Value,
93+
> = std::collections::BTreeMap::new();
94+
let mut _unparsed = false;
95+
96+
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
97+
match k.as_str() {
98+
"api_key" => {
99+
api_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
100+
}
101+
"app_key" => {
102+
app_key = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
103+
}
104+
"datacenter" => {
105+
datacenter = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
106+
}
107+
"subdomain" => {
108+
if v.is_null() {
109+
continue;
110+
}
111+
subdomain = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
112+
}
113+
"type" => {
114+
type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
115+
if let Some(ref _type_) = type_ {
116+
match _type_ {
117+
crate::datadogV2::model::DatadogAPIKeyType::UnparsedObject(
118+
_type_,
119+
) => {
120+
_unparsed = true;
121+
}
122+
_ => {}
123+
}
124+
}
125+
}
126+
&_ => {
127+
if let Ok(value) = serde_json::from_value(v.clone()) {
128+
additional_properties.insert(k, value);
129+
}
130+
}
131+
}
132+
}
133+
let api_key = api_key.ok_or_else(|| M::Error::missing_field("api_key"))?;
134+
let app_key = app_key.ok_or_else(|| M::Error::missing_field("app_key"))?;
135+
let datacenter = datacenter.ok_or_else(|| M::Error::missing_field("datacenter"))?;
136+
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
137+
138+
let content = DatadogAPIKey {
139+
api_key,
140+
app_key,
141+
datacenter,
142+
subdomain,
143+
type_,
144+
additional_properties,
145+
_unparsed,
146+
};
147+
148+
Ok(content)
149+
}
150+
}
151+
152+
deserializer.deserialize_any(DatadogAPIKeyVisitor)
153+
}
154+
}

0 commit comments

Comments
 (0)