Skip to content

Commit d08be41

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 2b591c2 of spec repo
1 parent be44d1c commit d08be41

File tree

7 files changed

+201
-2
lines changed

7 files changed

+201
-2
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60000,6 +60000,35 @@ paths:
6000060000
tags:
6000160001
- Error Tracking
6000260002
/api/v2/error-tracking/issues/{issue_id}/assignee:
60003+
delete:
60004+
description: Remove the assignee of an issue by `issue_id`.
60005+
operationId: DeleteIssueAssignee
60006+
parameters:
60007+
- $ref: '#/components/parameters/IssueIDPathParameter'
60008+
responses:
60009+
'204':
60010+
description: No Content
60011+
'400':
60012+
$ref: '#/components/responses/BadRequestResponse'
60013+
'401':
60014+
$ref: '#/components/responses/UnauthorizedResponse'
60015+
'403':
60016+
$ref: '#/components/responses/ForbiddenResponse'
60017+
'404':
60018+
$ref: '#/components/responses/NotFoundResponse'
60019+
'429':
60020+
$ref: '#/components/responses/TooManyRequestsResponse'
60021+
security:
60022+
- apiKeyAuth: []
60023+
appKeyAuth: []
60024+
- AuthZ:
60025+
- error_tracking_read
60026+
- error_tracking_write
60027+
- cases_read
60028+
- cases_write
60029+
summary: Remove the assignee of an issue
60030+
tags:
60031+
- Error Tracking
6000360032
put:
6000460033
description: Update the assignee of an issue by `issue_id`.
6000560034
operationId: UpdateIssueAssignee

LICENSE-3rdparty.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ native-tls,https://github.com/sfackler/rust-native-tls,MIT OR Apache-2.0,Steven
8383
num-conv,https://github.com/jhpratt/num-conv,MIT OR Apache-2.0,Jacob Pratt <[email protected]>
8484
num-traits,https://github.com/rust-num/num-traits,MIT OR Apache-2.0,The Rust Project Developers
8585
once_cell,https://github.com/matklad/once_cell,MIT OR Apache-2.0,Aleksey Kladov <[email protected]>
86-
openssl,https://github.com/sfackler/rust-openssl,Apache-2.0,Steven Fackler <[email protected]>
86+
openssl,https://github.com/rust-openssl/rust-openssl,Apache-2.0,Steven Fackler <[email protected]>
8787
openssl-macros,https://github.com/sfackler/rust-openssl,MIT OR Apache-2.0,The openssl-macros Authors
8888
openssl-probe,https://github.com/alexcrichton/openssl-probe,MIT OR Apache-2.0,Alex Crichton <[email protected]>
89-
openssl-sys,https://github.com/sfackler/rust-openssl,MIT,"Alex Crichton <[email protected]>, Steven Fackler <[email protected]>"
89+
openssl-sys,https://github.com/rust-openssl/rust-openssl,MIT,"Alex Crichton <[email protected]>, Steven Fackler <[email protected]>"
9090
parking_lot,https://github.com/Amanieu/parking_lot,Apache-2.0 OR MIT,Amanieu d'Antras <[email protected]>
9191
parking_lot_core,https://github.com/Amanieu/parking_lot,Apache-2.0 OR MIT,Amanieu d'Antras <[email protected]>
9292
percent-encoding,https://github.com/servo/rust-url,MIT OR Apache-2.0,The rust-url developers
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Remove the assignee of an issue returns "No Content" response
2+
use datadog_api_client::datadog;
3+
use datadog_api_client::datadogV2::api_error_tracking::ErrorTrackingAPI;
4+
5+
#[tokio::main]
6+
async fn main() {
7+
// there is a valid "issue" in the system
8+
let issue_id = std::env::var("ISSUE_ID").unwrap();
9+
let configuration = datadog::Configuration::new();
10+
let api = ErrorTrackingAPI::with_config(configuration);
11+
let resp = api.delete_issue_assignee(issue_id.clone()).await;
12+
if let Ok(value) = resp {
13+
println!("{:#?}", value);
14+
} else {
15+
println!("{:#?}", resp.unwrap_err());
16+
}
17+
}

