From 3416220501b06a2e38a5335c08028d5f0e166dcf Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Wed, 10 Sep 2025 15:44:57 +0000 Subject: [PATCH] Regenerate client from commit f3f1a38 of spec repo --- .generator/schemas/v2/openapi.yaml | 556 ++++++- .../CreateIncidentNotificationRule.java | 78 + ...teIncidentNotificationRule_3029800608.java | 66 + .../DeleteIncidentNotificationRule.java | 25 + ...teIncidentNotificationRule_4148107167.java | 32 + .../GetIncidentNotificationRule.java | 28 + .../GetIncidentNotificationRule_67441486.java | 35 + .../ListIncidentNotificationRules.java | 25 + .../UpdateIncidentNotificationRule.java | 81 + ...teIncidentNotificationRule_1207309457.java | 75 + .../com/datadog/api/client/ApiClient.java | 5 + .../api/client/v2/api/IncidentsApi.java | 1402 ++++++++++++++--- ...CreateIncidentNotificationRuleRequest.java | 148 ++ .../v2/model/IncidentNotificationRule.java | 190 +++ .../model/IncidentNotificationRuleArray.java | 227 +++ .../IncidentNotificationRuleArrayMeta.java | 139 ++ ...IncidentNotificationRuleArrayMetaPage.java | 193 +++ .../IncidentNotificationRuleAttributes.java | 368 +++++ ...tNotificationRuleAttributesVisibility.java | 67 + ...cidentNotificationRuleConditionsItems.java | 183 +++ ...identNotificationRuleCreateAttributes.java | 318 ++++ ...icationRuleCreateAttributesVisibility.java | 67 + .../IncidentNotificationRuleCreateData.java | 214 +++ ...tificationRuleCreateDataRelationships.java | 179 +++ ...IncidentNotificationRuleIncludedItems.java | 361 +++++ ...IncidentNotificationRuleRelationships.java | 237 +++ .../IncidentNotificationRuleResponseData.java | 240 +++ .../model/IncidentNotificationRuleType.java | 57 + .../IncidentNotificationRuleUpdateData.java | 243 +++ .../IncidentNotificationTemplateObject.java | 240 +++ .../PutIncidentNotificationRuleRequest.java | 148 ++ ...ionshipToIncidentNotificationTemplate.java | 151 ++ ...hipToIncidentNotificationTemplateData.java | 185 +++ ...ncident_type_returns_CREATED_response.json | 2 +- ...n_rule_returns_Bad_Request_response.freeze | 1 + ...ion_rule_returns_Bad_Request_response.json | 32 + ...ation_rule_returns_Created_response.freeze | 1 + ...ication_rule_returns_Created_response.json | 104 ++ ...on_rule_returns_No_Content_response.freeze | 1 + ...tion_rule_returns_No_Content_response.json | 130 ++ ...ion_rule_returns_Not_Found_response.freeze | 1 + ...ation_rule_returns_Not_Found_response.json | 28 + ...ion_rule_returns_Not_Found_response.freeze | 1 + ...ation_rule_returns_Not_Found_response.json | 28 + ...tification_rule_returns_OK_response.freeze | 1 + ...notification_rule_returns_OK_response.json | 130 ++ ...fication_template_returns_OK_response.json | 2 +- ...ification_rules_returns_OK_response.freeze | 1 + ...otification_rules_returns_OK_response.json | 130 ++ ...n_rule_returns_Bad_Request_response.freeze | 1 + ...ion_rule_returns_Bad_Request_response.json | 32 + ...ion_rule_returns_Not_Found_response.freeze | 1 + ...ation_rule_returns_Not_Found_response.json | 32 + ...tification_rule_returns_OK_response.freeze | 1 + ...notification_rule_returns_OK_response.json | 134 ++ ...fication_template_returns_OK_response.json | 2 +- .../com/datadog/api/client/v2/api/given.json | 12 + .../api/client/v2/api/incidents.feature | 215 +++ .../com/datadog/api/client/v2/api/undo.json | 37 + 59 files changed, 7439 insertions(+), 184 deletions(-) create mode 100644 examples/v2/incidents/CreateIncidentNotificationRule.java create mode 100644 examples/v2/incidents/CreateIncidentNotificationRule_3029800608.java create mode 100644 examples/v2/incidents/DeleteIncidentNotificationRule.java create mode 100644 examples/v2/incidents/DeleteIncidentNotificationRule_4148107167.java create mode 100644 examples/v2/incidents/GetIncidentNotificationRule.java create mode 100644 examples/v2/incidents/GetIncidentNotificationRule_67441486.java create mode 100644 examples/v2/incidents/ListIncidentNotificationRules.java create mode 100644 examples/v2/incidents/UpdateIncidentNotificationRule.java create mode 100644 examples/v2/incidents/UpdateIncidentNotificationRule_1207309457.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CreateIncidentNotificationRuleRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRule.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArray.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArrayMeta.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArrayMetaPage.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleAttributesVisibility.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleConditionsItems.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateAttributesVisibility.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateDataRelationships.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleIncludedItems.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleRelationships.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleUpdateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/IncidentNotificationTemplateObject.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/PutIncidentNotificationRuleRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentNotificationTemplate.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentNotificationTemplateData.java create mode 100644 src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Created_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Created_response.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_No_Content_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_No_Content_response.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/List_incident_notification_rules_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/List_incident_notification_rules_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_OK_response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fdfee387d48..c22e5932566 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/examples/v2/incidents/CreateIncidentNotificationRule.java b/examples/v2/incidents/CreateIncidentNotificationRule.java new file mode 100644 index 00000000000..be178d0e377 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentNotificationRule.java @@ -0,0 +1,78 @@ +// Create an incident notification rule returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.CreateIncidentNotificationRuleRequest; +import com.datadog.api.client.v2.model.IncidentNotificationRule; +import com.datadog.api.client.v2.model.IncidentNotificationRuleConditionsItems; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateAttributes; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateAttributesVisibility; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateData; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateDataRelationships; +import com.datadog.api.client.v2.model.IncidentNotificationRuleType; +import com.datadog.api.client.v2.model.IncidentNotificationTemplateType; +import com.datadog.api.client.v2.model.IncidentTypeType; +import com.datadog.api.client.v2.model.RelationshipToIncidentNotificationTemplate; +import com.datadog.api.client.v2.model.RelationshipToIncidentNotificationTemplateData; +import com.datadog.api.client.v2.model.RelationshipToIncidentType; +import com.datadog.api.client.v2.model.RelationshipToIncidentTypeData; +import java.util.Arrays; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createIncidentNotificationRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + CreateIncidentNotificationRuleRequest body = + new CreateIncidentNotificationRuleRequest() + .data( + new IncidentNotificationRuleCreateData() + .attributes( + new IncidentNotificationRuleCreateAttributes() + .conditions( + Collections.singletonList( + new IncidentNotificationRuleConditionsItems() + .field("severity") + .values(Arrays.asList("SEV-1", "SEV-2")))) + .enabled(true) + .handles(Arrays.asList("@team-email@company.com", "@slack-channel")) + .renotifyOn(Arrays.asList("status", "severity")) + .trigger("incident_created_trigger") + .visibility( + IncidentNotificationRuleCreateAttributesVisibility.ORGANIZATION)) + .relationships( + new IncidentNotificationRuleCreateDataRelationships() + .incidentType( + new RelationshipToIncidentType() + .data( + new RelationshipToIncidentTypeData() + .id("00000000-0000-0000-0000-000000000000") + .type(IncidentTypeType.INCIDENT_TYPES))) + .notificationTemplate( + new RelationshipToIncidentNotificationTemplate() + .data( + new RelationshipToIncidentNotificationTemplateData() + .id( + UUID.fromString( + "00000000-0000-0000-0000-000000000001")) + .type( + IncidentNotificationTemplateType + .NOTIFICATION_TEMPLATES)))) + .type(IncidentNotificationRuleType.INCIDENT_NOTIFICATION_RULES)); + + try { + IncidentNotificationRule result = apiInstance.createIncidentNotificationRule(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#createIncidentNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/CreateIncidentNotificationRule_3029800608.java b/examples/v2/incidents/CreateIncidentNotificationRule_3029800608.java new file mode 100644 index 00000000000..3f3bcc2f853 --- /dev/null +++ b/examples/v2/incidents/CreateIncidentNotificationRule_3029800608.java @@ -0,0 +1,66 @@ +// Create incident notification rule returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.CreateIncidentNotificationRuleRequest; +import com.datadog.api.client.v2.model.IncidentNotificationRule; +import com.datadog.api.client.v2.model.IncidentNotificationRuleConditionsItems; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateAttributes; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateAttributesVisibility; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateData; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateDataRelationships; +import com.datadog.api.client.v2.model.IncidentNotificationRuleType; +import com.datadog.api.client.v2.model.IncidentTypeType; +import com.datadog.api.client.v2.model.RelationshipToIncidentType; +import com.datadog.api.client.v2.model.RelationshipToIncidentTypeData; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createIncidentNotificationRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + // there is a valid "incident_type" in the system + String INCIDENT_TYPE_DATA_ID = System.getenv("INCIDENT_TYPE_DATA_ID"); + + CreateIncidentNotificationRuleRequest body = + new CreateIncidentNotificationRuleRequest() + .data( + new IncidentNotificationRuleCreateData() + .attributes( + new IncidentNotificationRuleCreateAttributes() + .conditions( + Collections.singletonList( + new IncidentNotificationRuleConditionsItems() + .field("severity") + .values(Arrays.asList("SEV-1", "SEV-2")))) + .handles(Collections.singletonList("@test-email@company.com")) + .visibility( + IncidentNotificationRuleCreateAttributesVisibility.ORGANIZATION) + .trigger("incident_created_trigger") + .enabled(true)) + .relationships( + new IncidentNotificationRuleCreateDataRelationships() + .incidentType( + new RelationshipToIncidentType() + .data( + new RelationshipToIncidentTypeData() + .id(INCIDENT_TYPE_DATA_ID) + .type(IncidentTypeType.INCIDENT_TYPES)))) + .type(IncidentNotificationRuleType.INCIDENT_NOTIFICATION_RULES)); + + try { + IncidentNotificationRule result = apiInstance.createIncidentNotificationRule(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#createIncidentNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/DeleteIncidentNotificationRule.java b/examples/v2/incidents/DeleteIncidentNotificationRule.java new file mode 100644 index 00000000000..00b1e17e178 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentNotificationRule.java @@ -0,0 +1,25 @@ +// Delete an incident notification rule returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteIncidentNotificationRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + try { + apiInstance.deleteIncidentNotificationRule( + UUID.fromString("00000000-0000-0000-0000-000000000001")); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#deleteIncidentNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/DeleteIncidentNotificationRule_4148107167.java b/examples/v2/incidents/DeleteIncidentNotificationRule_4148107167.java new file mode 100644 index 00000000000..ecefdfb1934 --- /dev/null +++ b/examples/v2/incidents/DeleteIncidentNotificationRule_4148107167.java @@ -0,0 +1,32 @@ +// Delete incident notification rule returns "No Content" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteIncidentNotificationRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + // there is a valid "notification_rule" in the system + UUID NOTIFICATION_RULE_DATA_ID = null; + try { + NOTIFICATION_RULE_DATA_ID = UUID.fromString(System.getenv("NOTIFICATION_RULE_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + try { + apiInstance.deleteIncidentNotificationRule(NOTIFICATION_RULE_DATA_ID); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#deleteIncidentNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/GetIncidentNotificationRule.java b/examples/v2/incidents/GetIncidentNotificationRule.java new file mode 100644 index 00000000000..12b61a4c8f5 --- /dev/null +++ b/examples/v2/incidents/GetIncidentNotificationRule.java @@ -0,0 +1,28 @@ +// Get an incident notification rule returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentNotificationRule; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getIncidentNotificationRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + try { + IncidentNotificationRule result = + apiInstance.getIncidentNotificationRule( + UUID.fromString("00000000-0000-0000-0000-000000000001")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#getIncidentNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/GetIncidentNotificationRule_67441486.java b/examples/v2/incidents/GetIncidentNotificationRule_67441486.java new file mode 100644 index 00000000000..7de91262e65 --- /dev/null +++ b/examples/v2/incidents/GetIncidentNotificationRule_67441486.java @@ -0,0 +1,35 @@ +// Get incident notification rule returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentNotificationRule; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getIncidentNotificationRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + // there is a valid "notification_rule" in the system + UUID NOTIFICATION_RULE_DATA_ID = null; + try { + NOTIFICATION_RULE_DATA_ID = UUID.fromString(System.getenv("NOTIFICATION_RULE_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + try { + IncidentNotificationRule result = + apiInstance.getIncidentNotificationRule(NOTIFICATION_RULE_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#getIncidentNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/ListIncidentNotificationRules.java b/examples/v2/incidents/ListIncidentNotificationRules.java new file mode 100644 index 00000000000..821339fb684 --- /dev/null +++ b/examples/v2/incidents/ListIncidentNotificationRules.java @@ -0,0 +1,25 @@ +// List incident notification rules returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentNotificationRuleArray; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listIncidentNotificationRules", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + try { + IncidentNotificationRuleArray result = apiInstance.listIncidentNotificationRules(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#listIncidentNotificationRules"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/UpdateIncidentNotificationRule.java b/examples/v2/incidents/UpdateIncidentNotificationRule.java new file mode 100644 index 00000000000..9f7e5684e6e --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentNotificationRule.java @@ -0,0 +1,81 @@ +// Update an incident notification rule returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentNotificationRule; +import com.datadog.api.client.v2.model.IncidentNotificationRuleConditionsItems; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateAttributes; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateAttributesVisibility; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateDataRelationships; +import com.datadog.api.client.v2.model.IncidentNotificationRuleType; +import com.datadog.api.client.v2.model.IncidentNotificationRuleUpdateData; +import com.datadog.api.client.v2.model.IncidentNotificationTemplateType; +import com.datadog.api.client.v2.model.IncidentTypeType; +import com.datadog.api.client.v2.model.PutIncidentNotificationRuleRequest; +import com.datadog.api.client.v2.model.RelationshipToIncidentNotificationTemplate; +import com.datadog.api.client.v2.model.RelationshipToIncidentNotificationTemplateData; +import com.datadog.api.client.v2.model.RelationshipToIncidentType; +import com.datadog.api.client.v2.model.RelationshipToIncidentTypeData; +import java.util.Arrays; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateIncidentNotificationRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + PutIncidentNotificationRuleRequest body = + new PutIncidentNotificationRuleRequest() + .data( + new IncidentNotificationRuleUpdateData() + .attributes( + new IncidentNotificationRuleCreateAttributes() + .conditions( + Collections.singletonList( + new IncidentNotificationRuleConditionsItems() + .field("severity") + .values(Arrays.asList("SEV-1", "SEV-2")))) + .enabled(true) + .handles(Arrays.asList("@team-email@company.com", "@slack-channel")) + .renotifyOn(Arrays.asList("status", "severity")) + .trigger("incident_created_trigger") + .visibility( + IncidentNotificationRuleCreateAttributesVisibility.ORGANIZATION)) + .id(UUID.fromString("00000000-0000-0000-0000-000000000001")) + .relationships( + new IncidentNotificationRuleCreateDataRelationships() + .incidentType( + new RelationshipToIncidentType() + .data( + new RelationshipToIncidentTypeData() + .id("00000000-0000-0000-0000-000000000000") + .type(IncidentTypeType.INCIDENT_TYPES))) + .notificationTemplate( + new RelationshipToIncidentNotificationTemplate() + .data( + new RelationshipToIncidentNotificationTemplateData() + .id( + UUID.fromString( + "00000000-0000-0000-0000-000000000001")) + .type( + IncidentNotificationTemplateType + .NOTIFICATION_TEMPLATES)))) + .type(IncidentNotificationRuleType.INCIDENT_NOTIFICATION_RULES)); + + try { + IncidentNotificationRule result = + apiInstance.updateIncidentNotificationRule( + UUID.fromString("00000000-0000-0000-0000-000000000001"), body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#updateIncidentNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/incidents/UpdateIncidentNotificationRule_1207309457.java b/examples/v2/incidents/UpdateIncidentNotificationRule_1207309457.java new file mode 100644 index 00000000000..e61a863dea9 --- /dev/null +++ b/examples/v2/incidents/UpdateIncidentNotificationRule_1207309457.java @@ -0,0 +1,75 @@ +// Update incident notification rule returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.IncidentsApi; +import com.datadog.api.client.v2.model.IncidentNotificationRule; +import com.datadog.api.client.v2.model.IncidentNotificationRuleConditionsItems; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateAttributes; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateAttributesVisibility; +import com.datadog.api.client.v2.model.IncidentNotificationRuleCreateDataRelationships; +import com.datadog.api.client.v2.model.IncidentNotificationRuleType; +import com.datadog.api.client.v2.model.IncidentNotificationRuleUpdateData; +import com.datadog.api.client.v2.model.IncidentTypeType; +import com.datadog.api.client.v2.model.PutIncidentNotificationRuleRequest; +import com.datadog.api.client.v2.model.RelationshipToIncidentType; +import com.datadog.api.client.v2.model.RelationshipToIncidentTypeData; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateIncidentNotificationRule", true); + IncidentsApi apiInstance = new IncidentsApi(defaultClient); + + // there is a valid "notification_rule" in the system + UUID NOTIFICATION_RULE_DATA_ID = null; + try { + NOTIFICATION_RULE_DATA_ID = UUID.fromString(System.getenv("NOTIFICATION_RULE_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + // there is a valid "incident_type" in the system + String INCIDENT_TYPE_DATA_ID = System.getenv("INCIDENT_TYPE_DATA_ID"); + + PutIncidentNotificationRuleRequest body = + new PutIncidentNotificationRuleRequest() + .data( + new IncidentNotificationRuleUpdateData() + .attributes( + new IncidentNotificationRuleCreateAttributes() + .enabled(false) + .conditions( + Collections.singletonList( + new IncidentNotificationRuleConditionsItems() + .field("severity") + .values(Collections.singletonList("SEV-1")))) + .handles(Collections.singletonList("@updated-team-email@company.com")) + .visibility(IncidentNotificationRuleCreateAttributesVisibility.PRIVATE) + .trigger("incident_modified_trigger")) + .relationships( + new IncidentNotificationRuleCreateDataRelationships() + .incidentType( + new RelationshipToIncidentType() + .data( + new RelationshipToIncidentTypeData() + .id(INCIDENT_TYPE_DATA_ID) + .type(IncidentTypeType.INCIDENT_TYPES)))) + .id(NOTIFICATION_RULE_DATA_ID) + .type(IncidentNotificationRuleType.INCIDENT_NOTIFICATION_RULES)); + + try { + IncidentNotificationRule result = + apiInstance.updateIncidentNotificationRule(NOTIFICATION_RULE_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling IncidentsApi#updateIncidentNotificationRule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/ApiClient.java b/src/main/java/com/datadog/api/client/ApiClient.java index 0e136cf69f7..2991a7bd15a 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -720,21 +720,25 @@ public class ApiClient { put("v2.getDataDeletionRequests", false); put("v2.createIncident", false); put("v2.createIncidentIntegration", false); + put("v2.createIncidentNotificationRule", false); put("v2.createIncidentNotificationTemplate", false); put("v2.createIncidentTodo", false); put("v2.createIncidentType", false); put("v2.deleteIncident", false); put("v2.deleteIncidentIntegration", false); + put("v2.deleteIncidentNotificationRule", false); put("v2.deleteIncidentNotificationTemplate", false); put("v2.deleteIncidentTodo", false); put("v2.deleteIncidentType", false); put("v2.getIncident", false); put("v2.getIncidentIntegration", false); + put("v2.getIncidentNotificationRule", false); put("v2.getIncidentNotificationTemplate", false); put("v2.getIncidentTodo", false); put("v2.getIncidentType", false); put("v2.listIncidentAttachments", false); put("v2.listIncidentIntegrations", false); + put("v2.listIncidentNotificationRules", false); put("v2.listIncidentNotificationTemplates", false); put("v2.listIncidents", false); put("v2.listIncidentTodos", false); @@ -743,6 +747,7 @@ public class ApiClient { put("v2.updateIncident", false); put("v2.updateIncidentAttachments", false); put("v2.updateIncidentIntegration", false); + put("v2.updateIncidentNotificationRule", false); put("v2.updateIncidentNotificationTemplate", false); put("v2.updateIncidentTodo", false); put("v2.updateIncidentType", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java index e2c515fef0b..60d9b0eeede 100644 --- a/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/IncidentsApi.java @@ -5,6 +5,7 @@ import com.datadog.api.client.ApiResponse; import com.datadog.api.client.PaginationIterable; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.CreateIncidentNotificationRuleRequest; import com.datadog.api.client.v2.model.CreateIncidentNotificationTemplateRequest; import com.datadog.api.client.v2.model.IncidentAttachmentAttachmentType; import com.datadog.api.client.v2.model.IncidentAttachmentRelatedObject; @@ -16,6 +17,8 @@ import com.datadog.api.client.v2.model.IncidentIntegrationMetadataListResponse; import com.datadog.api.client.v2.model.IncidentIntegrationMetadataPatchRequest; import com.datadog.api.client.v2.model.IncidentIntegrationMetadataResponse; +import com.datadog.api.client.v2.model.IncidentNotificationRule; +import com.datadog.api.client.v2.model.IncidentNotificationRuleArray; import com.datadog.api.client.v2.model.IncidentNotificationTemplate; import com.datadog.api.client.v2.model.IncidentNotificationTemplateArray; import com.datadog.api.client.v2.model.IncidentRelatedObject; @@ -35,6 +38,7 @@ import com.datadog.api.client.v2.model.IncidentUpdateRequest; import com.datadog.api.client.v2.model.IncidentsResponse; import com.datadog.api.client.v2.model.PatchIncidentNotificationTemplateRequest; +import com.datadog.api.client.v2.model.PutIncidentNotificationRuleRequest; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -411,6 +415,159 @@ public ApiResponse createIncidentIntegratio new GenericType() {}); } + /** + * Create an incident notification rule. + * + *

