diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 05ce562f5..5f8d77627 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -83879,7 +83879,7 @@ paths: - teams_read summary: Delete team connections tags: - - Team Connections + - Teams x-permission: operator: OR permissions: @@ -83958,7 +83958,7 @@ paths: - teams_read summary: List team connections tags: - - Team Connections + - Teams x-pagination: limitParam: page[size] pageParam: page[number] @@ -84002,7 +84002,7 @@ paths: - teams_read summary: Create team connections tags: - - Team Connections + - Teams x-permission: operator: OR permissions: @@ -87323,9 +87323,6 @@ tags: use Datadog\u2019s API to\nmanage both test types programmatically.\n\nFor more information about Synthetics, see the [Synthetics overview](https://docs.datadoghq.com/synthetics/)." name: Synthetics -- description: View and manage relationships between Datadog teams and teams from - external sources, such as GitHub. - name: Team Connections - description: View and manage teams within Datadog. See the [Teams page](https://docs.datadoghq.com/account_management/teams/) for more information. name: Teams diff --git a/examples/v2_team-connections_CreateTeamConnections.rs b/examples/v2_teams_CreateTeamConnections.rs similarity index 93% rename from examples/v2_team-connections_CreateTeamConnections.rs rename to examples/v2_teams_CreateTeamConnections.rs index 48ded5f69..7c8267ed6 100644 --- a/examples/v2_team-connections_CreateTeamConnections.rs +++ b/examples/v2_teams_CreateTeamConnections.rs @@ -1,6 +1,6 @@ // Create team connections returns "Created" response use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_team_connections::TeamConnectionsAPI; +use datadog_api_client::datadogV2::api_teams::TeamsAPI; use datadog_api_client::datadogV2::model::ConnectedTeamRef; use datadog_api_client::datadogV2::model::ConnectedTeamRefData; use datadog_api_client::datadogV2::model::ConnectedTeamRefDataType; @@ -38,7 +38,7 @@ async fn main() { )]); let mut configuration = datadog::Configuration::new(); configuration.set_unstable_operation_enabled("v2.CreateTeamConnections", true); - let api = TeamConnectionsAPI::with_config(configuration); + let api = TeamsAPI::with_config(configuration); let resp = api.create_team_connections(body).await; if let Ok(value) = resp { println!("{:#?}", value); diff --git a/examples/v2_team-connections_DeleteTeamConnections.rs b/examples/v2_teams_DeleteTeamConnections.rs similarity index 86% rename from examples/v2_team-connections_DeleteTeamConnections.rs rename to examples/v2_teams_DeleteTeamConnections.rs index 3501fff29..e17db8cdf 100644 --- a/examples/v2_team-connections_DeleteTeamConnections.rs +++ b/examples/v2_teams_DeleteTeamConnections.rs @@ -1,6 +1,6 @@ // Delete team connections returns "No Content" response use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_team_connections::TeamConnectionsAPI; +use datadog_api_client::datadogV2::api_teams::TeamsAPI; use datadog_api_client::datadogV2::model::TeamConnectionDeleteRequest; use datadog_api_client::datadogV2::model::TeamConnectionDeleteRequestDataItem; use datadog_api_client::datadogV2::model::TeamConnectionType; @@ -13,7 +13,7 @@ async fn main() { )]); let mut configuration = datadog::Configuration::new(); configuration.set_unstable_operation_enabled("v2.DeleteTeamConnections", true); - let api = TeamConnectionsAPI::with_config(configuration); + let api = TeamsAPI::with_config(configuration); let resp = api.delete_team_connections(body).await; if let Ok(value) = resp { println!("{:#?}", value); diff --git a/examples/v2_team-connections_ListTeamConnections.rs b/examples/v2_teams_ListTeamConnections.rs similarity index 68% rename from examples/v2_team-connections_ListTeamConnections.rs rename to examples/v2_teams_ListTeamConnections.rs index 612f87f27..6213ed262 100644 --- a/examples/v2_team-connections_ListTeamConnections.rs +++ b/examples/v2_teams_ListTeamConnections.rs @@ -1,13 +1,13 @@ // List team connections returns "OK" response use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_team_connections::ListTeamConnectionsOptionalParams; -use datadog_api_client::datadogV2::api_team_connections::TeamConnectionsAPI; +use datadog_api_client::datadogV2::api_teams::ListTeamConnectionsOptionalParams; +use datadog_api_client::datadogV2::api_teams::TeamsAPI; #[tokio::main] async fn main() { let mut configuration = datadog::Configuration::new(); configuration.set_unstable_operation_enabled("v2.ListTeamConnections", true); - let api = TeamConnectionsAPI::with_config(configuration); + let api = TeamsAPI::with_config(configuration); let resp = api .list_team_connections(ListTeamConnectionsOptionalParams::default()) .await; diff --git a/examples/v2_team-connections_ListTeamConnections_1473516764.rs b/examples/v2_teams_ListTeamConnections_1473516764.rs similarity index 73% rename from examples/v2_team-connections_ListTeamConnections_1473516764.rs rename to examples/v2_teams_ListTeamConnections_1473516764.rs index b8702075a..cbf1a3373 100644 --- a/examples/v2_team-connections_ListTeamConnections_1473516764.rs +++ b/examples/v2_teams_ListTeamConnections_1473516764.rs @@ -1,13 +1,13 @@ // List team connections with filters returns "OK" response use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_team_connections::ListTeamConnectionsOptionalParams; -use datadog_api_client::datadogV2::api_team_connections::TeamConnectionsAPI; +use datadog_api_client::datadogV2::api_teams::ListTeamConnectionsOptionalParams; +use datadog_api_client::datadogV2::api_teams::TeamsAPI; #[tokio::main] async fn main() { let mut configuration = datadog::Configuration::new(); configuration.set_unstable_operation_enabled("v2.ListTeamConnections", true); - let api = TeamConnectionsAPI::with_config(configuration); + let api = TeamsAPI::with_config(configuration); let resp = api .list_team_connections( ListTeamConnectionsOptionalParams::default() diff --git a/examples/v2_team-connections_ListTeamConnections_2418873869.rs b/examples/v2_teams_ListTeamConnections_2418873869.rs similarity index 74% rename from examples/v2_team-connections_ListTeamConnections_2418873869.rs rename to examples/v2_teams_ListTeamConnections_2418873869.rs index 09f385143..ed39b87e2 100644 --- a/examples/v2_team-connections_ListTeamConnections_2418873869.rs +++ b/examples/v2_teams_ListTeamConnections_2418873869.rs @@ -1,7 +1,7 @@ // List team connections returns "OK" response with pagination use datadog_api_client::datadog; -use datadog_api_client::datadogV2::api_team_connections::ListTeamConnectionsOptionalParams; -use datadog_api_client::datadogV2::api_team_connections::TeamConnectionsAPI; +use datadog_api_client::datadogV2::api_teams::ListTeamConnectionsOptionalParams; +use datadog_api_client::datadogV2::api_teams::TeamsAPI; use futures_util::pin_mut; use futures_util::stream::StreamExt; @@ -9,7 +9,7 @@ use futures_util::stream::StreamExt; async fn main() { let mut configuration = datadog::Configuration::new(); configuration.set_unstable_operation_enabled("v2.ListTeamConnections", true); - let api = TeamConnectionsAPI::with_config(configuration); + let api = TeamsAPI::with_config(configuration); let response = api.list_team_connections_with_pagination(ListTeamConnectionsOptionalParams::default()); pin_mut!(response); diff --git a/src/datadog/configuration.rs b/src/datadog/configuration.rs index 1ad54d180..7185d4e0f 100644 --- a/src/datadog/configuration.rs +++ b/src/datadog/configuration.rs @@ -275,13 +275,13 @@ impl Default for Configuration { ("v2.create_sca_resolve_vulnerable_symbols".to_owned(), false), ("v2.create_sca_result".to_owned(), false), ("v2.add_member_team".to_owned(), false), + ("v2.create_team_connections".to_owned(), false), + ("v2.delete_team_connections".to_owned(), false), ("v2.get_team_sync".to_owned(), false), ("v2.list_member_teams".to_owned(), false), + ("v2.list_team_connections".to_owned(), false), ("v2.remove_member_team".to_owned(), false), ("v2.sync_teams".to_owned(), false), - ("v2.create_team_connections".to_owned(), false), - ("v2.delete_team_connections".to_owned(), false), - ("v2.list_team_connections".to_owned(), false), ("v2.create_incident_team".to_owned(), false), ("v2.delete_incident_team".to_owned(), false), ("v2.get_incident_team".to_owned(), false), diff --git a/src/datadogV2/api/api_team_connections.rs b/src/datadogV2/api/api_team_connections.rs deleted file mode 100644 index 1e4813db4..000000000 --- a/src/datadogV2/api/api_team_connections.rs +++ /dev/null @@ -1,672 +0,0 @@ -// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. -// This product includes software developed at Datadog (https://www.datadoghq.com/). -// Copyright 2019-Present Datadog, Inc. -use crate::datadog; -use async_stream::try_stream; -use flate2::{ - write::{GzEncoder, ZlibEncoder}, - Compression, -}; -use futures_core::stream::Stream; -use log::warn; -use reqwest::header::{HeaderMap, HeaderValue}; -use serde::{Deserialize, Serialize}; -use std::io::Write; - -/// ListTeamConnectionsOptionalParams is a struct for passing parameters to the method [`TeamConnectionsAPI::list_team_connections`] -#[non_exhaustive] -#[derive(Clone, Default, Debug)] -pub struct ListTeamConnectionsOptionalParams { - /// Size for a given page. The maximum allowed value is 100. - pub page_size: Option, - /// Specific page number to return. - pub page_number: Option, - /// Filter team connections by external source systems. - pub filter_sources: Option>, - /// Filter team connections by Datadog team IDs. - pub filter_team_ids: Option>, - /// Filter team connections by connected team IDs from external systems. - pub filter_connected_team_ids: Option>, - /// Filter team connections by connection IDs. - pub filter_connection_ids: Option>, -} - -impl ListTeamConnectionsOptionalParams { - /// Size for a given page. The maximum allowed value is 100. - pub fn page_size(mut self, value: i64) -> Self { - self.page_size = Some(value); - self - } - /// Specific page number to return. - pub fn page_number(mut self, value: i64) -> Self { - self.page_number = Some(value); - self - } - /// Filter team connections by external source systems. - pub fn filter_sources(mut self, value: Vec) -> Self { - self.filter_sources = Some(value); - self - } - /// Filter team connections by Datadog team IDs. - pub fn filter_team_ids(mut self, value: Vec) -> Self { - self.filter_team_ids = Some(value); - self - } - /// Filter team connections by connected team IDs from external systems. - pub fn filter_connected_team_ids(mut self, value: Vec) -> Self { - self.filter_connected_team_ids = Some(value); - self - } - /// Filter team connections by connection IDs. - pub fn filter_connection_ids(mut self, value: Vec) -> Self { - self.filter_connection_ids = Some(value); - self - } -} - -/// CreateTeamConnectionsError is a struct for typed errors of method [`TeamConnectionsAPI::create_team_connections`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum CreateTeamConnectionsError { - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// DeleteTeamConnectionsError is a struct for typed errors of method [`TeamConnectionsAPI::delete_team_connections`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum DeleteTeamConnectionsError { - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// ListTeamConnectionsError is a struct for typed errors of method [`TeamConnectionsAPI::list_team_connections`] -#[derive(Debug, Clone, Serialize, Deserialize)] -#[serde(untagged)] -pub enum ListTeamConnectionsError { - APIErrorResponse(crate::datadogV2::model::APIErrorResponse), - UnknownValue(serde_json::Value), -} - -/// View and manage relationships between Datadog teams and teams from external sources, such as GitHub. -#[derive(Debug, Clone)] -pub struct TeamConnectionsAPI { - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, -} - -impl Default for TeamConnectionsAPI { - fn default() -> Self { - Self::with_config(datadog::Configuration::default()) - } -} - -impl TeamConnectionsAPI { - pub fn new() -> Self { - Self::default() - } - pub fn with_config(config: datadog::Configuration) -> Self { - let mut reqwest_client_builder = reqwest::Client::builder(); - - if let Some(proxy_url) = &config.proxy_url { - let proxy = reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"); - reqwest_client_builder = reqwest_client_builder.proxy(proxy); - } - - let mut middleware_client_builder = - reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap()); - - if config.enable_retry { - struct RetryableStatus; - impl reqwest_retry::RetryableStrategy for RetryableStatus { - fn handle( - &self, - res: &Result, - ) -> Option { - match res { - Ok(success) => reqwest_retry::default_on_request_success(success), - Err(_) => None, - } - } - } - let backoff_policy = reqwest_retry::policies::ExponentialBackoff::builder() - .build_with_max_retries(config.max_retries); - - let retry_middleware = - reqwest_retry::RetryTransientMiddleware::new_with_policy_and_strategy( - backoff_policy, - RetryableStatus, - ); - - middleware_client_builder = middleware_client_builder.with(retry_middleware); - } - - let client = middleware_client_builder.build(); - - Self { config, client } - } - - pub fn with_client_and_config( - config: datadog::Configuration, - client: reqwest_middleware::ClientWithMiddleware, - ) -> Self { - Self { config, client } - } - - /// Create multiple team connections. - pub async fn create_team_connections( - &self, - body: crate::datadogV2::model::TeamConnectionCreateRequest, - ) -> Result< - crate::datadogV2::model::TeamConnectionsResponse, - datadog::Error, - > { - match self.create_team_connections_with_http_info(body).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - /// Create multiple team connections. - pub async fn create_team_connections_with_http_info( - &self, - body: crate::datadogV2::model::TeamConnectionCreateRequest, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.create_team_connections"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.create_team_connections' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/team/connections", - local_configuration.get_operation_host(operation_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::POST, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Delete multiple team connections. - pub async fn delete_team_connections( - &self, - body: crate::datadogV2::model::TeamConnectionDeleteRequest, - ) -> Result<(), datadog::Error> { - match self.delete_team_connections_with_http_info(body).await { - Ok(_) => Ok(()), - Err(err) => Err(err), - } - } - - /// Delete multiple team connections. - pub async fn delete_team_connections_with_http_info( - &self, - body: crate::datadogV2::model::TeamConnectionDeleteRequest, - ) -> Result, datadog::Error> { - let local_configuration = &self.config; - let operation_id = "v2.delete_team_connections"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.delete_team_connections' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/team/connections", - local_configuration.get_operation_host(operation_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Content-Type", HeaderValue::from_static("application/json")); - headers.insert("Accept", HeaderValue::from_static("*/*")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - // build body parameters - let output = Vec::new(); - let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); - if body.serialize(&mut ser).is_ok() { - if let Some(content_encoding) = headers.get("Content-Encoding") { - match content_encoding.to_str().unwrap_or_default() { - "gzip" => { - let mut enc = GzEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "deflate" => { - let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - "zstd1" => { - let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); - let _ = enc.write_all(ser.into_inner().as_slice()); - match enc.finish() { - Ok(buf) => { - local_req_builder = local_req_builder.body(buf); - } - Err(e) => return Err(datadog::Error::Io(e)), - } - } - _ => { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - } else { - local_req_builder = local_req_builder.body(ser.into_inner()); - } - } - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: None, - }) - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } - - /// Returns all team connections. - pub async fn list_team_connections( - &self, - params: ListTeamConnectionsOptionalParams, - ) -> Result< - crate::datadogV2::model::TeamConnectionsResponse, - datadog::Error, - > { - match self.list_team_connections_with_http_info(params).await { - Ok(response_content) => { - if let Some(e) = response_content.entity { - Ok(e) - } else { - Err(datadog::Error::Serde(serde::de::Error::custom( - "response content was None", - ))) - } - } - Err(err) => Err(err), - } - } - - pub fn list_team_connections_with_pagination( - &self, - mut params: ListTeamConnectionsOptionalParams, - ) -> impl Stream< - Item = Result< - crate::datadogV2::model::TeamConnection, - datadog::Error, - >, - > + '_ { - try_stream! { - let mut page_size: i64 = 10; - if params.page_size.is_none() { - params.page_size = Some(page_size); - } else { - page_size = params.page_size.unwrap().clone(); - } - if params.page_number.is_none() { - params.page_number = Some(0); - } - loop { - let resp = self.list_team_connections(params.clone()).await?; - let Some(data) = resp.data else { break }; - - let r = data; - let count = r.len(); - for team in r { - yield team; - } - - if count < page_size as usize { - break; - } - params.page_number = Some(params.page_number.unwrap() + 1); - } - } - } - - /// Returns all team connections. - pub async fn list_team_connections_with_http_info( - &self, - params: ListTeamConnectionsOptionalParams, - ) -> Result< - datadog::ResponseContent, - datadog::Error, - > { - let local_configuration = &self.config; - let operation_id = "v2.list_team_connections"; - if local_configuration.is_unstable_operation_enabled(operation_id) { - warn!("Using unstable operation {operation_id}"); - } else { - let local_error = datadog::UnstableOperationDisabledError { - msg: "Operation 'v2.list_team_connections' is not enabled".to_string(), - }; - return Err(datadog::Error::UnstableOperationDisabledError(local_error)); - } - - // unbox and build optional parameters - let page_size = params.page_size; - let page_number = params.page_number; - let filter_sources = params.filter_sources; - let filter_team_ids = params.filter_team_ids; - let filter_connected_team_ids = params.filter_connected_team_ids; - let filter_connection_ids = params.filter_connection_ids; - - let local_client = &self.client; - - let local_uri_str = format!( - "{}/api/v2/team/connections", - local_configuration.get_operation_host(operation_id) - ); - let mut local_req_builder = - local_client.request(reqwest::Method::GET, local_uri_str.as_str()); - - if let Some(ref local_query_param) = page_size { - local_req_builder = - local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); - }; - if let Some(ref local_query_param) = page_number { - local_req_builder = - local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); - }; - if let Some(ref local) = filter_sources { - local_req_builder = local_req_builder.query(&[( - "filter[sources]", - &local - .iter() - .map(|p| p.to_string()) - .collect::>() - .join(",") - .to_string(), - )]); - }; - if let Some(ref local) = filter_team_ids { - local_req_builder = local_req_builder.query(&[( - "filter[team_ids]", - &local - .iter() - .map(|p| p.to_string()) - .collect::>() - .join(",") - .to_string(), - )]); - }; - if let Some(ref local) = filter_connected_team_ids { - local_req_builder = local_req_builder.query(&[( - "filter[connected_team_ids]", - &local - .iter() - .map(|p| p.to_string()) - .collect::>() - .join(",") - .to_string(), - )]); - }; - if let Some(ref local) = filter_connection_ids { - local_req_builder = local_req_builder.query(&[( - "filter[connection_ids]", - &local - .iter() - .map(|p| p.to_string()) - .collect::>() - .join(",") - .to_string(), - )]); - }; - - // build headers - let mut headers = HeaderMap::new(); - headers.insert("Accept", HeaderValue::from_static("application/json")); - - // build user agent - match HeaderValue::from_str(local_configuration.user_agent.as_str()) { - Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), - Err(e) => { - log::warn!("Failed to parse user agent header: {e}, falling back to default"); - headers.insert( - reqwest::header::USER_AGENT, - HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), - ) - } - }; - - // build auth - if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { - headers.insert( - "DD-API-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-API-KEY header"), - ); - }; - if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { - headers.insert( - "DD-APPLICATION-KEY", - HeaderValue::from_str(local_key.key.as_str()) - .expect("failed to parse DD-APPLICATION-KEY header"), - ); - }; - - local_req_builder = local_req_builder.headers(headers); - let local_req = local_req_builder.build()?; - log::debug!("request content: {:?}", local_req.body()); - let local_resp = local_client.execute(local_req).await?; - - let local_status = local_resp.status(); - let local_content = local_resp.text().await?; - log::debug!("response content: {}", local_content); - - if !local_status.is_client_error() && !local_status.is_server_error() { - match serde_json::from_str::( - &local_content, - ) { - Ok(e) => { - return Ok(datadog::ResponseContent { - status: local_status, - content: local_content, - entity: Some(e), - }) - } - Err(e) => return Err(datadog::Error::Serde(e)), - }; - } else { - let local_entity: Option = - serde_json::from_str(&local_content).ok(); - let local_error = datadog::ResponseContent { - status: local_status, - content: local_content, - entity: local_entity, - }; - Err(datadog::Error::ResponseError(local_error)) - } - } -} diff --git a/src/datadogV2/api/api_teams.rs b/src/datadogV2/api/api_teams.rs index 76b007a60..6256b9128 100644 --- a/src/datadogV2/api/api_teams.rs +++ b/src/datadogV2/api/api_teams.rs @@ -80,6 +80,57 @@ impl ListMemberTeamsOptionalParams { } } +/// ListTeamConnectionsOptionalParams is a struct for passing parameters to the method [`TeamsAPI::list_team_connections`] +#[non_exhaustive] +#[derive(Clone, Default, Debug)] +pub struct ListTeamConnectionsOptionalParams { + /// Size for a given page. The maximum allowed value is 100. + pub page_size: Option, + /// Specific page number to return. + pub page_number: Option, + /// Filter team connections by external source systems. + pub filter_sources: Option>, + /// Filter team connections by Datadog team IDs. + pub filter_team_ids: Option>, + /// Filter team connections by connected team IDs from external systems. + pub filter_connected_team_ids: Option>, + /// Filter team connections by connection IDs. + pub filter_connection_ids: Option>, +} + +impl ListTeamConnectionsOptionalParams { + /// Size for a given page. The maximum allowed value is 100. + pub fn page_size(mut self, value: i64) -> Self { + self.page_size = Some(value); + self + } + /// Specific page number to return. + pub fn page_number(mut self, value: i64) -> Self { + self.page_number = Some(value); + self + } + /// Filter team connections by external source systems. + pub fn filter_sources(mut self, value: Vec) -> Self { + self.filter_sources = Some(value); + self + } + /// Filter team connections by Datadog team IDs. + pub fn filter_team_ids(mut self, value: Vec) -> Self { + self.filter_team_ids = Some(value); + self + } + /// Filter team connections by connected team IDs from external systems. + pub fn filter_connected_team_ids(mut self, value: Vec) -> Self { + self.filter_connected_team_ids = Some(value); + self + } + /// Filter team connections by connection IDs. + pub fn filter_connection_ids(mut self, value: Vec) -> Self { + self.filter_connection_ids = Some(value); + self + } +} + /// ListTeamHierarchyLinksOptionalParams is a struct for passing parameters to the method [`TeamsAPI::list_team_hierarchy_links`] #[non_exhaustive] #[derive(Clone, Default, Debug)] @@ -199,6 +250,14 @@ pub enum CreateTeamError { UnknownValue(serde_json::Value), } +/// CreateTeamConnectionsError is a struct for typed errors of method [`TeamsAPI::create_team_connections`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum CreateTeamConnectionsError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// CreateTeamLinkError is a struct for typed errors of method [`TeamsAPI::create_team_link`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -223,6 +282,14 @@ pub enum DeleteTeamError { UnknownValue(serde_json::Value), } +/// DeleteTeamConnectionsError is a struct for typed errors of method [`TeamsAPI::delete_team_connections`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum DeleteTeamConnectionsError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// DeleteTeamLinkError is a struct for typed errors of method [`TeamsAPI::delete_team_link`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -311,6 +378,14 @@ pub enum ListMemberTeamsError { UnknownValue(serde_json::Value), } +/// ListTeamConnectionsError is a struct for typed errors of method [`TeamsAPI::list_team_connections`] +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(untagged)] +pub enum ListTeamConnectionsError { + APIErrorResponse(crate::datadogV2::model::APIErrorResponse), + UnknownValue(serde_json::Value), +} + /// ListTeamHierarchyLinksError is a struct for typed errors of method [`TeamsAPI::list_team_hierarchy_links`] #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(untagged)] @@ -905,6 +980,168 @@ impl TeamsAPI { } } + /// Create multiple team connections. + pub async fn create_team_connections( + &self, + body: crate::datadogV2::model::TeamConnectionCreateRequest, + ) -> Result< + crate::datadogV2::model::TeamConnectionsResponse, + datadog::Error, + > { + match self.create_team_connections_with_http_info(body).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + /// Create multiple team connections. + pub async fn create_team_connections_with_http_info( + &self, + body: crate::datadogV2::model::TeamConnectionCreateRequest, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.create_team_connections"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.create_team_connections' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/team/connections", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::POST, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + /// Add a new link to a team. pub async fn create_team_link( &self, @@ -1303,6 +1540,147 @@ impl TeamsAPI { } } + /// Delete multiple team connections. + pub async fn delete_team_connections( + &self, + body: crate::datadogV2::model::TeamConnectionDeleteRequest, + ) -> Result<(), datadog::Error> { + match self.delete_team_connections_with_http_info(body).await { + Ok(_) => Ok(()), + Err(err) => Err(err), + } + } + + /// Delete multiple team connections. + pub async fn delete_team_connections_with_http_info( + &self, + body: crate::datadogV2::model::TeamConnectionDeleteRequest, + ) -> Result, datadog::Error> { + let local_configuration = &self.config; + let operation_id = "v2.delete_team_connections"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.delete_team_connections' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/team/connections", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::DELETE, local_uri_str.as_str()); + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Content-Type", HeaderValue::from_static("application/json")); + headers.insert("Accept", HeaderValue::from_static("*/*")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + // build body parameters + let output = Vec::new(); + let mut ser = serde_json::Serializer::with_formatter(output, datadog::DDFormatter); + if body.serialize(&mut ser).is_ok() { + if let Some(content_encoding) = headers.get("Content-Encoding") { + match content_encoding.to_str().unwrap_or_default() { + "gzip" => { + let mut enc = GzEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "deflate" => { + let mut enc = ZlibEncoder::new(Vec::new(), Compression::default()); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + "zstd1" => { + let mut enc = zstd::stream::Encoder::new(Vec::new(), 0).unwrap(); + let _ = enc.write_all(ser.into_inner().as_slice()); + match enc.finish() { + Ok(buf) => { + local_req_builder = local_req_builder.body(buf); + } + Err(e) => return Err(datadog::Error::Io(e)), + } + } + _ => { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + } else { + local_req_builder = local_req_builder.body(ser.into_inner()); + } + } + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: None, + }) + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + /// Remove a link from a team. pub async fn delete_team_link( &self, @@ -2597,6 +2975,220 @@ impl TeamsAPI { } } + /// Returns all team connections. + pub async fn list_team_connections( + &self, + params: ListTeamConnectionsOptionalParams, + ) -> Result< + crate::datadogV2::model::TeamConnectionsResponse, + datadog::Error, + > { + match self.list_team_connections_with_http_info(params).await { + Ok(response_content) => { + if let Some(e) = response_content.entity { + Ok(e) + } else { + Err(datadog::Error::Serde(serde::de::Error::custom( + "response content was None", + ))) + } + } + Err(err) => Err(err), + } + } + + pub fn list_team_connections_with_pagination( + &self, + mut params: ListTeamConnectionsOptionalParams, + ) -> impl Stream< + Item = Result< + crate::datadogV2::model::TeamConnection, + datadog::Error, + >, + > + '_ { + try_stream! { + let mut page_size: i64 = 10; + if params.page_size.is_none() { + params.page_size = Some(page_size); + } else { + page_size = params.page_size.unwrap().clone(); + } + if params.page_number.is_none() { + params.page_number = Some(0); + } + loop { + let resp = self.list_team_connections(params.clone()).await?; + let Some(data) = resp.data else { break }; + + let r = data; + let count = r.len(); + for team in r { + yield team; + } + + if count < page_size as usize { + break; + } + params.page_number = Some(params.page_number.unwrap() + 1); + } + } + } + + /// Returns all team connections. + pub async fn list_team_connections_with_http_info( + &self, + params: ListTeamConnectionsOptionalParams, + ) -> Result< + datadog::ResponseContent, + datadog::Error, + > { + let local_configuration = &self.config; + let operation_id = "v2.list_team_connections"; + if local_configuration.is_unstable_operation_enabled(operation_id) { + warn!("Using unstable operation {operation_id}"); + } else { + let local_error = datadog::UnstableOperationDisabledError { + msg: "Operation 'v2.list_team_connections' is not enabled".to_string(), + }; + return Err(datadog::Error::UnstableOperationDisabledError(local_error)); + } + + // unbox and build optional parameters + let page_size = params.page_size; + let page_number = params.page_number; + let filter_sources = params.filter_sources; + let filter_team_ids = params.filter_team_ids; + let filter_connected_team_ids = params.filter_connected_team_ids; + let filter_connection_ids = params.filter_connection_ids; + + let local_client = &self.client; + + let local_uri_str = format!( + "{}/api/v2/team/connections", + local_configuration.get_operation_host(operation_id) + ); + let mut local_req_builder = + local_client.request(reqwest::Method::GET, local_uri_str.as_str()); + + if let Some(ref local_query_param) = page_size { + local_req_builder = + local_req_builder.query(&[("page[size]", &local_query_param.to_string())]); + }; + if let Some(ref local_query_param) = page_number { + local_req_builder = + local_req_builder.query(&[("page[number]", &local_query_param.to_string())]); + }; + if let Some(ref local) = filter_sources { + local_req_builder = local_req_builder.query(&[( + "filter[sources]", + &local + .iter() + .map(|p| p.to_string()) + .collect::>() + .join(",") + .to_string(), + )]); + }; + if let Some(ref local) = filter_team_ids { + local_req_builder = local_req_builder.query(&[( + "filter[team_ids]", + &local + .iter() + .map(|p| p.to_string()) + .collect::>() + .join(",") + .to_string(), + )]); + }; + if let Some(ref local) = filter_connected_team_ids { + local_req_builder = local_req_builder.query(&[( + "filter[connected_team_ids]", + &local + .iter() + .map(|p| p.to_string()) + .collect::>() + .join(",") + .to_string(), + )]); + }; + if let Some(ref local) = filter_connection_ids { + local_req_builder = local_req_builder.query(&[( + "filter[connection_ids]", + &local + .iter() + .map(|p| p.to_string()) + .collect::>() + .join(",") + .to_string(), + )]); + }; + + // build headers + let mut headers = HeaderMap::new(); + headers.insert("Accept", HeaderValue::from_static("application/json")); + + // build user agent + match HeaderValue::from_str(local_configuration.user_agent.as_str()) { + Ok(user_agent) => headers.insert(reqwest::header::USER_AGENT, user_agent), + Err(e) => { + log::warn!("Failed to parse user agent header: {e}, falling back to default"); + headers.insert( + reqwest::header::USER_AGENT, + HeaderValue::from_static(datadog::DEFAULT_USER_AGENT.as_str()), + ) + } + }; + + // build auth + if let Some(local_key) = local_configuration.auth_keys.get("apiKeyAuth") { + headers.insert( + "DD-API-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-API-KEY header"), + ); + }; + if let Some(local_key) = local_configuration.auth_keys.get("appKeyAuth") { + headers.insert( + "DD-APPLICATION-KEY", + HeaderValue::from_str(local_key.key.as_str()) + .expect("failed to parse DD-APPLICATION-KEY header"), + ); + }; + + local_req_builder = local_req_builder.headers(headers); + let local_req = local_req_builder.build()?; + log::debug!("request content: {:?}", local_req.body()); + let local_resp = local_client.execute(local_req).await?; + + let local_status = local_resp.status(); + let local_content = local_resp.text().await?; + log::debug!("response content: {}", local_content); + + if !local_status.is_client_error() && !local_status.is_server_error() { + match serde_json::from_str::( + &local_content, + ) { + Ok(e) => { + return Ok(datadog::ResponseContent { + status: local_status, + content: local_content, + entity: Some(e), + }) + } + Err(e) => return Err(datadog::Error::Serde(e)), + }; + } else { + let local_entity: Option = + serde_json::from_str(&local_content).ok(); + let local_error = datadog::ResponseContent { + status: local_status, + content: local_content, + entity: local_entity, + }; + Err(datadog::Error::ResponseError(local_error)) + } + } + /// List all team hierarchy links that match the provided filters. pub async fn list_team_hierarchy_links( &self, diff --git a/src/datadogV2/api/mod.rs b/src/datadogV2/api/mod.rs index 781193222..5ea26b017 100644 --- a/src/datadogV2/api/mod.rs +++ b/src/datadogV2/api/mod.rs @@ -81,7 +81,6 @@ pub mod api_spans; pub mod api_spans_metrics; pub mod api_static_analysis; pub mod api_synthetics; -pub mod api_team_connections; pub mod api_teams; pub mod api_test_optimization; pub mod api_usage_metering; diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs index 923ec2506..4c3054ef5 100644 --- a/src/datadogV2/mod.rs +++ b/src/datadogV2/mod.rs @@ -82,7 +82,6 @@ pub use self::api::api_spans; pub use self::api::api_spans_metrics; pub use self::api::api_static_analysis; pub use self::api::api_synthetics; -pub use self::api::api_team_connections; pub use self::api::api_teams; pub use self::api::api_test_optimization; pub use self::api::api_usage_metering; diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 6c6d3bf98..d919b9834 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -1209,7 +1209,7 @@ "source": "data.data[0]", "step": "there is a valid \"team_connection\" in the system", "key": "team_connection", - "tag": "Team Connections", + "tag": "Teams", "operationId": "CreateTeamConnections" }, { diff --git a/tests/scenarios/features/v2/team_connections.feature b/tests/scenarios/features/v2/team_connections.feature deleted file mode 100644 index 7bbce889e..000000000 --- a/tests/scenarios/features/v2/team_connections.feature +++ /dev/null @@ -1,93 +0,0 @@ -@endpoint(team-connections) @endpoint(team-connections-v2) -Feature: Team Connections - View and manage relationships between Datadog teams and teams from - external sources, such as GitHub. - - Background: - Given a valid "apiKeyAuth" key in the system - And a valid "appKeyAuth" key in the system - And an instance of "TeamConnections" API - - @skip @team:DataDog/aaa-omg - Scenario: Create team connections returns "Bad Request" response - Given operation "CreateTeamConnections" enabled - And new "CreateTeamConnections" request - And body with value {"data": [{"attributes": {"source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"type": "team"}}}, "type": "team_connection"}]} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-omg - Scenario: Create team connections returns "Conflict" response - Given operation "CreateTeamConnections" enabled - And new "CreateTeamConnections" request - And body with value {"data": [{"attributes": {"managed_by": "github_sync", "source": "github"}, "relationships": {"connected_team": {"data": {"id": "@GitHubOrg/team-handle", "type": "github_team"}}, "team": {"data": {"id": "87654321-4321-8765-dcba-210987654321", "type": "team"}}}, "type": "team_connection"}]} - When the request is sent - Then the response status is 409 Conflict - - @skip @team:DataDog/aaa-omg - Scenario: Create team connections returns "Created" response - Given operation "CreateTeamConnections" enabled - And new "CreateTeamConnections" request - And there is a valid "dd_team" in the system - And body with value {"data": [{"type": "team_connection", "attributes": {"source": "github", "managed_by": "datadog"}, "relationships": {"team": {"data": {"id": "{{ dd_team.data.id }}", "type": "team"}}, "connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}}}]} - When the request is sent - Then the response status is 201 Created - And the response "data.data[0].attributes.source" is equal to "github" - And the response "data.data[0].attributes.managed_by" is equal to "datadog" - And the response "data.data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}" - And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name" - And the response "data.data[0].type" is equal to "team_connection" - - @skip @team:DataDog/aaa-omg - Scenario: Delete team connections returns "Bad Request" response - Given operation "DeleteTeamConnections" enabled - And new "DeleteTeamConnections" request - And body with value {"data": [{"type": "team_connection"}]} - When the request is sent - Then the response status is 400 Bad Request - - @generated @skip @team:DataDog/aaa-omg - Scenario: Delete team connections returns "No Content" response - Given operation "DeleteTeamConnections" enabled - And new "DeleteTeamConnections" request - And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} - When the request is sent - Then the response status is 204 No Content - - @generated @skip @team:DataDog/aaa-omg - Scenario: Delete team connections returns "Not Found" response - Given operation "DeleteTeamConnections" enabled - And new "DeleteTeamConnections" request - And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} - When the request is sent - Then the response status is 404 Not Found - - @generated @skip @team:DataDog/aaa-omg - Scenario: List team connections returns "Bad Request" response - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - When the request is sent - Then the response status is 400 Bad Request - - @skip @team:DataDog/aaa-omg - Scenario: List team connections returns "OK" response - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - When the request is sent - Then the response status is 200 OK - - @generated @skip @team:DataDog/aaa-omg @with-pagination - Scenario: List team connections returns "OK" response with pagination - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - When the request with pagination is sent - Then the response status is 200 OK - - @skip @team:DataDog/aaa-omg - Scenario: List team connections with filters returns "OK" response - Given operation "ListTeamConnections" enabled - And new "ListTeamConnections" request - And request contains "filter[sources]" parameter with value ["github"] - And request contains "page[size]" parameter with value 10 - When the request is sent - Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/teams.feature b/tests/scenarios/features/v2/teams.feature index faa1ca088..c2f52d0d9 100644 --- a/tests/scenarios/features/v2/teams.feature +++ b/tests/scenarios/features/v2/teams.feature @@ -115,6 +115,60 @@ Feature: Teams And the response "data.attributes.visible_modules" is equal to ["m1","m2"] And the response "data.attributes.hidden_modules" is equal to ["m3"] + @skip @team:DataDog/aaa-omg + Scenario: Create team connections returns "Bad Request" response + Given operation "CreateTeamConnections" enabled + And new "CreateTeamConnections" request + And body with value {"data": [{"attributes": {"source": "github"}, "relationships": {"connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}, "team": {"data": {"type": "team"}}}, "type": "team_connection"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Create team connections returns "Conflict" response + Given operation "CreateTeamConnections" enabled + And new "CreateTeamConnections" request + And body with value {"data": [{"attributes": {"managed_by": "github_sync", "source": "github"}, "relationships": {"connected_team": {"data": {"id": "@GitHubOrg/team-handle", "type": "github_team"}}, "team": {"data": {"id": "87654321-4321-8765-dcba-210987654321", "type": "team"}}}, "type": "team_connection"}]} + When the request is sent + Then the response status is 409 Conflict + + @skip @team:DataDog/aaa-omg + Scenario: Create team connections returns "Created" response + Given operation "CreateTeamConnections" enabled + And new "CreateTeamConnections" request + And there is a valid "dd_team" in the system + And body with value {"data": [{"type": "team_connection", "attributes": {"source": "github", "managed_by": "datadog"}, "relationships": {"team": {"data": {"id": "{{ dd_team.data.id }}", "type": "team"}}, "connected_team": {"data": {"id": "@MyGitHubAccount/my-team-name", "type": "github_team"}}}}]} + When the request is sent + Then the response status is 201 Created + And the response "data.data[0].attributes.source" is equal to "github" + And the response "data.data[0].attributes.managed_by" is equal to "datadog" + And the response "data.data[0].relationships.team.data.id" is equal to "{{ dd_team.data.id }}" + And the response "data.data[0].relationships.connected_team.data.id" is equal to "@MyGitHubAccount/my-team-name" + And the response "data.data[0].type" is equal to "team_connection" + + @skip @team:DataDog/aaa-omg + Scenario: Delete team connections returns "Bad Request" response + Given operation "DeleteTeamConnections" enabled + And new "DeleteTeamConnections" request + And body with value {"data": [{"type": "team_connection"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete team connections returns "No Content" response + Given operation "DeleteTeamConnections" enabled + And new "DeleteTeamConnections" request + And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:DataDog/aaa-omg + Scenario: Delete team connections returns "Not Found" response + Given operation "DeleteTeamConnections" enabled + And new "DeleteTeamConnections" request + And body with value {"data": [{"id": "12345678-1234-5678-9abc-123456789012", "type": "team_connection"}]} + When the request is sent + Then the response status is 404 Not Found + @team:DataDog/aaa-omg Scenario: Get a team hierarchy link returns "API error response." response Given new "GetTeamHierarchyLink" request @@ -341,6 +395,36 @@ Feature: Teams When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/aaa-omg + Scenario: List team connections returns "Bad Request" response + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/aaa-omg + Scenario: List team connections returns "OK" response + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/aaa-omg @with-pagination + Scenario: List team connections returns "OK" response with pagination + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + When the request with pagination is sent + Then the response status is 200 OK + + @skip @team:DataDog/aaa-omg + Scenario: List team connections with filters returns "OK" response + Given operation "ListTeamConnections" enabled + And new "ListTeamConnections" request + And request contains "filter[sources]" parameter with value ["github"] + And request contains "page[size]" parameter with value 10 + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/aaa-omg Scenario: Remove a member team returns "API error response." response Given operation "RemoveMemberTeam" enabled diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 2e54bbe0a..2231f8c96 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -4494,19 +4494,19 @@ } }, "DeleteTeamConnections": { - "tag": "Team Connections", + "tag": "Teams", "undo": { "type": "idempotent" } }, "ListTeamConnections": { - "tag": "Team Connections", + "tag": "Teams", "undo": { "type": "safe" } }, "CreateTeamConnections": { - "tag": "Team Connections", + "tag": "Teams", "undo": { "operationId": "DeleteTeamConnections", "type": "unsafe" diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs index a1421af5e..8cd3458f7 100644 --- a/tests/scenarios/function_mappings.rs +++ b/tests/scenarios/function_mappings.rs @@ -152,7 +152,6 @@ pub struct ApiInstances { pub v2_api_static_analysis: Option, pub v2_api_synthetics: Option, pub v2_api_teams: Option, - pub v2_api_team_connections: Option, pub v2_api_incident_teams: Option, pub v2_api_test_optimization: Option, pub v2_api_users: Option, @@ -971,14 +970,6 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) { world.http_client.as_ref().unwrap().clone(), )); } - "TeamConnections" => { - world.api_instances.v2_api_team_connections = Some( - datadogV2::api_team_connections::TeamConnectionsAPI::with_client_and_config( - world.config.clone(), - world.http_client.as_ref().unwrap().clone(), - ), - ); - } "IncidentTeams" => { world.api_instances.v2_api_incident_teams = Some( datadogV2::api_incident_teams::IncidentTeamsAPI::with_client_and_config( @@ -4340,6 +4331,22 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { "v2.GetTeamHierarchyLink".into(), test_v2_get_team_hierarchy_link, ); + world.function_mappings.insert( + "v2.DeleteTeamConnections".into(), + test_v2_delete_team_connections, + ); + world.function_mappings.insert( + "v2.ListTeamConnections".into(), + test_v2_list_team_connections, + ); + world.function_mappings.insert( + "v2.ListTeamConnectionsWithPagination".into(), + test_v2_list_team_connections_with_pagination, + ); + world.function_mappings.insert( + "v2.CreateTeamConnections".into(), + test_v2_create_team_connections, + ); world .function_mappings .insert("v2.GetTeamSync".into(), test_v2_get_team_sync); @@ -4413,22 +4420,6 @@ pub fn collect_function_calls(world: &mut DatadogWorld) { world .function_mappings .insert("v2.GetUserMemberships".into(), test_v2_get_user_memberships); - world.function_mappings.insert( - "v2.DeleteTeamConnections".into(), - test_v2_delete_team_connections, - ); - world.function_mappings.insert( - "v2.ListTeamConnections".into(), - test_v2_list_team_connections, - ); - world.function_mappings.insert( - "v2.ListTeamConnectionsWithPagination".into(), - test_v2_list_team_connections_with_pagination, - ); - world.function_mappings.insert( - "v2.CreateTeamConnections".into(), - test_v2_create_team_connections, - ); world .function_mappings .insert("v2.ListIncidentTeams".into(), test_v2_list_incident_teams); @@ -33458,6 +33449,166 @@ fn test_v2_get_team_hierarchy_link(world: &mut DatadogWorld, _parameters: &HashM world.response.code = response.status.as_u16(); } +fn test_v2_delete_team_connections(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_teams + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.delete_team_connections_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + +fn test_v2_list_team_connections(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_teams + .as_ref() + .expect("api instance not found"); + let page_size = _parameters + .get("page[size]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let page_number = _parameters + .get("page[number]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_sources = _parameters + .get("filter[sources]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_team_ids = _parameters + .get("filter[team_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_connected_team_ids = _parameters + .get("filter[connected_team_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_connection_ids = _parameters + .get("filter[connection_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_teams::ListTeamConnectionsOptionalParams::default(); + params.page_size = page_size; + params.page_number = page_number; + params.filter_sources = filter_sources; + params.filter_team_ids = filter_team_ids; + params.filter_connected_team_ids = filter_connected_team_ids; + params.filter_connection_ids = filter_connection_ids; + let response = match block_on(api.list_team_connections_with_http_info(params)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} +fn test_v2_list_team_connections_with_pagination( + world: &mut DatadogWorld, + _parameters: &HashMap, +) { + let api = world + .api_instances + .v2_api_teams + .as_ref() + .expect("api instance not found"); + let page_size = _parameters + .get("page[size]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let page_number = _parameters + .get("page[number]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_sources = _parameters + .get("filter[sources]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_team_ids = _parameters + .get("filter[team_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_connected_team_ids = _parameters + .get("filter[connected_team_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let filter_connection_ids = _parameters + .get("filter[connection_ids]") + .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); + let mut params = datadogV2::api_teams::ListTeamConnectionsOptionalParams::default(); + params.page_size = page_size; + params.page_number = page_number; + params.filter_sources = filter_sources; + params.filter_team_ids = filter_team_ids; + params.filter_connected_team_ids = filter_connected_team_ids; + params.filter_connection_ids = filter_connection_ids; + let response = api.list_team_connections_with_pagination(params); + let mut result = Vec::new(); + + block_on(async { + pin_mut!(response); + + while let Some(resp) = response.next().await { + match resp { + Ok(response) => { + result.push(response); + } + Err(error) => { + return match error { + Error::ResponseError(e) => { + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {}", error), + }; + } + } + } + }); + world.response.object = serde_json::to_value(result).unwrap(); + world.response.code = 200; +} + +fn test_v2_create_team_connections(world: &mut DatadogWorld, _parameters: &HashMap) { + let api = world + .api_instances + .v2_api_teams + .as_ref() + .expect("api instance not found"); + let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); + let response = match block_on(api.create_team_connections_with_http_info(body)) { + Ok(response) => response, + Err(error) => { + return match error { + Error::ResponseError(e) => { + world.response.code = e.status.as_u16(); + if let Some(entity) = e.entity { + world.response.object = serde_json::to_value(entity).unwrap(); + } + } + _ => panic!("error parsing response: {error}"), + }; + } + }; + world.response.object = serde_json::to_value(response.entity).unwrap(); + world.response.code = response.status.as_u16(); +} + fn test_v2_get_team_sync(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances @@ -34121,166 +34272,6 @@ fn test_v2_get_user_memberships(world: &mut DatadogWorld, _parameters: &HashMap< world.response.code = response.status.as_u16(); } -fn test_v2_delete_team_connections(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_team_connections - .as_ref() - .expect("api instance not found"); - let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); - let response = match block_on(api.delete_team_connections_with_http_info(body)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - -fn test_v2_list_team_connections(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_team_connections - .as_ref() - .expect("api instance not found"); - let page_size = _parameters - .get("page[size]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let page_number = _parameters - .get("page[number]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_sources = _parameters - .get("filter[sources]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_team_ids = _parameters - .get("filter[team_ids]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_connected_team_ids = _parameters - .get("filter[connected_team_ids]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_connection_ids = _parameters - .get("filter[connection_ids]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let mut params = datadogV2::api_team_connections::ListTeamConnectionsOptionalParams::default(); - params.page_size = page_size; - params.page_number = page_number; - params.filter_sources = filter_sources; - params.filter_team_ids = filter_team_ids; - params.filter_connected_team_ids = filter_connected_team_ids; - params.filter_connection_ids = filter_connection_ids; - let response = match block_on(api.list_team_connections_with_http_info(params)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} -fn test_v2_list_team_connections_with_pagination( - world: &mut DatadogWorld, - _parameters: &HashMap, -) { - let api = world - .api_instances - .v2_api_team_connections - .as_ref() - .expect("api instance not found"); - let page_size = _parameters - .get("page[size]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let page_number = _parameters - .get("page[number]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_sources = _parameters - .get("filter[sources]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_team_ids = _parameters - .get("filter[team_ids]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_connected_team_ids = _parameters - .get("filter[connected_team_ids]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let filter_connection_ids = _parameters - .get("filter[connection_ids]") - .and_then(|param| Some(serde_json::from_value(param.clone()).unwrap())); - let mut params = datadogV2::api_team_connections::ListTeamConnectionsOptionalParams::default(); - params.page_size = page_size; - params.page_number = page_number; - params.filter_sources = filter_sources; - params.filter_team_ids = filter_team_ids; - params.filter_connected_team_ids = filter_connected_team_ids; - params.filter_connection_ids = filter_connection_ids; - let response = api.list_team_connections_with_pagination(params); - let mut result = Vec::new(); - - block_on(async { - pin_mut!(response); - - while let Some(resp) = response.next().await { - match resp { - Ok(response) => { - result.push(response); - } - Err(error) => { - return match error { - Error::ResponseError(e) => { - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {}", error), - }; - } - } - } - }); - world.response.object = serde_json::to_value(result).unwrap(); - world.response.code = 200; -} - -fn test_v2_create_team_connections(world: &mut DatadogWorld, _parameters: &HashMap) { - let api = world - .api_instances - .v2_api_team_connections - .as_ref() - .expect("api instance not found"); - let body = serde_json::from_value(_parameters.get("body").unwrap().clone()).unwrap(); - let response = match block_on(api.create_team_connections_with_http_info(body)) { - Ok(response) => response, - Err(error) => { - return match error { - Error::ResponseError(e) => { - world.response.code = e.status.as_u16(); - if let Some(entity) = e.entity { - world.response.object = serde_json::to_value(entity).unwrap(); - } - } - _ => panic!("error parsing response: {error}"), - }; - } - }; - world.response.object = serde_json::to_value(response.entity).unwrap(); - world.response.code = response.status.as_u16(); -} - fn test_v2_list_incident_teams(world: &mut DatadogWorld, _parameters: &HashMap) { let api = world .api_instances