Skip to content

Monitor Notif rule GA #2445

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
15 changes: 0 additions & 15 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54853,9 +54853,6 @@ paths:
- monitors_read
x-undo:
type: safe
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 @@ -54916,9 +54913,6 @@ paths:
- name: rule_id
source: data.id
type: unsafe
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 @@ -54962,9 +54956,6 @@ paths:
- monitor_config_policy_write
x-undo:
type: idempotent
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 @@ -55021,9 +55012,6 @@ paths:
- monitors_read
x-undo:
type: safe
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 @@ -55084,9 +55072,6 @@ paths:
- monitor_config_policy_write
x-undo:
type: idempotent
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
30 changes: 10 additions & 20 deletions 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
8 changes: 0 additions & 8 deletions services/monitors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,6 @@ import { MonitorsApiV2 } from "@datadog/datadog-api-client-monitors";
import { v2 } from "@datadog/datadog-api-client-monitors";

const configuration = createConfiguration();
// Enable unstable operations
const configurationOpts = {
unstableOperations: {
"MonitorsApi.v2.getMonitorNotificationRules": true
}
}

const configuration = createConfiguration(configurationOpts);
const apiInstance = new MonitorsApiV2(configuration);
const params = {/* parameters */};

Expand Down
46 changes: 0 additions & 46 deletions services/monitors/src/v2/MonitorsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,6 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
): Promise<RequestContext> {
const _config = _options || this.configuration;

if (
!_config.unstableOperations[
"MonitorsApi.v2.createMonitorNotificationRule"
]
) {
throw new Error(
"Unstable operation 'createMonitorNotificationRule' is disabled. Enable it by setting `configuration.unstableOperations['MonitorsApi.v2.createMonitorNotificationRule'] = true`",
);
}

// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError("body", "createMonitorNotificationRule");
Expand Down Expand Up @@ -267,16 +257,6 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
): Promise<RequestContext> {
const _config = _options || this.configuration;

if (
!_config.unstableOperations[
"MonitorsApi.v2.deleteMonitorNotificationRule"
]
) {
throw new Error(
"Unstable operation 'deleteMonitorNotificationRule' is disabled. Enable it by setting `configuration.unstableOperations['MonitorsApi.v2.deleteMonitorNotificationRule'] = true`",
);
}

// verify required parameter 'ruleId' is not null or undefined
if (ruleId === null || ruleId === undefined) {
throw new RequiredError("ruleId", "deleteMonitorNotificationRule");
Expand Down Expand Up @@ -421,14 +401,6 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
): Promise<RequestContext> {
const _config = _options || this.configuration;

if (
!_config.unstableOperations["MonitorsApi.v2.getMonitorNotificationRule"]
) {
throw new Error(
"Unstable operation 'getMonitorNotificationRule' is disabled. Enable it by setting `configuration.unstableOperations['MonitorsApi.v2.getMonitorNotificationRule'] = true`",
);
}

// verify required parameter 'ruleId' is not null or undefined
if (ruleId === null || ruleId === undefined) {
throw new RequiredError("ruleId", "getMonitorNotificationRule");
Expand Down Expand Up @@ -483,14 +455,6 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
): Promise<RequestContext> {
const _config = _options || this.configuration;

if (
!_config.unstableOperations["MonitorsApi.v2.getMonitorNotificationRules"]
) {
throw new Error(
"Unstable operation 'getMonitorNotificationRules' is disabled. Enable it by setting `configuration.unstableOperations['MonitorsApi.v2.getMonitorNotificationRules'] = true`",
);
}

// Path Params
const localVarPath = "/api/v2/monitor/notification_rule";

Expand Down Expand Up @@ -738,16 +702,6 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
): Promise<RequestContext> {
const _config = _options || this.configuration;

if (
!_config.unstableOperations[
"MonitorsApi.v2.updateMonitorNotificationRule"
]
) {
throw new Error(
"Unstable operation 'updateMonitorNotificationRule' is disabled. Enable it by setting `configuration.unstableOperations['MonitorsApi.v2.updateMonitorNotificationRule'] = true`",
);
}

// verify required parameter 'ruleId' is not null or undefined
if (ruleId === null || ruleId === undefined) {
throw new RequiredError("ruleId", "updateMonitorNotificationRule");
Expand Down