diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml
index bf25604f0..97f613dc1 100644
--- a/.generator/schemas/v2/openapi.yaml
+++ b/.generator/schemas/v2/openapi.yaml
@@ -1772,6 +1772,14 @@ components:
required: false
schema:
type: boolean
+ SlackUserUuidQueryParameter:
+ description: The UUID of the Datadog user to list Slack bindings for.
+ in: query
+ name: user_uuid
+ required: true
+ schema:
+ format: uuid
+ type: string
SloID:
description: The ID of the SLO.
in: path
@@ -88673,6 +88681,37 @@ components:
required:
- slackTrigger
type: object
+ SlackUserBindingData:
+ description: Slack team ID data from a response.
+ properties:
+ id:
+ description: The Slack team ID.
+ example: "T01234567"
+ type: string
+ type:
+ $ref: "#/components/schemas/SlackUserBindingType"
+ type: object
+ SlackUserBindingType:
+ default: team_id
+ description: Slack user binding resource type.
+ enum:
+ - team_id
+ example: team_id
+ type: string
+ x-enum-varnames:
+ - TEAM_ID
+ SlackUserBindingsResponse:
+ description: Response with a list of Slack user bindings.
+ properties:
+ data:
+ description: An array of Slack user bindings.
+ example: [{"id": "T01234567", "type": "team_id"}, {"id": "T09876543", "type": "team_id"}]
+ items:
+ $ref: "#/components/schemas/SlackUserBindingData"
+ type: array
+ required:
+ - data
+ type: object
SloDataSource:
default: slo
description: A data source for SLO queries.
@@ -135946,6 +135985,36 @@ paths:
summary: List ServiceNow users
tags:
- ServiceNow Integration
+ /api/v2/integration/slack/user-bindings:
+ get:
+ description: List all Slack user bindings for a given Datadog user from the Datadog Slack integration.
+ operationId: ListSlackUserBindings
+ parameters:
+ - $ref: "#/components/parameters/SlackUserUuidQueryParameter"
+ responses:
+ "200":
+ content:
+ application/json:
+ examples:
+ default:
+ value:
+ data:
+ - id: T01234567
+ type: team_id
+ - id: T09876543
+ type: team_id
+ schema:
+ $ref: "#/components/schemas/SlackUserBindingsResponse"
+ description: OK
+ "400":
+ $ref: "#/components/responses/BadRequestResponse"
+ "403":
+ $ref: "#/components/responses/ForbiddenResponse"
+ "429":
+ $ref: "#/components/responses/TooManyRequestsResponse"
+ summary: List Slack user bindings
+ tags:
+ - Slack Integration
/api/v2/integration/statuspage/account:
delete:
description: Delete the Statuspage account configured for your organization.
@@ -185814,6 +185883,13 @@ tags:
name: Service Level Objectives
- description: Manage your ServiceNow Integration. ServiceNow is a cloud-based platform that helps organizations manage digital workflows for enterprise operations.
name: ServiceNow Integration
+ - description: |-
+ Configure your [Datadog Slack integration](https://docs.datadoghq.com/integrations/slack/)
+ directly through the Datadog API.
+ externalDocs:
+ description: For more information about the Datadog Slack integration, see the integration page.
+ url: https://docs.datadoghq.com/integrations/slack/
+ name: Slack Integration
- description: |-
API to create, update, retrieve, and delete Software Catalog entities.
externalDocs:
diff --git a/examples/v2_slack-integration_ListSlackUserBindings.rs b/examples/v2_slack-integration_ListSlackUserBindings.rs
new file mode 100644
index 000000000..5077f3037
--- /dev/null
+++ b/examples/v2_slack-integration_ListSlackUserBindings.rs
@@ -0,0 +1,20 @@
+// List Slack user bindings returns "OK" response
+use datadog_api_client::datadog;
+use datadog_api_client::datadogV2::api_slack_integration::SlackIntegrationAPI;
+use uuid::Uuid;
+
+#[tokio::main]
+async fn main() {
+ let configuration = datadog::Configuration::new();
+ let api = SlackIntegrationAPI::with_config(configuration);
+ let resp = api
+ .list_slack_user_bindings(
+ Uuid::parse_str("00000000-0000-0000-0000-000000000000").expect("invalid UUID"),
+ )
+ .await;
+ if let Ok(value) = resp {
+ println!("{:#?}", value);
+ } else {
+ println!("{:#?}", resp.unwrap_err());
+ }
+}
diff --git a/src/datadogV2/api/api_slack_integration.rs b/src/datadogV2/api/api_slack_integration.rs
new file mode 100644
index 000000000..274be8194
--- /dev/null
+++ b/src/datadogV2/api/api_slack_integration.rs
@@ -0,0 +1,203 @@
+// 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 reqwest::header::{HeaderMap, HeaderValue};
+use serde::{Deserialize, Serialize};
+
+/// ListSlackUserBindingsError is a struct for typed errors of method [`SlackIntegrationAPI::list_slack_user_bindings`]
+#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(untagged)]
+pub enum ListSlackUserBindingsError {
+ APIErrorResponse(crate::datadogV2::model::APIErrorResponse),
+ UnknownValue(serde_json::Value),
+}
+
+/// Configure your [Datadog Slack integration]()
+/// directly through the Datadog API.
+#[derive(Debug, Clone)]
+pub struct SlackIntegrationAPI {
+ config: datadog::Configuration,
+ client: reqwest_middleware::ClientWithMiddleware,
+}
+
+impl Default for SlackIntegrationAPI {
+ fn default() -> Self {
+ Self::with_config(datadog::Configuration::default())
+ }
+}
+
+impl SlackIntegrationAPI {
+ pub fn new() -> Self {
+ Self::default()
+ }
+ pub fn with_config(config: datadog::Configuration) -> Self {
+ let reqwest_client_builder = {
+ let builder = reqwest::Client::builder();
+ #[cfg(not(target_arch = "wasm32"))]
+ let builder = if let Some(proxy_url) = &config.proxy_url {
+ builder.proxy(reqwest::Proxy::all(proxy_url).expect("Failed to parse proxy URL"))
+ } else {
+ builder
+ };
+ builder
+ };
+
+ let middleware_client_builder = {
+ let builder =
+ reqwest_middleware::ClientBuilder::new(reqwest_client_builder.build().unwrap());
+ #[cfg(feature = "retry")]
+ let builder = 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,
+ );
+
+ builder.with(retry_middleware)
+ } else {
+ builder
+ };
+ builder
+ };
+
+ 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 }
+ }
+
+ /// List all Slack user bindings for a given Datadog user from the Datadog Slack integration.
+ pub async fn list_slack_user_bindings(
+ &self,
+ user_uuid: uuid::Uuid,
+ ) -> Result<
+ crate::datadogV2::model::SlackUserBindingsResponse,
+ datadog::Error,
+ > {
+ match self
+ .list_slack_user_bindings_with_http_info(user_uuid)
+ .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),
+ }
+ }
+
+ /// List all Slack user bindings for a given Datadog user from the Datadog Slack integration.
+ pub async fn list_slack_user_bindings_with_http_info(
+ &self,
+ user_uuid: uuid::Uuid,
+ ) -> Result<
+ datadog::ResponseContent,
+ datadog::Error,
+ > {
+ let local_configuration = &self.config;
+ let operation_id = "v2.list_slack_user_bindings";
+
+ let local_client = &self.client;
+
+ let local_uri_str = format!(
+ "{}/api/v2/integration/slack/user-bindings",
+ local_configuration.get_operation_host(operation_id)
+ );
+ let mut local_req_builder =
+ local_client.request(reqwest::Method::GET, local_uri_str.as_str());
+
+ local_req_builder = local_req_builder.query(&[("user_uuid", &user_uuid.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/mod.rs b/src/datadogV2/api/mod.rs
index 1c5c3bc22..0cf4ae63d 100644
--- a/src/datadogV2/api/mod.rs
+++ b/src/datadogV2/api/mod.rs
@@ -113,6 +113,7 @@ pub mod api_service_accounts;
pub mod api_service_definition;
pub mod api_service_level_objectives;
pub mod api_service_now_integration;
+pub mod api_slack_integration;
pub mod api_software_catalog;
pub mod api_spa;
pub mod api_spans;
diff --git a/src/datadogV2/mod.rs b/src/datadogV2/mod.rs
index c5fc979a8..1ab5a6041 100644
--- a/src/datadogV2/mod.rs
+++ b/src/datadogV2/mod.rs
@@ -114,6 +114,7 @@ pub use self::api::api_service_accounts;
pub use self::api::api_service_definition;
pub use self::api::api_service_level_objectives;
pub use self::api::api_service_now_integration;
+pub use self::api::api_slack_integration;
pub use self::api::api_software_catalog;
pub use self::api::api_spa;
pub use self::api::api_spans;
diff --git a/src/datadogV2/model/mod.rs b/src/datadogV2/model/mod.rs
index 82689518b..99fad6df5 100644
--- a/src/datadogV2/model/mod.rs
+++ b/src/datadogV2/model/mod.rs
@@ -5144,6 +5144,12 @@ pub mod model_service_now_user_attributes;
pub use self::model_service_now_user_attributes::ServiceNowUserAttributes;
pub mod model_service_now_user_type;
pub use self::model_service_now_user_type::ServiceNowUserType;
+pub mod model_slack_user_bindings_response;
+pub use self::model_slack_user_bindings_response::SlackUserBindingsResponse;
+pub mod model_slack_user_binding_data;
+pub use self::model_slack_user_binding_data::SlackUserBindingData;
+pub mod model_slack_user_binding_type;
+pub use self::model_slack_user_binding_type::SlackUserBindingType;
pub mod model_statuspage_account_response;
pub use self::model_statuspage_account_response::StatuspageAccountResponse;
pub mod model_statuspage_account_response_data;
diff --git a/src/datadogV2/model/model_slack_user_binding_data.rs b/src/datadogV2/model/model_slack_user_binding_data.rs
new file mode 100644
index 000000000..b18e2f44e
--- /dev/null
+++ b/src/datadogV2/model/model_slack_user_binding_data.rs
@@ -0,0 +1,130 @@
+// 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 serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Slack team ID data from a response.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct SlackUserBindingData {
+ /// The Slack team ID.
+ #[serde(rename = "id")]
+ pub id: Option,
+ /// Slack user binding resource type.
+ #[serde(rename = "type")]
+ pub type_: Option,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl SlackUserBindingData {
+ pub fn new() -> SlackUserBindingData {
+ SlackUserBindingData {
+ id: None,
+ type_: None,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn id(mut self, value: String) -> Self {
+ self.id = Some(value);
+ self
+ }
+
+ pub fn type_(mut self, value: crate::datadogV2::model::SlackUserBindingType) -> Self {
+ self.type_ = Some(value);
+ self
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl Default for SlackUserBindingData {
+ fn default() -> Self {
+ Self::new()
+ }
+}
+
+impl<'de> Deserialize<'de> for SlackUserBindingData {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct SlackUserBindingDataVisitor;
+ impl<'a> Visitor<'a> for SlackUserBindingDataVisitor {
+ type Value = SlackUserBindingData;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut id: Option = None;
+ let mut type_: Option = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "id" => {
+ if v.is_null() {
+ continue;
+ }
+ id = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ "type" => {
+ if v.is_null() {
+ continue;
+ }
+ type_ = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ if let Some(ref _type_) = type_ {
+ match _type_ {
+ crate::datadogV2::model::SlackUserBindingType::UnparsedObject(_type_) => {
+ _unparsed = true;
+ },
+ _ => {}
+ }
+ }
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+
+ let content = SlackUserBindingData {
+ id,
+ type_,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(SlackUserBindingDataVisitor)
+ }
+}
diff --git a/src/datadogV2/model/model_slack_user_binding_type.rs b/src/datadogV2/model/model_slack_user_binding_type.rs
new file mode 100644
index 000000000..7419dede0
--- /dev/null
+++ b/src/datadogV2/model/model_slack_user_binding_type.rs
@@ -0,0 +1,48 @@
+// 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 serde::{Deserialize, Deserializer, Serialize, Serializer};
+
+#[non_exhaustive]
+#[derive(Clone, Debug, Eq, PartialEq)]
+pub enum SlackUserBindingType {
+ TEAM_ID,
+ UnparsedObject(crate::datadog::UnparsedObject),
+}
+
+impl ToString for SlackUserBindingType {
+ fn to_string(&self) -> String {
+ match self {
+ Self::TEAM_ID => String::from("team_id"),
+ Self::UnparsedObject(v) => v.value.to_string(),
+ }
+ }
+}
+
+impl Serialize for SlackUserBindingType {
+ fn serialize(&self, serializer: S) -> Result
+ where
+ S: Serializer,
+ {
+ match self {
+ Self::UnparsedObject(v) => v.serialize(serializer),
+ _ => serializer.serialize_str(self.to_string().as_str()),
+ }
+ }
+}
+
+impl<'de> Deserialize<'de> for SlackUserBindingType {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ let s: String = String::deserialize(deserializer)?;
+ Ok(match s.as_str() {
+ "team_id" => Self::TEAM_ID,
+ _ => Self::UnparsedObject(crate::datadog::UnparsedObject {
+ value: serde_json::Value::String(s.into()),
+ }),
+ })
+ }
+}
diff --git a/src/datadogV2/model/model_slack_user_bindings_response.rs b/src/datadogV2/model/model_slack_user_bindings_response.rs
new file mode 100644
index 000000000..f0a49954e
--- /dev/null
+++ b/src/datadogV2/model/model_slack_user_bindings_response.rs
@@ -0,0 +1,94 @@
+// 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 serde::de::{Error, MapAccess, Visitor};
+use serde::{Deserialize, Deserializer, Serialize};
+use serde_with::skip_serializing_none;
+use std::fmt::{self, Formatter};
+
+/// Response with a list of Slack user bindings.
+#[non_exhaustive]
+#[skip_serializing_none]
+#[derive(Clone, Debug, PartialEq, Serialize)]
+pub struct SlackUserBindingsResponse {
+ /// An array of Slack user bindings.
+ #[serde(rename = "data")]
+ pub data: Vec,
+ #[serde(flatten)]
+ pub additional_properties: std::collections::BTreeMap,
+ #[serde(skip)]
+ #[serde(default)]
+ pub(crate) _unparsed: bool,
+}
+
+impl SlackUserBindingsResponse {
+ pub fn new(
+ data: Vec,
+ ) -> SlackUserBindingsResponse {
+ SlackUserBindingsResponse {
+ data,
+ additional_properties: std::collections::BTreeMap::new(),
+ _unparsed: false,
+ }
+ }
+
+ pub fn additional_properties(
+ mut self,
+ value: std::collections::BTreeMap,
+ ) -> Self {
+ self.additional_properties = value;
+ self
+ }
+}
+
+impl<'de> Deserialize<'de> for SlackUserBindingsResponse {
+ fn deserialize(deserializer: D) -> Result
+ where
+ D: Deserializer<'de>,
+ {
+ struct SlackUserBindingsResponseVisitor;
+ impl<'a> Visitor<'a> for SlackUserBindingsResponseVisitor {
+ type Value = SlackUserBindingsResponse;
+
+ fn expecting(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ f.write_str("a mapping")
+ }
+
+ fn visit_map(self, mut map: M) -> Result
+ where
+ M: MapAccess<'a>,
+ {
+ let mut data: Option> = None;
+ let mut additional_properties: std::collections::BTreeMap<
+ String,
+ serde_json::Value,
+ > = std::collections::BTreeMap::new();
+ let mut _unparsed = false;
+
+ while let Some((k, v)) = map.next_entry::()? {
+ match k.as_str() {
+ "data" => {
+ data = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
+ }
+ &_ => {
+ if let Ok(value) = serde_json::from_value(v.clone()) {
+ additional_properties.insert(k, value);
+ }
+ }
+ }
+ }
+ let data = data.ok_or_else(|| M::Error::missing_field("data"))?;
+
+ let content = SlackUserBindingsResponse {
+ data,
+ additional_properties,
+ _unparsed,
+ };
+
+ Ok(content)
+ }
+ }
+
+ deserializer.deserialize_any(SlackUserBindingsResponseVisitor)
+ }
+}
diff --git a/tests/scenarios/features/v2/slack_integration.feature b/tests/scenarios/features/v2/slack_integration.feature
new file mode 100644
index 000000000..0ef645a64
--- /dev/null
+++ b/tests/scenarios/features/v2/slack_integration.feature
@@ -0,0 +1,23 @@
+@endpoint(slack-integration) @endpoint(slack-integration-v2)
+Feature: Slack Integration
+ Configure your [Datadog Slack
+ integration](https://docs.datadoghq.com/integrations/slack/) directly
+ through the Datadog API.
+
+ Background:
+ Given a valid "apiKeyAuth" key in the system
+ And a valid "appKeyAuth" key in the system
+ And an instance of "SlackIntegration" API
+ And new "ListSlackUserBindings" request
+
+ @generated @skip @team:DataDog/chat-integrations
+ Scenario: List Slack user bindings returns "Bad Request" response
+ Given request contains "user_uuid" parameter from "REPLACE.ME"
+ When the request is sent
+ Then the response status is 400 Bad Request
+
+ @generated @skip @team:DataDog/chat-integrations
+ Scenario: List Slack user bindings returns "OK" response
+ Given request contains "user_uuid" parameter from "REPLACE.ME"
+ When the request is sent
+ Then the response status is 200 OK
diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json
index 25fb6bb2d..99d762668 100644
--- a/tests/scenarios/features/v2/undo.json
+++ b/tests/scenarios/features/v2/undo.json
@@ -3775,6 +3775,12 @@
"type": "safe"
}
},
+ "ListSlackUserBindings": {
+ "tag": "Slack Integration",
+ "undo": {
+ "type": "safe"
+ }
+ },
"DeleteStatuspageAccount": {
"tag": "Statuspage Integration",
"undo": {
diff --git a/tests/scenarios/function_mappings.rs b/tests/scenarios/function_mappings.rs
index b48922841..d49420609 100644
--- a/tests/scenarios/function_mappings.rs
+++ b/tests/scenarios/function_mappings.rs
@@ -130,6 +130,7 @@ pub struct ApiInstances {
Option,
pub v2_api_service_now_integration:
Option,
+ pub v2_api_slack_integration: Option,
pub v2_api_statuspage_integration:
Option,
pub v2_api_webhooks_integration:
@@ -410,6 +411,12 @@ pub fn initialize_api_instance(world: &mut DatadogWorld, api: String) {
world.http_client.as_ref().unwrap().clone(),
),
);
+ world.api_instances.v2_api_slack_integration = Some(
+ datadogV2::api_slack_integration::SlackIntegrationAPI::with_client_and_config(
+ world.config.clone(),
+ world.http_client.as_ref().unwrap().clone(),
+ ),
+ );
}
"WebhooksIntegration" => {
world.api_instances.v1_api_webhooks_integration = Some(
@@ -5134,6 +5141,10 @@ pub fn collect_function_calls(world: &mut DatadogWorld) {
"v2.ListServiceNowUsers".into(),
test_v2_list_service_now_users,
);
+ world.function_mappings.insert(
+ "v2.ListSlackUserBindings".into(),
+ test_v2_list_slack_user_bindings,
+ );
world.function_mappings.insert(
"v2.DeleteStatuspageAccount".into(),
test_v2_delete_statuspage_account,
@@ -39454,6 +39465,34 @@ fn test_v2_list_service_now_users(world: &mut DatadogWorld, _parameters: &HashMa
world.response.code = response.status.as_u16();
}
+fn test_v2_list_slack_user_bindings(
+ world: &mut DatadogWorld,
+ _parameters: &HashMap,
+) {
+ let api = world
+ .api_instances
+ .v2_api_slack_integration
+ .as_ref()
+ .expect("api instance not found");
+ let user_uuid = serde_json::from_value(_parameters.get("user_uuid").unwrap().clone()).unwrap();
+ let response = match block_on(api.list_slack_user_bindings_with_http_info(user_uuid)) {
+ 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_delete_statuspage_account(
world: &mut DatadogWorld,
_parameters: &HashMap,