Skip to content

Commit 76c34ef

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit b75095c of spec repo
1 parent 3db8fce commit 76c34ef

File tree

63 files changed

+959
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+959
-117
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": "dcf594e",
3-
"generated": "2025-07-31 10:00:30.229"
2+
"spec_repo_commit": "b75095c",
3+
"generated": "2025-07-31 10:50:58.895"
44
}

.generator/schemas/v2/openapi.yaml

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6891,14 +6891,16 @@ components:
68916891
- data
68926892
type: object
68936893
CaseAttributes:
6894-
description: Case attributes
6894+
description: Case resource attributes
68956895
properties:
68966896
archived_at:
68976897
description: Timestamp of when the case was archived
68986898
format: date-time
68996899
nullable: true
69006900
readOnly: true
69016901
type: string
6902+
attributes:
6903+
$ref: '#/components/schemas/CaseObjectAttributes'
69026904
closed_at:
69036905
description: Timestamp of when the case was closed
69046906
format: date-time
@@ -7003,6 +7005,13 @@ components:
70037005
required:
70047006
- data
70057007
type: object
7008+
CaseObjectAttributes:
7009+
additionalProperties:
7010+
items:
7011+
type: string
7012+
type: array
7013+
description: The definition of `CaseObjectAttributes` object.
7014+
type: object
70067015
CasePriority:
70077016
default: NOT_DEFINED
70087017
description: Case priority
@@ -7098,6 +7107,33 @@ components:
70987107
type: string
70997108
x-enum-varnames:
71007109
- STANDARD
7110+
CaseUpdateAttributes:
7111+
description: Case update attributes
7112+
properties:
7113+
attributes:
7114+
$ref: '#/components/schemas/CaseUpdateAttributesAttributes'
7115+
type:
7116+
$ref: '#/components/schemas/CaseResourceType'
7117+
required:
7118+
- attributes
7119+
- type
7120+
type: object
7121+
CaseUpdateAttributesAttributes:
7122+
description: Case update attributes attributes
7123+
properties:
7124+
attributes:
7125+
$ref: '#/components/schemas/CaseObjectAttributes'
7126+
required:
7127+
- attributes
7128+
type: object
7129+
CaseUpdateAttributesRequest:
7130+
description: Case update attributes request
7131+
properties:
7132+
data:
7133+
$ref: '#/components/schemas/CaseUpdateAttributes'
7134+
required:
7135+
- data
7136+
type: object
71017137
CaseUpdatePriority:
71027138
description: Case priority status
71037139
properties:
@@ -45579,6 +45615,44 @@ paths:
4557945615
summary: Assign case
4558045616
tags:
4558145617
- Case Management
45618+
/api/v2/cases/{case_id}/attributes:
45619+
post:
45620+
description: Update case attributes
45621+
operationId: UpdateAttributes
45622+
parameters:
45623+
- $ref: '#/components/parameters/CaseIDPathParameter'
45624+
requestBody:
45625+
content:
45626+
application/json:
45627+
schema:
45628+
$ref: '#/components/schemas/CaseUpdateAttributesRequest'
45629+
description: Case attributes update payload
45630+
required: true
45631+
responses:
45632+
'200':
45633+
content:
45634+
application/json:
45635+
schema:
45636+
$ref: '#/components/schemas/CaseResponse'
45637+
description: OK
45638+
'400':
45639+
$ref: '#/components/responses/BadRequestResponse'
45640+
'401':
45641+
$ref: '#/components/responses/UnauthorizedResponse'
45642+
'403':
45643+
$ref: '#/components/responses/ForbiddenResponse'
45644+
'404':
45645+
$ref: '#/components/responses/NotFoundResponse'
45646+
'429':
45647+
$ref: '#/components/responses/TooManyRequestsResponse'
45648+
security:
45649+
- apiKeyAuth: []
45650+
appKeyAuth: []
45651+
- AuthZ:
45652+
- cases_write
45653+
summary: Update case attributes
45654+
tags:
45655+
- Case Management
4558245656
/api/v2/cases/{case_id}/priority:
4558345657
post:
4558445658
description: Update case priority
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Update case attributes returns "OK" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_case_management::CaseManagementAPI;
4+
use datadog_api_client::datadogV2::model::CaseResourceType;
5+
use datadog_api_client::datadogV2::model::CaseUpdateAttributes;
6+
use datadog_api_client::datadogV2::model::CaseUpdateAttributesAttributes;
7+
use datadog_api_client::datadogV2::model::CaseUpdateAttributesRequest;
8+
use std::collections::BTreeMap;
9+
10+
#[tokio::main]
11+
async fn main() {
12+
// there is a valid "case" in the system
13+
let case_id = std::env::var("CASE_ID").unwrap();
14+
let body = CaseUpdateAttributesRequest::new(CaseUpdateAttributes::new(
15+
CaseUpdateAttributesAttributes::new(BTreeMap::from([
16+
("env".to_string(), vec!["test".to_string()]),
17+
(
18+
"service".to_string(),
19+
vec!["web-store".to_string(), "web-api".to_string()],
20+
),
21+
("team".to_string(), vec!["engineer".to_string()]),
22+
])),
23+
CaseResourceType::CASE,
24+
));
25+
let configuration = datadog::Configuration::new();
26+
let api = CaseManagementAPI::with_config(configuration);
27+
let resp = api.update_attributes(case_id.clone(), body).await;
28+
if let Ok(value) = resp {
29+
println!("{:#?}", value);
30+
} else {
31+
println!("{:#?}", resp.unwrap_err());
32+
}
33+
}

