From 0317ad02c5e2b49c77536d89cbadabcff6685c41 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 15 Apr 2025 21:55:11 +0000 Subject: [PATCH] Regenerate client from commit 808cf2c3 of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 446 ++++++++++++++++++ ...n-rule-returns-Bad-Request-response.frozen | 1 + ...tion-rule-returns-Bad-Request-response.yml | 26 + ...tification-rule-returns-OK-response.frozen | 1 + ...-notification-rule-returns-OK-response.yml | 46 ++ ...ion-rule-returns-Not-Found-response.frozen | 1 + ...cation-rule-returns-Not-Found-response.yml | 20 + ...tification-rule-returns-OK-response.frozen | 1 + ...-notification-rule-returns-OK-response.yml | 64 +++ ...ion-rule-returns-Not-Found-response.frozen | 1 + ...cation-rule-returns-Not-Found-response.yml | 20 + ...tification-rule-returns-OK-response.frozen | 1 + ...-notification-rule-returns-OK-response.yml | 67 +++ ...ification-rules-returns-OK-response.frozen | 1 + ...notification-rules-returns-OK-response.yml | 67 +++ ...n-rule-returns-Bad-Request-response.frozen | 1 + ...tion-rule-returns-Bad-Request-response.yml | 70 +++ ...ion-rule-returns-Not-Found-response.frozen | 1 + ...cation-rule-returns-Not-Found-response.yml | 25 + ...tification-rule-returns-OK-response.frozen | 1 + ...-notification-rule-returns-OK-response.yml | 72 +++ ...n-rule-returns-Bad-Request-response.frozen | 1 + ...tion-rule-returns-Bad-Request-response.yml | 26 + ...tification-rule-returns-OK-response.frozen | 1 + ...-notification-rule-returns-OK-response.yml | 46 ++ ...ion-rule-returns-Not-Found-response.frozen | 1 + ...cation-rule-returns-Not-Found-response.yml | 20 + ...tification-rule-returns-OK-response.frozen | 1 + ...-notification-rule-returns-OK-response.yml | 64 +++ ...ion-rule-returns-Not-Found-response.frozen | 1 + ...cation-rule-returns-Not-Found-response.yml | 20 + ...tification-rule-returns-OK-response.frozen | 1 + ...-notification-rule-returns-OK-response.yml | 67 +++ ...ification-rules-returns-OK-response.frozen | 1 + ...notification-rules-returns-OK-response.yml | 67 +++ ...n-rule-returns-Bad-Request-response.frozen | 1 + ...tion-rule-returns-Bad-Request-response.yml | 70 +++ ...ion-rule-returns-Not-Found-response.frozen | 1 + ...cation-rule-returns-Not-Found-response.yml | 25 + ...tification-rule-returns-OK-response.frozen | 1 + ...-notification-rule-returns-OK-response.yml | 72 +++ .../monitors/CreateMonitorNotificationRule.rb | 26 + .../monitors/DeleteMonitorNotificationRule.rb | 11 + .../v2/monitors/GetMonitorNotificationRule.rb | 11 + .../monitors/GetMonitorNotificationRules.rb | 8 + .../monitors/UpdateMonitorNotificationRule.rb | 30 ++ features/scenarios_model_mapping.rb | 17 + features/v2/given.json | 12 + features/v2/monitors.feature | 92 ++++ features/v2/undo.json | 37 ++ lib/datadog_api_client/configuration.rb | 5 + lib/datadog_api_client/inflector.rb | 16 + lib/datadog_api_client/v2/api/monitors_api.rb | 363 ++++++++++++++ .../monitor_notification_rule_attributes.rb | 147 ++++++ ...onitor_notification_rule_create_request.rb | 123 +++++ ...r_notification_rule_create_request_data.rb | 133 ++++++ .../models/monitor_notification_rule_data.rb | 135 ++++++ .../monitor_notification_rule_filter.rb | 62 +++ .../monitor_notification_rule_filter_tags.rb | 108 +++++ ...monitor_notification_rule_list_response.rb | 119 +++++ ...monitor_notification_rule_relationships.rb | 105 +++++ ...ification_rule_relationships_created_by.rb | 113 +++++ ...tion_rule_relationships_created_by_data.rb | 115 +++++ ...monitor_notification_rule_resource_type.rb | 26 + .../monitor_notification_rule_response.rb | 117 +++++ ...r_notification_rule_response_attributes.rb | 184 ++++++++ ...otification_rule_response_included_item.rb | 62 +++ ...onitor_notification_rule_update_request.rb | 123 +++++ ...r_notification_rule_update_request_data.rb | 154 ++++++ 70 files changed, 3878 insertions(+), 4 deletions(-) create mode 100644 cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-OK-response.yml create mode 100644 cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-OK-response.yml create mode 100644 cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-OK-response.yml create mode 100644 cassettes/features/v2/monitor_notification_rules/Get-all-monitor-notification-rules-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Get-all-monitor-notification-rules-returns-OK-response.yml create mode 100644 cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-OK-response.yml create mode 100644 cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-OK-response.yml create mode 100644 cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-OK-response.yml create mode 100644 cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-OK-response.yml create mode 100644 cassettes/features/v2/monitors/Get-all-monitor-notification-rules-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitors/Get-all-monitor-notification-rules-returns-OK-response.yml create mode 100644 cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Bad-Request-response.frozen create mode 100644 cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Bad-Request-response.yml create mode 100644 cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Not-Found-response.frozen create mode 100644 cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Not-Found-response.yml create mode 100644 cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-OK-response.yml create mode 100644 examples/v2/monitors/CreateMonitorNotificationRule.rb create mode 100644 examples/v2/monitors/DeleteMonitorNotificationRule.rb create mode 100644 examples/v2/monitors/GetMonitorNotificationRule.rb create mode 100644 examples/v2/monitors/GetMonitorNotificationRules.rb create mode 100644 examples/v2/monitors/UpdateMonitorNotificationRule.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_create_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_data.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_filter.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_filter_tags.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_list_response.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_relationships_created_by.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_relationships_created_by_data.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_resource_type.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_response.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_response_included_item.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_update_request.rb create mode 100644 lib/datadog_api_client/v2/models/monitor_notification_rule_update_request_data.rb diff --git a/.apigentools-info b/.apigentools-info index d051c64d022f..98e651f18b42 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-04-15 16:46:15.803004", - "spec_repo_commit": "2d6e55b2" + "regenerated": "2025-04-15 21:54:41.547228", + "spec_repo_commit": "808cf2c3" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-04-15 16:46:15.819348", - "spec_repo_commit": "2d6e55b2" + "regenerated": "2025-04-15 21:54:41.562900", + "spec_repo_commit": "808cf2c3" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 6f7970cbbecb..12445d025208 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -21371,6 +21371,201 @@ components: type: $ref: '#/components/schemas/MonitorDowntimeMatchResourceType' type: object + MonitorNotificationRuleAttributes: + additionalProperties: false + description: Attributes of the monitor notification rule. + properties: + filter: + $ref: '#/components/schemas/MonitorNotificationRuleFilter' + name: + $ref: '#/components/schemas/MonitorNotificationRuleName' + recipients: + $ref: '#/components/schemas/MonitorNotificationRuleRecipients' + required: + - name + - recipients + type: object + MonitorNotificationRuleCreateRequest: + description: Request for creating a monitor notification rule. + properties: + data: + $ref: '#/components/schemas/MonitorNotificationRuleCreateRequestData' + required: + - data + type: object + MonitorNotificationRuleCreateRequestData: + description: Object to create a monitor notification rule. + properties: + attributes: + $ref: '#/components/schemas/MonitorNotificationRuleAttributes' + type: + $ref: '#/components/schemas/MonitorNotificationRuleResourceType' + required: + - attributes + type: object + MonitorNotificationRuleData: + description: Monitor notification rule data. + properties: + attributes: + $ref: '#/components/schemas/MonitorNotificationRuleResponseAttributes' + id: + $ref: '#/components/schemas/MonitorNotificationRuleId' + relationships: + $ref: '#/components/schemas/MonitorNotificationRuleRelationships' + type: + $ref: '#/components/schemas/MonitorNotificationRuleResourceType' + type: object + MonitorNotificationRuleFilter: + description: Filter used to associate the notification rule with monitors. + oneOf: + - $ref: '#/components/schemas/MonitorNotificationRuleFilterTags' + MonitorNotificationRuleFilterTags: + additionalProperties: false + description: Filter monitors by tags. Monitors must match all tags. + properties: + tags: + description: A list of monitor tags. + example: + - team:product + - host:abc + items: + maxLength: 255 + type: string + maxItems: 20 + minItems: 1 + type: array + uniqueItems: true + required: + - tags + type: object + MonitorNotificationRuleId: + description: The ID of the monitor notification rule. + example: 00000000-0000-1234-0000-000000000000 + type: string + MonitorNotificationRuleListResponse: + description: Response for retrieving all monitor notification rules. + properties: + data: + description: A list of monitor notification rules. + items: + $ref: '#/components/schemas/MonitorNotificationRuleData' + type: array + included: + description: Array of objects related to the monitor notification rules. + items: + $ref: '#/components/schemas/MonitorNotificationRuleResponseIncludedItem' + type: array + type: object + MonitorNotificationRuleName: + description: The name of the monitor notification rule. + example: A notification rule name + maxLength: 1000 + minLength: 1 + type: string + MonitorNotificationRuleRecipients: + description: A list of recipients to notify. Uses the same format as the monitor + `message` field. Must not start with an '@'. + example: + - slack-test-channel + - jira-test + items: + description: individual recipient. + maxLength: 255 + type: string + maxItems: 20 + minItems: 1 + type: array + uniqueItems: true + MonitorNotificationRuleRelationships: + description: All relationships associated with monitor notification rule. + properties: + created_by: + $ref: '#/components/schemas/MonitorNotificationRuleRelationshipsCreatedBy' + type: object + MonitorNotificationRuleRelationshipsCreatedBy: + description: The user who created the monitor notification rule. + properties: + data: + $ref: '#/components/schemas/MonitorNotificationRuleRelationshipsCreatedByData' + type: object + MonitorNotificationRuleRelationshipsCreatedByData: + description: Data for the user who created the monitor notification rule. + nullable: true + properties: + id: + description: User ID of the monitor notification rule creator. + example: 00000000-0000-1234-0000-000000000000 + type: string + type: + $ref: '#/components/schemas/UsersType' + type: object + MonitorNotificationRuleResourceType: + default: monitor-notification-rule + description: Monitor notification rule resource type. + enum: + - monitor-notification-rule + example: monitor-notification-rule + type: string + x-enum-varnames: + - MONITOR_NOTIFICATION_RULE + MonitorNotificationRuleResponse: + description: A monitor notification rule. + properties: + data: + $ref: '#/components/schemas/MonitorNotificationRuleData' + included: + description: Array of objects related to the monitor notification rule that + the user requested. + items: + $ref: '#/components/schemas/MonitorNotificationRuleResponseIncludedItem' + type: array + type: object + MonitorNotificationRuleResponseAttributes: + additionalProperties: {} + description: Attributes of the monitor notification rule. + properties: + created: + description: Creation time of the monitor notification rule. + example: 2020-01-02 03:04:00+00:00 + format: date-time + type: string + filter: + $ref: '#/components/schemas/MonitorNotificationRuleFilter' + modified: + description: Time the monitor notification rule was last modified. + example: 2020-01-02 03:04:00+00:00 + format: date-time + type: string + name: + $ref: '#/components/schemas/MonitorNotificationRuleName' + recipients: + $ref: '#/components/schemas/MonitorNotificationRuleRecipients' + type: object + MonitorNotificationRuleResponseIncludedItem: + description: An object related to a monitor notification rule. + oneOf: + - $ref: '#/components/schemas/User' + MonitorNotificationRuleUpdateRequest: + description: Request for updating a monitor notification rule. + properties: + data: + $ref: '#/components/schemas/MonitorNotificationRuleUpdateRequestData' + required: + - data + type: object + MonitorNotificationRuleUpdateRequestData: + description: Object to update a monitor notification rule. + properties: + attributes: + $ref: '#/components/schemas/MonitorNotificationRuleAttributes' + id: + $ref: '#/components/schemas/MonitorNotificationRuleId' + type: + $ref: '#/components/schemas/MonitorNotificationRuleResourceType' + required: + - id + - attributes + type: object MonitorTrigger: description: Trigger a workflow from a Monitor. For automatic triggering a handle must be configured and the workflow must be published. @@ -35806,6 +36001,7 @@ components: incident_settings_write: Configure Incident Settings. incident_write: Create, view, and manage incidents in Datadog. metrics_read: View custom metrics. + monitor_config_policy_write: Edit and delete monitor configuration. monitors_downtime: Set downtimes to suppress alerts from any monitor in an organization. Mute and unmute monitors. The ability to write monitors is not required to set downtimes. @@ -45721,6 +45917,256 @@ paths: x-permission: operator: OPEN permissions: [] + /api/v2/monitor/notification_rule: + get: + description: Returns a list of all monitor notification rules. + operationId: GetMonitorNotificationRules + parameters: + - description: 'Comma-separated list of resource paths for related resources + to include in the response. Supported resource + + path is `created_by`.' + in: query + name: include + required: false + schema: + example: created_by + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorNotificationRuleListResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_read + summary: Get all monitor notification rules + tags: + - Monitors + x-permission: + 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 + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorNotificationRuleCreateRequest' + description: Request body to create a monitor notification rule. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorNotificationRuleResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitor_config_policy_write + summary: Create a monitor notification rule + tags: + - Monitors + x-permission: + 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`. + operationId: DeleteMonitorNotificationRule + parameters: + - description: ID of the monitor notification rule to delete. + in: path + name: rule_id + required: true + schema: + type: string + responses: + '204': + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitor_config_policy_write + summary: Delete a monitor notification rule + tags: + - Monitors + x-permission: + 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 + parameters: + - description: ID of the monitor notification rule to fetch. + in: path + name: rule_id + required: true + schema: + type: string + - description: 'Comma-separated list of resource paths for related resources + to include in the response. Supported resource + + path is `created_by`.' + in: query + name: include + required: false + schema: + example: created_by + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorNotificationRuleResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_read + summary: Get a monitor notification rule + tags: + - Monitors + x-permission: + 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 + parameters: + - description: ID of the monitor notification rule to update. + in: path + name: rule_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorNotificationRuleUpdateRequest' + description: Request body to update the monitor notification rule. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorNotificationRuleResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitor_config_policy_write + summary: Update a monitor notification rule + tags: + - Monitors + x-codegen-request-body-name: body + x-permission: + 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. diff --git a/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-Bad-Request-response.frozen b/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..55dce406e380 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:02.871Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-Bad-Request-response.yml b/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..9e02ee8ecd75 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-Bad-Request-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:02 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-create_a_monitor_notification_rule_returns_bad_request_response-1743713882","host:abc"]},"name":"test + rule","recipients":["@slack-test-channel","@jira-test"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"errors":["Invalid recipients: Recipient handle should not start with + ''@''"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..d20cd994c4d3 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:03.005Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-OK-response.yml b/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..ed548eab0245 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Create-a-monitor-notification-rule-returns-OK-response.yml @@ -0,0 +1,46 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:03 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-create_a_monitor_notification_rule_returns_ok_response-1743713883"]},"name":"test + rule","recipients":["slack-test-channel","jira-test"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","id":"55959a04-463a-4579-8386-8c2ca120aa52","attributes":{"creator_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","filter":{"tags":["test:test-create_a_monitor_notification_rule_returns_ok_response-1743713883"]},"created_at":"2025-04-03T20:58:03.137650+00:00","recipients":["slack-test-channel","jira-test"],"name":"test + rule","modified_at":"1970-01-01T00:00:00+00:00"}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 03 Apr 2025 20:58:03 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/55959a04-463a-4579-8386-8c2ca120aa52 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..3c3eea7d14c4 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:03.324Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-Not-Found-response.yml b/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-Not-Found-response.yml new file mode 100644 index 000000000000..3d5466071d3a --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:03 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/00000000-0000-1234-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["Monitor notification rule not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..66abae37fd4a --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:03.428Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-OK-response.yml b/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..833bd0b966f8 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Delete-a-monitor-notification-rule-returns-OK-response.yml @@ -0,0 +1,64 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:03 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-delete_a_monitor_notification_rule_returns_ok_response-1743713883"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","id":"cef4c2c7-27b3-4259-9bdd-ec434b4a8a0e","attributes":{"creator_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","name":"test + rule","created_at":"2025-04-03T20:58:03.555501+00:00","modified_at":"1970-01-01T00:00:00+00:00","filter":{"tags":["app:test-delete_a_monitor_notification_rule_returns_ok_response-1743713883"]},"recipients":["slack-monitor-app"]}}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 03 Apr 2025 20:58:03 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/cef4c2c7-27b3-4259-9bdd-ec434b4a8a0e + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Thu, 03 Apr 2025 20:58:03 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/cef4c2c7-27b3-4259-9bdd-ec434b4a8a0e + response: + body: + encoding: UTF-8 + string: '{"errors":["Monitor notification rule not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..a8e729593b8a --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:03.884Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-Not-Found-response.yml b/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-Not-Found-response.yml new file mode 100644 index 000000000000..8e020f3af23b --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:03 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/00000000-0000-1234-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["Monitor notification rule not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..3563f6784075 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:04.007Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-OK-response.yml b/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..6c23d64a4c29 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Get-a-monitor-notification-rule-returns-OK-response.yml @@ -0,0 +1,67 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-get_a_monitor_notification_rule_returns_ok_response-1743713884"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"filter":{"tags":["app:test-get_a_monitor_notification_rule_returns_ok_response-1743713884"]},"created_at":"2025-04-03T20:58:04.156763+00:00","recipients":["slack-monitor-app"],"modified_at":"1970-01-01T00:00:00+00:00","creator_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","name":"test + rule"},"id":"8e0ab047-d891-476c-8fb1-da4d80ddc129"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 03 Apr 2025 20:58:04 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/8e0ab047-d891-476c-8fb1-da4d80ddc129 + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"creator_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","name":"test + rule","created_at":"2025-04-03T20:58:04.156763+00:00","recipients":["slack-monitor-app"],"modified_at":"2025-04-03T20:58:04.164001+00:00","filter":{"tags":["app:test-get_a_monitor_notification_rule_returns_ok_response-1743713884"]}},"id":"8e0ab047-d891-476c-8fb1-da4d80ddc129"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 03 Apr 2025 20:58:04 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/8e0ab047-d891-476c-8fb1-da4d80ddc129 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitor_notification_rules/Get-all-monitor-notification-rules-returns-OK-response.frozen b/cassettes/features/v2/monitor_notification_rules/Get-all-monitor-notification-rules-returns-OK-response.frozen new file mode 100644 index 000000000000..1b1c436dada8 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Get-all-monitor-notification-rules-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:04.487Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Get-all-monitor-notification-rules-returns-OK-response.yml b/cassettes/features/v2/monitor_notification_rules/Get-all-monitor-notification-rules-returns-OK-response.yml new file mode 100644 index 000000000000..5153566ca49a --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Get-all-monitor-notification-rules-returns-OK-response.yml @@ -0,0 +1,67 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-get_all_monitor_notification_rules_returns_ok_response-1743713884"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"filter":{"tags":["app:test-get_all_monitor_notification_rules_returns_ok_response-1743713884"]},"recipients":["slack-monitor-app"],"creator_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","modified_at":"1970-01-01T00:00:00+00:00","name":"test + rule","created_at":"2025-04-03T20:58:04.604345+00:00"},"id":"6e5b7a93-37b5-44b8-9098-2d31b6dd84b6"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 03 Apr 2025 20:58:04 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":[{"type":"monitor-notification-rule","id":"6e5b7a93-37b5-44b8-9098-2d31b6dd84b6","attributes":{"creator_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","name":"test + rule","recipients":["slack-monitor-app"],"created_at":"2025-04-03T20:58:04.604345+00:00","filter":{"tags":["app:test-get_all_monitor_notification_rules_returns_ok_response-1743713884"]},"modified_at":"2025-04-03T20:58:04.616893+00:00"}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 03 Apr 2025 20:58:04 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/6e5b7a93-37b5-44b8-9098-2d31b6dd84b6 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Bad-Request-response.frozen b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..f00bc0a89c79 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:04.953Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Bad-Request-response.yml b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..d9350c7c5050 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Bad-Request-response.yml @@ -0,0 +1,70 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_bad_request_response-1743713884"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_bad_request_response-1743713884"]},"recipients":["slack-monitor-app"],"creator_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","modified_at":"1970-01-01T00:00:00+00:00","name":"test + rule","created_at":"2025-04-03T20:58:05.080336+00:00"},"id":"30523422-5ed5-477d-b310-211ab89031dc"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 03 Apr 2025 20:58:04 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_bad_request_response-1743713884","host:abc"]},"name":"updated + rule","recipients":["@slack-test-channel"]},"id":"30523422-5ed5-477d-b310-211ab89031dc","type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/30523422-5ed5-477d-b310-211ab89031dc + response: + body: + encoding: UTF-8 + string: '{"errors":["Invalid recipients: Recipient handle should not start with + ''@''"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +- recorded_at: Thu, 03 Apr 2025 20:58:04 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/30523422-5ed5-477d-b310-211ab89031dc + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..becae1657e7d --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:05.447Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Not-Found-response.yml b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Not-Found-response.yml new file mode 100644 index 000000000000..af5ec6aee454 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:05 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_not_found_response-1743713885","host:abc"]},"name":"updated + rule","recipients":["slack-test-channel","jira-test"]},"id":"00000000-0000-1234-0000-000000000000","type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/00000000-0000-1234-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["Monitor notification rule not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..bb1ae0378851 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-03T20:58:05.597Z \ No newline at end of file diff --git a/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-OK-response.yml b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..5d7b27fb54f3 --- /dev/null +++ b/cassettes/features/v2/monitor_notification_rules/Update-a-monitor-notification-rule-returns-OK-response.yml @@ -0,0 +1,72 @@ +http_interactions: +- recorded_at: Thu, 03 Apr 2025 20:58:05 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_ok_response-1743713885"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"recipients":["slack-monitor-app"],"creator_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0","created_at":"2025-04-03T20:58:05.737805+00:00","modified_at":"1970-01-01T00:00:00+00:00","filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_ok_response-1743713885"]},"name":"test + rule"},"id":"f81c2483-18e3-4db3-ad1d-56e2e0ce41ef"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 03 Apr 2025 20:58:05 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_ok_response-1743713885","host:abc"]},"name":"updated + rule","recipients":["slack-test-channel"]},"id":"f81c2483-18e3-4db3-ad1d-56e2e0ce41ef","type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/f81c2483-18e3-4db3-ad1d-56e2e0ce41ef + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"recipients":["slack-test-channel"],"created_at":"2025-04-03T20:58:05.737806+00:00","filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_ok_response-1743713885","host:abc"]},"name":"updated + rule","modified_at":"2025-04-03T20:58:05.889695+00:00","creator_uuid":"3ad549bf-eba0-11e9-a77a-0705486660d0"},"id":"f81c2483-18e3-4db3-ad1d-56e2e0ce41ef"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 03 Apr 2025 20:58:05 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/f81c2483-18e3-4db3-ad1d-56e2e0ce41ef + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-Bad-Request-response.frozen b/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..454c4bb29a36 --- /dev/null +++ b/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:43.940Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-Bad-Request-response.yml b/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..a51c9490b51b --- /dev/null +++ b/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-Bad-Request-response.yml @@ -0,0 +1,26 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:43 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-create_a_monitor_notification_rule_returns_bad_request_response-1744280983","host:abc"]},"name":"test + rule","recipients":["@slack-test-channel","@jira-test"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"errors":["Invalid recipients: Recipient handle should not start with + ''@''"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..86ab3de39bc5 --- /dev/null +++ b/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:44.273Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-OK-response.yml b/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..179b174264fb --- /dev/null +++ b/cassettes/features/v2/monitors/Create-a-monitor-notification-rule-returns-OK-response.yml @@ -0,0 +1,46 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:44 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-create_a_monitor_notification_rule_returns_ok_response-1744280984"]},"name":"test + rule","recipients":["slack-test-channel","jira-test"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"filter":{"tags":["test:test-create_a_monitor_notification_rule_returns_ok_response-1744280984"]},"recipients":["slack-test-channel","jira-test"],"name":"test + rule","created_at":"2025-04-10T10:29:44.595607+00:00","modified_at":"1970-01-01T00:00:00+00:00"},"id":"a3323ef6-2a04-4ef9-8de8-cbcff5c3c203","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 10 Apr 2025 10:29:44 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/a3323ef6-2a04-4ef9-8de8-cbcff5c3c203 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..2590d462ecda --- /dev/null +++ b/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:46.694Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-Not-Found-response.yml b/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-Not-Found-response.yml new file mode 100644 index 000000000000..da33edcd8107 --- /dev/null +++ b/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:46 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/00000000-0000-1234-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["Monitor Notification Rule not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..c1dc706f2cb1 --- /dev/null +++ b/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:47.053Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-OK-response.yml b/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..50faee5387a1 --- /dev/null +++ b/cassettes/features/v2/monitors/Delete-a-monitor-notification-rule-returns-OK-response.yml @@ -0,0 +1,64 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:47 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-delete_a_monitor_notification_rule_returns_ok_response-1744280987"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}},"attributes":{"filter":{"tags":["app:test-delete_a_monitor_notification_rule_returns_ok_response-1744280987"]},"created_at":"2025-04-10T10:29:47.326243+00:00","name":"test + rule","recipients":["slack-monitor-app"],"modified_at":"1970-01-01T00:00:00+00:00"},"id":"66e399af-c07e-414d-b4f2-93e196d7b7b7"},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 10 Apr 2025 10:29:47 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/66e399af-c07e-414d-b4f2-93e196d7b7b7 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- recorded_at: Thu, 10 Apr 2025 10:29:47 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/66e399af-c07e-414d-b4f2-93e196d7b7b7 + response: + body: + encoding: UTF-8 + string: '{"errors":["Monitor Notification Rule not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..4d52b4ac383e --- /dev/null +++ b/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:52.213Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-Not-Found-response.yml b/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-Not-Found-response.yml new file mode 100644 index 000000000000..e2760e9e5edd --- /dev/null +++ b/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:52 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/00000000-0000-1234-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["Monitor Notification Rule not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..23fa2591c917 --- /dev/null +++ b/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:52.537Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-OK-response.yml b/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..d20de2c26816 --- /dev/null +++ b/cassettes/features/v2/monitors/Get-a-monitor-notification-rule-returns-OK-response.yml @@ -0,0 +1,67 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:52 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-get_a_monitor_notification_rule_returns_ok_response-1744280992"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"created_at":"2025-04-10T10:29:52.938158+00:00","filter":{"tags":["app:test-get_a_monitor_notification_rule_returns_ok_response-1744280992"]},"recipients":["slack-monitor-app"],"name":"test + rule","modified_at":"1970-01-01T00:00:00+00:00"},"id":"97afb4ac-6953-445f-9a0a-d225673449a6","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 10 Apr 2025 10:29:52 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/97afb4ac-6953-445f-9a0a-d225673449a6 + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"name":"test + rule","created_at":"2025-04-10T10:29:52.938158+00:00","recipients":["slack-monitor-app"],"filter":{"tags":["app:test-get_a_monitor_notification_rule_returns_ok_response-1744280992"]},"modified_at":"2025-04-10T10:29:52.948837+00:00"},"id":"97afb4ac-6953-445f-9a0a-d225673449a6"}} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 10 Apr 2025 10:29:52 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/97afb4ac-6953-445f-9a0a-d225673449a6 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Get-all-monitor-notification-rules-returns-OK-response.frozen b/cassettes/features/v2/monitors/Get-all-monitor-notification-rules-returns-OK-response.frozen new file mode 100644 index 000000000000..2681e3677398 --- /dev/null +++ b/cassettes/features/v2/monitors/Get-all-monitor-notification-rules-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:54.937Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Get-all-monitor-notification-rules-returns-OK-response.yml b/cassettes/features/v2/monitors/Get-all-monitor-notification-rules-returns-OK-response.yml new file mode 100644 index 000000000000..49fb1786cff0 --- /dev/null +++ b/cassettes/features/v2/monitors/Get-all-monitor-notification-rules-returns-OK-response.yml @@ -0,0 +1,67 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:54 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-get_all_monitor_notification_rules_returns_ok_response-1744280994"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"name":"test + rule","filter":{"tags":["app:test-get_all_monitor_notification_rules_returns_ok_response-1744280994"]},"recipients":["slack-monitor-app"],"modified_at":"1970-01-01T00:00:00+00:00","created_at":"2025-04-10T10:29:55.362004+00:00"},"relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}},"id":"b7122864-6517-45d3-8dc1-f226a08dd8f4"},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 10 Apr 2025 10:29:54 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":[{"type":"monitor-notification-rule","attributes":{"filter":{"tags":["app:test-get_all_monitor_notification_rules_returns_ok_response-1744280994"]},"name":"test + rule","recipients":["slack-monitor-app"],"modified_at":"2025-04-10T10:29:55.373154+00:00","created_at":"2025-04-10T10:29:55.362004+00:00"},"id":"b7122864-6517-45d3-8dc1-f226a08dd8f4"}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 10 Apr 2025 10:29:54 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/b7122864-6517-45d3-8dc1-f226a08dd8f4 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Bad-Request-response.frozen b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..c547acf2ee0f --- /dev/null +++ b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:56.210Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Bad-Request-response.yml b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..259c8a32927c --- /dev/null +++ b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Bad-Request-response.yml @@ -0,0 +1,70 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:56 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_bad_request_response-1744280996"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_bad_request_response-1744280996"]},"created_at":"2025-04-10T10:29:56.523436+00:00","recipients":["slack-monitor-app"],"name":"test + rule","modified_at":"1970-01-01T00:00:00+00:00"},"id":"f26ba0a6-1e84-4984-b061-4172a25a1332","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 10 Apr 2025 10:29:56 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_bad_request_response-1744280996","host:abc"]},"name":"updated + rule","recipients":["@slack-test-channel"]},"id":"f26ba0a6-1e84-4984-b061-4172a25a1332","type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/f26ba0a6-1e84-4984-b061-4172a25a1332 + response: + body: + encoding: UTF-8 + string: '{"errors":["Invalid recipients: Recipient handle should not start with + ''@''"]}' + headers: + Content-Type: + - application/json + status: + code: 400 + message: Bad Request +- recorded_at: Thu, 10 Apr 2025 10:29:56 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/f26ba0a6-1e84-4984-b061-4172a25a1332 + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..2eae355308b2 --- /dev/null +++ b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:57.263Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Not-Found-response.yml b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Not-Found-response.yml new file mode 100644 index 000000000000..c1de57e20f2e --- /dev/null +++ b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:57 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_not_found_response-1744280997","host:abc"]},"name":"updated + rule","recipients":["slack-test-channel","jira-test"]},"id":"00000000-0000-1234-0000-000000000000","type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/00000000-0000-1234-0000-000000000000 + response: + body: + encoding: UTF-8 + string: '{"errors":["Monitor Notification Rule not found"]}' + headers: + Content-Type: + - application/json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..b7d42a448905 --- /dev/null +++ b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-04-10T10:29:57.629Z \ No newline at end of file diff --git a/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-OK-response.yml b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..dc2ac5e175e2 --- /dev/null +++ b/cassettes/features/v2/monitors/Update-a-monitor-notification-rule-returns-OK-response.yml @@ -0,0 +1,72 @@ +http_interactions: +- recorded_at: Thu, 10 Apr 2025 10:29:57 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_ok_response-1744280997"]},"name":"test + rule","recipients":["slack-monitor-app"]},"type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","attributes":{"name":"test + rule","recipients":["slack-monitor-app"],"modified_at":"1970-01-01T00:00:00+00:00","filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_ok_response-1744280997"]},"created_at":"2025-04-10T10:29:57.930349+00:00"},"id":"da2c8a3b-94ea-49be-a85b-39c5eff99d6a","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 10 Apr 2025 10:29:57 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_ok_response-1744280997","host:abc"]},"name":"updated + rule","recipients":["slack-test-channel"]},"id":"da2c8a3b-94ea-49be-a85b-39c5eff99d6a","type":"monitor-notification-rule"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/da2c8a3b-94ea-49be-a85b-39c5eff99d6a + response: + body: + encoding: UTF-8 + string: '{"data":{"type":"monitor-notification-rule","id":"da2c8a3b-94ea-49be-a85b-39c5eff99d6a","attributes":{"modified_at":"2025-04-10T10:29:58.320928+00:00","recipients":["slack-test-channel"],"name":"updated + rule","filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_ok_response-1744280997","host:abc"]},"created_at":"2025-04-10T10:29:57.930349+00:00"},"relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Thu, 10 Apr 2025 10:29:57 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/da2c8a3b-94ea-49be-a85b-39c5eff99d6a + response: + body: + encoding: UTF-8 + string: '' + headers: + Content-Type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/monitors/CreateMonitorNotificationRule.rb b/examples/v2/monitors/CreateMonitorNotificationRule.rb new file mode 100644 index 000000000000..73e7ecb633c9 --- /dev/null +++ b/examples/v2/monitors/CreateMonitorNotificationRule.rb @@ -0,0 +1,26 @@ +# Create a monitor notification rule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_monitor_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::MonitorsAPI.new + +body = DatadogAPIClient::V2::MonitorNotificationRuleCreateRequest.new({ + data: DatadogAPIClient::V2::MonitorNotificationRuleCreateRequestData.new({ + attributes: DatadogAPIClient::V2::MonitorNotificationRuleAttributes.new({ + filter: DatadogAPIClient::V2::MonitorNotificationRuleFilterTags.new({ + tags: [ + "test:example-monitor", + ], + }), + name: "test rule", + recipients: [ + "slack-test-channel", + "jira-test", + ], + }), + type: DatadogAPIClient::V2::MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE, + }), +}) +p api_instance.create_monitor_notification_rule(body) diff --git a/examples/v2/monitors/DeleteMonitorNotificationRule.rb b/examples/v2/monitors/DeleteMonitorNotificationRule.rb new file mode 100644 index 000000000000..e6f2b2b8dbf4 --- /dev/null +++ b/examples/v2/monitors/DeleteMonitorNotificationRule.rb @@ -0,0 +1,11 @@ +# Delete a monitor notification rule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_monitor_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::MonitorsAPI.new + +# there is a valid "monitor_notification_rule" in the system +MONITOR_NOTIFICATION_RULE_DATA_ID = ENV["MONITOR_NOTIFICATION_RULE_DATA_ID"] +api_instance.delete_monitor_notification_rule(MONITOR_NOTIFICATION_RULE_DATA_ID) diff --git a/examples/v2/monitors/GetMonitorNotificationRule.rb b/examples/v2/monitors/GetMonitorNotificationRule.rb new file mode 100644 index 000000000000..d25dbc52e862 --- /dev/null +++ b/examples/v2/monitors/GetMonitorNotificationRule.rb @@ -0,0 +1,11 @@ +# Get a monitor notification rule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_monitor_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::MonitorsAPI.new + +# there is a valid "monitor_notification_rule" in the system +MONITOR_NOTIFICATION_RULE_DATA_ID = ENV["MONITOR_NOTIFICATION_RULE_DATA_ID"] +p api_instance.get_monitor_notification_rule(MONITOR_NOTIFICATION_RULE_DATA_ID) diff --git a/examples/v2/monitors/GetMonitorNotificationRules.rb b/examples/v2/monitors/GetMonitorNotificationRules.rb new file mode 100644 index 000000000000..a633e0712fb1 --- /dev/null +++ b/examples/v2/monitors/GetMonitorNotificationRules.rb @@ -0,0 +1,8 @@ +# Get all monitor notification rules returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_monitor_notification_rules".to_sym] = true +end +api_instance = DatadogAPIClient::V2::MonitorsAPI.new +p api_instance.get_monitor_notification_rules() diff --git a/examples/v2/monitors/UpdateMonitorNotificationRule.rb b/examples/v2/monitors/UpdateMonitorNotificationRule.rb new file mode 100644 index 000000000000..4b6c5f851bec --- /dev/null +++ b/examples/v2/monitors/UpdateMonitorNotificationRule.rb @@ -0,0 +1,30 @@ +# Update a monitor notification rule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_monitor_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::MonitorsAPI.new + +# there is a valid "monitor_notification_rule" in the system +MONITOR_NOTIFICATION_RULE_DATA_ID = ENV["MONITOR_NOTIFICATION_RULE_DATA_ID"] + +body = DatadogAPIClient::V2::MonitorNotificationRuleUpdateRequest.new({ + data: DatadogAPIClient::V2::MonitorNotificationRuleUpdateRequestData.new({ + attributes: DatadogAPIClient::V2::MonitorNotificationRuleAttributes.new({ + filter: DatadogAPIClient::V2::MonitorNotificationRuleFilterTags.new({ + tags: [ + "test:example-monitor", + "host:abc", + ], + }), + name: "updated rule", + recipients: [ + "slack-test-channel", + ], + }), + id: MONITOR_NOTIFICATION_RULE_DATA_ID, + type: DatadogAPIClient::V2::MonitorNotificationRuleResourceType::MONITOR_NOTIFICATION_RULE, + }), +}) +p api_instance.update_monitor_notification_rule(MONITOR_NOTIFICATION_RULE_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 732e6cbc585d..08ae06c5cda8 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1733,6 +1733,23 @@ "content_encoding" => "MetricContentEncoding", "body" => "MetricPayload", }, + "v2.GetMonitorNotificationRules" => { + "include" => "String", + }, + "v2.CreateMonitorNotificationRule" => { + "body" => "MonitorNotificationRuleCreateRequest", + }, + "v2.DeleteMonitorNotificationRule" => { + "rule_id" => "String", + }, + "v2.GetMonitorNotificationRule" => { + "rule_id" => "String", + "include" => "String", + }, + "v2.UpdateMonitorNotificationRule" => { + "rule_id" => "String", + "body" => "MonitorNotificationRuleUpdateRequest", + }, "v2.CreateMonitorConfigPolicy" => { "body" => "MonitorConfigPolicyCreateRequest", }, diff --git a/features/v2/given.json b/features/v2/given.json index 96c49b616686..9cd4b0450aa8 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -436,6 +436,18 @@ "tag": "Metrics", "operationId": "CreateTagConfiguration" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"monitor-notification-rule\",\n \"attributes\": {\n \"name\":\"test rule\",\n \"filter\": {\n \"tags\": [\n \"app:{{ unique_lower }}\"\n ]\n },\n \"recipients\":[\n \"slack-monitor-app\"\n ]\n }\n }\n}" + } + ], + "step": "there is a valid \"monitor_notification_rule\" in the system", + "key": "monitor_notification_rule", + "tag": "Monitors", + "operationId": "CreateMonitorNotificationRule" + }, { "parameters": [ { diff --git a/features/v2/monitors.feature b/features/v2/monitors.feature index 7585d0663d3e..5620258697d2 100644 --- a/features/v2/monitors.feature +++ b/features/v2/monitors.feature @@ -29,6 +29,23 @@ Feature: Monitors And the response "data.attributes.policy.tag_key" is equal to "{{ unique_lower_alnum }}" And the response "data.attributes.policy.valid_tag_values" is equal to ["prod", "staging"] + @skip-validation @team:DataDog/monitor-app + Scenario: Create a monitor notification rule returns "Bad Request" response + Given operation "CreateMonitorNotificationRule" enabled + And 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 + 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 + And the response "data.attributes.name" is equal to "test rule" + @team:DataDog/monitor-app Scenario: Delete a monitor configuration policy returns "Bad Request" response Given new "DeleteMonitorConfigPolicy" request @@ -51,6 +68,23 @@ Feature: Monitors When the request is sent Then the response status is 204 OK + @team:DataDog/monitor-app + Scenario: Delete a monitor notification rule returns "Not Found" response + Given operation "DeleteMonitorNotificationRule" enabled + And 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 + And new "DeleteMonitorNotificationRule" request + And request contains "rule_id" parameter from "monitor_notification_rule.data.id" + When the request is sent + Then the response status is 204 OK + @team:DataDog/monitor-app Scenario: Edit a monitor configuration policy returns "Not Found" response Given new "UpdateMonitorConfigPolicy" request @@ -102,6 +136,24 @@ Feature: Monitors And the response "data.attributes.policy.tag_key" is equal to "{{ unique_lower_alnum }}" And the response "data.attributes.policy.valid_tag_values" is equal to ["prod", "staging"] + @team:DataDog/monitor-app + Scenario: Get a monitor notification rule returns "Not Found" response + Given operation "GetMonitorNotificationRule" enabled + And 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 + And new "GetMonitorNotificationRule" request + And request contains "rule_id" parameter from "monitor_notification_rule.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "test rule" + @team:DataDog/monitor-app Scenario: Get all monitor configuration policies returns "OK" response Given there is a valid "monitor_configuration_policy" in the system @@ -113,3 +165,43 @@ Feature: Monitors And the response "data" has item with field "attributes.policy_type" with value "tag" And the response "data" has item with field "attributes.policy.tag_key" with value "{{ unique_lower_alnum }}" And the response "data" has item with field "attributes.policy.valid_tag_values" with value ["prod", "staging"] + + @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 + And new "GetMonitorNotificationRules" request + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data" has item with field "attributes.name" with value "test rule" + + @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 + 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"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/monitor-app + Scenario: Update a monitor notification rule returns "Not Found" response + Given operation "UpdateMonitorNotificationRule" enabled + And 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 + 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"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.name" is equal to "updated rule" diff --git a/features/v2/undo.json b/features/v2/undo.json index 333884a2f322..86a9a7285537 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1671,6 +1671,43 @@ "type": "safe" } }, + "GetMonitorNotificationRules": { + "tag": "Monitors", + "undo": { + "type": "safe" + } + }, + "CreateMonitorNotificationRule": { + "tag": "Monitors", + "undo": { + "operationId": "DeleteMonitorNotificationRule", + "parameters": [ + { + "name": "rule_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteMonitorNotificationRule": { + "tag": "Monitors", + "undo": { + "type": "idempotent" + } + }, + "GetMonitorNotificationRule": { + "tag": "Monitors", + "undo": { + "type": "safe" + } + }, + "UpdateMonitorNotificationRule": { + "tag": "Monitors", + "undo": { + "type": "idempotent" + } + }, "ListMonitorConfigPolicies": { "tag": "Monitors", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 2a237b310c58..b94c3c4d3b6d 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -230,6 +230,11 @@ def initialize "v2.list_aws_namespaces": false, "v2.update_aws_account": false, "v2.list_aws_logs_services": false, + "v2.create_monitor_notification_rule": false, + "v2.delete_monitor_notification_rule": false, + "v2.get_monitor_notification_rule": false, + "v2.get_monitor_notification_rules": false, + "v2.update_monitor_notification_rule": false, "v2.get_aggregated_connections": false, "v2.cancel_historical_job": false, "v2.convert_job_result_to_signal": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 187804fe93db..e99d850f9d0e 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -2226,6 +2226,22 @@ def overrides "v2.monitor_downtime_match_response" => "MonitorDowntimeMatchResponse", "v2.monitor_downtime_match_response_attributes" => "MonitorDowntimeMatchResponseAttributes", "v2.monitor_downtime_match_response_data" => "MonitorDowntimeMatchResponseData", + "v2.monitor_notification_rule_attributes" => "MonitorNotificationRuleAttributes", + "v2.monitor_notification_rule_create_request" => "MonitorNotificationRuleCreateRequest", + "v2.monitor_notification_rule_create_request_data" => "MonitorNotificationRuleCreateRequestData", + "v2.monitor_notification_rule_data" => "MonitorNotificationRuleData", + "v2.monitor_notification_rule_filter" => "MonitorNotificationRuleFilter", + "v2.monitor_notification_rule_filter_tags" => "MonitorNotificationRuleFilterTags", + "v2.monitor_notification_rule_list_response" => "MonitorNotificationRuleListResponse", + "v2.monitor_notification_rule_relationships" => "MonitorNotificationRuleRelationships", + "v2.monitor_notification_rule_relationships_created_by" => "MonitorNotificationRuleRelationshipsCreatedBy", + "v2.monitor_notification_rule_relationships_created_by_data" => "MonitorNotificationRuleRelationshipsCreatedByData", + "v2.monitor_notification_rule_resource_type" => "MonitorNotificationRuleResourceType", + "v2.monitor_notification_rule_response" => "MonitorNotificationRuleResponse", + "v2.monitor_notification_rule_response_attributes" => "MonitorNotificationRuleResponseAttributes", + "v2.monitor_notification_rule_response_included_item" => "MonitorNotificationRuleResponseIncludedItem", + "v2.monitor_notification_rule_update_request" => "MonitorNotificationRuleUpdateRequest", + "v2.monitor_notification_rule_update_request_data" => "MonitorNotificationRuleUpdateRequestData", "v2.monitor_trigger" => "MonitorTrigger", "v2.monitor_trigger_wrapper" => "MonitorTriggerWrapper", "v2.monitor_type" => "MonitorType", diff --git a/lib/datadog_api_client/v2/api/monitors_api.rb b/lib/datadog_api_client/v2/api/monitors_api.rb index abbd96ced1e4..6355b15a8688 100644 --- a/lib/datadog_api_client/v2/api/monitors_api.rb +++ b/lib/datadog_api_client/v2/api/monitors_api.rb @@ -90,6 +90,79 @@ def create_monitor_config_policy_with_http_info(body, opts = {}) return data, status_code, headers end + # Create a monitor notification rule. + # + # @see #create_monitor_notification_rule_with_http_info + def create_monitor_notification_rule(body, opts = {}) + data, _status_code, _headers = create_monitor_notification_rule_with_http_info(body, opts) + data + end + + # Create a monitor notification rule. + # + # Creates a monitor notification rule. + # + # @param body [MonitorNotificationRuleCreateRequest] Request body to create a monitor notification rule. + # @param opts [Hash] the optional parameters + # @return [Array<(MonitorNotificationRuleResponse, Integer, Hash)>] MonitorNotificationRuleResponse data, response status code and response headers + def create_monitor_notification_rule_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_monitor_notification_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_monitor_notification_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_monitor_notification_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MonitorsAPI.create_monitor_notification_rule ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling MonitorsAPI.create_monitor_notification_rule" + end + # resource path + local_var_path = '/api/v2/monitor/notification_rule' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'MonitorNotificationRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_monitor_notification_rule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MonitorsAPI#create_monitor_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete a monitor configuration policy. # # @see #delete_monitor_config_policy_with_http_info @@ -155,6 +228,77 @@ def delete_monitor_config_policy_with_http_info(policy_id, opts = {}) return data, status_code, headers end + # Delete a monitor notification rule. + # + # @see #delete_monitor_notification_rule_with_http_info + def delete_monitor_notification_rule(rule_id, opts = {}) + delete_monitor_notification_rule_with_http_info(rule_id, opts) + nil + end + + # Delete a monitor notification rule. + # + # Deletes a monitor notification rule by `rule_id`. + # + # @param rule_id [String] ID of the monitor notification rule to delete. + # @param opts [Hash] the optional parameters + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_monitor_notification_rule_with_http_info(rule_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_monitor_notification_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_monitor_notification_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_monitor_notification_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MonitorsAPI.delete_monitor_notification_rule ...' + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling MonitorsAPI.delete_monitor_notification_rule" + end + # resource path + local_var_path = '/api/v2/monitor/notification_rule/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['*/*']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :delete_monitor_notification_rule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MonitorsAPI#delete_monitor_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get a monitor configuration policy. # # @see #get_monitor_config_policy_with_http_info @@ -220,6 +364,147 @@ def get_monitor_config_policy_with_http_info(policy_id, opts = {}) return data, status_code, headers end + # Get a monitor notification rule. + # + # @see #get_monitor_notification_rule_with_http_info + def get_monitor_notification_rule(rule_id, opts = {}) + data, _status_code, _headers = get_monitor_notification_rule_with_http_info(rule_id, opts) + data + end + + # Get a monitor notification rule. + # + # Returns a monitor notification rule by `rule_id`. + # + # @param rule_id [String] ID of the monitor notification rule to fetch. + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of resource paths for related resources to include in the response. Supported resource path is `created_by`. + # @return [Array<(MonitorNotificationRuleResponse, Integer, Hash)>] MonitorNotificationRuleResponse data, response status code and response headers + def get_monitor_notification_rule_with_http_info(rule_id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_monitor_notification_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_monitor_notification_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_monitor_notification_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MonitorsAPI.get_monitor_notification_rule ...' + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling MonitorsAPI.get_monitor_notification_rule" + end + # resource path + local_var_path = '/api/v2/monitor/notification_rule/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MonitorNotificationRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_monitor_notification_rule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MonitorsAPI#get_monitor_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get all monitor notification rules. + # + # @see #get_monitor_notification_rules_with_http_info + def get_monitor_notification_rules(opts = {}) + data, _status_code, _headers = get_monitor_notification_rules_with_http_info(opts) + data + end + + # Get all monitor notification rules. + # + # Returns a list of all monitor notification rules. + # + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of resource paths for related resources to include in the response. Supported resource path is `created_by`. + # @return [Array<(MonitorNotificationRuleListResponse, Integer, Hash)>] MonitorNotificationRuleListResponse data, response status code and response headers + def get_monitor_notification_rules_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_monitor_notification_rules".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_monitor_notification_rules") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_monitor_notification_rules")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MonitorsAPI.get_monitor_notification_rules ...' + end + # resource path + local_var_path = '/api/v2/monitor/notification_rule' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'include'] = opts[:'include'] if !opts[:'include'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'MonitorNotificationRuleListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_monitor_notification_rules, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MonitorsAPI#get_monitor_notification_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get all monitor configuration policies. # # @see #list_monitor_config_policies_with_http_info @@ -351,5 +636,83 @@ def update_monitor_config_policy_with_http_info(policy_id, body, opts = {}) end return data, status_code, headers end + + # Update a monitor notification rule. + # + # @see #update_monitor_notification_rule_with_http_info + def update_monitor_notification_rule(rule_id, body, opts = {}) + data, _status_code, _headers = update_monitor_notification_rule_with_http_info(rule_id, body, opts) + data + end + + # Update a monitor notification rule. + # + # Updates a monitor notification rule by `rule_id`. + # + # @param rule_id [String] ID of the monitor notification rule to update. + # @param body [MonitorNotificationRuleUpdateRequest] Request body to update the monitor notification rule. + # @param opts [Hash] the optional parameters + # @return [Array<(MonitorNotificationRuleResponse, Integer, Hash)>] MonitorNotificationRuleResponse data, response status code and response headers + def update_monitor_notification_rule_with_http_info(rule_id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_monitor_notification_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_monitor_notification_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_monitor_notification_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: MonitorsAPI.update_monitor_notification_rule ...' + end + # verify the required parameter 'rule_id' is set + if @api_client.config.client_side_validation && rule_id.nil? + fail ArgumentError, "Missing the required parameter 'rule_id' when calling MonitorsAPI.update_monitor_notification_rule" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling MonitorsAPI.update_monitor_notification_rule" + end + # resource path + local_var_path = '/api/v2/monitor/notification_rule/{rule_id}'.sub('{rule_id}', CGI.escape(rule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'MonitorNotificationRuleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_monitor_notification_rule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: MonitorsAPI#update_monitor_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb new file mode 100644 index 000000000000..06f03578a2e2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_attributes.rb @@ -0,0 +1,147 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the monitor notification rule. + class MonitorNotificationRuleAttributes + include BaseGenericModel + + # Filter used to associate the notification rule with monitors. + attr_accessor :filter + + # The name of the monitor notification rule. + attr_reader :name + + # A list of recipients to notify. Uses the same format as the monitor `message` field. Must not start with an '@'. + attr_reader :recipients + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'filter' => :'filter', + :'name' => :'name', + :'recipients' => :'recipients' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'filter' => :'MonitorNotificationRuleFilter', + :'name' => :'String', + :'recipients' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleAttributes` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::MonitorNotificationRuleAttributes`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'recipients') + if (value = attributes[:'recipients']).is_a?(Array) + self.recipients = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + return false if @name.to_s.length > 1000 + return false if @name.to_s.length < 1 + return false if @recipients.nil? + return false if @recipients.length > 20 + return false if @recipients.length < 1 + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + if name.to_s.length > 1000 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 1000.' + end + if name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param recipients [Object] Object to be assigned + # @!visibility private + def recipients=(recipients) + if recipients.nil? + fail ArgumentError, 'invalid value for "recipients", recipients cannot be nil.' + end + if recipients.length > 20 + fail ArgumentError, 'invalid value for "recipients", number of items must be less than or equal to 20.' + end + if recipients.length < 1 + fail ArgumentError, 'invalid value for "recipients", number of items must be greater than or equal to 1.' + end + @recipients = recipients + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + filter == o.filter && + name == o.name && + recipients == o.recipients + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [filter, name, recipients].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_create_request.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_create_request.rb new file mode 100644 index 000000000000..c3133c52081f --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request for creating a monitor notification rule. + class MonitorNotificationRuleCreateRequest + include BaseGenericModel + + # Object to create a monitor notification rule. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'MonitorNotificationRuleCreateRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_create_request_data.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_create_request_data.rb new file mode 100644 index 000000000000..583fba830952 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_create_request_data.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Object to create a monitor notification rule. + class MonitorNotificationRuleCreateRequestData + include BaseGenericModel + + # Attributes of the monitor notification rule. + attr_reader :attributes + + # Monitor notification rule resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'MonitorNotificationRuleAttributes', + :'type' => :'MonitorNotificationRuleResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleCreateRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_data.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_data.rb new file mode 100644 index 000000000000..1a5b178bb9a4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_data.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Monitor notification rule data. + class MonitorNotificationRuleData + include BaseGenericModel + + # Attributes of the monitor notification rule. + attr_accessor :attributes + + # The ID of the monitor notification rule. + attr_accessor :id + + # All relationships associated with monitor notification rule. + attr_accessor :relationships + + # Monitor notification rule resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'MonitorNotificationRuleResponseAttributes', + :'id' => :'String', + :'relationships' => :'MonitorNotificationRuleRelationships', + :'type' => :'MonitorNotificationRuleResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_filter.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_filter.rb new file mode 100644 index 000000000000..85c38f33fad0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_filter.rb @@ -0,0 +1,62 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Filter used to associate the notification rule with monitors. + module MonitorNotificationRuleFilter + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'MonitorNotificationRuleFilterTags' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_filter_tags.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_filter_tags.rb new file mode 100644 index 000000000000..b330b1981ccc --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_filter_tags.rb @@ -0,0 +1,108 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Filter monitors by tags. Monitors must match all tags. + class MonitorNotificationRuleFilterTags + include BaseGenericModel + + # A list of monitor tags. + attr_reader :tags + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'tags' => :'tags' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'tags' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleFilterTags` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::MonitorNotificationRuleFilterTags`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @tags.nil? + return false if @tags.length > 20 + return false if @tags.length < 1 + true + end + + # Custom attribute writer method with validation + # @param tags [Object] Object to be assigned + # @!visibility private + def tags=(tags) + if tags.nil? + fail ArgumentError, 'invalid value for "tags", tags cannot be nil.' + end + if tags.length > 20 + fail ArgumentError, 'invalid value for "tags", number of items must be less than or equal to 20.' + end + if tags.length < 1 + fail ArgumentError, 'invalid value for "tags", number of items must be greater than or equal to 1.' + end + @tags = tags + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + tags == o.tags + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [tags].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_list_response.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_list_response.rb new file mode 100644 index 000000000000..e55ef7a981e7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_list_response.rb @@ -0,0 +1,119 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response for retrieving all monitor notification rules. + class MonitorNotificationRuleListResponse + include BaseGenericModel + + # A list of monitor notification rules. + attr_accessor :data + + # Array of objects related to the monitor notification rules. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleListResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_relationships.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_relationships.rb new file mode 100644 index 000000000000..fab6c63c14fe --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_relationships.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # All relationships associated with monitor notification rule. + class MonitorNotificationRuleRelationships + include BaseGenericModel + + # The user who created the monitor notification rule. + attr_accessor :created_by + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_by' => :'created_by' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_by' => :'MonitorNotificationRuleRelationshipsCreatedBy' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_by') + self.created_by = attributes[:'created_by'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_by == o.created_by && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_by, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_relationships_created_by.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_relationships_created_by.rb new file mode 100644 index 000000000000..d86743bb5d66 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_relationships_created_by.rb @@ -0,0 +1,113 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The user who created the monitor notification rule. + class MonitorNotificationRuleRelationshipsCreatedBy + include BaseGenericModel + + # Data for the user who created the monitor notification rule. + attr_accessor :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'MonitorNotificationRuleRelationshipsCreatedByData' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'data', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleRelationshipsCreatedBy` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_relationships_created_by_data.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_relationships_created_by_data.rb new file mode 100644 index 000000000000..0dcf0c711478 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_relationships_created_by_data.rb @@ -0,0 +1,115 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data for the user who created the monitor notification rule. + class MonitorNotificationRuleRelationshipsCreatedByData + include BaseGenericModel + + # User ID of the monitor notification rule creator. + attr_accessor :id + + # Users resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'UsersType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleRelationshipsCreatedByData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_resource_type.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_resource_type.rb new file mode 100644 index 000000000000..50b8ede2374d --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Monitor notification rule resource type. + class MonitorNotificationRuleResourceType + include BaseEnumModel + + MONITOR_NOTIFICATION_RULE = "monitor-notification-rule".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_response.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_response.rb new file mode 100644 index 000000000000..07c95b4d0324 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_response.rb @@ -0,0 +1,117 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A monitor notification rule. + class MonitorNotificationRuleResponse + include BaseGenericModel + + # Monitor notification rule data. + attr_accessor :data + + # Array of objects related to the monitor notification rule that the user requested. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'MonitorNotificationRuleData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_response_attributes.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_response_attributes.rb new file mode 100644 index 000000000000..e8433b1a00d5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_response_attributes.rb @@ -0,0 +1,184 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the monitor notification rule. + class MonitorNotificationRuleResponseAttributes + include BaseGenericModel + + # Creation time of the monitor notification rule. + attr_accessor :created + + # Filter used to associate the notification rule with monitors. + attr_accessor :filter + + # Time the monitor notification rule was last modified. + attr_accessor :modified + + # The name of the monitor notification rule. + attr_reader :name + + # A list of recipients to notify. Uses the same format as the monitor `message` field. Must not start with an '@'. + attr_reader :recipients + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created' => :'created', + :'filter' => :'filter', + :'modified' => :'modified', + :'name' => :'name', + :'recipients' => :'recipients' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created' => :'Time', + :'filter' => :'MonitorNotificationRuleFilter', + :'modified' => :'Time', + :'name' => :'String', + :'recipients' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created') + self.created = attributes[:'created'] + end + + if attributes.key?(:'filter') + self.filter = attributes[:'filter'] + end + + if attributes.key?(:'modified') + self.modified = attributes[:'modified'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'recipients') + if (value = attributes[:'recipients']).is_a?(Array) + self.recipients = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if !@name.nil? && @name.to_s.length > 1000 + return false if !@name.nil? && @name.to_s.length < 1 + return false if !@recipients.nil? && @recipients.length > 20 + return false if !@recipients.nil? && @recipients.length < 1 + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if !name.nil? && name.to_s.length > 1000 + fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 1000.' + end + if !name.nil? && name.to_s.length < 1 + fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 1.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param recipients [Object] Object to be assigned + # @!visibility private + def recipients=(recipients) + if !recipients.nil? && recipients.length > 20 + fail ArgumentError, 'invalid value for "recipients", number of items must be less than or equal to 20.' + end + if !recipients.nil? && recipients.length < 1 + fail ArgumentError, 'invalid value for "recipients", number of items must be greater than or equal to 1.' + end + @recipients = recipients + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created == o.created && + filter == o.filter && + modified == o.modified && + name == o.name && + recipients == o.recipients && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created, filter, modified, name, recipients, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_response_included_item.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_response_included_item.rb new file mode 100644 index 000000000000..49ed20ff6219 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_response_included_item.rb @@ -0,0 +1,62 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # An object related to a monitor notification rule. + module MonitorNotificationRuleResponseIncludedItem + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'User' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_update_request.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_update_request.rb new file mode 100644 index 000000000000..5a30be98d6dd --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_update_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request for updating a monitor notification rule. + class MonitorNotificationRuleUpdateRequest + include BaseGenericModel + + # Object to update a monitor notification rule. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'MonitorNotificationRuleUpdateRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleUpdateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/monitor_notification_rule_update_request_data.rb b/lib/datadog_api_client/v2/models/monitor_notification_rule_update_request_data.rb new file mode 100644 index 000000000000..72a7cd19c5f8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/monitor_notification_rule_update_request_data.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + 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 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Object to update a monitor notification rule. + class MonitorNotificationRuleUpdateRequestData + include BaseGenericModel + + # Attributes of the monitor notification rule. + attr_reader :attributes + + # The ID of the monitor notification rule. + attr_reader :id + + # Monitor notification rule resource type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'MonitorNotificationRuleAttributes', + :'id' => :'String', + :'type' => :'MonitorNotificationRuleResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::MonitorNotificationRuleUpdateRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end