src/datadogV2/api/api_error_tracking.rs

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ impl SearchIssuesOptionalParams {
4848
}
4949
}
5050

51+
/// DeleteIssueAssigneeError is a struct for typed errors of method [`ErrorTrackingAPI::delete_issue_assignee`]
52+
#[derive(Debug, Clone, Serialize, Deserialize)]
53+
#[serde(untagged)]
54+
pub enum DeleteIssueAssigneeError {
55+
APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
56+
UnknownValue(serde_json::Value),
57+
}
58+
5159
/// GetIssueError is a struct for typed errors of method [`ErrorTrackingAPI::get_issue`]
5260
#[derive(Debug, Clone, Serialize, Deserialize)]
5361
#[serde(untagged)]
@@ -145,6 +153,94 @@ impl ErrorTrackingAPI {
145153
Self { config, client }
146154
}
147155

156+
/// Remove the assignee of an issue by `issue_id`.
157+
pub async fn delete_issue_assignee(
158+
&self,
159+
issue_id: String,
160+
) -> Result<(), datadog::Error<DeleteIssueAssigneeError>> {
161+
match self.delete_issue_assignee_with_http_info(issue_id).await {
162+
Ok(_) => Ok(()),
163+
Err(err) => Err(err),
164+
}
165+
}
166+
167+
/// Remove the assignee of an issue by `issue_id`.
168+
pub async fn delete_issue_assignee_with_http_info(
169+
&self,
170+
issue_id: String,
171+
) -> Result<datadog::ResponseContent<()>, datadog::Error<DeleteIssueAssigneeError>> {
172+
let local_configuration = &self.config;
173+
let operation_id = "v2.delete_issue_assignee";
174+
175+
let local_client = &self.client;
176+
177+
let local_uri_str = format!(
178+
"{}/api/v2/error-tracking/issues/{issue_id}/assignee",
179+
local_configuration.get_operation_host(operation_id),
180+
issue_id = datadog::urlencode(issue_id)
181+
);
182+
let mut local_req_builder =
183+
local_client.request(reqwest::Method::DELETE, local_uri_str.as_str());
184+
185+
// build headers
186+
let mut headers = HeaderMap::new();
187+
headers.insert("Accept", HeaderValue::from_static("*/*"));
188+
189+
// build user agent
190+
match HeaderValue::from_str(local_configuration.user_agent.as_str()) {
191+
Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent),
192+
Err(e) => {
193+
log::warn!("Failed to parse user agent header: {e}, falling back to default");
194+
headers.insert(
195+
reqwest::header::USER_AGENT,
196+
HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()),
197+
)
198+
}
199+
};
200+
201+
// build auth
202+
if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") {
203+
headers.insert(
204+
"DD-API-KEY",
205+
HeaderValue::from_str(local_key.key.as_str())
206+
.expect("failed to parse DD-API-KEY header"),
207+
);
208+
};
209+
if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") {
210+
headers.insert(
211+
"DD-APPLICATION-KEY",
212+
HeaderValue::from_str(local_key.key.as_str())
213+
.expect("failed to parse DD-APPLICATION-KEY header"),
214+
);
215+
};
216+
217+
local_req_builder = local_req_builder.headers(headers);
218+
let local_req = local_req_builder.build()?;
219+
log::debug!("request content: {:?}", local_req.body());
220+
let local_resp = local_client.execute(local_req).await?;
221+
222+
let local_status = local_resp.status();
223+
let local_content = local_resp.text().await?;
224+
log::debug!("response content: {}", local_content);
225+
226+
if !local_status.is_client_error() && !local_status.is_server_error() {
227+
Ok(datadog::ResponseContent {
228+
status: local_status,
229+
content: local_content,
230+
entity: None,
231+
})
232+
} else {
233+
let local_entity: Option<DeleteIssueAssigneeError> =
234+
serde_json::from_str(&local_content).ok();
235+
let local_error = datadog::ResponseContent {
236+
status: local_status,
237+
content: local_content,
238+
entity: local_entity,
239+
};
240+
Err(datadog::Error::ResponseError(local_error))
241+
}
242+
}
243+
148244
/// Retrieve the full details for a specific error tracking issue, including attributes and relationships.
149245
pub async fn get_issue(
150246
&self,

tests/scenarios/features/v2/error_tracking.feature

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,28 @@ Feature: Error Tracking
3232
Then the response status is 200 OK
3333
And the response "data.id" is equal to "{{ issue.id }}"
3434

35+
@generated @skip @team:DataDog/error-tracking
36+
Scenario: Remove the assignee of an issue returns "Bad Request" response
37+
Given new "DeleteIssueAssignee" request
38+
And request contains "issue_id" parameter from "REPLACE.ME"
39+
When the request is sent
40+
Then the response status is 400 Bad Request
41+
42+
@team:DataDog/error-tracking
43+
Scenario: Remove the assignee of an issue returns "No Content" response
44+
Given new "DeleteIssueAssignee" request
45+
And there is a valid "issue" in the system
46+
And request contains "issue_id" parameter from "issue.id"
47+
When the request is sent
48+
Then the response status is 204 No Content
49+
50+
@team:DataDog/error-tracking
51+
Scenario: Remove the assignee of an issue returns "Not Found" response
52+
Given new "DeleteIssueAssignee" request
53+
And request contains "issue_id" parameter with value "67d80aa3-36ff-44b9-a694-c501a7591737"
54+
When the request is sent
55+
Then the response status is 404 Not Found
56+
3557
@team:DataDog/error-tracking
3658
Scenario: Search error tracking issues returns "Bad Request" response
3759
Given new "SearchIssues" request

tests/scenarios/features/v2/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,12 @@
12411241
"type": "safe"
12421242
}
12431243
},
1244+
"DeleteIssueAssignee": {
1245+
"tag": "Error Tracking",
1246+
"undo": {
1247+
"type": "idempotent"
1248+
}
1249+
},
12441250
"UpdateIssueAssignee": {
12451251
"tag": "Error Tracking",
12461252
"undo": {

tests/scenarios/function_mappings.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2770,6 +2770,10 @@ pub fn collect_function_calls(world: &mut DatadogWorld) {
27702770
world
27712771
.function_mappings
27722772
.insert("v2.GetIssue".into(), test_v2_get_issue);
2773+
world.function_mappings.insert(
2774+
"v2.DeleteIssueAssignee".into(),
2775+
test_v2_delete_issue_assignee,
2776+
);
27732777
world.function_mappings.insert(
27742778
"v2.UpdateIssueAssignee".into(),
27752779
test_v2_update_issue_assignee,
@@ -20515,6 +20519,31 @@ fn test_v2_get_issue(world: &mut DatadogWorld, _parameters: &HashMap<String, Val
2051520519
world.response.code = response.status.as_u16();
2051620520
}
2051720521

20522+
fn test_v2_delete_issue_assignee(world: &mut DatadogWorld, _parameters: &HashMap<String, Value>) {
20523+
let api = world
20524+
.api_instances
20525+
.v2_api_error_tracking
20526+
.as_ref()
20527+
.expect("api instance not found");
20528+
let issue_id = serde_json::from_value(_parameters.get("issue_id").unwrap().clone()).unwrap();
20529+
let response = match block_on(api.delete_issue_assignee_with_http_info(issue_id)) {
20530+
Ok(response) => response,
20531+
Err(error) => {
20532+
return match error {
20533+
Error::ResponseError(e) => {
20534+
world.response.code = e.status.as_u16();
20535+
if let Some(entity) = e.entity {
20536+
world.response.object = serde_json::to_value(entity).unwrap();
20537+
}
20538+
}
20539+
_ => panic!("error parsing response: {error}"),
20540+
};
20541+
}
20542+
};
20543+
world.response.object = serde_json::to_value(response.entity).unwrap();
20544+
world.response.code = response.status.as_u16();
20545+
}
20546+
2051820547
fn test_v2_update_issue_assignee(world: &mut DatadogWorld, _parameters: &HashMap<String, Value>) {
2051920548
let api = world
2052020549
.api_instances

0 commit comments

Comments
 (0)