See {@link #createIncidentNotificationRuleWithHttpInfo}. + * + * @param body (required) + * @return IncidentNotificationRule + * @throws ApiException if fails to make API call + */ + public IncidentNotificationRule createIncidentNotificationRule( + CreateIncidentNotificationRuleRequest body) throws ApiException { + return createIncidentNotificationRuleWithHttpInfo(body).getData(); + } + + /** + * Create an incident notification rule. + * + *

See {@link #createIncidentNotificationRuleWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<IncidentNotificationRule> + */ + public CompletableFuture createIncidentNotificationRuleAsync( + CreateIncidentNotificationRuleRequest body) { + return createIncidentNotificationRuleWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Creates a new notification rule. + * + * @param body (required) + * @return ApiResponse<IncidentNotificationRule> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse createIncidentNotificationRuleWithHttpInfo( + CreateIncidentNotificationRuleRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createIncidentNotificationRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createIncidentNotificationRule"); + } + // create path and map variables + String localVarPath = "/api/v2/incidents/config/notification-rules"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.createIncidentNotificationRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create an incident notification rule. + * + *

See {@link #createIncidentNotificationRuleWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<IncidentNotificationRule>> + */ + public CompletableFuture> + createIncidentNotificationRuleWithHttpInfoAsync(CreateIncidentNotificationRuleRequest body) { + // Check if unstable operation is enabled + String operationId = "createIncidentNotificationRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling createIncidentNotificationRule")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/incidents/config/notification-rules"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.createIncidentNotificationRule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Create incident notification template. * @@ -1241,48 +1398,48 @@ public CompletableFuture> deleteIncidentIntegrationWithHttpInf null); } - /** Manage optional parameters to deleteIncidentNotificationTemplate. */ - public static class DeleteIncidentNotificationTemplateOptionalParameters { + /** Manage optional parameters to deleteIncidentNotificationRule. */ + public static class DeleteIncidentNotificationRuleOptionalParameters { private String include; /** * Set include. * - * @param include Comma-separated list of relationships to include. Supported values: - * created_by_user, last_modified_by_user, incident_type - * (optional) - * @return DeleteIncidentNotificationTemplateOptionalParameters + * @param include Comma-separated list of resources to include. Supported values: + * created_by_user, last_modified_by_user, incident_type, + * notification_template (optional) + * @return DeleteIncidentNotificationRuleOptionalParameters */ - public DeleteIncidentNotificationTemplateOptionalParameters include(String include) { + public DeleteIncidentNotificationRuleOptionalParameters include(String include) { this.include = include; return this; } } /** - * Delete a notification template. + * Delete an incident notification rule. * - *

See {@link #deleteIncidentNotificationTemplateWithHttpInfo}. + *

See {@link #deleteIncidentNotificationRuleWithHttpInfo}. * - * @param id The ID of the notification template. (required) + * @param id The ID of the notification rule. (required) * @throws ApiException if fails to make API call */ - public void deleteIncidentNotificationTemplate(UUID id) throws ApiException { - deleteIncidentNotificationTemplateWithHttpInfo( - id, new DeleteIncidentNotificationTemplateOptionalParameters()); + public void deleteIncidentNotificationRule(UUID id) throws ApiException { + deleteIncidentNotificationRuleWithHttpInfo( + id, new DeleteIncidentNotificationRuleOptionalParameters()); } /** - * Delete a notification template. + * Delete an incident notification rule. * - *

See {@link #deleteIncidentNotificationTemplateWithHttpInfoAsync}. + *

See {@link #deleteIncidentNotificationRuleWithHttpInfoAsync}. * - * @param id The ID of the notification template. (required) + * @param id The ID of the notification rule. (required) * @return CompletableFuture */ - public CompletableFuture deleteIncidentNotificationTemplateAsync(UUID id) { - return deleteIncidentNotificationTemplateWithHttpInfoAsync( - id, new DeleteIncidentNotificationTemplateOptionalParameters()) + public CompletableFuture deleteIncidentNotificationRuleAsync(UUID id) { + return deleteIncidentNotificationRuleWithHttpInfoAsync( + id, new DeleteIncidentNotificationRuleOptionalParameters()) .thenApply( response -> { return response.getData(); @@ -1290,32 +1447,31 @@ id, new DeleteIncidentNotificationTemplateOptionalParameters()) } /** - * Delete a notification template. + * Delete an incident notification rule. * - *

See {@link #deleteIncidentNotificationTemplateWithHttpInfo}. + *

See {@link #deleteIncidentNotificationRuleWithHttpInfo}. * - * @param id The ID of the notification template. (required) + * @param id The ID of the notification rule. (required) * @param parameters Optional parameters for the request. * @throws ApiException if fails to make API call */ - public void deleteIncidentNotificationTemplate( - UUID id, DeleteIncidentNotificationTemplateOptionalParameters parameters) - throws ApiException { - deleteIncidentNotificationTemplateWithHttpInfo(id, parameters); + public void deleteIncidentNotificationRule( + UUID id, DeleteIncidentNotificationRuleOptionalParameters parameters) throws ApiException { + deleteIncidentNotificationRuleWithHttpInfo(id, parameters); } /** - * Delete a notification template. + * Delete an incident notification rule. * - *

See {@link #deleteIncidentNotificationTemplateWithHttpInfoAsync}. + *

See {@link #deleteIncidentNotificationRuleWithHttpInfoAsync}. * - * @param id The ID of the notification template. (required) + * @param id The ID of the notification rule. (required) * @param parameters Optional parameters for the request. * @return CompletableFuture */ - public CompletableFuture deleteIncidentNotificationTemplateAsync( - UUID id, DeleteIncidentNotificationTemplateOptionalParameters parameters) { - return deleteIncidentNotificationTemplateWithHttpInfoAsync(id, parameters) + public CompletableFuture deleteIncidentNotificationRuleAsync( + UUID id, DeleteIncidentNotificationRuleOptionalParameters parameters) { + return deleteIncidentNotificationRuleWithHttpInfoAsync(id, parameters) .thenApply( response -> { return response.getData(); @@ -1323,9 +1479,9 @@ public CompletableFuture deleteIncidentNotificationTemplateAsync( } /** - * Deletes a notification template by its ID. + * Deletes a notification rule by its ID. * - * @param id The ID of the notification template. (required) + * @param id The ID of the notification rule. (required) * @param parameters Optional parameters for the request. * @return ApiResponse<Void> * @throws ApiException if fails to make API call @@ -1341,11 +1497,10 @@ public CompletableFuture deleteIncidentNotificationTemplateAsync( * 429 Too many requests - * */ - public ApiResponse deleteIncidentNotificationTemplateWithHttpInfo( - UUID id, DeleteIncidentNotificationTemplateOptionalParameters parameters) - throws ApiException { + public ApiResponse deleteIncidentNotificationRuleWithHttpInfo( + UUID id, DeleteIncidentNotificationRuleOptionalParameters parameters) throws ApiException { // Check if unstable operation is enabled - String operationId = "deleteIncidentNotificationTemplate"; + String operationId = "deleteIncidentNotificationRule"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -1356,13 +1511,12 @@ public ApiResponse deleteIncidentNotificationTemplateWithHttpInfo( // verify the required parameter 'id' is set if (id == null) { throw new ApiException( - 400, - "Missing the required parameter 'id' when calling deleteIncidentNotificationTemplate"); + 400, "Missing the required parameter 'id' when calling deleteIncidentNotificationRule"); } String include = parameters.include; // create path and map variables String localVarPath = - "/api/v2/incidents/config/notification-templates/{id}" + "/api/v2/incidents/config/notification-rules/{id}" .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); @@ -1372,7 +1526,7 @@ public ApiResponse deleteIncidentNotificationTemplateWithHttpInfo( Invocation.Builder builder = apiClient.createBuilder( - "v2.IncidentsApi.deleteIncidentNotificationTemplate", + "v2.IncidentsApi.deleteIncidentNotificationRule", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -1391,18 +1545,18 @@ public ApiResponse deleteIncidentNotificationTemplateWithHttpInfo( } /** - * Delete a notification template. + * Delete an incident notification rule. * - *

See {@link #deleteIncidentNotificationTemplateWithHttpInfo}. + *

See {@link #deleteIncidentNotificationRuleWithHttpInfo}. * - * @param id The ID of the notification template. (required) + * @param id The ID of the notification rule. (required) * @param parameters Optional parameters for the request. * @return CompletableFuture<ApiResponse<Void>> */ - public CompletableFuture> deleteIncidentNotificationTemplateWithHttpInfoAsync( - UUID id, DeleteIncidentNotificationTemplateOptionalParameters parameters) { + public CompletableFuture> deleteIncidentNotificationRuleWithHttpInfoAsync( + UUID id, DeleteIncidentNotificationRuleOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "deleteIncidentNotificationTemplate"; + String operationId = "deleteIncidentNotificationRule"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { @@ -1419,14 +1573,13 @@ public CompletableFuture> deleteIncidentNotificationTemplateWi result.completeExceptionally( new ApiException( 400, - "Missing the required parameter 'id' when calling" - + " deleteIncidentNotificationTemplate")); + "Missing the required parameter 'id' when calling deleteIncidentNotificationRule")); return result; } String include = parameters.include; // create path and map variables String localVarPath = - "/api/v2/incidents/config/notification-templates/{id}" + "/api/v2/incidents/config/notification-rules/{id}" .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); List localVarQueryParams = new ArrayList(); @@ -1438,7 +1591,7 @@ public CompletableFuture> deleteIncidentNotificationTemplateWi try { builder = apiClient.createBuilder( - "v2.IncidentsApi.deleteIncidentNotificationTemplate", + "v2.IncidentsApi.deleteIncidentNotificationRule", localVarPath, localVarQueryParams, localVarHeaderParams, @@ -1461,30 +1614,48 @@ public CompletableFuture> deleteIncidentNotificationTemplateWi null); } + /** Manage optional parameters to deleteIncidentNotificationTemplate. */ + public static class DeleteIncidentNotificationTemplateOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Comma-separated list of relationships to include. Supported values: + * created_by_user, last_modified_by_user, incident_type + * (optional) + * @return DeleteIncidentNotificationTemplateOptionalParameters + */ + public DeleteIncidentNotificationTemplateOptionalParameters include(String include) { + this.include = include; + return this; + } + } + /** - * Delete an incident todo. + * Delete a notification template. * - *

See {@link #deleteIncidentTodoWithHttpInfo}. + *

See {@link #deleteIncidentNotificationTemplateWithHttpInfo}. * - * @param incidentId The UUID of the incident. (required) - * @param todoId The UUID of the incident todo. (required) + * @param id The ID of the notification template. (required) * @throws ApiException if fails to make API call */ - public void deleteIncidentTodo(String incidentId, String todoId) throws ApiException { - deleteIncidentTodoWithHttpInfo(incidentId, todoId); + public void deleteIncidentNotificationTemplate(UUID id) throws ApiException { + deleteIncidentNotificationTemplateWithHttpInfo( + id, new DeleteIncidentNotificationTemplateOptionalParameters()); } /** - * Delete an incident todo. + * Delete a notification template. * - *

See {@link #deleteIncidentTodoWithHttpInfoAsync}. + *

See {@link #deleteIncidentNotificationTemplateWithHttpInfoAsync}. * - * @param incidentId The UUID of the incident. (required) - * @param todoId The UUID of the incident todo. (required) + * @param id The ID of the notification template. (required) * @return CompletableFuture */ - public CompletableFuture deleteIncidentTodoAsync(String incidentId, String todoId) { - return deleteIncidentTodoWithHttpInfoAsync(incidentId, todoId) + public CompletableFuture deleteIncidentNotificationTemplateAsync(UUID id) { + return deleteIncidentNotificationTemplateWithHttpInfoAsync( + id, new DeleteIncidentNotificationTemplateOptionalParameters()) .thenApply( response -> { return response.getData(); @@ -1492,17 +1663,50 @@ public CompletableFuture deleteIncidentTodoAsync(String incidentId, String } /** - * Delete an incident todo. + * Delete a notification template. * - * @param incidentId The UUID of the incident. (required) - * @param todoId The UUID of the incident todo. (required) + *

See {@link #deleteIncidentNotificationTemplateWithHttpInfo}. + * + * @param id The ID of the notification template. (required) + * @param parameters Optional parameters for the request. + * @throws ApiException if fails to make API call + */ + public void deleteIncidentNotificationTemplate( + UUID id, DeleteIncidentNotificationTemplateOptionalParameters parameters) + throws ApiException { + deleteIncidentNotificationTemplateWithHttpInfo(id, parameters); + } + + /** + * Delete a notification template. + * + *

See {@link #deleteIncidentNotificationTemplateWithHttpInfoAsync}. + * + * @param id The ID of the notification template. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture + */ + public CompletableFuture deleteIncidentNotificationTemplateAsync( + UUID id, DeleteIncidentNotificationTemplateOptionalParameters parameters) { + return deleteIncidentNotificationTemplateWithHttpInfoAsync(id, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Deletes a notification template by its ID. + * + * @param id The ID of the notification template. (required) + * @param parameters Optional parameters for the request. * @return ApiResponse<Void> * @throws ApiException if fails to make API call * @http.response.details * * * - * + * * * * @@ -1510,8 +1714,177 @@ public CompletableFuture deleteIncidentTodoAsync(String incidentId, String * *
Response details
Status Code Description Response Headers
204 OK -
204 No Content -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
429 Too many requests -
*/ - public ApiResponse deleteIncidentTodoWithHttpInfo(String incidentId, String todoId) - throws ApiException { + public ApiResponse deleteIncidentNotificationTemplateWithHttpInfo( + UUID id, DeleteIncidentNotificationTemplateOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteIncidentNotificationTemplate"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + 400, + "Missing the required parameter 'id' when calling deleteIncidentNotificationTemplate"); + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/notification-templates/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentNotificationTemplate", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a notification template. + * + *

See {@link #deleteIncidentNotificationTemplateWithHttpInfo}. + * + * @param id The ID of the notification template. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteIncidentNotificationTemplateWithHttpInfoAsync( + UUID id, DeleteIncidentNotificationTemplateOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "deleteIncidentNotificationTemplate"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if (id == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'id' when calling" + + " deleteIncidentNotificationTemplate")); + return result; + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/notification-templates/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.deleteIncidentNotificationTemplate", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete an incident todo. + * + *

See {@link #deleteIncidentTodoWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param todoId The UUID of the incident todo. (required) + * @throws ApiException if fails to make API call + */ + public void deleteIncidentTodo(String incidentId, String todoId) throws ApiException { + deleteIncidentTodoWithHttpInfo(incidentId, todoId); + } + + /** + * Delete an incident todo. + * + *

See {@link #deleteIncidentTodoWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @param todoId The UUID of the incident todo. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteIncidentTodoAsync(String incidentId, String todoId) { + return deleteIncidentTodoWithHttpInfoAsync(incidentId, todoId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an incident todo. + * + * @param incidentId The UUID of the incident. (required) + * @param todoId The UUID of the incident todo. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteIncidentTodoWithHttpInfo(String incidentId, String todoId) + throws ApiException { // Check if unstable operation is enabled String operationId = "deleteIncidentTodo"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { @@ -2083,26 +2456,260 @@ public ApiResponse getIncidentIntegrationWi // verify the required parameter 'integrationMetadataId' is set if (integrationMetadataId == null) { throw new ApiException( - 400, - "Missing the required parameter 'integrationMetadataId' when calling" - + " getIncidentIntegration"); + 400, + "Missing the required parameter 'integrationMetadataId' when calling" + + " getIncidentIntegration"); + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) + .replaceAll( + "\\{" + "integration_metadata_id" + "\\}", + apiClient.escapeString(integrationMetadataId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.getIncidentIntegration", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get incident integration metadata details. + * + *

See {@link #getIncidentIntegrationWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @param integrationMetadataId The UUID of the incident integration metadata. (required) + * @return CompletableFuture<ApiResponse<IncidentIntegrationMetadataResponse>> + */ + public CompletableFuture> + getIncidentIntegrationWithHttpInfoAsync(String incidentId, String integrationMetadataId) { + // Check if unstable operation is enabled + String operationId = "getIncidentIntegration"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'incidentId' when calling getIncidentIntegration")); + return result; + } + + // verify the required parameter 'integrationMetadataId' is set + if (integrationMetadataId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'integrationMetadataId' when calling" + + " getIncidentIntegration")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) + .replaceAll( + "\\{" + "integration_metadata_id" + "\\}", + apiClient.escapeString(integrationMetadataId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.getIncidentIntegration", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to getIncidentNotificationRule. */ + public static class GetIncidentNotificationRuleOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Comma-separated list of resources to include. Supported values: + * created_by_user, last_modified_by_user, incident_type, + * notification_template (optional) + * @return GetIncidentNotificationRuleOptionalParameters + */ + public GetIncidentNotificationRuleOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * Get an incident notification rule. + * + *

See {@link #getIncidentNotificationRuleWithHttpInfo}. + * + * @param id The ID of the notification rule. (required) + * @return IncidentNotificationRule + * @throws ApiException if fails to make API call + */ + public IncidentNotificationRule getIncidentNotificationRule(UUID id) throws ApiException { + return getIncidentNotificationRuleWithHttpInfo( + id, new GetIncidentNotificationRuleOptionalParameters()) + .getData(); + } + + /** + * Get an incident notification rule. + * + *

See {@link #getIncidentNotificationRuleWithHttpInfoAsync}. + * + * @param id The ID of the notification rule. (required) + * @return CompletableFuture<IncidentNotificationRule> + */ + public CompletableFuture getIncidentNotificationRuleAsync(UUID id) { + return getIncidentNotificationRuleWithHttpInfoAsync( + id, new GetIncidentNotificationRuleOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get an incident notification rule. + * + *

See {@link #getIncidentNotificationRuleWithHttpInfo}. + * + * @param id The ID of the notification rule. (required) + * @param parameters Optional parameters for the request. + * @return IncidentNotificationRule + * @throws ApiException if fails to make API call + */ + public IncidentNotificationRule getIncidentNotificationRule( + UUID id, GetIncidentNotificationRuleOptionalParameters parameters) throws ApiException { + return getIncidentNotificationRuleWithHttpInfo(id, parameters).getData(); + } + + /** + * Get an incident notification rule. + * + *

See {@link #getIncidentNotificationRuleWithHttpInfoAsync}. + * + * @param id The ID of the notification rule. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<IncidentNotificationRule> + */ + public CompletableFuture getIncidentNotificationRuleAsync( + UUID id, GetIncidentNotificationRuleOptionalParameters parameters) { + return getIncidentNotificationRuleWithHttpInfoAsync(id, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieves a specific notification rule by its ID. + * + * @param id The ID of the notification rule. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<IncidentNotificationRule> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getIncidentNotificationRuleWithHttpInfo( + UUID id, GetIncidentNotificationRuleOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getIncidentNotificationRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + 400, "Missing the required parameter 'id' when calling getIncidentNotificationRule"); } + String include = parameters.include; // create path and map variables String localVarPath = - "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" - .replaceAll( - "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) - .replaceAll( - "\\{" + "integration_metadata_id" + "\\}", - apiClient.escapeString(integrationMetadataId.toString())); + "/api/v2/incidents/config/notification-rules/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + Invocation.Builder builder = apiClient.createBuilder( - "v2.IncidentsApi.getIncidentIntegration", + "v2.IncidentsApi.getIncidentNotificationRule", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -2115,80 +2722,65 @@ public ApiResponse getIncidentIntegrationWi localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get incident integration metadata details. + * Get an incident notification rule. * - *

See {@link #getIncidentIntegrationWithHttpInfo}. + *

See {@link #getIncidentNotificationRuleWithHttpInfo}. * - * @param incidentId The UUID of the incident. (required) - * @param integrationMetadataId The UUID of the incident integration metadata. (required) - * @return CompletableFuture<ApiResponse<IncidentIntegrationMetadataResponse>> + * @param id The ID of the notification rule. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentNotificationRule>> */ - public CompletableFuture> - getIncidentIntegrationWithHttpInfoAsync(String incidentId, String integrationMetadataId) { + public CompletableFuture> + getIncidentNotificationRuleWithHttpInfoAsync( + UUID id, GetIncidentNotificationRuleOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "getIncidentIntegration"; + String operationId = "getIncidentNotificationRule"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } Object localVarPostBody = null; - // verify the required parameter 'incidentId' is set - if (incidentId == null) { - CompletableFuture> result = - new CompletableFuture<>(); - result.completeExceptionally( - new ApiException( - 400, - "Missing the required parameter 'incidentId' when calling getIncidentIntegration")); - return result; - } - - // verify the required parameter 'integrationMetadataId' is set - if (integrationMetadataId == null) { - CompletableFuture> result = - new CompletableFuture<>(); + // verify the required parameter 'id' is set + if (id == null) { + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException( - 400, - "Missing the required parameter 'integrationMetadataId' when calling" - + " getIncidentIntegration")); + 400, "Missing the required parameter 'id' when calling getIncidentNotificationRule")); return result; } + String include = parameters.include; // create path and map variables String localVarPath = - "/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}" - .replaceAll( - "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())) - .replaceAll( - "\\{" + "integration_metadata_id" + "\\}", - apiClient.escapeString(integrationMetadataId.toString())); + "/api/v2/incidents/config/notification-rules/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.IncidentsApi.getIncidentIntegration", + "v2.IncidentsApi.getIncidentNotificationRule", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = - new CompletableFuture<>(); + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -2200,7 +2792,7 @@ public ApiResponse getIncidentIntegrationWi localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to getIncidentNotificationTemplate. */ @@ -3014,28 +3606,238 @@ public ApiResponse listIncidentAttachmentsWithHttpI /** * Get a list of an incident's integration metadata. * - *

See {@link #listIncidentIntegrationsWithHttpInfo}. + *

See {@link #listIncidentIntegrationsWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @return IncidentIntegrationMetadataListResponse + * @throws ApiException if fails to make API call + */ + public IncidentIntegrationMetadataListResponse listIncidentIntegrations(String incidentId) + throws ApiException { + return listIncidentIntegrationsWithHttpInfo(incidentId).getData(); + } + + /** + * Get a list of an incident's integration metadata. + * + *

See {@link #listIncidentIntegrationsWithHttpInfoAsync}. + * + * @param incidentId The UUID of the incident. (required) + * @return CompletableFuture<IncidentIntegrationMetadataListResponse> + */ + public CompletableFuture listIncidentIntegrationsAsync( + String incidentId) { + return listIncidentIntegrationsWithHttpInfoAsync(incidentId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all integration metadata for an incident. + * + * @param incidentId The UUID of the incident. (required) + * @return ApiResponse<IncidentIntegrationMetadataListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse listIncidentIntegrationsWithHttpInfo( + String incidentId) throws ApiException { + // Check if unstable operation is enabled + String operationId = "listIncidentIntegrations"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = null; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + throw new ApiException( + 400, "Missing the required parameter 'incidentId' when calling listIncidentIntegrations"); + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/relationships/integrations" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.listIncidentIntegrations", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a list of an incident's integration metadata. + * + *

See {@link #listIncidentIntegrationsWithHttpInfo}. + * + * @param incidentId The UUID of the incident. (required) + * @return CompletableFuture<ApiResponse<IncidentIntegrationMetadataListResponse>> + */ + public CompletableFuture> + listIncidentIntegrationsWithHttpInfoAsync(String incidentId) { + // Check if unstable operation is enabled + String operationId = "listIncidentIntegrations"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = null; + + // verify the required parameter 'incidentId' is set + if (incidentId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'incidentId' when calling listIncidentIntegrations")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/incidents/{incident_id}/relationships/integrations" + .replaceAll( + "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.listIncidentIntegrations", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** Manage optional parameters to listIncidentNotificationRules. */ + public static class ListIncidentNotificationRulesOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Comma-separated list of resources to include. Supported values: + * created_by_user, last_modified_by_user, incident_type, + * notification_template (optional) + * @return ListIncidentNotificationRulesOptionalParameters + */ + public ListIncidentNotificationRulesOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * List incident notification rules. + * + *

See {@link #listIncidentNotificationRulesWithHttpInfo}. + * + * @return IncidentNotificationRuleArray + * @throws ApiException if fails to make API call + */ + public IncidentNotificationRuleArray listIncidentNotificationRules() throws ApiException { + return listIncidentNotificationRulesWithHttpInfo( + new ListIncidentNotificationRulesOptionalParameters()) + .getData(); + } + + /** + * List incident notification rules. + * + *

See {@link #listIncidentNotificationRulesWithHttpInfoAsync}. + * + * @return CompletableFuture<IncidentNotificationRuleArray> + */ + public CompletableFuture listIncidentNotificationRulesAsync() { + return listIncidentNotificationRulesWithHttpInfoAsync( + new ListIncidentNotificationRulesOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * List incident notification rules. + * + *

See {@link #listIncidentNotificationRulesWithHttpInfo}. * - * @param incidentId The UUID of the incident. (required) - * @return IncidentIntegrationMetadataListResponse + * @param parameters Optional parameters for the request. + * @return IncidentNotificationRuleArray * @throws ApiException if fails to make API call */ - public IncidentIntegrationMetadataListResponse listIncidentIntegrations(String incidentId) - throws ApiException { - return listIncidentIntegrationsWithHttpInfo(incidentId).getData(); + public IncidentNotificationRuleArray listIncidentNotificationRules( + ListIncidentNotificationRulesOptionalParameters parameters) throws ApiException { + return listIncidentNotificationRulesWithHttpInfo(parameters).getData(); } /** - * Get a list of an incident's integration metadata. + * List incident notification rules. * - *

See {@link #listIncidentIntegrationsWithHttpInfoAsync}. + *

See {@link #listIncidentNotificationRulesWithHttpInfoAsync}. * - * @param incidentId The UUID of the incident. (required) - * @return CompletableFuture<IncidentIntegrationMetadataListResponse> + * @param parameters Optional parameters for the request. + * @return CompletableFuture<IncidentNotificationRuleArray> */ - public CompletableFuture listIncidentIntegrationsAsync( - String incidentId) { - return listIncidentIntegrationsWithHttpInfoAsync(incidentId) + public CompletableFuture listIncidentNotificationRulesAsync( + ListIncidentNotificationRulesOptionalParameters parameters) { + return listIncidentNotificationRulesWithHttpInfoAsync(parameters) .thenApply( response -> { return response.getData(); @@ -3043,10 +3845,10 @@ public CompletableFuture listIncidentIn } /** - * Get all integration metadata for an incident. + * Lists all notification rules for the organization. Optionally filter by incident type. * - * @param incidentId The UUID of the incident. (required) - * @return ApiResponse<IncidentIntegrationMetadataListResponse> + * @param parameters Optional parameters for the request. + * @return ApiResponse<IncidentNotificationRuleArray> * @throws ApiException if fails to make API call * @http.response.details * @@ -3060,35 +3862,30 @@ public CompletableFuture listIncidentIn * *
429 Too many requests -
*/ - public ApiResponse listIncidentIntegrationsWithHttpInfo( - String incidentId) throws ApiException { + public ApiResponse listIncidentNotificationRulesWithHttpInfo( + ListIncidentNotificationRulesOptionalParameters parameters) throws ApiException { // Check if unstable operation is enabled - String operationId = "listIncidentIntegrations"; + String operationId = "listIncidentNotificationRules"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); } Object localVarPostBody = null; - - // verify the required parameter 'incidentId' is set - if (incidentId == null) { - throw new ApiException( - 400, "Missing the required parameter 'incidentId' when calling listIncidentIntegrations"); - } + String include = parameters.include; // create path and map variables - String localVarPath = - "/api/v2/incidents/{incident_id}/relationships/integrations" - .replaceAll( - "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + String localVarPath = "/api/v2/incidents/config/notification-rules"; + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + Invocation.Builder builder = apiClient.createBuilder( - "v2.IncidentsApi.listIncidentIntegrations", + "v2.IncidentsApi.listIncidentNotificationRules", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, @@ -3101,63 +3898,54 @@ public ApiResponse listIncidentIntegrat localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Get a list of an incident's integration metadata. + * List incident notification rules. * - *

See {@link #listIncidentIntegrationsWithHttpInfo}. + *

See {@link #listIncidentNotificationRulesWithHttpInfo}. * - * @param incidentId The UUID of the incident. (required) - * @return CompletableFuture<ApiResponse<IncidentIntegrationMetadataListResponse>> + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentNotificationRuleArray>> */ - public CompletableFuture> - listIncidentIntegrationsWithHttpInfoAsync(String incidentId) { + public CompletableFuture> + listIncidentNotificationRulesWithHttpInfoAsync( + ListIncidentNotificationRulesOptionalParameters parameters) { // Check if unstable operation is enabled - String operationId = "listIncidentIntegrations"; + String operationId = "listIncidentNotificationRules"; if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); } else { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally( new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); return result; } Object localVarPostBody = null; - - // verify the required parameter 'incidentId' is set - if (incidentId == null) { - CompletableFuture> result = - new CompletableFuture<>(); - result.completeExceptionally( - new ApiException( - 400, - "Missing the required parameter 'incidentId' when calling listIncidentIntegrations")); - return result; - } + String include = parameters.include; // create path and map variables - String localVarPath = - "/api/v2/incidents/{incident_id}/relationships/integrations" - .replaceAll( - "\\{" + "incident_id" + "\\}", apiClient.escapeString(incidentId.toString())); + String localVarPath = "/api/v2/incidents/config/notification-rules"; + List localVarQueryParams = new ArrayList(); Map localVarHeaderParams = new HashMap(); + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + Invocation.Builder builder; try { builder = apiClient.createBuilder( - "v2.IncidentsApi.listIncidentIntegrations", + "v2.IncidentsApi.listIncidentNotificationRules", localVarPath, - new ArrayList(), + localVarQueryParams, localVarHeaderParams, new HashMap(), new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); } catch (ApiException ex) { - CompletableFuture> result = + CompletableFuture> result = new CompletableFuture<>(); result.completeExceptionally(ex); return result; @@ -3170,7 +3958,7 @@ public ApiResponse listIncidentIntegrat localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** Manage optional parameters to listIncidentNotificationTemplates. */ @@ -5077,6 +5865,260 @@ public ApiResponse updateIncidentIntegratio new GenericType() {}); } + /** Manage optional parameters to updateIncidentNotificationRule. */ + public static class UpdateIncidentNotificationRuleOptionalParameters { + private String include; + + /** + * Set include. + * + * @param include Comma-separated list of resources to include. Supported values: + * created_by_user, last_modified_by_user, incident_type, + * notification_template (optional) + * @return UpdateIncidentNotificationRuleOptionalParameters + */ + public UpdateIncidentNotificationRuleOptionalParameters include(String include) { + this.include = include; + return this; + } + } + + /** + * Update an incident notification rule. + * + *

See {@link #updateIncidentNotificationRuleWithHttpInfo}. + * + * @param id The ID of the notification rule. (required) + * @param body (required) + * @return IncidentNotificationRule + * @throws ApiException if fails to make API call + */ + public IncidentNotificationRule updateIncidentNotificationRule( + UUID id, PutIncidentNotificationRuleRequest body) throws ApiException { + return updateIncidentNotificationRuleWithHttpInfo( + id, body, new UpdateIncidentNotificationRuleOptionalParameters()) + .getData(); + } + + /** + * Update an incident notification rule. + * + *

See {@link #updateIncidentNotificationRuleWithHttpInfoAsync}. + * + * @param id The ID of the notification rule. (required) + * @param body (required) + * @return CompletableFuture<IncidentNotificationRule> + */ + public CompletableFuture updateIncidentNotificationRuleAsync( + UUID id, PutIncidentNotificationRuleRequest body) { + return updateIncidentNotificationRuleWithHttpInfoAsync( + id, body, new UpdateIncidentNotificationRuleOptionalParameters()) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Update an incident notification rule. + * + *

See {@link #updateIncidentNotificationRuleWithHttpInfo}. + * + * @param id The ID of the notification rule. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return IncidentNotificationRule + * @throws ApiException if fails to make API call + */ + public IncidentNotificationRule updateIncidentNotificationRule( + UUID id, + PutIncidentNotificationRuleRequest body, + UpdateIncidentNotificationRuleOptionalParameters parameters) + throws ApiException { + return updateIncidentNotificationRuleWithHttpInfo(id, body, parameters).getData(); + } + + /** + * Update an incident notification rule. + * + *

See {@link #updateIncidentNotificationRuleWithHttpInfoAsync}. + * + * @param id The ID of the notification rule. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<IncidentNotificationRule> + */ + public CompletableFuture updateIncidentNotificationRuleAsync( + UUID id, + PutIncidentNotificationRuleRequest body, + UpdateIncidentNotificationRuleOptionalParameters parameters) { + return updateIncidentNotificationRuleWithHttpInfoAsync(id, body, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Updates an existing notification rule with a complete replacement. + * + * @param id The ID of the notification rule. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<IncidentNotificationRule> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
401 Unauthorized -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateIncidentNotificationRuleWithHttpInfo( + UUID id, + PutIncidentNotificationRuleRequest body, + UpdateIncidentNotificationRuleOptionalParameters parameters) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateIncidentNotificationRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + throw new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId)); + } + Object localVarPostBody = body; + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException( + 400, "Missing the required parameter 'id' when calling updateIncidentNotificationRule"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateIncidentNotificationRule"); + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/notification-rules/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.IncidentsApi.updateIncidentNotificationRule", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update an incident notification rule. + * + *

See {@link #updateIncidentNotificationRuleWithHttpInfo}. + * + * @param id The ID of the notification rule. (required) + * @param body (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<IncidentNotificationRule>> + */ + public CompletableFuture> + updateIncidentNotificationRuleWithHttpInfoAsync( + UUID id, + PutIncidentNotificationRuleRequest body, + UpdateIncidentNotificationRuleOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "updateIncidentNotificationRule"; + if (apiClient.isUnstableOperationEnabled("v2." + operationId)) { + apiClient.getLogger().warning(String.format("Using unstable operation '%s'", operationId)); + } else { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException(0, String.format("Unstable operation '%s' is disabled", operationId))); + return result; + } + Object localVarPostBody = body; + + // verify the required parameter 'id' is set + if (id == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'id' when calling updateIncidentNotificationRule")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling updateIncidentNotificationRule")); + return result; + } + String include = parameters.include; + // create path and map variables + String localVarPath = + "/api/v2/incidents/config/notification-rules/{id}" + .replaceAll("\\{" + "id" + "\\}", apiClient.escapeString(id.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.IncidentsApi.updateIncidentNotificationRule", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth", "AuthZ"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** Manage optional parameters to updateIncidentNotificationTemplate. */ public static class UpdateIncidentNotificationTemplateOptionalParameters { private String include; diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateIncidentNotificationRuleRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateIncidentNotificationRuleRequest.java new file mode 100644 index 00000000000..ee5cb9afd28 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateIncidentNotificationRuleRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Create request for a notification rule. */ +@JsonPropertyOrder({CreateIncidentNotificationRuleRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateIncidentNotificationRuleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentNotificationRuleCreateData data; + + public CreateIncidentNotificationRuleRequest() {} + + @JsonCreator + public CreateIncidentNotificationRuleRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + IncidentNotificationRuleCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CreateIncidentNotificationRuleRequest data(IncidentNotificationRuleCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Notification rule data for a create request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationRuleCreateData getData() { + return data; + } + + public void setData(IncidentNotificationRuleCreateData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateIncidentNotificationRuleRequest + */ + @JsonAnySetter + public CreateIncidentNotificationRuleRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateIncidentNotificationRuleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateIncidentNotificationRuleRequest createIncidentNotificationRuleRequest = + (CreateIncidentNotificationRuleRequest) o; + return Objects.equals(this.data, createIncidentNotificationRuleRequest.data) + && Objects.equals( + this.additionalProperties, createIncidentNotificationRuleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateIncidentNotificationRuleRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRule.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRule.java new file mode 100644 index 00000000000..075166f3592 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRule.java @@ -0,0 +1,190 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response with a notification rule. */ +@JsonPropertyOrder({ + IncidentNotificationRule.JSON_PROPERTY_DATA, + IncidentNotificationRule.JSON_PROPERTY_INCLUDED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentNotificationRuleResponseData data; + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public IncidentNotificationRule() {} + + @JsonCreator + public IncidentNotificationRule( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + IncidentNotificationRuleResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public IncidentNotificationRule data(IncidentNotificationRuleResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Notification rule data from a response. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationRuleResponseData getData() { + return data; + } + + public void setData(IncidentNotificationRuleResponseData data) { + this.data = data; + } + + public IncidentNotificationRule included(List included) { + this.included = included; + for (IncidentNotificationRuleIncludedItems item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentNotificationRule addIncludedItem( + IncidentNotificationRuleIncludedItems includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Related objects that are included in the response. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRule + */ + @JsonAnySetter + public IncidentNotificationRule putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRule incidentNotificationRule = (IncidentNotificationRule) o; + return Objects.equals(this.data, incidentNotificationRule.data) + && Objects.equals(this.included, incidentNotificationRule.included) + && Objects.equals(this.additionalProperties, incidentNotificationRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRule {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArray.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArray.java new file mode 100644 index 00000000000..ee00e946545 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArray.java @@ -0,0 +1,227 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response with notification rules. */ +@JsonPropertyOrder({ + IncidentNotificationRuleArray.JSON_PROPERTY_DATA, + IncidentNotificationRuleArray.JSON_PROPERTY_INCLUDED, + IncidentNotificationRuleArray.JSON_PROPERTY_META +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleArray { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public static final String JSON_PROPERTY_META = "meta"; + private IncidentNotificationRuleArrayMeta meta; + + public IncidentNotificationRuleArray() {} + + @JsonCreator + public IncidentNotificationRuleArray( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public IncidentNotificationRuleArray data(List data) { + this.data = data; + for (IncidentNotificationRuleResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentNotificationRuleArray addDataItem(IncidentNotificationRuleResponseData dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * The NotificationRuleArray data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public IncidentNotificationRuleArray included( + List included) { + this.included = included; + for (IncidentNotificationRuleIncludedItems item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentNotificationRuleArray addIncludedItem( + IncidentNotificationRuleIncludedItems includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Related objects that are included in the response. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + } + + public IncidentNotificationRuleArray meta(IncidentNotificationRuleArrayMeta meta) { + this.meta = meta; + this.unparsed |= meta.unparsed; + return this; + } + + /** + * Response metadata. + * + * @return meta + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_META) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentNotificationRuleArrayMeta getMeta() { + return meta; + } + + public void setMeta(IncidentNotificationRuleArrayMeta meta) { + this.meta = meta; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleArray + */ + @JsonAnySetter + public IncidentNotificationRuleArray putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleArray object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleArray incidentNotificationRuleArray = (IncidentNotificationRuleArray) o; + return Objects.equals(this.data, incidentNotificationRuleArray.data) + && Objects.equals(this.included, incidentNotificationRuleArray.included) + && Objects.equals(this.meta, incidentNotificationRuleArray.meta) + && Objects.equals( + this.additionalProperties, incidentNotificationRuleArray.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, meta, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleArray {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArrayMeta.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArrayMeta.java new file mode 100644 index 00000000000..7ba5911b322 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArrayMeta.java @@ -0,0 +1,139 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response metadata. */ +@JsonPropertyOrder({IncidentNotificationRuleArrayMeta.JSON_PROPERTY_PAGINATION}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleArrayMeta { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_PAGINATION = "pagination"; + private IncidentNotificationRuleArrayMetaPage pagination; + + public IncidentNotificationRuleArrayMeta pagination( + IncidentNotificationRuleArrayMetaPage pagination) { + this.pagination = pagination; + this.unparsed |= pagination.unparsed; + return this; + } + + /** + * Pagination metadata. + * + * @return pagination + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_PAGINATION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentNotificationRuleArrayMetaPage getPagination() { + return pagination; + } + + public void setPagination(IncidentNotificationRuleArrayMetaPage pagination) { + this.pagination = pagination; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleArrayMeta + */ + @JsonAnySetter + public IncidentNotificationRuleArrayMeta putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleArrayMeta object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleArrayMeta incidentNotificationRuleArrayMeta = + (IncidentNotificationRuleArrayMeta) o; + return Objects.equals(this.pagination, incidentNotificationRuleArrayMeta.pagination) + && Objects.equals( + this.additionalProperties, incidentNotificationRuleArrayMeta.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(pagination, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleArrayMeta {\n"); + sb.append(" pagination: ").append(toIndentedString(pagination)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArrayMetaPage.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArrayMetaPage.java new file mode 100644 index 00000000000..68167528e43 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleArrayMetaPage.java @@ -0,0 +1,193 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Pagination metadata. */ +@JsonPropertyOrder({ + IncidentNotificationRuleArrayMetaPage.JSON_PROPERTY_NEXT_OFFSET, + IncidentNotificationRuleArrayMetaPage.JSON_PROPERTY_OFFSET, + IncidentNotificationRuleArrayMetaPage.JSON_PROPERTY_SIZE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleArrayMetaPage { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NEXT_OFFSET = "next_offset"; + private Long nextOffset; + + public static final String JSON_PROPERTY_OFFSET = "offset"; + private Long offset; + + public static final String JSON_PROPERTY_SIZE = "size"; + private Long size; + + public IncidentNotificationRuleArrayMetaPage nextOffset(Long nextOffset) { + this.nextOffset = nextOffset; + return this; + } + + /** + * The offset for the next page of results. + * + * @return nextOffset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NEXT_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getNextOffset() { + return nextOffset; + } + + public void setNextOffset(Long nextOffset) { + this.nextOffset = nextOffset; + } + + public IncidentNotificationRuleArrayMetaPage offset(Long offset) { + this.offset = offset; + return this; + } + + /** + * The current offset in the results. + * + * @return offset + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_OFFSET) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getOffset() { + return offset; + } + + public void setOffset(Long offset) { + this.offset = offset; + } + + public IncidentNotificationRuleArrayMetaPage size(Long size) { + this.size = size; + return this; + } + + /** + * The number of results returned per page. + * + * @return size + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SIZE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleArrayMetaPage + */ + @JsonAnySetter + public IncidentNotificationRuleArrayMetaPage putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleArrayMetaPage object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleArrayMetaPage incidentNotificationRuleArrayMetaPage = + (IncidentNotificationRuleArrayMetaPage) o; + return Objects.equals(this.nextOffset, incidentNotificationRuleArrayMetaPage.nextOffset) + && Objects.equals(this.offset, incidentNotificationRuleArrayMetaPage.offset) + && Objects.equals(this.size, incidentNotificationRuleArrayMetaPage.size) + && Objects.equals( + this.additionalProperties, incidentNotificationRuleArrayMetaPage.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(nextOffset, offset, size, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleArrayMetaPage {\n"); + sb.append(" nextOffset: ").append(toIndentedString(nextOffset)).append("\n"); + sb.append(" offset: ").append(toIndentedString(offset)).append("\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleAttributes.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleAttributes.java new file mode 100644 index 00000000000..d83947594e8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleAttributes.java @@ -0,0 +1,368 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The notification rule's attributes. */ +@JsonPropertyOrder({ + IncidentNotificationRuleAttributes.JSON_PROPERTY_CONDITIONS, + IncidentNotificationRuleAttributes.JSON_PROPERTY_CREATED, + IncidentNotificationRuleAttributes.JSON_PROPERTY_ENABLED, + IncidentNotificationRuleAttributes.JSON_PROPERTY_HANDLES, + IncidentNotificationRuleAttributes.JSON_PROPERTY_MODIFIED, + IncidentNotificationRuleAttributes.JSON_PROPERTY_RENOTIFY_ON, + IncidentNotificationRuleAttributes.JSON_PROPERTY_TRIGGER, + IncidentNotificationRuleAttributes.JSON_PROPERTY_VISIBILITY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONDITIONS = "conditions"; + private List conditions = new ArrayList<>(); + + public static final String JSON_PROPERTY_CREATED = "created"; + private OffsetDateTime created; + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled; + + public static final String JSON_PROPERTY_HANDLES = "handles"; + private List handles = new ArrayList<>(); + + public static final String JSON_PROPERTY_MODIFIED = "modified"; + private OffsetDateTime modified; + + public static final String JSON_PROPERTY_RENOTIFY_ON = "renotify_on"; + private List renotifyOn = null; + + public static final String JSON_PROPERTY_TRIGGER = "trigger"; + private String trigger; + + public static final String JSON_PROPERTY_VISIBILITY = "visibility"; + private IncidentNotificationRuleAttributesVisibility visibility; + + public IncidentNotificationRuleAttributes() {} + + @JsonCreator + public IncidentNotificationRuleAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CONDITIONS) + List conditions, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED) OffsetDateTime created, + @JsonProperty(required = true, value = JSON_PROPERTY_ENABLED) Boolean enabled, + @JsonProperty(required = true, value = JSON_PROPERTY_HANDLES) List handles, + @JsonProperty(required = true, value = JSON_PROPERTY_MODIFIED) OffsetDateTime modified, + @JsonProperty(required = true, value = JSON_PROPERTY_TRIGGER) String trigger, + @JsonProperty(required = true, value = JSON_PROPERTY_VISIBILITY) + IncidentNotificationRuleAttributesVisibility visibility) { + this.conditions = conditions; + this.created = created; + this.enabled = enabled; + this.handles = handles; + this.modified = modified; + this.trigger = trigger; + this.visibility = visibility; + this.unparsed |= !visibility.isValid(); + } + + public IncidentNotificationRuleAttributes conditions( + List conditions) { + this.conditions = conditions; + for (IncidentNotificationRuleConditionsItems item : conditions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentNotificationRuleAttributes addConditionsItem( + IncidentNotificationRuleConditionsItems conditionsItem) { + this.conditions.add(conditionsItem); + this.unparsed |= conditionsItem.unparsed; + return this; + } + + /** + * The conditions that trigger this notification rule. + * + * @return conditions + */ + @JsonProperty(JSON_PROPERTY_CONDITIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getConditions() { + return conditions; + } + + public void setConditions(List conditions) { + this.conditions = conditions; + } + + /** + * Timestamp when the notification rule was created. + * + * @return created + */ + @JsonProperty(JSON_PROPERTY_CREATED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreated() { + return created; + } + + public IncidentNotificationRuleAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether the notification rule is enabled. + * + * @return enabled + */ + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public IncidentNotificationRuleAttributes handles(List handles) { + this.handles = handles; + return this; + } + + public IncidentNotificationRuleAttributes addHandlesItem(String handlesItem) { + this.handles.add(handlesItem); + return this; + } + + /** + * The notification handles (targets) for this rule. + * + * @return handles + */ + @JsonProperty(JSON_PROPERTY_HANDLES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getHandles() { + return handles; + } + + public void setHandles(List handles) { + this.handles = handles; + } + + /** + * Timestamp when the notification rule was last modified. + * + * @return modified + */ + @JsonProperty(JSON_PROPERTY_MODIFIED) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getModified() { + return modified; + } + + public IncidentNotificationRuleAttributes renotifyOn(List renotifyOn) { + this.renotifyOn = renotifyOn; + return this; + } + + public IncidentNotificationRuleAttributes addRenotifyOnItem(String renotifyOnItem) { + if (this.renotifyOn == null) { + this.renotifyOn = new ArrayList<>(); + } + this.renotifyOn.add(renotifyOnItem); + return this; + } + + /** + * List of incident fields that trigger re-notification when changed. + * + * @return renotifyOn + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RENOTIFY_ON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getRenotifyOn() { + return renotifyOn; + } + + public void setRenotifyOn(List renotifyOn) { + this.renotifyOn = renotifyOn; + } + + public IncidentNotificationRuleAttributes trigger(String trigger) { + this.trigger = trigger; + return this; + } + + /** + * The trigger event for this notification rule. + * + * @return trigger + */ + @JsonProperty(JSON_PROPERTY_TRIGGER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTrigger() { + return trigger; + } + + public void setTrigger(String trigger) { + this.trigger = trigger; + } + + public IncidentNotificationRuleAttributes visibility( + IncidentNotificationRuleAttributesVisibility visibility) { + this.visibility = visibility; + this.unparsed |= !visibility.isValid(); + return this; + } + + /** + * The visibility of the notification rule. + * + * @return visibility + */ + @JsonProperty(JSON_PROPERTY_VISIBILITY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationRuleAttributesVisibility getVisibility() { + return visibility; + } + + public void setVisibility(IncidentNotificationRuleAttributesVisibility visibility) { + if (!visibility.isValid()) { + this.unparsed = true; + } + this.visibility = visibility; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleAttributes + */ + @JsonAnySetter + public IncidentNotificationRuleAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleAttributes incidentNotificationRuleAttributes = + (IncidentNotificationRuleAttributes) o; + return Objects.equals(this.conditions, incidentNotificationRuleAttributes.conditions) + && Objects.equals(this.created, incidentNotificationRuleAttributes.created) + && Objects.equals(this.enabled, incidentNotificationRuleAttributes.enabled) + && Objects.equals(this.handles, incidentNotificationRuleAttributes.handles) + && Objects.equals(this.modified, incidentNotificationRuleAttributes.modified) + && Objects.equals(this.renotifyOn, incidentNotificationRuleAttributes.renotifyOn) + && Objects.equals(this.trigger, incidentNotificationRuleAttributes.trigger) + && Objects.equals(this.visibility, incidentNotificationRuleAttributes.visibility) + && Objects.equals( + this.additionalProperties, incidentNotificationRuleAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + conditions, + created, + enabled, + handles, + modified, + renotifyOn, + trigger, + visibility, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleAttributes {\n"); + sb.append(" conditions: ").append(toIndentedString(conditions)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" handles: ").append(toIndentedString(handles)).append("\n"); + sb.append(" modified: ").append(toIndentedString(modified)).append("\n"); + sb.append(" renotifyOn: ").append(toIndentedString(renotifyOn)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append(" visibility: ").append(toIndentedString(visibility)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleAttributesVisibility.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleAttributesVisibility.java new file mode 100644 index 00000000000..df550321447 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleAttributesVisibility.java @@ -0,0 +1,67 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The visibility of the notification rule. */ +@JsonSerialize( + using = + IncidentNotificationRuleAttributesVisibility + .IncidentNotificationRuleAttributesVisibilitySerializer.class) +public class IncidentNotificationRuleAttributesVisibility extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("all", "organization", "private")); + + public static final IncidentNotificationRuleAttributesVisibility ALL = + new IncidentNotificationRuleAttributesVisibility("all"); + public static final IncidentNotificationRuleAttributesVisibility ORGANIZATION = + new IncidentNotificationRuleAttributesVisibility("organization"); + public static final IncidentNotificationRuleAttributesVisibility PRIVATE = + new IncidentNotificationRuleAttributesVisibility("private"); + + IncidentNotificationRuleAttributesVisibility(String value) { + super(value, allowedValues); + } + + public static class IncidentNotificationRuleAttributesVisibilitySerializer + extends StdSerializer { + public IncidentNotificationRuleAttributesVisibilitySerializer( + Class t) { + super(t); + } + + public IncidentNotificationRuleAttributesVisibilitySerializer() { + this(null); + } + + @Override + public void serialize( + IncidentNotificationRuleAttributesVisibility value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentNotificationRuleAttributesVisibility fromValue(String value) { + return new IncidentNotificationRuleAttributesVisibility(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleConditionsItems.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleConditionsItems.java new file mode 100644 index 00000000000..33d628430ce --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleConditionsItems.java @@ -0,0 +1,183 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A condition that must be met to trigger the notification rule. */ +@JsonPropertyOrder({ + IncidentNotificationRuleConditionsItems.JSON_PROPERTY_FIELD, + IncidentNotificationRuleConditionsItems.JSON_PROPERTY_VALUES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleConditionsItems { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_FIELD = "field"; + private String field; + + public static final String JSON_PROPERTY_VALUES = "values"; + private List values = new ArrayList<>(); + + public IncidentNotificationRuleConditionsItems() {} + + @JsonCreator + public IncidentNotificationRuleConditionsItems( + @JsonProperty(required = true, value = JSON_PROPERTY_FIELD) String field, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUES) List values) { + this.field = field; + this.values = values; + } + + public IncidentNotificationRuleConditionsItems field(String field) { + this.field = field; + return this; + } + + /** + * The incident field to evaluate + * + * @return field + */ + @JsonProperty(JSON_PROPERTY_FIELD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } + + public IncidentNotificationRuleConditionsItems values(List values) { + this.values = values; + return this; + } + + public IncidentNotificationRuleConditionsItems addValuesItem(String valuesItem) { + this.values.add(valuesItem); + return this; + } + + /** + * The value(s) to compare against. Multiple values are ORed together. + * + * @return values + */ + @JsonProperty(JSON_PROPERTY_VALUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValues() { + return values; + } + + public void setValues(List values) { + this.values = values; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleConditionsItems + */ + @JsonAnySetter + public IncidentNotificationRuleConditionsItems putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleConditionsItems object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleConditionsItems incidentNotificationRuleConditionsItems = + (IncidentNotificationRuleConditionsItems) o; + return Objects.equals(this.field, incidentNotificationRuleConditionsItems.field) + && Objects.equals(this.values, incidentNotificationRuleConditionsItems.values) + && Objects.equals( + this.additionalProperties, + incidentNotificationRuleConditionsItems.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(field, values, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleConditionsItems {\n"); + sb.append(" field: ").append(toIndentedString(field)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateAttributes.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateAttributes.java new file mode 100644 index 00000000000..a12ca40be25 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateAttributes.java @@ -0,0 +1,318 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The attributes for creating a notification rule. */ +@JsonPropertyOrder({ + IncidentNotificationRuleCreateAttributes.JSON_PROPERTY_CONDITIONS, + IncidentNotificationRuleCreateAttributes.JSON_PROPERTY_ENABLED, + IncidentNotificationRuleCreateAttributes.JSON_PROPERTY_HANDLES, + IncidentNotificationRuleCreateAttributes.JSON_PROPERTY_RENOTIFY_ON, + IncidentNotificationRuleCreateAttributes.JSON_PROPERTY_TRIGGER, + IncidentNotificationRuleCreateAttributes.JSON_PROPERTY_VISIBILITY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleCreateAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONDITIONS = "conditions"; + private List conditions = new ArrayList<>(); + + public static final String JSON_PROPERTY_ENABLED = "enabled"; + private Boolean enabled = false; + + public static final String JSON_PROPERTY_HANDLES = "handles"; + private List handles = new ArrayList<>(); + + public static final String JSON_PROPERTY_RENOTIFY_ON = "renotify_on"; + private List renotifyOn = null; + + public static final String JSON_PROPERTY_TRIGGER = "trigger"; + private String trigger; + + public static final String JSON_PROPERTY_VISIBILITY = "visibility"; + private IncidentNotificationRuleCreateAttributesVisibility visibility; + + public IncidentNotificationRuleCreateAttributes() {} + + @JsonCreator + public IncidentNotificationRuleCreateAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_CONDITIONS) + List conditions, + @JsonProperty(required = true, value = JSON_PROPERTY_HANDLES) List handles, + @JsonProperty(required = true, value = JSON_PROPERTY_TRIGGER) String trigger) { + this.conditions = conditions; + this.handles = handles; + this.trigger = trigger; + } + + public IncidentNotificationRuleCreateAttributes conditions( + List conditions) { + this.conditions = conditions; + for (IncidentNotificationRuleConditionsItems item : conditions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public IncidentNotificationRuleCreateAttributes addConditionsItem( + IncidentNotificationRuleConditionsItems conditionsItem) { + this.conditions.add(conditionsItem); + this.unparsed |= conditionsItem.unparsed; + return this; + } + + /** + * The conditions that trigger this notification rule. + * + * @return conditions + */ + @JsonProperty(JSON_PROPERTY_CONDITIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getConditions() { + return conditions; + } + + public void setConditions(List conditions) { + this.conditions = conditions; + } + + public IncidentNotificationRuleCreateAttributes enabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Whether the notification rule is enabled. + * + * @return enabled + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENABLED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public IncidentNotificationRuleCreateAttributes handles(List handles) { + this.handles = handles; + return this; + } + + public IncidentNotificationRuleCreateAttributes addHandlesItem(String handlesItem) { + this.handles.add(handlesItem); + return this; + } + + /** + * The notification handles (targets) for this rule. + * + * @return handles + */ + @JsonProperty(JSON_PROPERTY_HANDLES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getHandles() { + return handles; + } + + public void setHandles(List handles) { + this.handles = handles; + } + + public IncidentNotificationRuleCreateAttributes renotifyOn(List renotifyOn) { + this.renotifyOn = renotifyOn; + return this; + } + + public IncidentNotificationRuleCreateAttributes addRenotifyOnItem(String renotifyOnItem) { + if (this.renotifyOn == null) { + this.renotifyOn = new ArrayList<>(); + } + this.renotifyOn.add(renotifyOnItem); + return this; + } + + /** + * List of incident fields that trigger re-notification when changed. + * + * @return renotifyOn + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RENOTIFY_ON) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getRenotifyOn() { + return renotifyOn; + } + + public void setRenotifyOn(List renotifyOn) { + this.renotifyOn = renotifyOn; + } + + public IncidentNotificationRuleCreateAttributes trigger(String trigger) { + this.trigger = trigger; + return this; + } + + /** + * The trigger event for this notification rule. + * + * @return trigger + */ + @JsonProperty(JSON_PROPERTY_TRIGGER) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTrigger() { + return trigger; + } + + public void setTrigger(String trigger) { + this.trigger = trigger; + } + + public IncidentNotificationRuleCreateAttributes visibility( + IncidentNotificationRuleCreateAttributesVisibility visibility) { + this.visibility = visibility; + this.unparsed |= !visibility.isValid(); + return this; + } + + /** + * The visibility of the notification rule. + * + * @return visibility + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VISIBILITY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentNotificationRuleCreateAttributesVisibility getVisibility() { + return visibility; + } + + public void setVisibility(IncidentNotificationRuleCreateAttributesVisibility visibility) { + if (!visibility.isValid()) { + this.unparsed = true; + } + this.visibility = visibility; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleCreateAttributes + */ + @JsonAnySetter + public IncidentNotificationRuleCreateAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleCreateAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleCreateAttributes incidentNotificationRuleCreateAttributes = + (IncidentNotificationRuleCreateAttributes) o; + return Objects.equals(this.conditions, incidentNotificationRuleCreateAttributes.conditions) + && Objects.equals(this.enabled, incidentNotificationRuleCreateAttributes.enabled) + && Objects.equals(this.handles, incidentNotificationRuleCreateAttributes.handles) + && Objects.equals(this.renotifyOn, incidentNotificationRuleCreateAttributes.renotifyOn) + && Objects.equals(this.trigger, incidentNotificationRuleCreateAttributes.trigger) + && Objects.equals(this.visibility, incidentNotificationRuleCreateAttributes.visibility) + && Objects.equals( + this.additionalProperties, + incidentNotificationRuleCreateAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + conditions, enabled, handles, renotifyOn, trigger, visibility, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleCreateAttributes {\n"); + sb.append(" conditions: ").append(toIndentedString(conditions)).append("\n"); + sb.append(" enabled: ").append(toIndentedString(enabled)).append("\n"); + sb.append(" handles: ").append(toIndentedString(handles)).append("\n"); + sb.append(" renotifyOn: ").append(toIndentedString(renotifyOn)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append(" visibility: ").append(toIndentedString(visibility)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateAttributesVisibility.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateAttributesVisibility.java new file mode 100644 index 00000000000..eb579337778 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateAttributesVisibility.java @@ -0,0 +1,67 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The visibility of the notification rule. */ +@JsonSerialize( + using = + IncidentNotificationRuleCreateAttributesVisibility + .IncidentNotificationRuleCreateAttributesVisibilitySerializer.class) +public class IncidentNotificationRuleCreateAttributesVisibility extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("all", "organization", "private")); + + public static final IncidentNotificationRuleCreateAttributesVisibility ALL = + new IncidentNotificationRuleCreateAttributesVisibility("all"); + public static final IncidentNotificationRuleCreateAttributesVisibility ORGANIZATION = + new IncidentNotificationRuleCreateAttributesVisibility("organization"); + public static final IncidentNotificationRuleCreateAttributesVisibility PRIVATE = + new IncidentNotificationRuleCreateAttributesVisibility("private"); + + IncidentNotificationRuleCreateAttributesVisibility(String value) { + super(value, allowedValues); + } + + public static class IncidentNotificationRuleCreateAttributesVisibilitySerializer + extends StdSerializer { + public IncidentNotificationRuleCreateAttributesVisibilitySerializer( + Class t) { + super(t); + } + + public IncidentNotificationRuleCreateAttributesVisibilitySerializer() { + this(null); + } + + @Override + public void serialize( + IncidentNotificationRuleCreateAttributesVisibility value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentNotificationRuleCreateAttributesVisibility fromValue(String value) { + return new IncidentNotificationRuleCreateAttributesVisibility(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateData.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateData.java new file mode 100644 index 00000000000..0a3f4da558c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateData.java @@ -0,0 +1,214 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Notification rule data for a create request. */ +@JsonPropertyOrder({ + IncidentNotificationRuleCreateData.JSON_PROPERTY_ATTRIBUTES, + IncidentNotificationRuleCreateData.JSON_PROPERTY_RELATIONSHIPS, + IncidentNotificationRuleCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentNotificationRuleCreateAttributes attributes; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private IncidentNotificationRuleCreateDataRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentNotificationRuleType type; + + public IncidentNotificationRuleCreateData() {} + + @JsonCreator + public IncidentNotificationRuleCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + IncidentNotificationRuleCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + IncidentNotificationRuleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentNotificationRuleCreateData attributes( + IncidentNotificationRuleCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes for creating a notification rule. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationRuleCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(IncidentNotificationRuleCreateAttributes attributes) { + this.attributes = attributes; + } + + public IncidentNotificationRuleCreateData relationships( + IncidentNotificationRuleCreateDataRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * The definition of NotificationRuleCreateDataRelationships object. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentNotificationRuleCreateDataRelationships getRelationships() { + return relationships; + } + + public void setRelationships(IncidentNotificationRuleCreateDataRelationships relationships) { + this.relationships = relationships; + } + + public IncidentNotificationRuleCreateData type(IncidentNotificationRuleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Notification rules resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationRuleType getType() { + return type; + } + + public void setType(IncidentNotificationRuleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleCreateData + */ + @JsonAnySetter + public IncidentNotificationRuleCreateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleCreateData incidentNotificationRuleCreateData = + (IncidentNotificationRuleCreateData) o; + return Objects.equals(this.attributes, incidentNotificationRuleCreateData.attributes) + && Objects.equals(this.relationships, incidentNotificationRuleCreateData.relationships) + && Objects.equals(this.type, incidentNotificationRuleCreateData.type) + && Objects.equals( + this.additionalProperties, incidentNotificationRuleCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleCreateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateDataRelationships.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateDataRelationships.java new file mode 100644 index 00000000000..547f2744d93 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleCreateDataRelationships.java @@ -0,0 +1,179 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The definition of NotificationRuleCreateDataRelationships object. */ +@JsonPropertyOrder({ + IncidentNotificationRuleCreateDataRelationships.JSON_PROPERTY_INCIDENT_TYPE, + IncidentNotificationRuleCreateDataRelationships.JSON_PROPERTY_NOTIFICATION_TEMPLATE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleCreateDataRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_INCIDENT_TYPE = "incident_type"; + private RelationshipToIncidentType incidentType; + + public static final String JSON_PROPERTY_NOTIFICATION_TEMPLATE = "notification_template"; + private RelationshipToIncidentNotificationTemplate notificationTemplate; + + public IncidentNotificationRuleCreateDataRelationships incidentType( + RelationshipToIncidentType incidentType) { + this.incidentType = incidentType; + this.unparsed |= incidentType.unparsed; + return this; + } + + /** + * Relationship to an incident type. + * + * @return incidentType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCIDENT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToIncidentType getIncidentType() { + return incidentType; + } + + public void setIncidentType(RelationshipToIncidentType incidentType) { + this.incidentType = incidentType; + } + + public IncidentNotificationRuleCreateDataRelationships notificationTemplate( + RelationshipToIncidentNotificationTemplate notificationTemplate) { + this.notificationTemplate = notificationTemplate; + this.unparsed |= notificationTemplate.unparsed; + return this; + } + + /** + * A relationship reference to a notification template. + * + * @return notificationTemplate + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NOTIFICATION_TEMPLATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToIncidentNotificationTemplate getNotificationTemplate() { + return notificationTemplate; + } + + public void setNotificationTemplate( + RelationshipToIncidentNotificationTemplate notificationTemplate) { + this.notificationTemplate = notificationTemplate; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleCreateDataRelationships + */ + @JsonAnySetter + public IncidentNotificationRuleCreateDataRelationships putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleCreateDataRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleCreateDataRelationships + incidentNotificationRuleCreateDataRelationships = + (IncidentNotificationRuleCreateDataRelationships) o; + return Objects.equals( + this.incidentType, incidentNotificationRuleCreateDataRelationships.incidentType) + && Objects.equals( + this.notificationTemplate, + incidentNotificationRuleCreateDataRelationships.notificationTemplate) + && Objects.equals( + this.additionalProperties, + incidentNotificationRuleCreateDataRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(incidentType, notificationTemplate, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleCreateDataRelationships {\n"); + sb.append(" incidentType: ").append(toIndentedString(incidentType)).append("\n"); + sb.append(" notificationTemplate: ") + .append(toIndentedString(notificationTemplate)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleIncludedItems.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleIncludedItems.java new file mode 100644 index 00000000000..0e7fa78dce0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleIncludedItems.java @@ -0,0 +1,361 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = + IncidentNotificationRuleIncludedItems.IncidentNotificationRuleIncludedItemsDeserializer + .class) +@JsonSerialize( + using = + IncidentNotificationRuleIncludedItems.IncidentNotificationRuleIncludedItemsSerializer.class) +public class IncidentNotificationRuleIncludedItems extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(IncidentNotificationRuleIncludedItems.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class IncidentNotificationRuleIncludedItemsSerializer + extends StdSerializer { + public IncidentNotificationRuleIncludedItemsSerializer( + Class t) { + super(t); + } + + public IncidentNotificationRuleIncludedItemsSerializer() { + this(null); + } + + @Override + public void serialize( + IncidentNotificationRuleIncludedItems value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class IncidentNotificationRuleIncludedItemsDeserializer + extends StdDeserializer { + public IncidentNotificationRuleIncludedItemsDeserializer() { + this(IncidentNotificationRuleIncludedItems.class); + } + + public IncidentNotificationRuleIncludedItemsDeserializer(Class vc) { + super(vc); + } + + @Override + public IncidentNotificationRuleIncludedItems deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize User + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (User.class.equals(Integer.class) + || User.class.equals(Long.class) + || User.class.equals(Float.class) + || User.class.equals(Double.class) + || User.class.equals(Boolean.class) + || User.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((User.class.equals(Integer.class) || User.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((User.class.equals(Float.class) || User.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (User.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= (User.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(User.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((User) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'User'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'User'", e); + } + + // deserialize IncidentTypeObject + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (IncidentTypeObject.class.equals(Integer.class) + || IncidentTypeObject.class.equals(Long.class) + || IncidentTypeObject.class.equals(Float.class) + || IncidentTypeObject.class.equals(Double.class) + || IncidentTypeObject.class.equals(Boolean.class) + || IncidentTypeObject.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((IncidentTypeObject.class.equals(Integer.class) + || IncidentTypeObject.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((IncidentTypeObject.class.equals(Float.class) + || IncidentTypeObject.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (IncidentTypeObject.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (IncidentTypeObject.class.equals(String.class) && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(IncidentTypeObject.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((IncidentTypeObject) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'IncidentTypeObject'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'IncidentTypeObject'", e); + } + + // deserialize IncidentNotificationTemplateObject + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (IncidentNotificationTemplateObject.class.equals(Integer.class) + || IncidentNotificationTemplateObject.class.equals(Long.class) + || IncidentNotificationTemplateObject.class.equals(Float.class) + || IncidentNotificationTemplateObject.class.equals(Double.class) + || IncidentNotificationTemplateObject.class.equals(Boolean.class) + || IncidentNotificationTemplateObject.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((IncidentNotificationTemplateObject.class.equals(Integer.class) + || IncidentNotificationTemplateObject.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((IncidentNotificationTemplateObject.class.equals(Float.class) + || IncidentNotificationTemplateObject.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (IncidentNotificationTemplateObject.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (IncidentNotificationTemplateObject.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(IncidentNotificationTemplateObject.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((IncidentNotificationTemplateObject) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'IncidentNotificationTemplateObject'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log( + Level.FINER, + "Input data does not match schema 'IncidentNotificationTemplateObject'", + e); + } + + IncidentNotificationRuleIncludedItems ret = new IncidentNotificationRuleIncludedItems(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public IncidentNotificationRuleIncludedItems getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "IncidentNotificationRuleIncludedItems cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public IncidentNotificationRuleIncludedItems() { + super("oneOf", Boolean.FALSE); + } + + public IncidentNotificationRuleIncludedItems(User o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public IncidentNotificationRuleIncludedItems(IncidentTypeObject o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + public IncidentNotificationRuleIncludedItems(IncidentNotificationTemplateObject o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("User", new GenericType() {}); + schemas.put("IncidentTypeObject", new GenericType() {}); + schemas.put( + "IncidentNotificationTemplateObject", + new GenericType() {}); + JSON.registerDescendants( + IncidentNotificationRuleIncludedItems.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return IncidentNotificationRuleIncludedItems.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: User, IncidentTypeObject, IncidentNotificationTemplateObject + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(User.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf(IncidentTypeObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + if (JSON.isInstanceOf( + IncidentNotificationTemplateObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException( + "Invalid instance type. Must be User, IncidentTypeObject," + + " IncidentNotificationTemplateObject"); + } + + /** + * Get the actual instance, which can be the following: User, IncidentTypeObject, + * IncidentNotificationTemplateObject + * + * @return The actual instance (User, IncidentTypeObject, IncidentNotificationTemplateObject) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `User`. If the actual instance is not `User`, the ClassCastException + * will be thrown. + * + * @return The actual instance of `User` + * @throws ClassCastException if the instance is not `User` + */ + public User getUser() throws ClassCastException { + return (User) super.getActualInstance(); + } + + /** + * Get the actual instance of `IncidentTypeObject`. If the actual instance is not + * `IncidentTypeObject`, the ClassCastException will be thrown. + * + * @return The actual instance of `IncidentTypeObject` + * @throws ClassCastException if the instance is not `IncidentTypeObject` + */ + public IncidentTypeObject getIncidentTypeObject() throws ClassCastException { + return (IncidentTypeObject) super.getActualInstance(); + } + + /** + * Get the actual instance of `IncidentNotificationTemplateObject`. If the actual instance is not + * `IncidentNotificationTemplateObject`, the ClassCastException will be thrown. + * + * @return The actual instance of `IncidentNotificationTemplateObject` + * @throws ClassCastException if the instance is not `IncidentNotificationTemplateObject` + */ + public IncidentNotificationTemplateObject getIncidentNotificationTemplateObject() + throws ClassCastException { + return (IncidentNotificationTemplateObject) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleRelationships.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleRelationships.java new file mode 100644 index 00000000000..9ba611cace6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleRelationships.java @@ -0,0 +1,237 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The notification rule's resource relationships. */ +@JsonPropertyOrder({ + IncidentNotificationRuleRelationships.JSON_PROPERTY_CREATED_BY_USER, + IncidentNotificationRuleRelationships.JSON_PROPERTY_INCIDENT_TYPE, + IncidentNotificationRuleRelationships.JSON_PROPERTY_LAST_MODIFIED_BY_USER, + IncidentNotificationRuleRelationships.JSON_PROPERTY_NOTIFICATION_TEMPLATE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleRelationships { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_BY_USER = "created_by_user"; + private RelationshipToUser createdByUser; + + public static final String JSON_PROPERTY_INCIDENT_TYPE = "incident_type"; + private RelationshipToIncidentType incidentType; + + public static final String JSON_PROPERTY_LAST_MODIFIED_BY_USER = "last_modified_by_user"; + private RelationshipToUser lastModifiedByUser; + + public static final String JSON_PROPERTY_NOTIFICATION_TEMPLATE = "notification_template"; + private RelationshipToIncidentNotificationTemplate notificationTemplate; + + public IncidentNotificationRuleRelationships createdByUser(RelationshipToUser createdByUser) { + this.createdByUser = createdByUser; + this.unparsed |= createdByUser.unparsed; + return this; + } + + /** + * Relationship to user. + * + * @return createdByUser + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_BY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToUser getCreatedByUser() { + return createdByUser; + } + + public void setCreatedByUser(RelationshipToUser createdByUser) { + this.createdByUser = createdByUser; + } + + public IncidentNotificationRuleRelationships incidentType( + RelationshipToIncidentType incidentType) { + this.incidentType = incidentType; + this.unparsed |= incidentType.unparsed; + return this; + } + + /** + * Relationship to an incident type. + * + * @return incidentType + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCIDENT_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToIncidentType getIncidentType() { + return incidentType; + } + + public void setIncidentType(RelationshipToIncidentType incidentType) { + this.incidentType = incidentType; + } + + public IncidentNotificationRuleRelationships lastModifiedByUser( + RelationshipToUser lastModifiedByUser) { + this.lastModifiedByUser = lastModifiedByUser; + this.unparsed |= lastModifiedByUser.unparsed; + return this; + } + + /** + * Relationship to user. + * + * @return lastModifiedByUser + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_LAST_MODIFIED_BY_USER) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToUser getLastModifiedByUser() { + return lastModifiedByUser; + } + + public void setLastModifiedByUser(RelationshipToUser lastModifiedByUser) { + this.lastModifiedByUser = lastModifiedByUser; + } + + public IncidentNotificationRuleRelationships notificationTemplate( + RelationshipToIncidentNotificationTemplate notificationTemplate) { + this.notificationTemplate = notificationTemplate; + this.unparsed |= notificationTemplate.unparsed; + return this; + } + + /** + * A relationship reference to a notification template. + * + * @return notificationTemplate + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NOTIFICATION_TEMPLATE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public RelationshipToIncidentNotificationTemplate getNotificationTemplate() { + return notificationTemplate; + } + + public void setNotificationTemplate( + RelationshipToIncidentNotificationTemplate notificationTemplate) { + this.notificationTemplate = notificationTemplate; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleRelationships + */ + @JsonAnySetter + public IncidentNotificationRuleRelationships putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleRelationships object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleRelationships incidentNotificationRuleRelationships = + (IncidentNotificationRuleRelationships) o; + return Objects.equals(this.createdByUser, incidentNotificationRuleRelationships.createdByUser) + && Objects.equals(this.incidentType, incidentNotificationRuleRelationships.incidentType) + && Objects.equals( + this.lastModifiedByUser, incidentNotificationRuleRelationships.lastModifiedByUser) + && Objects.equals( + this.notificationTemplate, incidentNotificationRuleRelationships.notificationTemplate) + && Objects.equals( + this.additionalProperties, incidentNotificationRuleRelationships.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdByUser, + incidentType, + lastModifiedByUser, + notificationTemplate, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleRelationships {\n"); + sb.append(" createdByUser: ").append(toIndentedString(createdByUser)).append("\n"); + sb.append(" incidentType: ").append(toIndentedString(incidentType)).append("\n"); + sb.append(" lastModifiedByUser: ").append(toIndentedString(lastModifiedByUser)).append("\n"); + sb.append(" notificationTemplate: ") + .append(toIndentedString(notificationTemplate)) + .append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleResponseData.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleResponseData.java new file mode 100644 index 00000000000..f0766b36d52 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleResponseData.java @@ -0,0 +1,240 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Notification rule data from a response. */ +@JsonPropertyOrder({ + IncidentNotificationRuleResponseData.JSON_PROPERTY_ATTRIBUTES, + IncidentNotificationRuleResponseData.JSON_PROPERTY_ID, + IncidentNotificationRuleResponseData.JSON_PROPERTY_RELATIONSHIPS, + IncidentNotificationRuleResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentNotificationRuleAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private IncidentNotificationRuleRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentNotificationRuleType type; + + public IncidentNotificationRuleResponseData() {} + + @JsonCreator + public IncidentNotificationRuleResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + IncidentNotificationRuleType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentNotificationRuleResponseData attributes( + IncidentNotificationRuleAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The notification rule's attributes. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentNotificationRuleAttributes getAttributes() { + return attributes; + } + + public void setAttributes(IncidentNotificationRuleAttributes attributes) { + this.attributes = attributes; + } + + public IncidentNotificationRuleResponseData id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the notification rule. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public IncidentNotificationRuleResponseData relationships( + IncidentNotificationRuleRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * The notification rule's resource relationships. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentNotificationRuleRelationships getRelationships() { + return relationships; + } + + public void setRelationships(IncidentNotificationRuleRelationships relationships) { + this.relationships = relationships; + } + + public IncidentNotificationRuleResponseData type(IncidentNotificationRuleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Notification rules resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationRuleType getType() { + return type; + } + + public void setType(IncidentNotificationRuleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleResponseData + */ + @JsonAnySetter + public IncidentNotificationRuleResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleResponseData incidentNotificationRuleResponseData = + (IncidentNotificationRuleResponseData) o; + return Objects.equals(this.attributes, incidentNotificationRuleResponseData.attributes) + && Objects.equals(this.id, incidentNotificationRuleResponseData.id) + && Objects.equals(this.relationships, incidentNotificationRuleResponseData.relationships) + && Objects.equals(this.type, incidentNotificationRuleResponseData.type) + && Objects.equals( + this.additionalProperties, incidentNotificationRuleResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleType.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleType.java new file mode 100644 index 00000000000..1bc2f8e1fd9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleType.java @@ -0,0 +1,57 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Notification rules resource type. */ +@JsonSerialize(using = IncidentNotificationRuleType.IncidentNotificationRuleTypeSerializer.class) +public class IncidentNotificationRuleType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("incident_notification_rules")); + + public static final IncidentNotificationRuleType INCIDENT_NOTIFICATION_RULES = + new IncidentNotificationRuleType("incident_notification_rules"); + + IncidentNotificationRuleType(String value) { + super(value, allowedValues); + } + + public static class IncidentNotificationRuleTypeSerializer + extends StdSerializer { + public IncidentNotificationRuleTypeSerializer(Class t) { + super(t); + } + + public IncidentNotificationRuleTypeSerializer() { + this(null); + } + + @Override + public void serialize( + IncidentNotificationRuleType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static IncidentNotificationRuleType fromValue(String value) { + return new IncidentNotificationRuleType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleUpdateData.java new file mode 100644 index 00000000000..4aadf908849 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationRuleUpdateData.java @@ -0,0 +1,243 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Notification rule data for an update request. */ +@JsonPropertyOrder({ + IncidentNotificationRuleUpdateData.JSON_PROPERTY_ATTRIBUTES, + IncidentNotificationRuleUpdateData.JSON_PROPERTY_ID, + IncidentNotificationRuleUpdateData.JSON_PROPERTY_RELATIONSHIPS, + IncidentNotificationRuleUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationRuleUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentNotificationRuleCreateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private IncidentNotificationRuleCreateDataRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentNotificationRuleType type; + + public IncidentNotificationRuleUpdateData() {} + + @JsonCreator + public IncidentNotificationRuleUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + IncidentNotificationRuleCreateAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + IncidentNotificationRuleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentNotificationRuleUpdateData attributes( + IncidentNotificationRuleCreateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The attributes for creating a notification rule. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationRuleCreateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(IncidentNotificationRuleCreateAttributes attributes) { + this.attributes = attributes; + } + + public IncidentNotificationRuleUpdateData id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the notification rule. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public IncidentNotificationRuleUpdateData relationships( + IncidentNotificationRuleCreateDataRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * The definition of NotificationRuleCreateDataRelationships object. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentNotificationRuleCreateDataRelationships getRelationships() { + return relationships; + } + + public void setRelationships(IncidentNotificationRuleCreateDataRelationships relationships) { + this.relationships = relationships; + } + + public IncidentNotificationRuleUpdateData type(IncidentNotificationRuleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Notification rules resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationRuleType getType() { + return type; + } + + public void setType(IncidentNotificationRuleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationRuleUpdateData + */ + @JsonAnySetter + public IncidentNotificationRuleUpdateData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationRuleUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationRuleUpdateData incidentNotificationRuleUpdateData = + (IncidentNotificationRuleUpdateData) o; + return Objects.equals(this.attributes, incidentNotificationRuleUpdateData.attributes) + && Objects.equals(this.id, incidentNotificationRuleUpdateData.id) + && Objects.equals(this.relationships, incidentNotificationRuleUpdateData.relationships) + && Objects.equals(this.type, incidentNotificationRuleUpdateData.type) + && Objects.equals( + this.additionalProperties, incidentNotificationRuleUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationRuleUpdateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationTemplateObject.java b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationTemplateObject.java new file mode 100644 index 00000000000..9e736321241 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/IncidentNotificationTemplateObject.java @@ -0,0 +1,240 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** A notification template object for inclusion in other resources. */ +@JsonPropertyOrder({ + IncidentNotificationTemplateObject.JSON_PROPERTY_ATTRIBUTES, + IncidentNotificationTemplateObject.JSON_PROPERTY_ID, + IncidentNotificationTemplateObject.JSON_PROPERTY_RELATIONSHIPS, + IncidentNotificationTemplateObject.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class IncidentNotificationTemplateObject { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private IncidentNotificationTemplateAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_RELATIONSHIPS = "relationships"; + private IncidentNotificationTemplateRelationships relationships; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentNotificationTemplateType type; + + public IncidentNotificationTemplateObject() {} + + @JsonCreator + public IncidentNotificationTemplateObject( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + IncidentNotificationTemplateType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public IncidentNotificationTemplateObject attributes( + IncidentNotificationTemplateAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The notification template's attributes. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentNotificationTemplateAttributes getAttributes() { + return attributes; + } + + public void setAttributes(IncidentNotificationTemplateAttributes attributes) { + this.attributes = attributes; + } + + public IncidentNotificationTemplateObject id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the notification template. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public IncidentNotificationTemplateObject relationships( + IncidentNotificationTemplateRelationships relationships) { + this.relationships = relationships; + this.unparsed |= relationships.unparsed; + return this; + } + + /** + * The notification template's resource relationships. + * + * @return relationships + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_RELATIONSHIPS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public IncidentNotificationTemplateRelationships getRelationships() { + return relationships; + } + + public void setRelationships(IncidentNotificationTemplateRelationships relationships) { + this.relationships = relationships; + } + + public IncidentNotificationTemplateObject type(IncidentNotificationTemplateType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Notification templates resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationTemplateType getType() { + return type; + } + + public void setType(IncidentNotificationTemplateType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return IncidentNotificationTemplateObject + */ + @JsonAnySetter + public IncidentNotificationTemplateObject putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this IncidentNotificationTemplateObject object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + IncidentNotificationTemplateObject incidentNotificationTemplateObject = + (IncidentNotificationTemplateObject) o; + return Objects.equals(this.attributes, incidentNotificationTemplateObject.attributes) + && Objects.equals(this.id, incidentNotificationTemplateObject.id) + && Objects.equals(this.relationships, incidentNotificationTemplateObject.relationships) + && Objects.equals(this.type, incidentNotificationTemplateObject.type) + && Objects.equals( + this.additionalProperties, incidentNotificationTemplateObject.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, relationships, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class IncidentNotificationTemplateObject {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" relationships: ").append(toIndentedString(relationships)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/PutIncidentNotificationRuleRequest.java b/src/main/java/com/datadog/api/client/v2/model/PutIncidentNotificationRuleRequest.java new file mode 100644 index 00000000000..4faaeecb50d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/PutIncidentNotificationRuleRequest.java @@ -0,0 +1,148 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Put request for a notification rule. */ +@JsonPropertyOrder({PutIncidentNotificationRuleRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class PutIncidentNotificationRuleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private IncidentNotificationRuleUpdateData data; + + public PutIncidentNotificationRuleRequest() {} + + @JsonCreator + public PutIncidentNotificationRuleRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + IncidentNotificationRuleUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public PutIncidentNotificationRuleRequest data(IncidentNotificationRuleUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Notification rule data for an update request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationRuleUpdateData getData() { + return data; + } + + public void setData(IncidentNotificationRuleUpdateData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return PutIncidentNotificationRuleRequest + */ + @JsonAnySetter + public PutIncidentNotificationRuleRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this PutIncidentNotificationRuleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + PutIncidentNotificationRuleRequest putIncidentNotificationRuleRequest = + (PutIncidentNotificationRuleRequest) o; + return Objects.equals(this.data, putIncidentNotificationRuleRequest.data) + && Objects.equals( + this.additionalProperties, putIncidentNotificationRuleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PutIncidentNotificationRuleRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentNotificationTemplate.java b/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentNotificationTemplate.java new file mode 100644 index 00000000000..ee3660b4778 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentNotificationTemplate.java @@ -0,0 +1,151 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A relationship reference to a notification template. */ +@JsonPropertyOrder({RelationshipToIncidentNotificationTemplate.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RelationshipToIncidentNotificationTemplate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private RelationshipToIncidentNotificationTemplateData data; + + public RelationshipToIncidentNotificationTemplate() {} + + @JsonCreator + public RelationshipToIncidentNotificationTemplate( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + RelationshipToIncidentNotificationTemplateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public RelationshipToIncidentNotificationTemplate data( + RelationshipToIncidentNotificationTemplateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The notification template relationship data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RelationshipToIncidentNotificationTemplateData getData() { + return data; + } + + public void setData(RelationshipToIncidentNotificationTemplateData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RelationshipToIncidentNotificationTemplate + */ + @JsonAnySetter + public RelationshipToIncidentNotificationTemplate putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RelationshipToIncidentNotificationTemplate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationshipToIncidentNotificationTemplate relationshipToIncidentNotificationTemplate = + (RelationshipToIncidentNotificationTemplate) o; + return Objects.equals(this.data, relationshipToIncidentNotificationTemplate.data) + && Objects.equals( + this.additionalProperties, + relationshipToIncidentNotificationTemplate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipToIncidentNotificationTemplate {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentNotificationTemplateData.java b/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentNotificationTemplateData.java new file mode 100644 index 00000000000..d9902160589 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RelationshipToIncidentNotificationTemplateData.java @@ -0,0 +1,185 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** The notification template relationship data. */ +@JsonPropertyOrder({ + RelationshipToIncidentNotificationTemplateData.JSON_PROPERTY_ID, + RelationshipToIncidentNotificationTemplateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RelationshipToIncidentNotificationTemplateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private IncidentNotificationTemplateType type; + + public RelationshipToIncidentNotificationTemplateData() {} + + @JsonCreator + public RelationshipToIncidentNotificationTemplateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + IncidentNotificationTemplateType type) { + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public RelationshipToIncidentNotificationTemplateData id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the notification template. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public RelationshipToIncidentNotificationTemplateData type( + IncidentNotificationTemplateType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Notification templates resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public IncidentNotificationTemplateType getType() { + return type; + } + + public void setType(IncidentNotificationTemplateType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RelationshipToIncidentNotificationTemplateData + */ + @JsonAnySetter + public RelationshipToIncidentNotificationTemplateData putAdditionalProperty( + String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RelationshipToIncidentNotificationTemplateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RelationshipToIncidentNotificationTemplateData relationshipToIncidentNotificationTemplateData = + (RelationshipToIncidentNotificationTemplateData) o; + return Objects.equals(this.id, relationshipToIncidentNotificationTemplateData.id) + && Objects.equals(this.type, relationshipToIncidentNotificationTemplateData.type) + && Objects.equals( + this.additionalProperties, + relationshipToIncidentNotificationTemplateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RelationshipToIncidentNotificationTemplateData {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/cassettes/features/v2/Create_an_incident_type_returns_CREATED_response.json b/src/test/resources/cassettes/features/v2/Create_an_incident_type_returns_CREATED_response.json index 865c18a3146..be30b5d0169 100644 --- a/src/test/resources/cassettes/features/v2/Create_an_incident_type_returns_CREATED_response.json +++ b/src/test/resources/cassettes/features/v2/Create_an_incident_type_returns_CREATED_response.json @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "7bcfec66-5300-9891-51e5-e4d7e0833bd5" + "id": "7bcfec66-5300-9891-51e5-e4d7e0833bd8" }, { "httpRequest": { diff --git a/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..275d1a82320 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:08.891Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Bad_Request_response.json new file mode 100644 index 00000000000..232eaab1fec --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"got type \\\"invalid_type\\\" expected one of \\\"incident_notification_rules\\\"\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4bf993a7-1968-5870-671d-138b90cb252b" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Created_response.freeze b/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Created_response.freeze new file mode 100644 index 00000000000..67baa5efb45 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Created_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:09.032Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Created_response.json b/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Created_response.json new file mode 100644 index 00000000000..1ee8bebe3f5 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_incident_notification_rule_returns_Created_response.json @@ -0,0 +1,104 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/types", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7bcfec66-5300-9891-51e5-e4d7e0833bd5" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "be87f38a-377c-6052-443e-2c757f463a06" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/notification-rules/93dada9a-d032-49a4-b445-0673aaebb888", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5b2dfde4-6563-2fbf-7f92-ee21c6225cc6" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/types/107e7ed1-ec07-483f-a723-882ce86702ba", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "1aaaa50c-7ce4-b368-0dca-3b808825cc48" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_No_Content_response.freeze b/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_No_Content_response.freeze new file mode 100644 index 00000000000..86eba7dd7a7 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:13.145Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_No_Content_response.json b/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_No_Content_response.json new file mode 100644 index 00000000000..b2fc9afb746 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_No_Content_response.json @@ -0,0 +1,130 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/types", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7bcfec66-5300-9891-51e5-e4d7e0833bd6" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4edea809-df67-7046-7c56-841a4ea4da43" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/notification-rules/dc55d64f-6897-49b0-93b7-d2a34b010cab", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5ce4a021-c778-0dda-2dca-8d37883233a4" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/notification-rules/dc55d64f-6897-49b0-93b7-d2a34b010cab", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"rule not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5ce4a021-c778-0dda-2dca-8d37883233a5" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/types/ad9ae59d-b9ce-494b-98b2-326fbcc804b9", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "9ec1c319-2205-1e41-91a5-6a44604a089b" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..f82ca340020 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:13.827Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_Not_Found_response.json new file mode 100644 index 00000000000..f8d2f374b53 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_incident_notification_rule_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/notification-rules/00000000-0000-0000-0000-000000000001", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"rule not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b3fad29a-10a3-99c7-4985-6e7c8423bc04" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..a527f341515 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:20.351Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_Not_Found_response.json new file mode 100644 index 00000000000..5c6641c59f8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/incidents/config/notification-rules/00000000-0000-0000-0000-000000000001", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"rule not found\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c59ad237-5b4e-2051-d048-c88b1f66393f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_OK_response.freeze new file mode 100644 index 00000000000..b5df2e3ca94 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:20.427Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_OK_response.json new file mode 100644 index 00000000000..66218850c74 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_incident_notification_rule_returns_OK_response.json @@ -0,0 +1,130 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/types", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7bcfec66-5300-9891-51e5-e4d7e0833bdc" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6776f422-eaaa-a075-62da-5f388401bf66" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/incidents/config/notification-rules/d364309f-e1ee-4bdb-a6a2-508c21601f5d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "61b00c59-23d9-b563-f8fd-05b17e6d4d1b" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/notification-rules/d364309f-e1ee-4bdb-a6a2-508c21601f5d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c3d4220a-5b3f-d114-1e8b-3b1fafc7555d" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/types/ba3134f6-c17f-415b-8023-776f53667031", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f893a3cf-648a-e0cd-fe0f-b607ead764b6" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_incident_notification_template_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_incident_notification_template_returns_OK_response.json index fae631ce4f3..3ea0ac83ce6 100644 --- a/src/test/resources/cassettes/features/v2/Get_incident_notification_template_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Get_incident_notification_template_returns_OK_response.json @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "7bcfec66-5300-9891-51e5-e4d7e0833bd7" + "id": "7bcfec66-5300-9891-51e5-e4d7e0833bdb" }, { "httpRequest": { diff --git a/src/test/resources/cassettes/features/v2/List_incident_notification_rules_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/List_incident_notification_rules_returns_OK_response.freeze new file mode 100644 index 00000000000..188351a15b8 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_incident_notification_rules_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:22.504Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/List_incident_notification_rules_returns_OK_response.json b/src/test/resources/cassettes/features/v2/List_incident_notification_rules_returns_OK_response.json new file mode 100644 index 00000000000..2f3d1555a1f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/List_incident_notification_rules_returns_OK_response.json @@ -0,0 +1,130 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/types", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7bcfec66-5300-9891-51e5-e4d7e0833bd7" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "476cf1a8-bd40-281b-dd59-b40242924096" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/incidents/config/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "47534575-47d8-cd49-13b1-e0aecfd82a33" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/notification-rules/94e7cf01-bf6e-4ad5-bb87-e91880318851", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6fe3884f-0feb-6835-0b39-4c96a5f11dd4" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/types/33eb6b19-1034-4233-9bfa-03e4ffbc18ca", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b19c730b-f843-5d97-0ff8-898b819b2b01" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..b4f928015d4 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:42.727Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Bad_Request_response.json new file mode 100644 index 00000000000..3af277e3e0b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "PUT", + "path": "/api/v2/incidents/config/notification-rules/00000000-0000-0000-0000-000000000001", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"status\":\"400\",\"title\":\"Bad Request\",\"detail\":\"got type \\\"invalid_type\\\" expected one of \\\"incident_notification_rules\\\"\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e2d9d3be-1083-d3f6-5c81-637677cd9cb7" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..525cde36091 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:42.804Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Not_Found_response.json new file mode 100644 index 00000000000..dac3ff2d8df --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "PUT", + "path": "/api/v2/incidents/config/notification-rules/00000000-0000-0000-0000-000000000001", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[{\"title\":\"Generic Error\",\"detail\":\"incident type doesn't exist\"}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "22f89f86-c1f6-8868-f119-51a2b4696b45" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_OK_response.freeze new file mode 100644 index 00000000000..2f3783d3904 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-09-09T18:32:42.885Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_OK_response.json new file mode 100644 index 00000000000..e6376ecec7b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_incident_notification_rule_returns_OK_response.json @@ -0,0 +1,134 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/types", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "7bcfec66-5300-9891-51e5-e4d7e0833bd9" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "POST", + "path": "/api/v2/incidents/config/notification-rules", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a30a6fcd-56f3-83b3-7194-438c64dd36b4" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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": {}, + "method": "PUT", + "path": "/api/v2/incidents/config/notification-rules/01b558a4-32f7-4d4d-b46a-793dca40df48", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "18d6081c-eb98-aabd-24d8-c51a3bb4bcaf" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/notification-rules/01b558a4-32f7-4d4d-b46a-793dca40df48", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "e7ba5345-539f-0f4f-36f7-9c1d1b6ea4b6" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/incidents/config/types/2e166ce6-b249-46d1-8143-5ad4f5dda002", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "4e10bab5-1385-89fc-5509-d2e37bc8b930" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_incident_notification_template_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_incident_notification_template_returns_OK_response.json index 35480b47097..0825245dbe7 100644 --- a/src/test/resources/cassettes/features/v2/Update_incident_notification_template_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Update_incident_notification_template_returns_OK_response.json @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "7bcfec66-5300-9891-51e5-e4d7e0833bd6" + "id": "7bcfec66-5300-9891-51e5-e4d7e0833bda" }, { "httpRequest": { diff --git a/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 2fce716f34a..4e0610f2f8f 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/incidents.feature b/src/test/resources/com/datadog/api/client/v2/api/incidents.feature index f381e2e6f0b..4f278f28160 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/incidents.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 58051028c29..f9424d938fd 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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": {