src/datadogV2/api/api_case_management.rs

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ pub enum UnassignCaseError {
144144
UnknownValue(serde_json::Value),
145145
}
146146

147+
/// UpdateAttributesError is a struct for typed errors of method [`CaseManagementAPI::update_attributes`]
148+
#[derive(Debug, Clone, Serialize, Deserialize)]
149+
#[serde(untagged)]
150+
pub enum UpdateAttributesError {
151+
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
152+
UnknownValue(serde_json::Value),
153+
}
154+
147155
/// UpdatePriorityError is a struct for typed errors of method [`CaseManagementAPI::update_priority`]
148156
#[derive(Debug, Clone, Serialize, Deserialize)]
149157
#[serde(untagged)]
@@ -1685,6 +1693,158 @@ impl CaseManagementAPI {
16851693
}
16861694
}
16871695

1696+
/// Update case attributes
1697+
pub async fn update_attributes(
1698+
&self,
1699+
case_id: String,
1700+
body: crate::datadogV2::model::CaseUpdateAttributesRequest,
1701+
) -> Result<crate::datadogV2::model::CaseResponse, datadog::Error<UpdateAttributesError>> {
1702+
match self.update_attributes_with_http_info(case_id, body).await {
1703+
Ok(response_content) => {
1704+
if let Some(e) = response_content.entity {
1705+
Ok(e)
1706+
} else {
1707+
Err(datadog::Error::Serde(serde::de::Error::custom(
1708+
"response content was None",
1709+
)))
1710+
}
1711+
}
1712+
Err(err) => Err(err),
1713+
}
1714+
}
1715+
1716+
/// Update case attributes
1717+
pub async fn update_attributes_with_http_info(
1718+
&self,
1719+
case_id: String,
1720+
body: crate::datadogV2::model::CaseUpdateAttributesRequest,
1721+
) -> Result<
1722+
datadog::ResponseContent<crate::datadogV2::model::CaseResponse>,
1723+
datadog::Error<UpdateAttributesError>,
1724+
> {
1725+
let local_configuration = &self.config;
1726+
let operation_id = "v2.update_attributes";
1727+
1728+
let local_client = &self.client;
1729+
1730+
let local_uri_str = format!(
1731+
"{}/api/v2/cases/{case_id}/attributes",
1732+
local_configuration.get_operation_host(operation_id),
1733+
case_id = datadog::urlencode(case_id)
1734+
);
1735+
let mut local_req_builder =
1736+
local_client.request(reqwest::Method::POST, local_uri_str.as_str());
1737+
1738+
// build headers
1739+
let mut headers = HeaderMap::new();
1740+
headers.insert("Content-Type", HeaderValue::from_static("application/json"));
1741+
headers.insert("Accept", HeaderValue::from_static("application/json"));
1742+
1743+
// build user agent
1744+
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
1745+
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
1746+
Err(e) => {
1747+
log::warn!("Failed to parse user agent header: {e}, falling back to default");
1748+
headers.insert(
1749+
reqwest::header::USER_AGENT,
1750+
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
1751+
)
1752+
}
1753+
};
1754+
1755+
// build auth
1756+
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
1757+
headers.insert(
1758+
"DD-API-KEY",
1759+
HeaderValue::from_str(local_key.key.as_str())
1760+
.expect("failed to parse DD-API-KEY header"),
1761+
);
1762+
};
1763+
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
1764+
headers.insert(
1765+
"DD-APPLICATION-KEY",
1766+
HeaderValue::from_str(local_key.key.as_str())
1767+
.expect("failed to parse DD-APPLICATION-KEY header"),
1768+
);
1769+
};
1770+
1771+
// build body parameters
1772+
let output = Vec::new();
1773+
let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter);
1774+
if body.serialize(&mut ser).is_ok() {
1775+
if let Some(content_encoding) = headers.get("Content-Encoding") {
1776+
match content_encoding.to_str().unwrap_or_default() {
1777+
"gzip" => {
1778+
let mut enc = GzEncoder::new(Vec::new(), Compression::default());
1779+
let _ = enc.write_all(ser.into_inner().as_slice());
1780+
match enc.finish() {
1781+
Ok(buf) => {
1782+
local_req_builder = local_req_builder.body(buf);
1783+
}
1784+
Err(e) => return Err(datadog::Error::Io(e)),
1785+
}
1786+
}
1787+
"deflate" => {
1788+
let mut enc = ZlibEncoder::new(Vec::new(), Compression::default());
1789+
let _ = enc.write_all(ser.into_inner().as_slice());
1790+
match enc.finish() {
1791+
Ok(buf) => {
1792+
local_req_builder = local_req_builder.body(buf);
1793+
}
1794+
Err(e) => return Err(datadog::Error::Io(e)),
1795+
}
1796+
}
1797+
"zstd1" => {
1798+
let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap();
1799+
let _ = enc.write_all(ser.into_inner().as_slice());
1800+
match enc.finish() {
1801+
Ok(buf) => {
1802+
local_req_builder = local_req_builder.body(buf);
1803+
}
1804+
Err(e) => return Err(datadog::Error::Io(e)),
1805+
}
1806+
}
1807+
_ => {
1808+
local_req_builder = local_req_builder.body(ser.into_inner());
1809+
}
1810+
}
1811+
} else {
1812+
local_req_builder = local_req_builder.body(ser.into_inner());
1813+
}
1814+
}
1815+
1816+
local_req_builder = local_req_builder.headers(headers);
1817+
let local_req = local_req_builder.build()?;
1818+
log::debug!("request content: {:?}", local_req.body());
1819+
let local_resp = local_client.execute(local_req).await?;
1820+
1821+
let local_status = local_resp.status();
1822+
let local_content = local_resp.text().await?;
1823+
log::debug!("response content: {}", local_content);
1824+
1825+
if !local_status.is_client_error() && !local_status.is_server_error() {
1826+
match serde_json::from_str::<crate::datadogV2::model::CaseResponse>(&local_content) {
1827+
Ok(e) => {
1828+
return Ok(datadog::ResponseContent {
1829+
status: local_status,
1830+
content: local_content,
1831+
entity: Some(e),
1832+
})
1833+
}
1834+
Err(e) => return Err(datadog::Error::Serde(e)),
1835+
};
1836+
} else {
1837+
let local_entity: Option<UpdateAttributesError> =
1838+
serde_json::from_str(&local_content).ok();
1839+
let local_error = datadog::ResponseContent {
1840+
status: local_status,
1841+
content: local_content,
1842+
entity: local_entity,
1843+
};
1844+
Err(datadog::Error::ResponseError(local_error))
1845+
}
1846+
}
1847+
16881848
/// Update case priority
16891849
pub async fn update_priority(
16901850
&self,

src/datadogV2/model/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,12 @@ pub mod model_case_assign;
704704
pub use self::model_case_assign::CaseAssign;
705705
pub mod model_case_assign_attributes;
706706
pub use self::model_case_assign_attributes::CaseAssignAttributes;
707+
pub mod model_case_update_attributes_request;
708+
pub use self::model_case_update_attributes_request::CaseUpdateAttributesRequest;
709+
pub mod model_case_update_attributes;
710+
pub use self::model_case_update_attributes::CaseUpdateAttributes;
711+
pub mod model_case_update_attributes_attributes;
712+
pub use self::model_case_update_attributes_attributes::CaseUpdateAttributesAttributes;
707713
pub mod model_case_update_priority_request;
708714
pub use self::model_case_update_priority_request::CaseUpdatePriorityRequest;
709715
pub mod model_case_update_priority;

src/datadogV2/model/model_case.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct Case {
14-
/// Case attributes
14+
/// Case resource attributes
1515
#[serde(rename = "attributes")]
1616
pub attributes: crate::datadogV2::model::CaseAttributes,
1717
/// Case's identifier

0 commit comments

Comments
 (0)