diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fdfee387d48a..c22e59325667 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -485,6 +485,27 @@ components: required: true schema: type: string + IncidentNotificationRuleIDPathParameter: + description: The ID of the notification rule. + in: path + name: id + required: true + schema: + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + IncidentNotificationRuleIncludeQueryParameter: + description: 'Comma-separated list of resources to include. Supported values: + `created_by_user`, `last_modified_by_user`, `incident_type`, `notification_template` + + ' + explode: false + in: query + name: include + required: false + schema: + example: created_by_user,incident_type,notification_template + type: string IncidentNotificationTemplateIDPathParameter: description: The ID of the notification template. in: path @@ -10851,6 +10872,14 @@ components: meta: $ref: '#/components/schemas/DataDeletionResponseMeta' type: object + CreateIncidentNotificationRuleRequest: + description: Create request for a notification rule. + properties: + data: + $ref: '#/components/schemas/IncidentNotificationRuleCreateData' + required: + - data + type: object CreateIncidentNotificationTemplateRequest: description: Create request for a notification template. properties: @@ -19939,6 +19968,283 @@ components: example: '@test.user@test.com' type: string type: object + IncidentNotificationRule: + description: Response with a notification rule. + properties: + data: + $ref: '#/components/schemas/IncidentNotificationRuleResponseData' + included: + description: Related objects that are included in the response. + items: + $ref: '#/components/schemas/IncidentNotificationRuleIncludedItems' + type: array + required: + - data + type: object + IncidentNotificationRuleArray: + description: Response with notification rules. + properties: + data: + description: The `NotificationRuleArray` `data`. + items: + $ref: '#/components/schemas/IncidentNotificationRuleResponseData' + type: array + included: + description: Related objects that are included in the response. + items: + $ref: '#/components/schemas/IncidentNotificationRuleIncludedItems' + type: array + meta: + $ref: '#/components/schemas/IncidentNotificationRuleArrayMeta' + required: + - data + type: object + IncidentNotificationRuleArrayMeta: + description: Response metadata. + properties: + pagination: + $ref: '#/components/schemas/IncidentNotificationRuleArrayMetaPage' + type: object + IncidentNotificationRuleArrayMetaPage: + description: Pagination metadata. + properties: + next_offset: + description: The offset for the next page of results. + example: 15 + format: int64 + type: integer + offset: + description: The current offset in the results. + example: 0 + format: int64 + type: integer + size: + description: The number of results returned per page. + example: 15 + format: int64 + type: integer + type: object + IncidentNotificationRuleAttributes: + description: The notification rule's attributes. + properties: + conditions: + $ref: '#/components/schemas/IncidentNotificationRuleConditions' + created: + description: Timestamp when the notification rule was created. + example: '2025-01-15T10:30:00Z' + format: date-time + readOnly: true + type: string + enabled: + description: Whether the notification rule is enabled. + example: true + type: boolean + handles: + $ref: '#/components/schemas/IncidentNotificationRuleHandles' + modified: + description: Timestamp when the notification rule was last modified. + example: '2025-01-15T14:45:00Z' + format: date-time + readOnly: true + type: string + renotify_on: + $ref: '#/components/schemas/IncidentNotificationRuleRenotifyOn' + trigger: + description: The trigger event for this notification rule. + example: incident_created_trigger + type: string + visibility: + $ref: '#/components/schemas/IncidentNotificationRuleAttributesVisibility' + required: + - conditions + - handles + - visibility + - trigger + - enabled + - created + - modified + type: object + IncidentNotificationRuleAttributesVisibility: + description: The visibility of the notification rule. + enum: + - all + - organization + - private + example: organization + type: string + x-enum-varnames: + - ALL + - ORGANIZATION + - PRIVATE + IncidentNotificationRuleConditions: + description: The conditions that trigger this notification rule. + example: + - field: severity + values: + - SEV-1 + - SEV-2 + items: + $ref: '#/components/schemas/IncidentNotificationRuleConditionsItems' + type: array + IncidentNotificationRuleConditionsItems: + description: A condition that must be met to trigger the notification rule. + properties: + field: + description: The incident field to evaluate + example: severity + type: string + values: + description: The value(s) to compare against. Multiple values are `ORed` + together. + example: + - SEV-1 + - SEV-2 + items: + type: string + type: array + required: + - field + - values + type: object + IncidentNotificationRuleCreateAttributes: + description: The attributes for creating a notification rule. + properties: + conditions: + $ref: '#/components/schemas/IncidentNotificationRuleConditions' + enabled: + default: false + description: Whether the notification rule is enabled. + example: true + type: boolean + handles: + $ref: '#/components/schemas/IncidentNotificationRuleHandles' + renotify_on: + $ref: '#/components/schemas/IncidentNotificationRuleRenotifyOn' + trigger: + description: The trigger event for this notification rule. + example: incident_created_trigger + type: string + visibility: + $ref: '#/components/schemas/IncidentNotificationRuleCreateAttributesVisibility' + required: + - conditions + - handles + - trigger + type: object + IncidentNotificationRuleCreateAttributesVisibility: + description: The visibility of the notification rule. + enum: + - all + - organization + - private + example: organization + type: string + x-enum-varnames: + - ALL + - ORGANIZATION + - PRIVATE + IncidentNotificationRuleCreateData: + description: Notification rule data for a create request. + properties: + attributes: + $ref: '#/components/schemas/IncidentNotificationRuleCreateAttributes' + relationships: + $ref: '#/components/schemas/IncidentNotificationRuleCreateDataRelationships' + type: + $ref: '#/components/schemas/IncidentNotificationRuleType' + required: + - type + - attributes + type: object + IncidentNotificationRuleCreateDataRelationships: + description: The definition of `NotificationRuleCreateDataRelationships` object. + properties: + incident_type: + $ref: '#/components/schemas/RelationshipToIncidentType' + notification_template: + $ref: '#/components/schemas/RelationshipToIncidentNotificationTemplate' + type: object + IncidentNotificationRuleHandles: + description: The notification handles (targets) for this rule. + example: + - '@team-email@company.com' + - '@slack-channel' + items: + description: A notification handle (email, Slack channel, etc.). + type: string + type: array + IncidentNotificationRuleIncludedItems: + description: Objects related to a notification rule. + oneOf: + - $ref: '#/components/schemas/User' + - $ref: '#/components/schemas/IncidentTypeObject' + - $ref: '#/components/schemas/IncidentNotificationTemplateObject' + IncidentNotificationRuleRelationships: + description: The notification rule's resource relationships. + properties: + created_by_user: + $ref: '#/components/schemas/RelationshipToUser' + incident_type: + $ref: '#/components/schemas/RelationshipToIncidentType' + last_modified_by_user: + $ref: '#/components/schemas/RelationshipToUser' + notification_template: + $ref: '#/components/schemas/RelationshipToIncidentNotificationTemplate' + type: object + IncidentNotificationRuleRenotifyOn: + description: List of incident fields that trigger re-notification when changed. + example: + - status + - severity + items: + description: An incident field name. + type: string + type: array + IncidentNotificationRuleResponseData: + description: Notification rule data from a response. + properties: + attributes: + $ref: '#/components/schemas/IncidentNotificationRuleAttributes' + id: + description: The unique identifier of the notification rule. + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + relationships: + $ref: '#/components/schemas/IncidentNotificationRuleRelationships' + type: + $ref: '#/components/schemas/IncidentNotificationRuleType' + required: + - id + - type + type: object + IncidentNotificationRuleType: + description: Notification rules resource type. + enum: + - incident_notification_rules + example: incident_notification_rules + type: string + x-enum-varnames: + - INCIDENT_NOTIFICATION_RULES + IncidentNotificationRuleUpdateData: + description: Notification rule data for an update request. + properties: + attributes: + $ref: '#/components/schemas/IncidentNotificationRuleCreateAttributes' + id: + description: The unique identifier of the notification rule. + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + relationships: + $ref: '#/components/schemas/IncidentNotificationRuleCreateDataRelationships' + type: + $ref: '#/components/schemas/IncidentNotificationRuleType' + required: + - id + - type + - attributes + type: object IncidentNotificationTemplate: description: Response with a notification template. properties: @@ -20103,6 +20409,24 @@ components: oneOf: - $ref: '#/components/schemas/User' - $ref: '#/components/schemas/IncidentTypeObject' + IncidentNotificationTemplateObject: + description: A notification template object for inclusion in other resources. + properties: + attributes: + $ref: '#/components/schemas/IncidentNotificationTemplateAttributes' + id: + description: The unique identifier of the notification template. + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + relationships: + $ref: '#/components/schemas/IncidentNotificationTemplateRelationships' + type: + $ref: '#/components/schemas/IncidentNotificationTemplateType' + required: + - id + - type + type: object IncidentNotificationTemplateRelationships: description: The notification template's resource relationships. properties: @@ -33499,6 +33823,14 @@ components: data: $ref: '#/components/schemas/Deployment' type: object + PutIncidentNotificationRuleRequest: + description: Put request for a notification rule. + properties: + data: + $ref: '#/components/schemas/IncidentNotificationRuleUpdateData' + required: + - data + type: object Query: description: A data query used by an app. This can take the form of an external action, a data transformation, or a state variable. @@ -34674,6 +35006,28 @@ components: required: - data type: object + RelationshipToIncidentNotificationTemplate: + description: A relationship reference to a notification template. + properties: + data: + $ref: '#/components/schemas/RelationshipToIncidentNotificationTemplateData' + required: + - data + type: object + RelationshipToIncidentNotificationTemplateData: + description: The notification template relationship data. + properties: + id: + description: The unique identifier of the notification template. + example: 00000000-0000-0000-0000-000000000001 + format: uuid + type: string + type: + $ref: '#/components/schemas/IncidentNotificationTemplateType' + required: + - id + - type + type: object RelationshipToIncidentPostmortem: description: A relationship reference for postmortems. example: @@ -47267,8 +47621,9 @@ components: error_tracking_write: Edit Error Tracking issues. events_read: Read Events data. hosts_read: List hosts and their attributes. + incident_notification_settings_read: View Incident Notification Rule Settings. incident_notification_settings_write: Configure Incidents Notification - settings. + Rule settings. incident_read: View incidents in Datadog. incident_settings_read: View Incident Settings. incident_settings_write: Configure Incident Settings. @@ -54198,6 +54553,205 @@ paths: - incident_write x-unstable: '**Note**: This endpoint is in public beta. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/config/notification-rules: + get: + description: Lists all notification rules for the organization. Optionally filter + by incident type. + operationId: ListIncidentNotificationRules + parameters: + - $ref: '#/components/parameters/IncidentNotificationRuleIncludeQueryParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentNotificationRuleArray' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_notification_settings_read + summary: List incident notification rules + tags: + - Incidents + x-permission: + operator: AND + permissions: + - incident_notification_settings_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 new notification rule. + operationId: CreateIncidentNotificationRule + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateIncidentNotificationRuleRequest' + required: true + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentNotificationRule' + description: Created + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_notification_settings_write + summary: Create an incident notification rule + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - incident_notification_settings_write + x-unstable: '**Note**: This endpoint is in Preview. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/incidents/config/notification-rules/{id}: + delete: + description: Deletes a notification rule by its ID. + operationId: DeleteIncidentNotificationRule + parameters: + - $ref: '#/components/parameters/IncidentNotificationRuleIDPathParameter' + - $ref: '#/components/parameters/IncidentNotificationRuleIncludeQueryParameter' + responses: + '204': + description: No Content + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_notification_settings_write + summary: Delete an incident notification rule + tags: + - Incidents + x-permission: + operator: AND + permissions: + - incident_notification_settings_write + x-unstable: '**Note**: This endpoint is in Preview. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Retrieves a specific notification rule by its ID. + operationId: GetIncidentNotificationRule + parameters: + - $ref: '#/components/parameters/IncidentNotificationRuleIDPathParameter' + - $ref: '#/components/parameters/IncidentNotificationRuleIncludeQueryParameter' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentNotificationRule' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_notification_settings_read + summary: Get an incident notification rule + tags: + - Incidents + x-permission: + operator: AND + permissions: + - incident_notification_settings_read + x-unstable: '**Note**: This endpoint is in Preview. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + put: + description: Updates an existing notification rule with a complete replacement. + operationId: UpdateIncidentNotificationRule + parameters: + - $ref: '#/components/parameters/IncidentNotificationRuleIDPathParameter' + - $ref: '#/components/parameters/IncidentNotificationRuleIncludeQueryParameter' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PutIncidentNotificationRuleRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/IncidentNotificationRule' + description: OK + '400': + $ref: '#/components/responses/BadRequestResponse' + '401': + $ref: '#/components/responses/UnauthorizedResponse' + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + $ref: '#/components/responses/NotFoundResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - incident_notification_settings_write + summary: Update an incident notification rule + tags: + - Incidents + x-codegen-request-body-name: body + x-permission: + operator: AND + permissions: + - incident_notification_settings_write + x-unstable: '**Note**: This endpoint is in Preview. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents/config/notification-templates: get: diff --git a/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Bad-Request-response.frozen b/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..275d1a823200 --- /dev/null +++ b/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:08.891Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Bad-Request-response.yml b/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..9f0aa1a3daae --- /dev/null +++ b/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Bad-Request-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:08 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"enabled":true,"handles":["@test-email@company.com"],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"incident_type":{"data":{"id":"00000000-0000-0000-0000-000000000000","type":"incident_types"}}},"type":"invalid_type"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"got type + \"invalid_type\" expected one of \"incident_notification_rules\""}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Created-response.frozen b/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Created-response.frozen new file mode 100644 index 000000000000..67baa5efb456 --- /dev/null +++ b/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Created-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:09.032Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Created-response.yml b/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Created-response.yml new file mode 100644 index 000000000000..96c5bcd19d3c --- /dev/null +++ b/cassettes/features/v2/incidents/Create-incident-notification-rule-returns-Created-response.yml @@ -0,0 +1,83 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"description":"Any incidents that harm (or have + the potential to) the confidentiality, integrity, or availability of our data.","is_default":false,"name":"Security + Incident"},"type":"incident_types"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/types + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"107e7ed1-ec07-483f-a723-882ce86702ba","type":"incident_types","attributes":{"createdAt":"2025-09-09T18:32:09.112896114Z","createdBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"Any + incidents that harm (or have the potential to) the confidentiality, integrity, + or availability of our data.","is_default":false,"lastModifiedBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","modifiedAt":"2025-09-09T18:32:09.112896213Z","name":"Security + Incident","prefix":"IR"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"google_meet_configuration":{"data":null},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"microsoft_teams_configuration":{"data":null},"zoom_configuration":{"data":null}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:09 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"enabled":true,"handles":["@test-email@company.com"],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"incident_type":{"data":{"id":"107e7ed1-ec07-483f-a723-882ce86702ba","type":"incident_types"}}},"type":"incident_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"93dada9a-d032-49a4-b445-0673aaebb888","type":"incident_notification_rules","attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"created":"2025-09-09T18:32:09.321517146Z","enabled":true,"handles":["@test-email@company.com"],"modified":"2025-09-09T18:32:09.321517146Z","renotify_on":[],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident_type":{"data":{"id":"107e7ed1-ec07-483f-a723-882ce86702ba","type":"incident_types"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:09 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/93dada9a-d032-49a4-b445-0673aaebb888 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 09 Sep 2025 18:32:09 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/types/107e7ed1-ec07-483f-a723-882ce86702ba + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-No-Content-response.frozen b/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-No-Content-response.frozen new file mode 100644 index 000000000000..86eba7dd7a7e --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-No-Content-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:13.145Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-No-Content-response.yml b/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-No-Content-response.yml new file mode 100644 index 000000000000..a3fa66ac297f --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-No-Content-response.yml @@ -0,0 +1,101 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:13 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"description":"Any incidents that harm (or have + the potential to) the confidentiality, integrity, or availability of our data.","is_default":false,"name":"Security + Incident"},"type":"incident_types"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/types + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"ad9ae59d-b9ce-494b-98b2-326fbcc804b9","type":"incident_types","attributes":{"createdAt":"2025-09-09T18:32:13.227280334Z","createdBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"Any + incidents that harm (or have the potential to) the confidentiality, integrity, + or availability of our data.","is_default":false,"lastModifiedBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","modifiedAt":"2025-09-09T18:32:13.227280425Z","name":"Security + Incident","prefix":"IR"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"google_meet_configuration":{"data":null},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"microsoft_teams_configuration":{"data":null},"zoom_configuration":{"data":null}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:13 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"enabled":true,"handles":["@test-email@company.com"],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"incident_type":{"data":{"id":"ad9ae59d-b9ce-494b-98b2-326fbcc804b9","type":"incident_types"}}},"type":"incident_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"dc55d64f-6897-49b0-93b7-d2a34b010cab","type":"incident_notification_rules","attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"created":"2025-09-09T18:32:13.449216494Z","enabled":true,"handles":["@test-email@company.com"],"modified":"2025-09-09T18:32:13.449216494Z","renotify_on":[],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident_type":{"data":{"id":"ad9ae59d-b9ce-494b-98b2-326fbcc804b9","type":"incident_types"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:13 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/dc55d64f-6897-49b0-93b7-d2a34b010cab + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 09 Sep 2025 18:32:13 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/dc55d64f-6897-49b0-93b7-d2a34b010cab + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"rule not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +- recorded_at: Tue, 09 Sep 2025 18:32:13 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/types/ad9ae59d-b9ce-494b-98b2-326fbcc804b9 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..f82ca3400200 --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:13.827Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-Not-Found-response.yml b/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-Not-Found-response.yml new file mode 100644 index 000000000000..e27390ddce6d --- /dev/null +++ b/cassettes/features/v2/incidents/Delete-incident-notification-rule-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:13 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/00000000-0000-0000-0000-000000000001 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"rule not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..a527f3415155 --- /dev/null +++ b/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:20.351Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-Not-Found-response.yml b/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-Not-Found-response.yml new file mode 100644 index 000000000000..dbc911292835 --- /dev/null +++ b/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-Not-Found-response.yml @@ -0,0 +1,20 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:20 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/00000000-0000-0000-0000-000000000001 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"rule not found"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..b5df2e3ca941 --- /dev/null +++ b/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:20.427Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-OK-response.yml b/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..8a23b638df78 --- /dev/null +++ b/cassettes/features/v2/incidents/Get-incident-notification-rule-returns-OK-response.yml @@ -0,0 +1,101 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:20 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"description":"Any incidents that harm (or have + the potential to) the confidentiality, integrity, or availability of our data.","is_default":false,"name":"Security + Incident"},"type":"incident_types"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/types + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"ba3134f6-c17f-415b-8023-776f53667031","type":"incident_types","attributes":{"createdAt":"2025-09-09T18:32:20.515024463Z","createdBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"Any + incidents that harm (or have the potential to) the confidentiality, integrity, + or availability of our data.","is_default":false,"lastModifiedBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","modifiedAt":"2025-09-09T18:32:20.515024553Z","name":"Security + Incident","prefix":"IR"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"google_meet_configuration":{"data":null},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"microsoft_teams_configuration":{"data":null},"zoom_configuration":{"data":null}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:20 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"enabled":true,"handles":["@test-email@company.com"],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"incident_type":{"data":{"id":"ba3134f6-c17f-415b-8023-776f53667031","type":"incident_types"}}},"type":"incident_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"d364309f-e1ee-4bdb-a6a2-508c21601f5d","type":"incident_notification_rules","attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"created":"2025-09-09T18:32:20.702950616Z","enabled":true,"handles":["@test-email@company.com"],"modified":"2025-09-09T18:32:20.702950616Z","renotify_on":[],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident_type":{"data":{"id":"ba3134f6-c17f-415b-8023-776f53667031","type":"incident_types"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:20 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/d364309f-e1ee-4bdb-a6a2-508c21601f5d + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"d364309f-e1ee-4bdb-a6a2-508c21601f5d","type":"incident_notification_rules","attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"created":"2025-09-09T18:32:20.70295Z","enabled":true,"handles":["@test-email@company.com"],"modified":"2025-09-09T18:32:20.70295Z","renotify_on":[],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident_type":{"data":{"id":"ba3134f6-c17f-415b-8023-776f53667031","type":"incident_types"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 09 Sep 2025 18:32:20 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/d364309f-e1ee-4bdb-a6a2-508c21601f5d + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 09 Sep 2025 18:32:20 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/types/ba3134f6-c17f-415b-8023-776f53667031 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/List-incident-notification-rules-returns-OK-response.frozen b/cassettes/features/v2/incidents/List-incident-notification-rules-returns-OK-response.frozen new file mode 100644 index 000000000000..188351a15b86 --- /dev/null +++ b/cassettes/features/v2/incidents/List-incident-notification-rules-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:22.504Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/List-incident-notification-rules-returns-OK-response.yml b/cassettes/features/v2/incidents/List-incident-notification-rules-returns-OK-response.yml new file mode 100644 index 000000000000..c6aa709b730a --- /dev/null +++ b/cassettes/features/v2/incidents/List-incident-notification-rules-returns-OK-response.yml @@ -0,0 +1,101 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"description":"Any incidents that harm (or have + the potential to) the confidentiality, integrity, or availability of our data.","is_default":false,"name":"Security + Incident"},"type":"incident_types"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/types + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"33eb6b19-1034-4233-9bfa-03e4ffbc18ca","type":"incident_types","attributes":{"createdAt":"2025-09-09T18:32:22.588970617Z","createdBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"Any + incidents that harm (or have the potential to) the confidentiality, integrity, + or availability of our data.","is_default":false,"lastModifiedBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","modifiedAt":"2025-09-09T18:32:22.588970732Z","name":"Security + Incident","prefix":"IR"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"google_meet_configuration":{"data":null},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"microsoft_teams_configuration":{"data":null},"zoom_configuration":{"data":null}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:22 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"enabled":true,"handles":["@test-email@company.com"],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"incident_type":{"data":{"id":"33eb6b19-1034-4233-9bfa-03e4ffbc18ca","type":"incident_types"}}},"type":"incident_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"94e7cf01-bf6e-4ad5-bb87-e91880318851","type":"incident_notification_rules","attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"created":"2025-09-09T18:32:22.776194917Z","enabled":true,"handles":["@test-email@company.com"],"modified":"2025-09-09T18:32:22.776194917Z","renotify_on":[],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident_type":{"data":{"id":"33eb6b19-1034-4233-9bfa-03e4ffbc18ca","type":"incident_types"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:22 GMT + request: + body: null + headers: + Accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":[{"id":"94e7cf01-bf6e-4ad5-bb87-e91880318851","type":"incident_notification_rules","attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"created":"2025-09-09T18:32:22.776194Z","enabled":true,"handles":["@test-email@company.com"],"modified":"2025-09-09T18:32:22.776194Z","renotify_on":[],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident_type":{"data":{"id":"33eb6b19-1034-4233-9bfa-03e4ffbc18ca","type":"incident_types"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}],"meta":{"pagination":{"offset":0,"next_offset":1,"size":1}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 09 Sep 2025 18:32:22 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/94e7cf01-bf6e-4ad5-bb87-e91880318851 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 09 Sep 2025 18:32:22 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/types/33eb6b19-1034-4233-9bfa-03e4ffbc18ca + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Bad-Request-response.frozen b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Bad-Request-response.frozen new file mode 100644 index 000000000000..b4f928015d47 --- /dev/null +++ b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Bad-Request-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:42.727Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Bad-Request-response.yml b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Bad-Request-response.yml new file mode 100644 index 000000000000..d6e7a79a946d --- /dev/null +++ b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Bad-Request-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:42 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"enabled":true,"handles":["@test-email@company.com"],"trigger":"incident_created_trigger","visibility":"organization"},"id":"00000000-0000-0000-0000-000000000001","relationships":{"incident_type":{"data":{"id":"00000000-0000-0000-0000-000000000000","type":"incident_types"}}},"type":"invalid_type"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/00000000-0000-0000-0000-000000000001 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"status":"400","title":"Bad Request","detail":"got type + \"invalid_type\" expected one of \"incident_notification_rules\""}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 400 + message: Bad Request +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Not-Found-response.frozen b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Not-Found-response.frozen new file mode 100644 index 000000000000..525cde360910 --- /dev/null +++ b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Not-Found-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:42.804Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Not-Found-response.yml b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Not-Found-response.yml new file mode 100644 index 000000000000..fd884e6a8e04 --- /dev/null +++ b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-Not-Found-response.yml @@ -0,0 +1,25 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:42 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"conditions":[{"field":"severity","values":["SEV-1"]}],"enabled":false,"handles":["@test-email@company.com"],"trigger":"incident_created_trigger"},"id":"00000000-0000-0000-0000-000000000001","relationships":{"incident_type":{"data":{"id":"00000000-0000-0000-0000-000000000001","type":"incident_types"}}},"type":"incident_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/00000000-0000-0000-0000-000000000001 + response: + body: + encoding: UTF-8 + string: '{"errors":[{"title":"Generic Error","detail":"incident type doesn''t + exist"}]}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 404 + message: Not Found +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..2f3783d39045 --- /dev/null +++ b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2025-09-09T18:32:42.885Z \ No newline at end of file diff --git a/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-OK-response.yml b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..484740fa6a3a --- /dev/null +++ b/cassettes/features/v2/incidents/Update-incident-notification-rule-returns-OK-response.yml @@ -0,0 +1,105 @@ +http_interactions: +- recorded_at: Tue, 09 Sep 2025 18:32:42 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"description":"Any incidents that harm (or have + the potential to) the confidentiality, integrity, or availability of our data.","is_default":false,"name":"Security + Incident"},"type":"incident_types"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/types + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"2e166ce6-b249-46d1-8143-5ad4f5dda002","type":"incident_types","attributes":{"createdAt":"2025-09-09T18:32:42.95399842Z","createdBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","description":"Any + incidents that harm (or have the potential to) the confidentiality, integrity, + or availability of our data.","is_default":false,"lastModifiedBy":"3ad549bf-eba0-11e9-a77a-0705486660d0","modifiedAt":"2025-09-09T18:32:42.953998518Z","name":"Security + Incident","prefix":"IR"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"google_meet_configuration":{"data":null},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"microsoft_teams_configuration":{"data":null},"zoom_configuration":{"data":null}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:42 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"enabled":true,"handles":["@test-email@company.com"],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"incident_type":{"data":{"id":"2e166ce6-b249-46d1-8143-5ad4f5dda002","type":"incident_types"}}},"type":"incident_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"01b558a4-32f7-4d4d-b46a-793dca40df48","type":"incident_notification_rules","attributes":{"conditions":[{"field":"severity","values":["SEV-1","SEV-2"]}],"created":"2025-09-09T18:32:43.137893329Z","enabled":true,"handles":["@test-email@company.com"],"modified":"2025-09-09T18:32:43.137893329Z","renotify_on":[],"trigger":"incident_created_trigger","visibility":"organization"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident_type":{"data":{"id":"2e166ce6-b249-46d1-8143-5ad4f5dda002","type":"incident_types"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 201 + message: Created +- recorded_at: Tue, 09 Sep 2025 18:32:42 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"conditions":[{"field":"severity","values":["SEV-1"]}],"enabled":false,"handles":["@updated-team-email@company.com"],"trigger":"incident_modified_trigger","visibility":"private"},"id":"01b558a4-32f7-4d4d-b46a-793dca40df48","relationships":{"incident_type":{"data":{"id":"2e166ce6-b249-46d1-8143-5ad4f5dda002","type":"incident_types"}}},"type":"incident_notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/01b558a4-32f7-4d4d-b46a-793dca40df48 + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"01b558a4-32f7-4d4d-b46a-793dca40df48","type":"incident_notification_rules","attributes":{"conditions":[{"field":"severity","values":["SEV-1"]}],"created":"2025-09-09T18:32:43.137893Z","enabled":false,"handles":["@updated-team-email@company.com"],"modified":"2025-09-09T18:32:43.24636504Z","renotify_on":[],"trigger":"incident_modified_trigger","visibility":"private"},"relationships":{"created_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}},"incident_type":{"data":{"id":"2e166ce6-b249-46d1-8143-5ad4f5dda002","type":"incident_types"}},"last_modified_by_user":{"data":{"id":"3ad549bf-eba0-11e9-a77a-0705486660d0","type":"users"}}}}}' + headers: + Content-Type: + - application/vnd.api+json + status: + code: 200 + message: OK +- recorded_at: Tue, 09 Sep 2025 18:32:42 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/notification-rules/01b558a4-32f7-4d4d-b46a-793dca40df48 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Tue, 09 Sep 2025 18:32:42 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/incidents/config/types/2e166ce6-b249-46d1-8143-5ad4f5dda002 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +recorded_with: VCR 6.0.0 diff --git a/examples/v2/incidents/CreateIncidentNotificationRule.rb b/examples/v2/incidents/CreateIncidentNotificationRule.rb new file mode 100644 index 000000000000..77f60141da25 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentNotificationRule.rb @@ -0,0 +1,50 @@ +# Create an incident notification rule returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_incident_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::CreateIncidentNotificationRuleRequest.new({ + data: DatadogAPIClient::V2::IncidentNotificationRuleCreateData.new({ + attributes: DatadogAPIClient::V2::IncidentNotificationRuleCreateAttributes.new({ + conditions: [ + DatadogAPIClient::V2::IncidentNotificationRuleConditionsItems.new({ + field: "severity", + values: [ + "SEV-1", + "SEV-2", + ], + }), + ], + enabled: true, + handles: [ + "@team-email@company.com", + "@slack-channel", + ], + renotify_on: [ + "status", + "severity", + ], + trigger: "incident_created_trigger", + visibility: DatadogAPIClient::V2::IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION, + }), + relationships: DatadogAPIClient::V2::IncidentNotificationRuleCreateDataRelationships.new({ + incident_type: DatadogAPIClient::V2::RelationshipToIncidentType.new({ + data: DatadogAPIClient::V2::RelationshipToIncidentTypeData.new({ + id: "00000000-0000-0000-0000-000000000000", + type: DatadogAPIClient::V2::IncidentTypeType::INCIDENT_TYPES, + }), + }), + notification_template: DatadogAPIClient::V2::RelationshipToIncidentNotificationTemplate.new({ + data: DatadogAPIClient::V2::RelationshipToIncidentNotificationTemplateData.new({ + id: "00000000-0000-0000-0000-000000000001", + type: DatadogAPIClient::V2::IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES, + }), + }), + }), + type: DatadogAPIClient::V2::IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES, + }), +}) +p api_instance.create_incident_notification_rule(body) diff --git a/examples/v2/incidents/CreateIncidentNotificationRule_3029800608.rb b/examples/v2/incidents/CreateIncidentNotificationRule_3029800608.rb new file mode 100644 index 000000000000..3bd2f61c6fee --- /dev/null +++ b/examples/v2/incidents/CreateIncidentNotificationRule_3029800608.rb @@ -0,0 +1,42 @@ +# Create incident notification rule returns "Created" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_incident_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "incident_type" in the system +INCIDENT_TYPE_DATA_ID = ENV["INCIDENT_TYPE_DATA_ID"] + +body = DatadogAPIClient::V2::CreateIncidentNotificationRuleRequest.new({ + data: DatadogAPIClient::V2::IncidentNotificationRuleCreateData.new({ + attributes: DatadogAPIClient::V2::IncidentNotificationRuleCreateAttributes.new({ + conditions: [ + DatadogAPIClient::V2::IncidentNotificationRuleConditionsItems.new({ + field: "severity", + values: [ + "SEV-1", + "SEV-2", + ], + }), + ], + handles: [ + "@test-email@company.com", + ], + visibility: DatadogAPIClient::V2::IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION, + trigger: "incident_created_trigger", + enabled: true, + }), + relationships: DatadogAPIClient::V2::IncidentNotificationRuleCreateDataRelationships.new({ + incident_type: DatadogAPIClient::V2::RelationshipToIncidentType.new({ + data: DatadogAPIClient::V2::RelationshipToIncidentTypeData.new({ + id: INCIDENT_TYPE_DATA_ID, + type: DatadogAPIClient::V2::IncidentTypeType::INCIDENT_TYPES, + }), + }), + }), + type: DatadogAPIClient::V2::IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES, + }), +}) +p api_instance.create_incident_notification_rule(body) diff --git a/examples/v2/incidents/DeleteIncidentNotificationRule.rb b/examples/v2/incidents/DeleteIncidentNotificationRule.rb new file mode 100644 index 000000000000..beb52da22f44 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentNotificationRule.rb @@ -0,0 +1,8 @@ +# Delete an incident notification rule returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_incident_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +api_instance.delete_incident_notification_rule("00000000-0000-0000-0000-000000000001") diff --git a/examples/v2/incidents/DeleteIncidentNotificationRule_4148107167.rb b/examples/v2/incidents/DeleteIncidentNotificationRule_4148107167.rb new file mode 100644 index 000000000000..a12d63eefade --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentNotificationRule_4148107167.rb @@ -0,0 +1,11 @@ +# Delete incident notification rule returns "No Content" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.delete_incident_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "notification_rule" in the system +NOTIFICATION_RULE_DATA_ID = ENV["NOTIFICATION_RULE_DATA_ID"] +api_instance.delete_incident_notification_rule(NOTIFICATION_RULE_DATA_ID) diff --git a/examples/v2/incidents/GetIncidentNotificationRule.rb b/examples/v2/incidents/GetIncidentNotificationRule.rb new file mode 100644 index 000000000000..2ddf7747885a --- /dev/null +++ b/examples/v2/incidents/GetIncidentNotificationRule.rb @@ -0,0 +1,8 @@ +# Get an incident notification rule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_incident_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +p api_instance.get_incident_notification_rule("00000000-0000-0000-0000-000000000001") diff --git a/examples/v2/incidents/GetIncidentNotificationRule_67441486.rb b/examples/v2/incidents/GetIncidentNotificationRule_67441486.rb new file mode 100644 index 000000000000..703ffdfc62e5 --- /dev/null +++ b/examples/v2/incidents/GetIncidentNotificationRule_67441486.rb @@ -0,0 +1,11 @@ +# Get incident notification rule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_incident_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "notification_rule" in the system +NOTIFICATION_RULE_DATA_ID = ENV["NOTIFICATION_RULE_DATA_ID"] +p api_instance.get_incident_notification_rule(NOTIFICATION_RULE_DATA_ID) diff --git a/examples/v2/incidents/ListIncidentNotificationRules.rb b/examples/v2/incidents/ListIncidentNotificationRules.rb new file mode 100644 index 000000000000..89784c61b3bc --- /dev/null +++ b/examples/v2/incidents/ListIncidentNotificationRules.rb @@ -0,0 +1,8 @@ +# List incident notification rules returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.list_incident_notification_rules".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new +p api_instance.list_incident_notification_rules() diff --git a/examples/v2/incidents/UpdateIncidentNotificationRule.rb b/examples/v2/incidents/UpdateIncidentNotificationRule.rb new file mode 100644 index 000000000000..96e9e00c3b2a --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentNotificationRule.rb @@ -0,0 +1,51 @@ +# Update an incident notification rule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_incident_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +body = DatadogAPIClient::V2::PutIncidentNotificationRuleRequest.new({ + data: DatadogAPIClient::V2::IncidentNotificationRuleUpdateData.new({ + attributes: DatadogAPIClient::V2::IncidentNotificationRuleCreateAttributes.new({ + conditions: [ + DatadogAPIClient::V2::IncidentNotificationRuleConditionsItems.new({ + field: "severity", + values: [ + "SEV-1", + "SEV-2", + ], + }), + ], + enabled: true, + handles: [ + "@team-email@company.com", + "@slack-channel", + ], + renotify_on: [ + "status", + "severity", + ], + trigger: "incident_created_trigger", + visibility: DatadogAPIClient::V2::IncidentNotificationRuleCreateAttributesVisibility::ORGANIZATION, + }), + id: "00000000-0000-0000-0000-000000000001", + relationships: DatadogAPIClient::V2::IncidentNotificationRuleCreateDataRelationships.new({ + incident_type: DatadogAPIClient::V2::RelationshipToIncidentType.new({ + data: DatadogAPIClient::V2::RelationshipToIncidentTypeData.new({ + id: "00000000-0000-0000-0000-000000000000", + type: DatadogAPIClient::V2::IncidentTypeType::INCIDENT_TYPES, + }), + }), + notification_template: DatadogAPIClient::V2::RelationshipToIncidentNotificationTemplate.new({ + data: DatadogAPIClient::V2::RelationshipToIncidentNotificationTemplateData.new({ + id: "00000000-0000-0000-0000-000000000001", + type: DatadogAPIClient::V2::IncidentNotificationTemplateType::NOTIFICATION_TEMPLATES, + }), + }), + }), + type: DatadogAPIClient::V2::IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES, + }), +}) +p api_instance.update_incident_notification_rule("00000000-0000-0000-0000-000000000001", body) diff --git a/examples/v2/incidents/UpdateIncidentNotificationRule_1207309457.rb b/examples/v2/incidents/UpdateIncidentNotificationRule_1207309457.rb new file mode 100644 index 000000000000..7356e3f780db --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentNotificationRule_1207309457.rb @@ -0,0 +1,45 @@ +# Update incident notification rule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.update_incident_notification_rule".to_sym] = true +end +api_instance = DatadogAPIClient::V2::IncidentsAPI.new + +# there is a valid "notification_rule" in the system +NOTIFICATION_RULE_DATA_ID = ENV["NOTIFICATION_RULE_DATA_ID"] + +# there is a valid "incident_type" in the system +INCIDENT_TYPE_DATA_ID = ENV["INCIDENT_TYPE_DATA_ID"] + +body = DatadogAPIClient::V2::PutIncidentNotificationRuleRequest.new({ + data: DatadogAPIClient::V2::IncidentNotificationRuleUpdateData.new({ + attributes: DatadogAPIClient::V2::IncidentNotificationRuleCreateAttributes.new({ + enabled: false, + conditions: [ + DatadogAPIClient::V2::IncidentNotificationRuleConditionsItems.new({ + field: "severity", + values: [ + "SEV-1", + ], + }), + ], + handles: [ + "@updated-team-email@company.com", + ], + visibility: DatadogAPIClient::V2::IncidentNotificationRuleCreateAttributesVisibility::PRIVATE, + trigger: "incident_modified_trigger", + }), + relationships: DatadogAPIClient::V2::IncidentNotificationRuleCreateDataRelationships.new({ + incident_type: DatadogAPIClient::V2::RelationshipToIncidentType.new({ + data: DatadogAPIClient::V2::RelationshipToIncidentTypeData.new({ + id: INCIDENT_TYPE_DATA_ID, + type: DatadogAPIClient::V2::IncidentTypeType::INCIDENT_TYPES, + }), + }), + }), + id: NOTIFICATION_RULE_DATA_ID, + type: DatadogAPIClient::V2::IncidentNotificationRuleType::INCIDENT_NOTIFICATION_RULES, + }), +}) +p api_instance.update_incident_notification_rule(NOTIFICATION_RULE_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 408295b5af9b..a10fe86546c4 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -1752,6 +1752,25 @@ "v2.CreateIncident" => { "body" => "IncidentCreateRequest", }, + "v2.ListIncidentNotificationRules" => { + "include" => "String", + }, + "v2.CreateIncidentNotificationRule" => { + "body" => "CreateIncidentNotificationRuleRequest", + }, + "v2.DeleteIncidentNotificationRule" => { + "id" => "UUID", + "include" => "String", + }, + "v2.GetIncidentNotificationRule" => { + "id" => "UUID", + "include" => "String", + }, + "v2.UpdateIncidentNotificationRule" => { + "id" => "UUID", + "include" => "String", + "body" => "PutIncidentNotificationRuleRequest", + }, "v2.ListIncidentNotificationTemplates" => { "filter_incident_type" => "UUID", "include" => "String", diff --git a/features/v2/given.json b/features/v2/given.json index 2fce716f34a1..4e0610f2f8f9 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -249,6 +249,18 @@ "tag": "Incidents", "operationId": "CreateIncident" }, + { + "operationId": "CreateIncidentNotificationRule", + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"conditions\": [{\"field\": \"severity\", \"values\": [\"SEV-1\", \"SEV-2\"]}],\n \"handles\": [\"@test-email@company.com\"],\n \"visibility\": \"organization\",\n \"trigger\": \"incident_created_trigger\",\n \"enabled\": true\n },\n \"relationships\": {\n \"incident_type\": {\n \"data\": {\n \"id\": \"{{ incident_type.data.id }}\",\n \"type\": \"incident_types\"\n }\n }\n },\n \"type\": \"incident_notification_rules\"\n }\n}" + } + ], + "step": "there is a valid \"notification_rule\" in the system", + "key": "notification_rule", + "tag": "Incidents" + }, { "operationId": "CreateIncidentNotificationTemplate", "parameters": [ diff --git a/features/v2/incidents.feature b/features/v2/incidents.feature index f381e2e6f0b8..4f278f281608 100644 --- a/features/v2/incidents.feature +++ b/features/v2/incidents.feature @@ -66,6 +66,30 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @generated @skip @team:Datadog/incident-app + Scenario: Create an incident notification rule returns "Bad Request" response + Given operation "CreateIncidentNotificationRule" enabled + And new "CreateIncidentNotificationRule" request + And body with value {"data": {"attributes": {"conditions": [{"field": "severity", "values": ["SEV-1", "SEV-2"]}], "enabled": true, "handles": ["@team-email@company.com", "@slack-channel"], "renotify_on": ["status", "severity"], "trigger": "incident_created_trigger", "visibility": "organization"}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}, "notification_template": {"data": {"id": "00000000-0000-0000-0000-000000000001", "type": "notification_templates"}}}, "type": "incident_notification_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/incident-app + Scenario: Create an incident notification rule returns "Created" response + Given operation "CreateIncidentNotificationRule" enabled + And new "CreateIncidentNotificationRule" request + And body with value {"data": {"attributes": {"conditions": [{"field": "severity", "values": ["SEV-1", "SEV-2"]}], "enabled": true, "handles": ["@team-email@company.com", "@slack-channel"], "renotify_on": ["status", "severity"], "trigger": "incident_created_trigger", "visibility": "organization"}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}, "notification_template": {"data": {"id": "00000000-0000-0000-0000-000000000001", "type": "notification_templates"}}}, "type": "incident_notification_rules"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:Datadog/incident-app + Scenario: Create an incident notification rule returns "Not Found" response + Given operation "CreateIncidentNotificationRule" enabled + And new "CreateIncidentNotificationRule" request + And body with value {"data": {"attributes": {"conditions": [{"field": "severity", "values": ["SEV-1", "SEV-2"]}], "enabled": true, "handles": ["@team-email@company.com", "@slack-channel"], "renotify_on": ["status", "severity"], "trigger": "incident_created_trigger", "visibility": "organization"}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}, "notification_template": {"data": {"id": "00000000-0000-0000-0000-000000000001", "type": "notification_templates"}}}, "type": "incident_notification_rules"}} + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:DataDog/incident-app Scenario: Create an incident returns "Bad Request" response Given operation "CreateIncident" enabled @@ -146,6 +170,26 @@ Feature: Incidents When the request is sent Then the response status is 404 Not Found + @team:Datadog/incident-app + Scenario: Create incident notification rule returns "Bad Request" response + Given operation "CreateIncidentNotificationRule" enabled + And new "CreateIncidentNotificationRule" request + And body with value {"data": {"type": "invalid_type", "attributes": {"conditions": [{"field": "severity", "values": ["SEV-1", "SEV-2"]}], "handles": ["@test-email@company.com"], "visibility": "organization", "trigger": "incident_created_trigger", "enabled": true}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}}} + When the request is sent + Then the response status is 400 Bad Request + + @team:Datadog/incident-app + Scenario: Create incident notification rule returns "Created" response + Given there is a valid "incident_type" in the system + And operation "CreateIncidentNotificationRule" enabled + And new "CreateIncidentNotificationRule" request + And body with value {"data": {"attributes": {"conditions": [{"field": "severity", "values": ["SEV-1", "SEV-2"]}], "handles": ["@test-email@company.com"], "visibility": "organization", "trigger": "incident_created_trigger", "enabled": true}, "relationships": {"incident_type": {"data": {"id": "{{ incident_type.data.id }}", "type": "incident_types"}}}, "type": "incident_notification_rules"}} + When the request is sent + Then the response status is 201 Created + And the response "data.type" is equal to "incident_notification_rules" + And the response "data.attributes.visibility" is equal to "organization" + And the response "data.attributes.enabled" is equal to true + @team:Datadog/incident-app Scenario: Create incident notification template returns "Bad Request" response Given operation "CreateIncidentNotificationTemplate" enabled @@ -280,6 +324,30 @@ Feature: Incidents When the request is sent Then the response status is 204 OK + @generated @skip @team:Datadog/incident-app + Scenario: Delete an incident notification rule returns "Bad Request" response + Given operation "DeleteIncidentNotificationRule" enabled + And new "DeleteIncidentNotificationRule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/incident-app + Scenario: Delete an incident notification rule returns "No Content" response + Given operation "DeleteIncidentNotificationRule" enabled + And new "DeleteIncidentNotificationRule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 No Content + + @generated @skip @team:Datadog/incident-app + Scenario: Delete an incident notification rule returns "Not Found" response + Given operation "DeleteIncidentNotificationRule" enabled + And new "DeleteIncidentNotificationRule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + @generated @skip @team:Datadog/incident-app Scenario: Delete an incident todo returns "Bad Request" response Given operation "DeleteIncidentTodo" enabled @@ -334,6 +402,24 @@ Feature: Incidents When the request is sent Then the response status is 204 OK + @team:Datadog/incident-app + Scenario: Delete incident notification rule returns "No Content" response + Given there is a valid "incident_type" in the system + And there is a valid "notification_rule" in the system + And operation "DeleteIncidentNotificationRule" enabled + And new "DeleteIncidentNotificationRule" request + And request contains "id" parameter from "notification_rule.data.id" + When the request is sent + Then the response status is 204 No Content + + @team:Datadog/incident-app + Scenario: Delete incident notification rule returns "Not Found" response + Given operation "DeleteIncidentNotificationRule" enabled + And new "DeleteIncidentNotificationRule" request + And request contains "id" parameter with value "00000000-0000-0000-0000-000000000001" + When the request is sent + Then the response status is 404 Not Found + @team:Datadog/incident-app Scenario: Delete incident notification template returns "No Content" response Given there is a valid "incident_type" in the system @@ -470,6 +556,30 @@ Feature: Incidents Then the response status is 200 OK And the response has 3 items + @generated @skip @team:Datadog/incident-app + Scenario: Get an incident notification rule returns "Bad Request" response + Given operation "GetIncidentNotificationRule" enabled + And new "GetIncidentNotificationRule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/incident-app + Scenario: Get an incident notification rule returns "Not Found" response + Given operation "GetIncidentNotificationRule" enabled + And new "GetIncidentNotificationRule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/incident-app + Scenario: Get an incident notification rule returns "OK" response + Given operation "GetIncidentNotificationRule" enabled + And new "GetIncidentNotificationRule" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @team:DataDog/incident-app Scenario: Get incident attachments returns "OK" response Given operation "ListIncidentAttachments" enabled @@ -513,6 +623,26 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @team:Datadog/incident-app + Scenario: Get incident notification rule returns "Not Found" response + Given operation "GetIncidentNotificationRule" enabled + And new "GetIncidentNotificationRule" request + And request contains "id" parameter with value "00000000-0000-0000-0000-000000000001" + When the request is sent + Then the response status is 404 Not Found + + @team:Datadog/incident-app + Scenario: Get incident notification rule returns "OK" response + Given there is a valid "incident_type" in the system + And there is a valid "notification_rule" in the system + And operation "GetIncidentNotificationRule" enabled + And new "GetIncidentNotificationRule" request + And request contains "id" parameter from "notification_rule.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "incident_notification_rules" + And the response "data.id" has the same value as "notification_rule.data.id" + @generated @skip @team:Datadog/incident-app Scenario: Get incident notification template returns "Bad Request" response Given operation "GetIncidentNotificationTemplate" enabled @@ -624,6 +754,31 @@ Feature: Incidents Then the response status is 200 OK And the response "data.attributes.title" has the same value as "incident.data.attributes.title" + @generated @skip @team:Datadog/incident-app + Scenario: List incident notification rules returns "Bad Request" response + Given operation "ListIncidentNotificationRules" enabled + And new "ListIncidentNotificationRules" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/incident-app + Scenario: List incident notification rules returns "Not Found" response + Given operation "ListIncidentNotificationRules" enabled + And new "ListIncidentNotificationRules" request + When the request is sent + Then the response status is 404 Not Found + + @team:Datadog/incident-app + Scenario: List incident notification rules returns "OK" response + Given there is a valid "incident_type" in the system + And there is a valid "notification_rule" in the system + And operation "ListIncidentNotificationRules" enabled + And new "ListIncidentNotificationRules" request + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].type" is equal to "incident_notification_rules" + @generated @skip @team:Datadog/incident-app Scenario: List incident notification templates returns "Bad Request" response Given operation "ListIncidentNotificationTemplates" enabled @@ -756,6 +911,33 @@ Feature: Incidents Then the response status is 200 OK And the response "data.attributes.title" is equal to "{{ incident.data.attributes.title }}-updated" + @generated @skip @team:Datadog/incident-app + Scenario: Update an incident notification rule returns "Bad Request" response + Given operation "UpdateIncidentNotificationRule" enabled + And new "UpdateIncidentNotificationRule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"conditions": [{"field": "severity", "values": ["SEV-1", "SEV-2"]}], "enabled": true, "handles": ["@team-email@company.com", "@slack-channel"], "renotify_on": ["status", "severity"], "trigger": "incident_created_trigger", "visibility": "organization"}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}, "notification_template": {"data": {"id": "00000000-0000-0000-0000-000000000001", "type": "notification_templates"}}}, "type": "incident_notification_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:Datadog/incident-app + Scenario: Update an incident notification rule returns "Not Found" response + Given operation "UpdateIncidentNotificationRule" enabled + And new "UpdateIncidentNotificationRule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"conditions": [{"field": "severity", "values": ["SEV-1", "SEV-2"]}], "enabled": true, "handles": ["@team-email@company.com", "@slack-channel"], "renotify_on": ["status", "severity"], "trigger": "incident_created_trigger", "visibility": "organization"}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}, "notification_template": {"data": {"id": "00000000-0000-0000-0000-000000000001", "type": "notification_templates"}}}, "type": "incident_notification_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:Datadog/incident-app + Scenario: Update an incident notification rule returns "OK" response + Given operation "UpdateIncidentNotificationRule" enabled + And new "UpdateIncidentNotificationRule" request + And request contains "id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"conditions": [{"field": "severity", "values": ["SEV-1", "SEV-2"]}], "enabled": true, "handles": ["@team-email@company.com", "@slack-channel"], "renotify_on": ["status", "severity"], "trigger": "incident_created_trigger", "visibility": "organization"}, "id": "00000000-0000-0000-0000-000000000001", "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}, "notification_template": {"data": {"id": "00000000-0000-0000-0000-000000000001", "type": "notification_templates"}}}, "type": "incident_notification_rules"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:Datadog/incident-app Scenario: Update an incident todo returns "Bad Request" response Given operation "UpdateIncidentTodo" enabled @@ -818,6 +1000,39 @@ Feature: Incidents When the request is sent Then the response status is 200 OK + @team:Datadog/incident-app + Scenario: Update incident notification rule returns "Bad Request" response + Given operation "UpdateIncidentNotificationRule" enabled + And new "UpdateIncidentNotificationRule" request + And request contains "id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"type": "invalid_type", "attributes": {"conditions": [{"field": "severity", "values": ["SEV-1", "SEV-2"]}], "handles": ["@test-email@company.com"], "visibility": "organization", "trigger": "incident_created_trigger", "enabled": true}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000000", "type": "incident_types"}}}, "id": "00000000-0000-0000-0000-000000000001"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:Datadog/incident-app + Scenario: Update incident notification rule returns "Not Found" response + Given operation "UpdateIncidentNotificationRule" enabled + And new "UpdateIncidentNotificationRule" request + And request contains "id" parameter with value "00000000-0000-0000-0000-000000000001" + And body with value {"data": {"attributes": {"enabled": false, "conditions": [{"field": "severity", "values": ["SEV-1"]}], "handles": ["@test-email@company.com"], "trigger": "incident_created_trigger"}, "relationships": {"incident_type": {"data": {"id": "00000000-0000-0000-0000-000000000001", "type": "incident_types"}}}, "id": "00000000-0000-0000-0000-000000000001", "type": "incident_notification_rules"}} + When the request is sent + Then the response status is 404 Not Found + + @team:Datadog/incident-app + Scenario: Update incident notification rule returns "OK" response + Given there is a valid "incident_type" in the system + And there is a valid "notification_rule" in the system + And operation "UpdateIncidentNotificationRule" enabled + And new "UpdateIncidentNotificationRule" request + And request contains "id" parameter from "notification_rule.data.id" + And body with value {"data": {"attributes": {"enabled": false, "conditions": [{"field": "severity", "values": ["SEV-1"]}], "handles": ["@updated-team-email@company.com"], "visibility": "private", "trigger": "incident_modified_trigger"}, "relationships": {"incident_type": {"data": {"id": "{{ incident_type.data.id }}", "type": "incident_types"}}}, "id": "{{ notification_rule.data.id }}", "type": "incident_notification_rules"}} + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "incident_notification_rules" + And the response "data.id" has the same value as "notification_rule.data.id" + And the response "data.attributes.visibility" is equal to "private" + And the response "data.attributes.enabled" is equal to false + @team:Datadog/incident-app Scenario: Update incident notification template returns "Bad Request" response Given operation "UpdateIncidentNotificationTemplate" enabled diff --git a/features/v2/undo.json b/features/v2/undo.json index 58051028c293..f9424d938fd4 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1089,6 +1089,43 @@ "type": "unsafe" } }, + "ListIncidentNotificationRules": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "CreateIncidentNotificationRule": { + "tag": "Incidents", + "undo": { + "operationId": "DeleteIncidentNotificationRule", + "parameters": [ + { + "name": "id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "DeleteIncidentNotificationRule": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, + "GetIncidentNotificationRule": { + "tag": "Incidents", + "undo": { + "type": "safe" + } + }, + "UpdateIncidentNotificationRule": { + "tag": "Incidents", + "undo": { + "type": "idempotent" + } + }, "ListIncidentNotificationTemplates": { "tag": "Incidents", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index 85a3d5f1e1fe..533ac41e0d40 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -222,21 +222,25 @@ def initialize "v2.get_data_deletion_requests": false, "v2.create_incident": false, "v2.create_incident_integration": false, + "v2.create_incident_notification_rule": false, "v2.create_incident_notification_template": false, "v2.create_incident_todo": false, "v2.create_incident_type": false, "v2.delete_incident": false, "v2.delete_incident_integration": false, + "v2.delete_incident_notification_rule": false, "v2.delete_incident_notification_template": false, "v2.delete_incident_todo": false, "v2.delete_incident_type": false, "v2.get_incident": false, "v2.get_incident_integration": false, + "v2.get_incident_notification_rule": false, "v2.get_incident_notification_template": false, "v2.get_incident_todo": false, "v2.get_incident_type": false, "v2.list_incident_attachments": false, "v2.list_incident_integrations": false, + "v2.list_incident_notification_rules": false, "v2.list_incident_notification_templates": false, "v2.list_incidents": false, "v2.list_incident_todos": false, @@ -245,6 +249,7 @@ def initialize "v2.update_incident": false, "v2.update_incident_attachments": false, "v2.update_incident_integration": false, + "v2.update_incident_notification_rule": false, "v2.update_incident_notification_template": false, "v2.update_incident_todo": false, "v2.update_incident_type": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 5af3a0cd9007..bfa46ed1d75b 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1554,6 +1554,7 @@ def overrides "v2.create_data_deletion_request_body_data" => "CreateDataDeletionRequestBodyData", "v2.create_data_deletion_request_body_data_type" => "CreateDataDeletionRequestBodyDataType", "v2.create_data_deletion_response_body" => "CreateDataDeletionResponseBody", + "v2.create_incident_notification_rule_request" => "CreateIncidentNotificationRuleRequest", "v2.create_incident_notification_template_request" => "CreateIncidentNotificationTemplateRequest", "v2.create_notification_rule_parameters" => "CreateNotificationRuleParameters", "v2.create_notification_rule_parameters_data" => "CreateNotificationRuleParametersData", @@ -2148,6 +2149,22 @@ def overrides "v2.incident_integration_relationships" => "IncidentIntegrationRelationships", "v2.incident_non_datadog_creator" => "IncidentNonDatadogCreator", "v2.incident_notification_handle" => "IncidentNotificationHandle", + "v2.incident_notification_rule" => "IncidentNotificationRule", + "v2.incident_notification_rule_array" => "IncidentNotificationRuleArray", + "v2.incident_notification_rule_array_meta" => "IncidentNotificationRuleArrayMeta", + "v2.incident_notification_rule_array_meta_page" => "IncidentNotificationRuleArrayMetaPage", + "v2.incident_notification_rule_attributes" => "IncidentNotificationRuleAttributes", + "v2.incident_notification_rule_attributes_visibility" => "IncidentNotificationRuleAttributesVisibility", + "v2.incident_notification_rule_conditions_items" => "IncidentNotificationRuleConditionsItems", + "v2.incident_notification_rule_create_attributes" => "IncidentNotificationRuleCreateAttributes", + "v2.incident_notification_rule_create_attributes_visibility" => "IncidentNotificationRuleCreateAttributesVisibility", + "v2.incident_notification_rule_create_data" => "IncidentNotificationRuleCreateData", + "v2.incident_notification_rule_create_data_relationships" => "IncidentNotificationRuleCreateDataRelationships", + "v2.incident_notification_rule_included_items" => "IncidentNotificationRuleIncludedItems", + "v2.incident_notification_rule_relationships" => "IncidentNotificationRuleRelationships", + "v2.incident_notification_rule_response_data" => "IncidentNotificationRuleResponseData", + "v2.incident_notification_rule_type" => "IncidentNotificationRuleType", + "v2.incident_notification_rule_update_data" => "IncidentNotificationRuleUpdateData", "v2.incident_notification_template" => "IncidentNotificationTemplate", "v2.incident_notification_template_array" => "IncidentNotificationTemplateArray", "v2.incident_notification_template_array_meta" => "IncidentNotificationTemplateArrayMeta", @@ -2157,6 +2174,7 @@ def overrides "v2.incident_notification_template_create_data" => "IncidentNotificationTemplateCreateData", "v2.incident_notification_template_create_data_relationships" => "IncidentNotificationTemplateCreateDataRelationships", "v2.incident_notification_template_included_items" => "IncidentNotificationTemplateIncludedItems", + "v2.incident_notification_template_object" => "IncidentNotificationTemplateObject", "v2.incident_notification_template_relationships" => "IncidentNotificationTemplateRelationships", "v2.incident_notification_template_response_data" => "IncidentNotificationTemplateResponseData", "v2.incident_notification_template_type" => "IncidentNotificationTemplateType", @@ -3044,6 +3062,7 @@ def overrides "v2.project_response" => "ProjectResponse", "v2.projects_response" => "ProjectsResponse", "v2.publish_app_response" => "PublishAppResponse", + "v2.put_incident_notification_rule_request" => "PutIncidentNotificationRuleRequest", "v2.query" => "Query", "v2.query_formula" => "QueryFormula", "v2.query_sort_order" => "QuerySortOrder", @@ -3069,6 +3088,8 @@ def overrides "v2.relationship_to_incident_impacts" => "RelationshipToIncidentImpacts", "v2.relationship_to_incident_integration_metadata_data" => "RelationshipToIncidentIntegrationMetadataData", "v2.relationship_to_incident_integration_metadatas" => "RelationshipToIncidentIntegrationMetadatas", + "v2.relationship_to_incident_notification_template" => "RelationshipToIncidentNotificationTemplate", + "v2.relationship_to_incident_notification_template_data" => "RelationshipToIncidentNotificationTemplateData", "v2.relationship_to_incident_postmortem" => "RelationshipToIncidentPostmortem", "v2.relationship_to_incident_postmortem_data" => "RelationshipToIncidentPostmortemData", "v2.relationship_to_incident_responder_data" => "RelationshipToIncidentResponderData", diff --git a/lib/datadog_api_client/v2/api/incidents_api.rb b/lib/datadog_api_client/v2/api/incidents_api.rb index 926634445c59..b586257da8c9 100644 --- a/lib/datadog_api_client/v2/api/incidents_api.rb +++ b/lib/datadog_api_client/v2/api/incidents_api.rb @@ -174,6 +174,79 @@ def create_incident_integration_with_http_info(incident_id, body, opts = {}) return data, status_code, headers end + # Create an incident notification rule. + # + # @see #create_incident_notification_rule_with_http_info + def create_incident_notification_rule(body, opts = {}) + data, _status_code, _headers = create_incident_notification_rule_with_http_info(body, opts) + data + end + + # Create an incident notification rule. + # + # Creates a new notification rule. + # + # @param body [CreateIncidentNotificationRuleRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(IncidentNotificationRule, Integer, Hash)>] IncidentNotificationRule data, response status code and response headers + def create_incident_notification_rule_with_http_info(body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_incident_notification_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_incident_notification_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_incident_notification_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.create_incident_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 IncidentsAPI.create_incident_notification_rule" + end + # resource path + local_var_path = '/api/v2/incidents/config/notification-rules' + + # 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] || 'IncidentNotificationRule' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :create_incident_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: IncidentsAPI#create_incident_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create incident notification template. # # @see #create_incident_notification_template_with_http_info @@ -545,6 +618,79 @@ def delete_incident_integration_with_http_info(incident_id, integration_metadata return data, status_code, headers end + # Delete an incident notification rule. + # + # @see #delete_incident_notification_rule_with_http_info + def delete_incident_notification_rule(id, opts = {}) + delete_incident_notification_rule_with_http_info(id, opts) + nil + end + + # Delete an incident notification rule. + # + # Deletes a notification rule by its ID. + # + # @param id [UUID] The ID of the notification rule. + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of resources to include. Supported values: `created_by_user`, `last_modified_by_user`, `incident_type`, `notification_template` + # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers + def delete_incident_notification_rule_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.delete_incident_notification_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.delete_incident_notification_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.delete_incident_notification_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.delete_incident_notification_rule ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling IncidentsAPI.delete_incident_notification_rule" + end + # resource path + local_var_path = '/api/v2/incidents/config/notification-rules/{id}'.sub('{id}', CGI.escape(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(['*/*']) + + # 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_incident_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: IncidentsAPI#delete_incident_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Delete a notification template. # # @see #delete_incident_notification_template_with_http_info @@ -914,6 +1060,79 @@ def get_incident_integration_with_http_info(incident_id, integration_metadata_id return data, status_code, headers end + # Get an incident notification rule. + # + # @see #get_incident_notification_rule_with_http_info + def get_incident_notification_rule(id, opts = {}) + data, _status_code, _headers = get_incident_notification_rule_with_http_info(id, opts) + data + end + + # Get an incident notification rule. + # + # Retrieves a specific notification rule by its ID. + # + # @param id [UUID] The ID of the notification rule. + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of resources to include. Supported values: `created_by_user`, `last_modified_by_user`, `incident_type`, `notification_template` + # @return [Array<(IncidentNotificationRule, Integer, Hash)>] IncidentNotificationRule data, response status code and response headers + def get_incident_notification_rule_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_incident_notification_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_incident_notification_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_incident_notification_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.get_incident_notification_rule ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling IncidentsAPI.get_incident_notification_rule" + end + # resource path + local_var_path = '/api/v2/incidents/config/notification-rules/{id}'.sub('{id}', CGI.escape(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] || 'IncidentNotificationRule' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_incident_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: IncidentsAPI#get_incident_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get incident notification template. # # @see #get_incident_notification_template_with_http_info @@ -1280,6 +1499,74 @@ def list_incident_integrations_with_http_info(incident_id, opts = {}) return data, status_code, headers end + # List incident notification rules. + # + # @see #list_incident_notification_rules_with_http_info + def list_incident_notification_rules(opts = {}) + data, _status_code, _headers = list_incident_notification_rules_with_http_info(opts) + data + end + + # List incident notification rules. + # + # Lists all notification rules for the organization. Optionally filter by incident type. + # + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of resources to include. Supported values: `created_by_user`, `last_modified_by_user`, `incident_type`, `notification_template` + # @return [Array<(IncidentNotificationRuleArray, Integer, Hash)>] IncidentNotificationRuleArray data, response status code and response headers + def list_incident_notification_rules_with_http_info(opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.list_incident_notification_rules".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_incident_notification_rules") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_incident_notification_rules")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.list_incident_notification_rules ...' + end + # resource path + local_var_path = '/api/v2/incidents/config/notification-rules' + + # 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] || 'IncidentNotificationRuleArray' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :list_incident_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: IncidentsAPI#list_incident_notification_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # List incident notification templates. # # @see #list_incident_notification_templates_with_http_info @@ -1934,6 +2221,86 @@ def update_incident_integration_with_http_info(incident_id, integration_metadata return data, status_code, headers end + # Update an incident notification rule. + # + # @see #update_incident_notification_rule_with_http_info + def update_incident_notification_rule(id, body, opts = {}) + data, _status_code, _headers = update_incident_notification_rule_with_http_info(id, body, opts) + data + end + + # Update an incident notification rule. + # + # Updates an existing notification rule with a complete replacement. + # + # @param id [UUID] The ID of the notification rule. + # @param body [PutIncidentNotificationRuleRequest] + # @param opts [Hash] the optional parameters + # @option opts [String] :include Comma-separated list of resources to include. Supported values: `created_by_user`, `last_modified_by_user`, `incident_type`, `notification_template` + # @return [Array<(IncidentNotificationRule, Integer, Hash)>] IncidentNotificationRule data, response status code and response headers + def update_incident_notification_rule_with_http_info(id, body, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.update_incident_notification_rule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.update_incident_notification_rule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.update_incident_notification_rule")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: IncidentsAPI.update_incident_notification_rule ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling IncidentsAPI.update_incident_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 IncidentsAPI.update_incident_notification_rule" + end + # resource path + local_var_path = '/api/v2/incidents/config/notification-rules/{id}'.sub('{id}', CGI.escape(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']) + # 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] || 'IncidentNotificationRule' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :update_incident_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::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: IncidentsAPI#update_incident_notification_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update incident notification template. # # @see #update_incident_notification_template_with_http_info diff --git a/lib/datadog_api_client/v2/models/create_incident_notification_rule_request.rb b/lib/datadog_api_client/v2/models/create_incident_notification_rule_request.rb new file mode 100644 index 000000000000..e3c3cc608f76 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_incident_notification_rule_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 + # Create request for a notification rule. + class CreateIncidentNotificationRuleRequest + include BaseGenericModel + + # Notification rule data for a create request. + 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' => :'IncidentNotificationRuleCreateData' + } + 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::CreateIncidentNotificationRuleRequest` 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/incident_notification_rule.rb b/lib/datadog_api_client/v2/models/incident_notification_rule.rb new file mode 100644 index 000000000000..43a9e2ad55b1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule.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 + # Response with a notification rule. + class IncidentNotificationRule + include BaseGenericModel + + # Notification rule data from a response. + attr_reader :data + + # Related objects that are included in the response. + 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' => :'IncidentNotificationRuleResponseData', + :'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::IncidentNotificationRule` 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 + + # 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 && + 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/incident_notification_rule_array.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_array.rb new file mode 100644 index 000000000000..aeddca76092a --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_array.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 + # Response with notification rules. + class IncidentNotificationRuleArray + include BaseGenericModel + + # The `NotificationRuleArray` `data`. + attr_reader :data + + # Related objects that are included in the response. + attr_accessor :included + + # Response metadata. + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'included' => :'Array', + :'meta' => :'IncidentNotificationRuleArrayMeta' + } + 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::IncidentNotificationRuleArray` 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 + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + 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 && + included == o.included && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_array_meta.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_array_meta.rb new file mode 100644 index 000000000000..740d94ab8bc4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_array_meta.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 + # Response metadata. + class IncidentNotificationRuleArrayMeta + include BaseGenericModel + + # Pagination metadata. + attr_accessor :pagination + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'pagination' => :'pagination' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'pagination' => :'IncidentNotificationRuleArrayMetaPage' + } + 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::IncidentNotificationRuleArrayMeta` 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?(:'pagination') + self.pagination = attributes[:'pagination'] + 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 && + pagination == o.pagination && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [pagination, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_array_meta_page.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_array_meta_page.rb new file mode 100644 index 000000000000..8719dc79438c --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_array_meta_page.rb @@ -0,0 +1,125 @@ +=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 + # Pagination metadata. + class IncidentNotificationRuleArrayMetaPage + include BaseGenericModel + + # The offset for the next page of results. + attr_accessor :next_offset + + # The current offset in the results. + attr_accessor :offset + + # The number of results returned per page. + attr_accessor :size + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'next_offset' => :'next_offset', + :'offset' => :'offset', + :'size' => :'size' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'next_offset' => :'Integer', + :'offset' => :'Integer', + :'size' => :'Integer' + } + 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::IncidentNotificationRuleArrayMetaPage` 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?(:'next_offset') + self.next_offset = attributes[:'next_offset'] + end + + if attributes.key?(:'offset') + self.offset = attributes[:'offset'] + end + + if attributes.key?(:'size') + self.size = attributes[:'size'] + 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 && + next_offset == o.next_offset && + offset == o.offset && + size == o.size && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [next_offset, offset, size, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_attributes.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_attributes.rb new file mode 100644 index 000000000000..adedd3f154c0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_attributes.rb @@ -0,0 +1,265 @@ +=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 notification rule's attributes. + class IncidentNotificationRuleAttributes + include BaseGenericModel + + # The conditions that trigger this notification rule. + attr_reader :conditions + + # Timestamp when the notification rule was created. + attr_reader :created + + # Whether the notification rule is enabled. + attr_reader :enabled + + # The notification handles (targets) for this rule. + attr_reader :handles + + # Timestamp when the notification rule was last modified. + attr_reader :modified + + # List of incident fields that trigger re-notification when changed. + attr_accessor :renotify_on + + # The trigger event for this notification rule. + attr_reader :trigger + + # The visibility of the notification rule. + attr_reader :visibility + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'conditions' => :'conditions', + :'created' => :'created', + :'enabled' => :'enabled', + :'handles' => :'handles', + :'modified' => :'modified', + :'renotify_on' => :'renotify_on', + :'trigger' => :'trigger', + :'visibility' => :'visibility' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'conditions' => :'Array', + :'created' => :'Time', + :'enabled' => :'Boolean', + :'handles' => :'Array', + :'modified' => :'Time', + :'renotify_on' => :'Array', + :'trigger' => :'String', + :'visibility' => :'IncidentNotificationRuleAttributesVisibility' + } + 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::IncidentNotificationRuleAttributes` 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?(:'conditions') + if (value = attributes[:'conditions']).is_a?(Array) + self.conditions = value + end + end + + if attributes.key?(:'created') + self.created = attributes[:'created'] + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'handles') + if (value = attributes[:'handles']).is_a?(Array) + self.handles = value + end + end + + if attributes.key?(:'modified') + self.modified = attributes[:'modified'] + end + + if attributes.key?(:'renotify_on') + if (value = attributes[:'renotify_on']).is_a?(Array) + self.renotify_on = value + end + end + + if attributes.key?(:'trigger') + self.trigger = attributes[:'trigger'] + end + + if attributes.key?(:'visibility') + self.visibility = attributes[:'visibility'] + 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 @conditions.nil? + return false if @created.nil? + return false if @enabled.nil? + return false if @handles.nil? + return false if @modified.nil? + return false if @trigger.nil? + return false if @visibility.nil? + true + end + + # Custom attribute writer method with validation + # @param conditions [Object] Object to be assigned + # @!visibility private + def conditions=(conditions) + if conditions.nil? + fail ArgumentError, 'invalid value for "conditions", conditions cannot be nil.' + end + @conditions = conditions + end + + # Custom attribute writer method with validation + # @param created [Object] Object to be assigned + # @!visibility private + def created=(created) + if created.nil? + fail ArgumentError, 'invalid value for "created", created cannot be nil.' + end + @created = created + end + + # Custom attribute writer method with validation + # @param enabled [Object] Object to be assigned + # @!visibility private + def enabled=(enabled) + if enabled.nil? + fail ArgumentError, 'invalid value for "enabled", enabled cannot be nil.' + end + @enabled = enabled + end + + # Custom attribute writer method with validation + # @param handles [Object] Object to be assigned + # @!visibility private + def handles=(handles) + if handles.nil? + fail ArgumentError, 'invalid value for "handles", handles cannot be nil.' + end + @handles = handles + end + + # Custom attribute writer method with validation + # @param modified [Object] Object to be assigned + # @!visibility private + def modified=(modified) + if modified.nil? + fail ArgumentError, 'invalid value for "modified", modified cannot be nil.' + end + @modified = modified + end + + # Custom attribute writer method with validation + # @param trigger [Object] Object to be assigned + # @!visibility private + def trigger=(trigger) + if trigger.nil? + fail ArgumentError, 'invalid value for "trigger", trigger cannot be nil.' + end + @trigger = trigger + end + + # Custom attribute writer method with validation + # @param visibility [Object] Object to be assigned + # @!visibility private + def visibility=(visibility) + if visibility.nil? + fail ArgumentError, 'invalid value for "visibility", visibility cannot be nil.' + end + @visibility = visibility + 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 && + conditions == o.conditions && + created == o.created && + enabled == o.enabled && + handles == o.handles && + modified == o.modified && + renotify_on == o.renotify_on && + trigger == o.trigger && + visibility == o.visibility && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [conditions, created, enabled, handles, modified, renotify_on, trigger, visibility, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_attributes_visibility.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_attributes_visibility.rb new file mode 100644 index 000000000000..f0ceb46f3064 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_attributes_visibility.rb @@ -0,0 +1,28 @@ +=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 visibility of the notification rule. + class IncidentNotificationRuleAttributesVisibility + include BaseEnumModel + + ALL = "all".freeze + ORGANIZATION = "organization".freeze + PRIVATE = "private".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_conditions_items.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_conditions_items.rb new file mode 100644 index 000000000000..5955646eb140 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_conditions_items.rb @@ -0,0 +1,146 @@ +=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 condition that must be met to trigger the notification rule. + class IncidentNotificationRuleConditionsItems + include BaseGenericModel + + # The incident field to evaluate + attr_reader :field + + # The value(s) to compare against. Multiple values are `ORed` together. + attr_reader :values + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'field' => :'field', + :'values' => :'values' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'field' => :'String', + :'values' => :'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::IncidentNotificationRuleConditionsItems` 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?(:'field') + self.field = attributes[:'field'] + end + + if attributes.key?(:'values') + if (value = attributes[:'values']).is_a?(Array) + self.values = 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 @field.nil? + return false if @values.nil? + true + end + + # Custom attribute writer method with validation + # @param field [Object] Object to be assigned + # @!visibility private + def field=(field) + if field.nil? + fail ArgumentError, 'invalid value for "field", field cannot be nil.' + end + @field = field + end + + # Custom attribute writer method with validation + # @param values [Object] Object to be assigned + # @!visibility private + def values=(values) + if values.nil? + fail ArgumentError, 'invalid value for "values", values cannot be nil.' + end + @values = values + 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 && + field == o.field && + values == o.values && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [field, values, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_create_attributes.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_create_attributes.rb new file mode 100644 index 000000000000..4d1d65c0be64 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_create_attributes.rb @@ -0,0 +1,201 @@ +=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 attributes for creating a notification rule. + class IncidentNotificationRuleCreateAttributes + include BaseGenericModel + + # The conditions that trigger this notification rule. + attr_reader :conditions + + # Whether the notification rule is enabled. + attr_accessor :enabled + + # The notification handles (targets) for this rule. + attr_reader :handles + + # List of incident fields that trigger re-notification when changed. + attr_accessor :renotify_on + + # The trigger event for this notification rule. + attr_reader :trigger + + # The visibility of the notification rule. + attr_accessor :visibility + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'conditions' => :'conditions', + :'enabled' => :'enabled', + :'handles' => :'handles', + :'renotify_on' => :'renotify_on', + :'trigger' => :'trigger', + :'visibility' => :'visibility' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'conditions' => :'Array', + :'enabled' => :'Boolean', + :'handles' => :'Array', + :'renotify_on' => :'Array', + :'trigger' => :'String', + :'visibility' => :'IncidentNotificationRuleCreateAttributesVisibility' + } + 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::IncidentNotificationRuleCreateAttributes` 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?(:'conditions') + if (value = attributes[:'conditions']).is_a?(Array) + self.conditions = value + end + end + + if attributes.key?(:'enabled') + self.enabled = attributes[:'enabled'] + end + + if attributes.key?(:'handles') + if (value = attributes[:'handles']).is_a?(Array) + self.handles = value + end + end + + if attributes.key?(:'renotify_on') + if (value = attributes[:'renotify_on']).is_a?(Array) + self.renotify_on = value + end + end + + if attributes.key?(:'trigger') + self.trigger = attributes[:'trigger'] + end + + if attributes.key?(:'visibility') + self.visibility = attributes[:'visibility'] + 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 @conditions.nil? + return false if @handles.nil? + return false if @trigger.nil? + true + end + + # Custom attribute writer method with validation + # @param conditions [Object] Object to be assigned + # @!visibility private + def conditions=(conditions) + if conditions.nil? + fail ArgumentError, 'invalid value for "conditions", conditions cannot be nil.' + end + @conditions = conditions + end + + # Custom attribute writer method with validation + # @param handles [Object] Object to be assigned + # @!visibility private + def handles=(handles) + if handles.nil? + fail ArgumentError, 'invalid value for "handles", handles cannot be nil.' + end + @handles = handles + end + + # Custom attribute writer method with validation + # @param trigger [Object] Object to be assigned + # @!visibility private + def trigger=(trigger) + if trigger.nil? + fail ArgumentError, 'invalid value for "trigger", trigger cannot be nil.' + end + @trigger = trigger + 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 && + conditions == o.conditions && + enabled == o.enabled && + handles == o.handles && + renotify_on == o.renotify_on && + trigger == o.trigger && + visibility == o.visibility && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [conditions, enabled, handles, renotify_on, trigger, visibility, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_create_attributes_visibility.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_create_attributes_visibility.rb new file mode 100644 index 000000000000..aa133c889c8d --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_create_attributes_visibility.rb @@ -0,0 +1,28 @@ +=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 visibility of the notification rule. + class IncidentNotificationRuleCreateAttributesVisibility + include BaseEnumModel + + ALL = "all".freeze + ORGANIZATION = "organization".freeze + PRIVATE = "private".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_create_data.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_create_data.rb new file mode 100644 index 000000000000..54a65449cb70 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_create_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 + # Notification rule data for a create request. + class IncidentNotificationRuleCreateData + include BaseGenericModel + + # The attributes for creating a notification rule. + attr_reader :attributes + + # The definition of `NotificationRuleCreateDataRelationships` object. + attr_accessor :relationships + + # Notification rules resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'IncidentNotificationRuleCreateAttributes', + :'relationships' => :'IncidentNotificationRuleCreateDataRelationships', + :'type' => :'IncidentNotificationRuleType' + } + 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::IncidentNotificationRuleCreateData` 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?(:'relationships') + self.relationships = attributes[:'relationships'] + 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 @type.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 type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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 && + 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, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_create_data_relationships.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_create_data_relationships.rb new file mode 100644 index 000000000000..b1ba68508f9b --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_create_data_relationships.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 + # The definition of `NotificationRuleCreateDataRelationships` object. + class IncidentNotificationRuleCreateDataRelationships + include BaseGenericModel + + # Relationship to an incident type. + attr_accessor :incident_type + + # A relationship reference to a notification template. + attr_accessor :notification_template + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'incident_type' => :'incident_type', + :'notification_template' => :'notification_template' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'incident_type' => :'RelationshipToIncidentType', + :'notification_template' => :'RelationshipToIncidentNotificationTemplate' + } + 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::IncidentNotificationRuleCreateDataRelationships` 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?(:'incident_type') + self.incident_type = attributes[:'incident_type'] + end + + if attributes.key?(:'notification_template') + self.notification_template = attributes[:'notification_template'] + 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 && + incident_type == o.incident_type && + notification_template == o.notification_template && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [incident_type, notification_template, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_included_items.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_included_items.rb new file mode 100644 index 000000000000..feb203d81d80 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_included_items.rb @@ -0,0 +1,64 @@ +=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 + # Objects related to a notification rule. + module IncidentNotificationRuleIncludedItems + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'User', + :'IncidentTypeObject', + :'IncidentNotificationTemplateObject' + ] + 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/incident_notification_rule_relationships.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_relationships.rb new file mode 100644 index 000000000000..f3b2bc081b55 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_relationships.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 + # The notification rule's resource relationships. + class IncidentNotificationRuleRelationships + include BaseGenericModel + + # Relationship to user. + attr_accessor :created_by_user + + # Relationship to an incident type. + attr_accessor :incident_type + + # Relationship to user. + attr_accessor :last_modified_by_user + + # A relationship reference to a notification template. + attr_accessor :notification_template + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_by_user' => :'created_by_user', + :'incident_type' => :'incident_type', + :'last_modified_by_user' => :'last_modified_by_user', + :'notification_template' => :'notification_template' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_by_user' => :'RelationshipToUser', + :'incident_type' => :'RelationshipToIncidentType', + :'last_modified_by_user' => :'RelationshipToUser', + :'notification_template' => :'RelationshipToIncidentNotificationTemplate' + } + 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::IncidentNotificationRuleRelationships` 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_user') + self.created_by_user = attributes[:'created_by_user'] + end + + if attributes.key?(:'incident_type') + self.incident_type = attributes[:'incident_type'] + end + + if attributes.key?(:'last_modified_by_user') + self.last_modified_by_user = attributes[:'last_modified_by_user'] + end + + if attributes.key?(:'notification_template') + self.notification_template = attributes[:'notification_template'] + 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_user == o.created_by_user && + incident_type == o.incident_type && + last_modified_by_user == o.last_modified_by_user && + notification_template == o.notification_template && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_by_user, incident_type, last_modified_by_user, notification_template, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_response_data.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_response_data.rb new file mode 100644 index 000000000000..0bc16a10c482 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_response_data.rb @@ -0,0 +1,164 @@ +=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 + # Notification rule data from a response. + class IncidentNotificationRuleResponseData + include BaseGenericModel + + # The notification rule's attributes. + attr_accessor :attributes + + # The unique identifier of the notification rule. + attr_reader :id + + # The notification rule's resource relationships. + attr_accessor :relationships + + # Notification rules resource type. + attr_reader :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' => :'IncidentNotificationRuleAttributes', + :'id' => :'UUID', + :'relationships' => :'IncidentNotificationRuleRelationships', + :'type' => :'IncidentNotificationRuleType' + } + 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::IncidentNotificationRuleResponseData` 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 + + # 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 @id.nil? + return false if @type.nil? + true + 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 + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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/incident_notification_rule_type.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_type.rb new file mode 100644 index 000000000000..c920cd2d2c5c --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_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 + # Notification rules resource type. + class IncidentNotificationRuleType + include BaseEnumModel + + INCIDENT_NOTIFICATION_RULES = "incident_notification_rules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/incident_notification_rule_update_data.rb b/lib/datadog_api_client/v2/models/incident_notification_rule_update_data.rb new file mode 100644 index 000000000000..9cc6e8ccb369 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_rule_update_data.rb @@ -0,0 +1,175 @@ +=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 + # Notification rule data for an update request. + class IncidentNotificationRuleUpdateData + include BaseGenericModel + + # The attributes for creating a notification rule. + attr_reader :attributes + + # The unique identifier of the notification rule. + attr_reader :id + + # The definition of `NotificationRuleCreateDataRelationships` object. + attr_accessor :relationships + + # Notification rules resource type. + attr_reader :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' => :'IncidentNotificationRuleCreateAttributes', + :'id' => :'UUID', + :'relationships' => :'IncidentNotificationRuleCreateDataRelationships', + :'type' => :'IncidentNotificationRuleType' + } + 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::IncidentNotificationRuleUpdateData` 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 + + # 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? + return false if @type.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 + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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/incident_notification_template_object.rb b/lib/datadog_api_client/v2/models/incident_notification_template_object.rb new file mode 100644 index 000000000000..63917fd96107 --- /dev/null +++ b/lib/datadog_api_client/v2/models/incident_notification_template_object.rb @@ -0,0 +1,164 @@ +=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 notification template object for inclusion in other resources. + class IncidentNotificationTemplateObject + include BaseGenericModel + + # The notification template's attributes. + attr_accessor :attributes + + # The unique identifier of the notification template. + attr_reader :id + + # The notification template's resource relationships. + attr_accessor :relationships + + # Notification templates resource type. + attr_reader :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' => :'IncidentNotificationTemplateAttributes', + :'id' => :'UUID', + :'relationships' => :'IncidentNotificationTemplateRelationships', + :'type' => :'IncidentNotificationTemplateType' + } + 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::IncidentNotificationTemplateObject` 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 + + # 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 @id.nil? + return false if @type.nil? + true + 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 + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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/put_incident_notification_rule_request.rb b/lib/datadog_api_client/v2/models/put_incident_notification_rule_request.rb new file mode 100644 index 000000000000..123ebaa75609 --- /dev/null +++ b/lib/datadog_api_client/v2/models/put_incident_notification_rule_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 + # Put request for a notification rule. + class PutIncidentNotificationRuleRequest + include BaseGenericModel + + # Notification rule data for an update request. + 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' => :'IncidentNotificationRuleUpdateData' + } + 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::PutIncidentNotificationRuleRequest` 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/relationship_to_incident_notification_template.rb b/lib/datadog_api_client/v2/models/relationship_to_incident_notification_template.rb new file mode 100644 index 000000000000..3438b6815e39 --- /dev/null +++ b/lib/datadog_api_client/v2/models/relationship_to_incident_notification_template.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 + # A relationship reference to a notification template. + class RelationshipToIncidentNotificationTemplate + include BaseGenericModel + + # The notification template relationship data. + 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' => :'RelationshipToIncidentNotificationTemplateData' + } + 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::RelationshipToIncidentNotificationTemplate` 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/relationship_to_incident_notification_template_data.rb b/lib/datadog_api_client/v2/models/relationship_to_incident_notification_template_data.rb new file mode 100644 index 000000000000..87739a5749b1 --- /dev/null +++ b/lib/datadog_api_client/v2/models/relationship_to_incident_notification_template_data.rb @@ -0,0 +1,144 @@ +=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 notification template relationship data. + class RelationshipToIncidentNotificationTemplateData + include BaseGenericModel + + # The unique identifier of the notification template. + attr_reader :id + + # Notification templates resource type. + attr_reader :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' => :'UUID', + :'type' => :'IncidentNotificationTemplateType' + } + 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::RelationshipToIncidentNotificationTemplateData` 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 + + # 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 @id.nil? + return false if @type.nil? + true + 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 + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + 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