Skip to content

Monitor Notif rule GA #755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-07-02 16:34:47.090537",
"spec_repo_commit": "de2517ad"
"regenerated": "2025-07-02 20:43:19.225643",
"spec_repo_commit": "e327e6df"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-07-02 16:34:47.107437",
"spec_repo_commit": "de2517ad"
"regenerated": "2025-07-02 20:43:19.242229",
"spec_repo_commit": "e327e6df"
}
}
}
15 changes: 0 additions & 15 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53140,9 +53140,6 @@ paths:
operator: OR
permissions:
- monitors_read
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
post:
description: Creates a monitor notification rule.
operationId: CreateMonitorNotificationRule
Expand Down Expand Up @@ -53186,9 +53183,6 @@ paths:
operator: OR
permissions:
- monitor_config_policy_write
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/monitor/notification_rule/{rule_id}:
delete:
description: Deletes a monitor notification rule by `rule_id`.
Expand Down Expand Up @@ -53229,9 +53223,6 @@ paths:
operator: OR
permissions:
- monitor_config_policy_write
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
get:
description: Returns a monitor notification rule by `rule_id`.
operationId: GetMonitorNotificationRule
Expand Down Expand Up @@ -53285,9 +53276,6 @@ paths:
operator: OR
permissions:
- monitors_read
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
patch:
description: Updates a monitor notification rule by `rule_id`.
operationId: UpdateMonitorNotificationRule
Expand Down Expand Up @@ -53345,9 +53333,6 @@ paths:
operator: OR
permissions:
- monitor_config_policy_write
x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback,

contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/monitor/policy:
get:
description: Get all monitor configuration policies.
Expand Down
3 changes: 1 addition & 2 deletions examples/v2_monitors_CreateMonitorNotificationRule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ async fn main() {
)
.type_(MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE),
);
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.CreateMonitorNotificationRule", true);
let configuration = datadog::Configuration::new();
let api = MonitorsAPI::with_config(configuration);
let resp = api.create_monitor_notification_rule(body).await;
if let Ok(value) = resp {
Expand Down
3 changes: 1 addition & 2 deletions examples/v2_monitors_DeleteMonitorNotificationRule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ async fn main() {
// there is a valid "monitor_notification_rule" in the system
let monitor_notification_rule_data_id =
std::env::var("MONITOR_NOTIFICATION_RULE_DATA_ID").unwrap();
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.DeleteMonitorNotificationRule", true);
let configuration = datadog::Configuration::new();
let api = MonitorsAPI::with_config(configuration);
let resp = api
.delete_monitor_notification_rule(monitor_notification_rule_data_id.clone())
Expand Down
3 changes: 1 addition & 2 deletions examples/v2_monitors_GetMonitorNotificationRule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ async fn main() {
// there is a valid "monitor_notification_rule" in the system
let monitor_notification_rule_data_id =
std::env::var("MONITOR_NOTIFICATION_RULE_DATA_ID").unwrap();
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.GetMonitorNotificationRule", true);
let configuration = datadog::Configuration::new();
let api = MonitorsAPI::with_config(configuration);
let resp = api
.get_monitor_notification_rule(
Expand Down
3 changes: 1 addition & 2 deletions examples/v2_monitors_GetMonitorNotificationRules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ use datadog_api_client::datadogV2::api_monitors::MonitorsAPI;

#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.GetMonitorNotificationRules", true);
let configuration = datadog::Configuration::new();
let api = MonitorsAPI::with_config(configuration);
let resp = api
.get_monitor_notification_rules(GetMonitorNotificationRulesOptionalParams::default())
Expand Down
3 changes: 1 addition & 2 deletions examples/v2_monitors_UpdateMonitorNotificationRule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ async fn main() {
)
.type_(MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE),
);
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.UpdateMonitorNotificationRule", true);
let configuration = datadog::Configuration::new();
let api = MonitorsAPI::with_config(configuration);
let resp = api
.update_monitor_notification_rule(monitor_notification_rule_data_id.clone(), body)
Expand Down
5 changes: 0 additions & 5 deletions src/datadog/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,15 +174,10 @@ impl Default for Configuration {
("v2.list_aws_namespaces".to_owned(), false),
("v2.update_aws_account".to_owned(), false),
("v2.list_aws_logs_services".to_owned(), false),
("v2.create_monitor_notification_rule".to_owned(), false),
("v2.create_monitor_user_template".to_owned(), false),
("v2.delete_monitor_notification_rule".to_owned(), false),
("v2.delete_monitor_user_template".to_owned(), false),
("v2.get_monitor_notification_rule".to_owned(), false),
("v2.get_monitor_notification_rules".to_owned(), false),
("v2.get_monitor_user_template".to_owned(), false),
("v2.list_monitor_user_templates".to_owned(), false),
("v2.update_monitor_notification_rule".to_owned(), false),
("v2.update_monitor_user_template".to_owned(), false),
(
"v2.validate_existing_monitor_user_template".to_owned(),
Expand Down
40 changes: 0 additions & 40 deletions src/datadogV2/api/api_monitors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,6 @@ impl MonitorsAPI {
> {
let local_configuration = &self.config;
let operation_id = "v2.create_monitor_notification_rule";
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_monitor_notification_rule' is not enabled".to_string(),
};
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
}

let local_client = &self.client;

Expand Down Expand Up @@ -862,14 +854,6 @@ impl MonitorsAPI {
{
let local_configuration = &self.config;
let operation_id = "v2.delete_monitor_notification_rule";
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_monitor_notification_rule' is not enabled".to_string(),
};
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
}

let local_client = &self.client;

Expand Down Expand Up @@ -1188,14 +1172,6 @@ impl MonitorsAPI {
> {
let local_configuration = &self.config;
let operation_id = "v2.get_monitor_notification_rule";
if local_configuration.is_unstable_operation_enabled(operation_id) {
warn!("Using unstable operation {operation_id}");
} else {
let local_error = datadog::UnstableOperationDisabledError {
msg: "Operation 'v2.get_monitor_notification_rule' is not enabled".to_string(),
};
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
}

// unbox and build optional parameters
let include = params.include;
Expand Down Expand Up @@ -1316,14 +1292,6 @@ impl MonitorsAPI {
> {
let local_configuration = &self.config;
let operation_id = "v2.get_monitor_notification_rules";
if local_configuration.is_unstable_operation_enabled(operation_id) {
warn!("Using unstable operation {operation_id}");
} else {
let local_error = datadog::UnstableOperationDisabledError {
msg: "Operation 'v2.get_monitor_notification_rules' is not enabled".to_string(),
};
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
}

// unbox and build optional parameters
let include = params.include;
Expand Down Expand Up @@ -1955,14 +1923,6 @@ impl MonitorsAPI {
> {
let local_configuration = &self.config;
let operation_id = "v2.update_monitor_notification_rule";
if local_configuration.is_unstable_operation_enabled(operation_id) {
warn!("Using unstable operation {operation_id}");
} else {
let local_error = datadog::UnstableOperationDisabledError {
msg: "Operation 'v2.update_monitor_notification_rule' is not enabled".to_string(),
};
return Err(datadog::Error::UnstableOperationDisabledError(local_error));
}

let local_client = &self.client;

Expand Down
30 changes: 10 additions & 20 deletions tests/scenarios/features/v2/monitors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ Feature: Monitors

@skip-validation @team:DataDog/monitor-app
Scenario: Create a monitor notification rule returns "Bad Request" response
Given operation "CreateMonitorNotificationRule" enabled
And new "CreateMonitorNotificationRule" request
Given new "CreateMonitorNotificationRule" request
And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}", "host:abc"]}, "name": "test rule", "recipients": ["@slack-test-channel", "@jira-test"]}, "type": "monitor-notification-rule"}}
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/monitor-app
Scenario: Create a monitor notification rule returns "OK" response
Given operation "CreateMonitorNotificationRule" enabled
And new "CreateMonitorNotificationRule" request
Given new "CreateMonitorNotificationRule" request
And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}"]}, "name": "test rule", "recipients": ["slack-test-channel", "jira-test"]}, "type": "monitor-notification-rule"}}
When the request is sent
Then the response status is 200 OK
Expand Down Expand Up @@ -86,16 +84,14 @@ Feature: Monitors

@team:DataDog/monitor-app
Scenario: Delete a monitor notification rule returns "Not Found" response
Given operation "DeleteMonitorNotificationRule" enabled
And new "DeleteMonitorNotificationRule" request
Given new "DeleteMonitorNotificationRule" request
And request contains "rule_id" parameter with value "00000000-0000-1234-0000-000000000000"
When the request is sent
Then the response status is 404 Not Found

@team:DataDog/monitor-app
Scenario: Delete a monitor notification rule returns "OK" response
Given operation "DeleteMonitorNotificationRule" enabled
And there is a valid "monitor_notification_rule" in the system
Given there is a valid "monitor_notification_rule" in the system
And new "DeleteMonitorNotificationRule" request
And request contains "rule_id" parameter from "monitor_notification_rule.data.id"
When the request is sent
Expand Down Expand Up @@ -170,16 +166,14 @@ Feature: Monitors

@team:DataDog/monitor-app
Scenario: Get a monitor notification rule returns "Not Found" response
Given operation "GetMonitorNotificationRule" enabled
And new "GetMonitorNotificationRule" request
Given new "GetMonitorNotificationRule" request
And request contains "rule_id" parameter with value "00000000-0000-1234-0000-000000000000"
When the request is sent
Then the response status is 404 Not Found

@team:DataDog/monitor-app
Scenario: Get a monitor notification rule returns "OK" response
Given operation "GetMonitorNotificationRule" enabled
And there is a valid "monitor_notification_rule" in the system
Given there is a valid "monitor_notification_rule" in the system
And new "GetMonitorNotificationRule" request
And request contains "rule_id" parameter from "monitor_notification_rule.data.id"
When the request is sent
Expand Down Expand Up @@ -218,8 +212,7 @@ Feature: Monitors

@team:DataDog/monitor-app
Scenario: Get all monitor notification rules returns "OK" response
Given operation "GetMonitorNotificationRules" enabled
And there is a valid "monitor_notification_rule" in the system
Given there is a valid "monitor_notification_rule" in the system
And new "GetMonitorNotificationRules" request
When the request is sent
Then the response status is 200 OK
Expand All @@ -237,8 +230,7 @@ Feature: Monitors

@skip-validation @team:DataDog/monitor-app
Scenario: Update a monitor notification rule returns "Bad Request" response
Given operation "UpdateMonitorNotificationRule" enabled
And there is a valid "monitor_notification_rule" in the system
Given there is a valid "monitor_notification_rule" in the system
And new "UpdateMonitorNotificationRule" request
And request contains "rule_id" parameter from "monitor_notification_rule.data.id"
And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}", "host:abc"]}, "name": "updated rule", "recipients": ["@slack-test-channel"]}, "id": "{{ monitor_notification_rule.data.id }}", "type": "monitor-notification-rule"}}
Expand All @@ -247,17 +239,15 @@ Feature: Monitors

@team:DataDog/monitor-app
Scenario: Update a monitor notification rule returns "Not Found" response
Given operation "UpdateMonitorNotificationRule" enabled
And new "UpdateMonitorNotificationRule" request
Given new "UpdateMonitorNotificationRule" request
And request contains "rule_id" parameter with value "00000000-0000-1234-0000-000000000000"
And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}", "host:abc"]}, "name": "updated rule", "recipients": ["slack-test-channel", "jira-test"]}, "id": "00000000-0000-1234-0000-000000000000", "type": "monitor-notification-rule"}}
When the request is sent
Then the response status is 404 Not Found

@team:DataDog/monitor-app
Scenario: Update a monitor notification rule returns "OK" response
Given operation "UpdateMonitorNotificationRule" enabled
And there is a valid "monitor_notification_rule" in the system
Given there is a valid "monitor_notification_rule" in the system
And new "UpdateMonitorNotificationRule" request
And request contains "rule_id" parameter from "monitor_notification_rule.data.id"
And body with value {"data": {"attributes": {"filter": {"tags": ["test:{{ unique_lower }}", "host:abc"]}, "name": "updated rule", "recipients": ["slack-test-channel"]}, "id": "{{ monitor_notification_rule.data.id }}", "type": "monitor-notification-rule"}}
Expand Down
Loading