From 4722f711ac5cfe54792ed49b22ada6ff1cfd88cf Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Tue, 24 Jun 2025 13:21:32 +0000 Subject: [PATCH] Regenerate client from commit 8772660e of spec repo --- .apigentools-info | 8 +- .generator/schemas/v2/openapi.yaml | 567 ++++++++ .../monitors/CreateMonitorUserTemplate.java | 59 + .../monitors/DeleteMonitorUserTemplate.java | 23 + .../v2/monitors/GetMonitorUserTemplate.java | 29 + .../v2/monitors/ListMonitorUserTemplates.java | 25 + .../monitors/UpdateMonitorUserTemplate.java | 64 + .../ValidateExistingMonitorUserTemplate.java | 61 + .../monitors/ValidateMonitorUserTemplate.java | 57 + .../com/datadog/api/client/ApiClient.java | 7 + .../api/client/v2/api/MonitorsApi.java | 1205 ++++++++++++++++- .../client/v2/model/MonitorUserTemplate.java | 408 ++++++ .../model/MonitorUserTemplateCreateData.java | 184 +++ .../MonitorUserTemplateCreateRequest.java | 148 ++ .../MonitorUserTemplateCreateResponse.java | 138 ++ .../MonitorUserTemplateListResponse.java | 151 +++ .../MonitorUserTemplateRequestAttributes.java | 248 ++++ .../MonitorUserTemplateResourceType.java | 58 + .../v2/model/MonitorUserTemplateResponse.java | 137 ++ ...MonitorUserTemplateResponseAttributes.java | 374 +++++ .../MonitorUserTemplateResponseData.java | 200 +++ ...rUserTemplateResponseDataWithVersions.java | 201 +++ ...torUserTemplateTemplateVariablesItems.java | 195 +++ .../model/MonitorUserTemplateUpdateData.java | 212 +++ .../MonitorUserTemplateUpdateRequest.java | 148 ++ .../v2/model/SimpleMonitorUserTemplate.java | 379 ++++++ ...policy_returns_Bad_Request_response.freeze | 2 +- ...guration_policy_returns_OK_response.freeze | 2 +- ...figuration_policy_returns_OK_response.json | 10 +- ...n_rule_returns_Bad_Request_response.freeze | 2 +- ...ion_rule_returns_Bad_Request_response.json | 4 +- ...tification_rule_returns_OK_response.freeze | 2 +- ...notification_rule_returns_OK_response.json | 10 +- ...mplate_returns_Bad_Request_response.freeze | 1 + ...template_returns_Bad_Request_response.json | 32 + ...r_user_template_returns_OK_response.freeze | 1 + ...tor_user_template_returns_OK_response.json | 57 + ...policy_returns_Bad_Request_response.freeze | 2 +- ...n_policy_returns_Not_Found_response.freeze | 2 +- ...guration_policy_returns_OK_response.freeze | 2 +- ...figuration_policy_returns_OK_response.json | 14 +- ...ion_rule_returns_Not_Found_response.freeze | 2 +- ...tification_rule_returns_OK_response.freeze | 2 +- ...notification_rule_returns_OK_response.json | 14 +- ...template_returns_Not_Found_response.freeze | 1 + ...r_template_returns_Not_Found_response.json | 28 + ...n_policy_returns_Not_Found_response.freeze | 2 +- ...guration_policy_returns_OK_response.freeze | 2 +- ...figuration_policy_returns_OK_response.json | 18 +- ...turns_Unprocessable_Entity_response.freeze | 2 +- ...returns_Unprocessable_Entity_response.json | 16 +- ...n_policy_returns_Not_Found_response.freeze | 2 +- ...guration_policy_returns_OK_response.freeze | 2 +- ...figuration_policy_returns_OK_response.json | 16 +- ...ion_rule_returns_Not_Found_response.freeze | 2 +- ...tification_rule_returns_OK_response.freeze | 2 +- ...notification_rule_returns_OK_response.json | 16 +- ...template_returns_Not_Found_response.freeze | 1 + ...r_template_returns_Not_Found_response.json | 28 + ...r_user_template_returns_OK_response.freeze | 1 + ...tor_user_template_returns_OK_response.json | 83 ++ ...ration_policies_returns_OK_response.freeze | 2 +- ...guration_policies_returns_OK_response.json | 12 +- ...ification_rules_returns_OK_response.freeze | 2 +- ...otification_rules_returns_OK_response.json | 12 +- ..._user_templates_returns_OK_response.freeze | 1 + ...or_user_templates_returns_OK_response.json | 83 ++ ...n_rule_returns_Bad_Request_response.freeze | 2 +- ...ion_rule_returns_Bad_Request_response.json | 16 +- ...ion_rule_returns_Not_Found_response.freeze | 2 +- ...ation_rule_returns_Not_Found_response.json | 4 +- ...tification_rule_returns_OK_response.freeze | 2 +- ...notification_rule_returns_OK_response.json | 18 +- ...ersion_returns_Bad_Request_response.freeze | 1 + ..._version_returns_Bad_Request_response.json | 87 ++ ..._version_returns_Not_Found_response.freeze | 1 + ...ew_version_returns_Not_Found_response.json | 32 + ...o_a_new_version_returns_OK_response.freeze | 1 + ..._to_a_new_version_returns_OK_response.json | 87 ++ ...mplate_returns_Bad_Request_response.freeze | 1 + ...template_returns_Bad_Request_response.json | 32 + ...r_user_template_returns_OK_response.freeze | 1 + ...tor_user_template_returns_OK_response.json | 31 + ...mplate_returns_Bad_Request_response.freeze | 1 + ...template_returns_Bad_Request_response.json | 87 ++ ...template_returns_Not_Found_response.freeze | 1 + ...r_template_returns_Not_Found_response.json | 32 + ...r_user_template_returns_OK_response.freeze | 1 + ...tor_user_template_returns_OK_response.json | 86 ++ .../com/datadog/api/client/v2/api/given.json | 12 + .../api/client/v2/api/monitors.feature | 133 ++ .../com/datadog/api/client/v2/api/undo.json | 49 + 92 files changed, 6373 insertions(+), 128 deletions(-) create mode 100644 examples/v2/monitors/CreateMonitorUserTemplate.java create mode 100644 examples/v2/monitors/DeleteMonitorUserTemplate.java create mode 100644 examples/v2/monitors/GetMonitorUserTemplate.java create mode 100644 examples/v2/monitors/ListMonitorUserTemplates.java create mode 100644 examples/v2/monitors/UpdateMonitorUserTemplate.java create mode 100644 examples/v2/monitors/ValidateExistingMonitorUserTemplate.java create mode 100644 examples/v2/monitors/ValidateMonitorUserTemplate.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplate.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateCreateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateCreateResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateListResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResourceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseDataWithVersions.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateTemplateVariablesItems.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateUpdateData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateUpdateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/SimpleMonitorUserTemplate.java create mode 100644 src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Delete_a_monitor_user_template_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Delete_a_monitor_user_template_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Get_all_monitor_user_templates_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Get_all_monitor_user_templates_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_OK_response.json create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Bad_Request_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Bad_Request_response.json create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Not_Found_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Not_Found_response.json create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_OK_response.json diff --git a/.apigentools-info b/.apigentools-info index 6917c16da83..364b0b9670d 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-23 20:34:48.753397", - "spec_repo_commit": "837c2656" + "regenerated": "2025-06-24 13:19:24.897822", + "spec_repo_commit": "8772660e" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-23 20:34:48.769158", - "spec_repo_commit": "837c2656" + "regenerated": "2025-06-24 13:19:24.915653", + "spec_repo_commit": "8772660e" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 115918b18dc..6f33dcc74da 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23664,6 +23664,278 @@ components: description: The monitor type. type: string type: object + MonitorUserTemplate: + additionalProperties: {} + description: A monitor user template object. + properties: + created: + $ref: '#/components/schemas/MonitorUserTemplateCreated' + description: + $ref: '#/components/schemas/MonitorUserTemplateDescription' + modified: + $ref: '#/components/schemas/MonitorUserTemplateModified' + monitor_definition: + additionalProperties: {} + description: A valid monitor definition in the same format as the [V1 Monitor + API](https://docs.datadoghq.com/api/latest/monitors/#create-a-monitor). + example: + message: You may need to add web hosts if this is consistently high. + name: Bytes received on host0 + query: avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100 + type: query alert + type: object + tags: + $ref: '#/components/schemas/MonitorUserTemplateTags' + template_variables: + $ref: '#/components/schemas/MonitorUserTemplateTemplateVariables' + title: + $ref: '#/components/schemas/MonitorUserTemplateTitle' + version: + $ref: '#/components/schemas/MonitorUserTemplateVersion' + versions: + description: All versions of the monitor user template. + items: + $ref: '#/components/schemas/SimpleMonitorUserTemplate' + type: array + type: object + MonitorUserTemplateCreateData: + description: Monitor user template data. + properties: + attributes: + $ref: '#/components/schemas/MonitorUserTemplateRequestAttributes' + type: + $ref: '#/components/schemas/MonitorUserTemplateResourceType' + required: + - type + - attributes + type: object + MonitorUserTemplateCreateRequest: + description: Request for creating a monitor user template. + properties: + data: + $ref: '#/components/schemas/MonitorUserTemplateCreateData' + required: + - data + type: object + MonitorUserTemplateCreateResponse: + description: Response for creating a monitor user template. + properties: + data: + $ref: '#/components/schemas/MonitorUserTemplateResponseData' + type: object + MonitorUserTemplateCreated: + description: The created timestamp of the template. + example: '2024-01-02T03:04:23.274966+00:00' + format: date-time + readOnly: true + type: string + MonitorUserTemplateDescription: + description: A brief description of the monitor user template. + example: This is a template for monitoring user activity. + nullable: true + type: string + MonitorUserTemplateId: + description: The unique identifier. + example: 00000000-0000-1234-0000-000000000000 + type: string + MonitorUserTemplateListResponse: + description: Response for retrieving all monitor user templates. + properties: + data: + description: An array of monitor user templates. + items: + $ref: '#/components/schemas/MonitorUserTemplateResponseData' + type: array + type: object + MonitorUserTemplateModified: + description: The last modified timestamp. When the template version was created. + example: '2024-02-02T03:04:23.274966+00:00' + format: date-time + readOnly: true + type: string + MonitorUserTemplateRequestAttributes: + additionalProperties: false + description: Attributes for a monitor user template. + properties: + description: + $ref: '#/components/schemas/MonitorUserTemplateDescription' + monitor_definition: + additionalProperties: {} + description: A valid monitor definition in the same format as the [V1 Monitor + API](https://docs.datadoghq.com/api/latest/monitors/#create-a-monitor). + example: + message: You may need to add web hosts if this is consistently high. + name: Bytes received on host0 + query: avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100 + type: query alert + type: object + tags: + $ref: '#/components/schemas/MonitorUserTemplateTags' + template_variables: + $ref: '#/components/schemas/MonitorUserTemplateTemplateVariables' + title: + $ref: '#/components/schemas/MonitorUserTemplateTitle' + required: + - title + - monitor_definition + - tags + type: object + MonitorUserTemplateResourceType: + default: monitor-user-template + description: Monitor user template resource type. + enum: + - monitor-user-template + example: monitor-user-template + type: string + x-enum-varnames: + - MONITOR_USER_TEMPLATE + MonitorUserTemplateResponse: + description: Response for retrieving a monitor user template. + properties: + data: + $ref: '#/components/schemas/MonitorUserTemplateResponseDataWithVersions' + type: object + MonitorUserTemplateResponseAttributes: + additionalProperties: {} + description: Attributes for a monitor user template. + properties: + created: + $ref: '#/components/schemas/MonitorUserTemplateCreated' + description: + $ref: '#/components/schemas/MonitorUserTemplateDescription' + modified: + $ref: '#/components/schemas/MonitorUserTemplateModified' + monitor_definition: + additionalProperties: {} + description: A valid monitor definition in the same format as the [V1 Monitor + API](https://docs.datadoghq.com/api/latest/monitors/#create-a-monitor). + example: + message: You may need to add web hosts if this is consistently high. + name: Bytes received on host0 + query: avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100 + type: query alert + type: object + tags: + $ref: '#/components/schemas/MonitorUserTemplateTags' + template_variables: + $ref: '#/components/schemas/MonitorUserTemplateTemplateVariables' + title: + $ref: '#/components/schemas/MonitorUserTemplateTitle' + version: + $ref: '#/components/schemas/MonitorUserTemplateVersion' + type: object + MonitorUserTemplateResponseData: + description: Monitor user template list response data. + properties: + attributes: + $ref: '#/components/schemas/MonitorUserTemplateResponseAttributes' + id: + $ref: '#/components/schemas/MonitorUserTemplateId' + type: + $ref: '#/components/schemas/MonitorUserTemplateResourceType' + type: object + MonitorUserTemplateResponseDataWithVersions: + description: Monitor user template data. + properties: + attributes: + $ref: '#/components/schemas/MonitorUserTemplate' + id: + $ref: '#/components/schemas/MonitorUserTemplateId' + type: + $ref: '#/components/schemas/MonitorUserTemplateResourceType' + type: object + MonitorUserTemplateTags: + description: The definition of `MonitorUserTemplateTags` object. + example: + - product:Our Custom App + - integration:Azure + items: + description: 'Tags associated with the monitor user template. Must be key + value. Only ''product'' and ''integration'' keys are + + allowed. The value is the name of the category to display the template under. + Integrations can be filtered out in the UI. + + (Review note: This modeling of ''categories'' is subject to change.)' + example: us-east1 + minLength: 1 + type: string + uniqueItems: true + type: array + MonitorUserTemplateTemplateVariables: + description: The definition of `MonitorUserTemplateTemplateVariables` object. + items: + $ref: '#/components/schemas/MonitorUserTemplateTemplateVariablesItems' + type: array + MonitorUserTemplateTemplateVariablesItems: + additionalProperties: false + description: List of objects representing template variables on the monitor + which can have selectable values. + properties: + available_values: + description: Available values for the variable. + example: + - value1 + - value2 + items: + minLength: 1 + type: string + uniqueItems: true + type: array + defaults: + description: Default values of the template variable. + example: + - defaultValue + items: + minLength: 0 + type: string + uniqueItems: true + type: array + name: + description: The name of the template variable. + example: regionName + type: string + tag_key: + description: The tag key associated with the variable. This works the same + as dashboard template variables. + example: datacenter + type: string + required: + - name + type: object + MonitorUserTemplateTitle: + description: The title of the monitor user template. + example: Postgres CPU Monitor + type: string + MonitorUserTemplateUpdateData: + description: Monitor user template data. + properties: + attributes: + $ref: '#/components/schemas/MonitorUserTemplateRequestAttributes' + id: + $ref: '#/components/schemas/MonitorUserTemplateId' + type: + $ref: '#/components/schemas/MonitorUserTemplateResourceType' + required: + - id + - type + - attributes + type: object + MonitorUserTemplateUpdateRequest: + description: Request for creating a new monitor user template version. + properties: + data: + $ref: '#/components/schemas/MonitorUserTemplateUpdateData' + required: + - data + type: object + MonitorUserTemplateVersion: + description: The version of the monitor user template. + example: 0 + format: int64 + nullable: true + readOnly: true + type: integer MonthlyCostAttributionAttributes: description: Cost Attribution by Tag for a given organization. properties: @@ -36839,6 +37111,37 @@ components: description: The definition of `ShiftIncluded` object. oneOf: - $ref: '#/components/schemas/ScheduleUser' + SimpleMonitorUserTemplate: + description: A simplified version of a monitor user template. + properties: + created: + $ref: '#/components/schemas/MonitorUserTemplateCreated' + description: + $ref: '#/components/schemas/MonitorUserTemplateDescription' + id: + description: The unique identifier. The initial version will match the template + ID. + example: 00000000-0000-1234-0000-000000000000 + type: string + monitor_definition: + additionalProperties: {} + description: A valid monitor definition in the same format as the [V1 Monitor + API](https://docs.datadoghq.com/api/latest/monitors/#create-a-monitor). + example: + message: You may need to add web hosts if this is consistently high. + name: Bytes received on host0 + query: avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100 + type: query alert + type: object + tags: + $ref: '#/components/schemas/MonitorUserTemplateTags' + template_variables: + $ref: '#/components/schemas/MonitorUserTemplateTemplateVariables' + title: + $ref: '#/components/schemas/MonitorUserTemplateTitle' + version: + $ref: '#/components/schemas/MonitorUserTemplateVersion' + type: object SingleAggregatedConnectionResponseArray: description: List of aggregated connections. example: @@ -52384,6 +52687,270 @@ paths: operator: OR permissions: - monitor_config_policy_write + /api/v2/monitor/template: + get: + description: Retrieve all monitor user templates. + operationId: ListMonitorUserTemplates + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorUserTemplateListResponse' + description: OK + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_read + summary: Get all monitor user templates + tags: + - Monitors + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create a new monitor user template. + operationId: CreateMonitorUserTemplate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorUserTemplateCreateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorUserTemplateCreateResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitor_config_policy_write + summary: Create a monitor user template + tags: + - Monitors + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/monitor/template/validate: + post: + description: Validate the structure and content of a monitor user template. + operationId: ValidateMonitorUserTemplate + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorUserTemplateCreateRequest' + required: true + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitor_config_policy_write + summary: Validate a monitor user template + tags: + - Monitors + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/monitor/template/{template_id}: + delete: + description: Delete an existing monitor user template by its ID. + operationId: DeleteMonitorUserTemplate + parameters: + - description: ID of the monitor user template. + in: path + name: template_id + required: true + schema: + type: string + responses: + '204': + description: OK + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitor_config_policy_write + summary: Delete a monitor user template + tags: + - Monitors + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Retrieve a monitor user template by its ID. + operationId: GetMonitorUserTemplate + parameters: + - description: ID of the monitor user template. + in: path + name: template_id + required: true + schema: + example: 00000000-0000-1234-0000-000000000000 + type: string + - description: Whether to include all versions of the template in the response + in the versions field. + example: false + in: query + name: with_all_versions + required: false + schema: + type: boolean + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorUserTemplateResponse' + description: OK + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_read + summary: Get a monitor user template + tags: + - Monitors + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' + put: + description: Creates a new version of an existing monitor user template. + operationId: UpdateMonitorUserTemplate + parameters: + - description: ID of the monitor user template. + in: path + name: template_id + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorUserTemplateUpdateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorUserTemplateResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitor_config_policy_write + summary: Update a monitor user template to a new version + tags: + - Monitors + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/monitor/template/{template_id}/validate: + post: + description: Validate the structure and content of an existing monitor user + template being updated to a new version. + operationId: ValidateExistingMonitorUserTemplate + parameters: + - description: ID of the monitor user template. + in: path + name: template_id + required: true + schema: + example: 00000000-0000-1234-0000-000000000000 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MonitorUserTemplateUpdateRequest' + required: true + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitor_config_policy_write + summary: Validate an existing monitor user template + tags: + - Monitors + x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, + + contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/monitor/{monitor_id}/downtime_matches: get: description: Get all active downtimes for the specified monitor. diff --git a/examples/v2/monitors/CreateMonitorUserTemplate.java b/examples/v2/monitors/CreateMonitorUserTemplate.java new file mode 100644 index 00000000000..065b18bff4d --- /dev/null +++ b/examples/v2/monitors/CreateMonitorUserTemplate.java @@ -0,0 +1,59 @@ +// Create a monitor user template returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MonitorsApi; +import com.datadog.api.client.v2.model.MonitorUserTemplateCreateData; +import com.datadog.api.client.v2.model.MonitorUserTemplateCreateRequest; +import com.datadog.api.client.v2.model.MonitorUserTemplateCreateResponse; +import com.datadog.api.client.v2.model.MonitorUserTemplateRequestAttributes; +import com.datadog.api.client.v2.model.MonitorUserTemplateResourceType; +import com.datadog.api.client.v2.model.MonitorUserTemplateTemplateVariablesItems; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.createMonitorUserTemplate", true); + MonitorsApi apiInstance = new MonitorsApi(defaultClient); + + MonitorUserTemplateCreateRequest body = + new MonitorUserTemplateCreateRequest() + .data( + new MonitorUserTemplateCreateData() + .attributes( + new MonitorUserTemplateRequestAttributes() + .description("A description.") + .monitorDefinition( + Map.ofEntries( + Map.entry("message", "A msg."), + Map.entry("name", "A name example-monitor"), + Map.entry( + "query", + "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100"), + Map.entry("type", "query alert"))) + .tags(Collections.singletonList("integration:Azure")) + .templateVariables( + Collections.singletonList( + new MonitorUserTemplateTemplateVariablesItems() + .availableValues(Arrays.asList("value1", "value2")) + .defaults(Collections.singletonList("defaultValue")) + .name("regionName") + .tagKey("datacenter"))) + .title("Postgres DB example-monitor")) + .type(MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE)); + + try { + MonitorUserTemplateCreateResponse result = apiInstance.createMonitorUserTemplate(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MonitorsApi#createMonitorUserTemplate"); + 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/monitors/DeleteMonitorUserTemplate.java b/examples/v2/monitors/DeleteMonitorUserTemplate.java new file mode 100644 index 00000000000..5845b90d18c --- /dev/null +++ b/examples/v2/monitors/DeleteMonitorUserTemplate.java @@ -0,0 +1,23 @@ +// Delete a monitor user template returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MonitorsApi; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.deleteMonitorUserTemplate", true); + MonitorsApi apiInstance = new MonitorsApi(defaultClient); + + try { + apiInstance.deleteMonitorUserTemplate("template_id"); + } catch (ApiException e) { + System.err.println("Exception when calling MonitorsApi#deleteMonitorUserTemplate"); + 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/monitors/GetMonitorUserTemplate.java b/examples/v2/monitors/GetMonitorUserTemplate.java new file mode 100644 index 00000000000..2e4749d2084 --- /dev/null +++ b/examples/v2/monitors/GetMonitorUserTemplate.java @@ -0,0 +1,29 @@ +// Get a monitor user template returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MonitorsApi; +import com.datadog.api.client.v2.model.MonitorUserTemplateResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.getMonitorUserTemplate", true); + MonitorsApi apiInstance = new MonitorsApi(defaultClient); + + // there is a valid "monitor_user_template" in the system + String MONITOR_USER_TEMPLATE_DATA_ID = System.getenv("MONITOR_USER_TEMPLATE_DATA_ID"); + + try { + MonitorUserTemplateResponse result = + apiInstance.getMonitorUserTemplate(MONITOR_USER_TEMPLATE_DATA_ID); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MonitorsApi#getMonitorUserTemplate"); + 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/monitors/ListMonitorUserTemplates.java b/examples/v2/monitors/ListMonitorUserTemplates.java new file mode 100644 index 00000000000..ecb50b68de1 --- /dev/null +++ b/examples/v2/monitors/ListMonitorUserTemplates.java @@ -0,0 +1,25 @@ +// Get all monitor user templates returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MonitorsApi; +import com.datadog.api.client.v2.model.MonitorUserTemplateListResponse; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.listMonitorUserTemplates", true); + MonitorsApi apiInstance = new MonitorsApi(defaultClient); + + try { + MonitorUserTemplateListResponse result = apiInstance.listMonitorUserTemplates(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MonitorsApi#listMonitorUserTemplates"); + 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/monitors/UpdateMonitorUserTemplate.java b/examples/v2/monitors/UpdateMonitorUserTemplate.java new file mode 100644 index 00000000000..8b2888fb3b6 --- /dev/null +++ b/examples/v2/monitors/UpdateMonitorUserTemplate.java @@ -0,0 +1,64 @@ +// Update a monitor user template to a new version returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MonitorsApi; +import com.datadog.api.client.v2.model.MonitorUserTemplateRequestAttributes; +import com.datadog.api.client.v2.model.MonitorUserTemplateResourceType; +import com.datadog.api.client.v2.model.MonitorUserTemplateResponse; +import com.datadog.api.client.v2.model.MonitorUserTemplateTemplateVariablesItems; +import com.datadog.api.client.v2.model.MonitorUserTemplateUpdateData; +import com.datadog.api.client.v2.model.MonitorUserTemplateUpdateRequest; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.updateMonitorUserTemplate", true); + MonitorsApi apiInstance = new MonitorsApi(defaultClient); + + // there is a valid "monitor_user_template" in the system + String MONITOR_USER_TEMPLATE_DATA_ID = System.getenv("MONITOR_USER_TEMPLATE_DATA_ID"); + + MonitorUserTemplateUpdateRequest body = + new MonitorUserTemplateUpdateRequest() + .data( + new MonitorUserTemplateUpdateData() + .attributes( + new MonitorUserTemplateRequestAttributes() + .description("A description.") + .monitorDefinition( + Map.ofEntries( + Map.entry("message", "A msg."), + Map.entry("name", "A name example-monitor"), + Map.entry( + "query", + "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100"), + Map.entry("type", "query alert"))) + .tags(Collections.singletonList("integration:Azure")) + .templateVariables( + Collections.singletonList( + new MonitorUserTemplateTemplateVariablesItems() + .availableValues(Arrays.asList("value1", "value2")) + .defaults(Collections.singletonList("defaultValue")) + .name("regionName") + .tagKey("datacenter"))) + .title("Postgres DB example-monitor")) + .id(MONITOR_USER_TEMPLATE_DATA_ID) + .type(MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE)); + + try { + MonitorUserTemplateResponse result = + apiInstance.updateMonitorUserTemplate(MONITOR_USER_TEMPLATE_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling MonitorsApi#updateMonitorUserTemplate"); + 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/monitors/ValidateExistingMonitorUserTemplate.java b/examples/v2/monitors/ValidateExistingMonitorUserTemplate.java new file mode 100644 index 00000000000..b7fd183372c --- /dev/null +++ b/examples/v2/monitors/ValidateExistingMonitorUserTemplate.java @@ -0,0 +1,61 @@ +// Validate an existing monitor user template returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MonitorsApi; +import com.datadog.api.client.v2.model.MonitorUserTemplateRequestAttributes; +import com.datadog.api.client.v2.model.MonitorUserTemplateResourceType; +import com.datadog.api.client.v2.model.MonitorUserTemplateTemplateVariablesItems; +import com.datadog.api.client.v2.model.MonitorUserTemplateUpdateData; +import com.datadog.api.client.v2.model.MonitorUserTemplateUpdateRequest; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.validateExistingMonitorUserTemplate", true); + MonitorsApi apiInstance = new MonitorsApi(defaultClient); + + // there is a valid "monitor_user_template" in the system + String MONITOR_USER_TEMPLATE_DATA_ID = System.getenv("MONITOR_USER_TEMPLATE_DATA_ID"); + + MonitorUserTemplateUpdateRequest body = + new MonitorUserTemplateUpdateRequest() + .data( + new MonitorUserTemplateUpdateData() + .attributes( + new MonitorUserTemplateRequestAttributes() + .description("A description.") + .monitorDefinition( + Map.ofEntries( + Map.entry("message", "A msg."), + Map.entry("name", "A name example-monitor"), + Map.entry( + "query", + "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100"), + Map.entry("type", "query alert"))) + .tags(Collections.singletonList("integration:Azure")) + .templateVariables( + Collections.singletonList( + new MonitorUserTemplateTemplateVariablesItems() + .availableValues(Arrays.asList("value1", "value2")) + .defaults(Collections.singletonList("defaultValue")) + .name("regionName") + .tagKey("datacenter"))) + .title("Postgres DB example-monitor")) + .id(MONITOR_USER_TEMPLATE_DATA_ID) + .type(MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE)); + + try { + apiInstance.validateExistingMonitorUserTemplate(MONITOR_USER_TEMPLATE_DATA_ID, body); + } catch (ApiException e) { + System.err.println("Exception when calling MonitorsApi#validateExistingMonitorUserTemplate"); + 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/monitors/ValidateMonitorUserTemplate.java b/examples/v2/monitors/ValidateMonitorUserTemplate.java new file mode 100644 index 00000000000..4c6692b1868 --- /dev/null +++ b/examples/v2/monitors/ValidateMonitorUserTemplate.java @@ -0,0 +1,57 @@ +// Validate a monitor user template returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.MonitorsApi; +import com.datadog.api.client.v2.model.MonitorUserTemplateCreateData; +import com.datadog.api.client.v2.model.MonitorUserTemplateCreateRequest; +import com.datadog.api.client.v2.model.MonitorUserTemplateRequestAttributes; +import com.datadog.api.client.v2.model.MonitorUserTemplateResourceType; +import com.datadog.api.client.v2.model.MonitorUserTemplateTemplateVariablesItems; +import java.util.Arrays; +import java.util.Collections; +import java.util.Map; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + defaultClient.setUnstableOperationEnabled("v2.validateMonitorUserTemplate", true); + MonitorsApi apiInstance = new MonitorsApi(defaultClient); + + MonitorUserTemplateCreateRequest body = + new MonitorUserTemplateCreateRequest() + .data( + new MonitorUserTemplateCreateData() + .attributes( + new MonitorUserTemplateRequestAttributes() + .description("A description.") + .monitorDefinition( + Map.ofEntries( + Map.entry("message", "A msg."), + Map.entry("name", "A name example-monitor"), + Map.entry( + "query", + "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100"), + Map.entry("type", "query alert"))) + .tags(Collections.singletonList("integration:Azure")) + .templateVariables( + Collections.singletonList( + new MonitorUserTemplateTemplateVariablesItems() + .availableValues(Arrays.asList("value1", "value2")) + .defaults(Collections.singletonList("defaultValue")) + .name("regionName") + .tagKey("datacenter"))) + .title("Postgres DB example-monitor")) + .type(MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE)); + + try { + apiInstance.validateMonitorUserTemplate(body); + } catch (ApiException e) { + System.err.println("Exception when calling MonitorsApi#validateMonitorUserTemplate"); + 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 d661a282821..52044a525b3 100644 --- a/src/main/java/com/datadog/api/client/ApiClient.java +++ b/src/main/java/com/datadog/api/client/ApiClient.java @@ -668,10 +668,17 @@ public class ApiClient { put("v2.updateAWSAccount", false); put("v2.listAWSLogsServices", false); put("v2.createMonitorNotificationRule", false); + put("v2.createMonitorUserTemplate", false); put("v2.deleteMonitorNotificationRule", false); + put("v2.deleteMonitorUserTemplate", false); put("v2.getMonitorNotificationRule", false); put("v2.getMonitorNotificationRules", false); + put("v2.getMonitorUserTemplate", false); + put("v2.listMonitorUserTemplates", false); put("v2.updateMonitorNotificationRule", false); + put("v2.updateMonitorUserTemplate", false); + put("v2.validateExistingMonitorUserTemplate", false); + put("v2.validateMonitorUserTemplate", false); put("v2.getAggregatedConnections", false); put("v2.createPipeline", false); put("v2.deletePipeline", false); diff --git a/src/main/java/com/datadog/api/client/v2/api/MonitorsApi.java b/src/main/java/com/datadog/api/client/v2/api/MonitorsApi.java index 4ff4400c6af..8af39950331 100644 --- a/src/main/java/com/datadog/api/client/v2/api/MonitorsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/MonitorsApi.java @@ -12,6 +12,11 @@ import com.datadog.api.client.v2.model.MonitorNotificationRuleListResponse; import com.datadog.api.client.v2.model.MonitorNotificationRuleResponse; import com.datadog.api.client.v2.model.MonitorNotificationRuleUpdateRequest; +import com.datadog.api.client.v2.model.MonitorUserTemplateCreateRequest; +import com.datadog.api.client.v2.model.MonitorUserTemplateCreateResponse; +import com.datadog.api.client.v2.model.MonitorUserTemplateListResponse; +import com.datadog.api.client.v2.model.MonitorUserTemplateResponse; +import com.datadog.api.client.v2.model.MonitorUserTemplateUpdateRequest; import jakarta.ws.rs.client.Invocation; import jakarta.ws.rs.core.GenericType; import java.util.ArrayList; @@ -340,6 +345,158 @@ public ApiResponse createMonitorNotificationRul new GenericType() {}); } + /** + * Create a monitor user template. + * + *

See {@link #createMonitorUserTemplateWithHttpInfo}. + * + * @param body (required) + * @return MonitorUserTemplateCreateResponse + * @throws ApiException if fails to make API call + */ + public MonitorUserTemplateCreateResponse createMonitorUserTemplate( + MonitorUserTemplateCreateRequest body) throws ApiException { + return createMonitorUserTemplateWithHttpInfo(body).getData(); + } + + /** + * Create a monitor user template. + * + *

See {@link #createMonitorUserTemplateWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<MonitorUserTemplateCreateResponse> + */ + public CompletableFuture createMonitorUserTemplateAsync( + MonitorUserTemplateCreateRequest body) { + return createMonitorUserTemplateWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Create a new monitor user template. + * + * @param body (required) + * @return ApiResponse<MonitorUserTemplateCreateResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
429 Too many requests -
+ */ + public ApiResponse createMonitorUserTemplateWithHttpInfo( + MonitorUserTemplateCreateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "createMonitorUserTemplate"; + 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 createMonitorUserTemplate"); + } + // create path and map variables + String localVarPath = "/api/v2/monitor/template"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.MonitorsApi.createMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a monitor user template. + * + *

See {@link #createMonitorUserTemplateWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<MonitorUserTemplateCreateResponse>> + */ + public CompletableFuture> + createMonitorUserTemplateWithHttpInfoAsync(MonitorUserTemplateCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "createMonitorUserTemplate"; + 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 createMonitorUserTemplate")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/monitor/template"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.MonitorsApi.createMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + /** * Delete a monitor configuration policy. * @@ -630,6 +787,161 @@ public CompletableFuture> deleteMonitorNotificationRuleWithHtt null); } + /** + * Delete a monitor user template. + * + *

See {@link #deleteMonitorUserTemplateWithHttpInfo}. + * + * @param templateId ID of the monitor user template. (required) + * @throws ApiException if fails to make API call + */ + public void deleteMonitorUserTemplate(String templateId) throws ApiException { + deleteMonitorUserTemplateWithHttpInfo(templateId); + } + + /** + * Delete a monitor user template. + * + *

See {@link #deleteMonitorUserTemplateWithHttpInfoAsync}. + * + * @param templateId ID of the monitor user template. (required) + * @return CompletableFuture + */ + public CompletableFuture deleteMonitorUserTemplateAsync(String templateId) { + return deleteMonitorUserTemplateWithHttpInfoAsync(templateId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Delete an existing monitor user template by its ID. + * + * @param templateId ID of the monitor user template. (required) + * @return ApiResponse<Void> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
204 OK -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse deleteMonitorUserTemplateWithHttpInfo(String templateId) + throws ApiException { + // Check if unstable operation is enabled + String operationId = "deleteMonitorUserTemplate"; + 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 'templateId' is set + if (templateId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'templateId' when calling deleteMonitorUserTemplate"); + } + // create path and map variables + String localVarPath = + "/api/v2/monitor/template/{template_id}" + .replaceAll( + "\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.MonitorsApi.deleteMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "DELETE", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Delete a monitor user template. + * + *

See {@link #deleteMonitorUserTemplateWithHttpInfo}. + * + * @param templateId ID of the monitor user template. (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> deleteMonitorUserTemplateWithHttpInfoAsync( + String templateId) { + // Check if unstable operation is enabled + String operationId = "deleteMonitorUserTemplate"; + 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 'templateId' is set + if (templateId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'templateId' when calling" + + " deleteMonitorUserTemplate")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/monitor/template/{template_id}" + .replaceAll( + "\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.MonitorsApi.deleteMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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); + } + /** * Get a monitor configuration policy. * @@ -1183,27 +1495,50 @@ public ApiResponse getMonitorNotificationRu new GenericType() {}); } + /** Manage optional parameters to getMonitorUserTemplate. */ + public static class GetMonitorUserTemplateOptionalParameters { + private Boolean withAllVersions; + + /** + * Set withAllVersions. + * + * @param withAllVersions Whether to include all versions of the template in the response in the + * versions field. (optional) + * @return GetMonitorUserTemplateOptionalParameters + */ + public GetMonitorUserTemplateOptionalParameters withAllVersions(Boolean withAllVersions) { + this.withAllVersions = withAllVersions; + return this; + } + } + /** - * Get all monitor configuration policies. + * Get a monitor user template. * - *

See {@link #listMonitorConfigPoliciesWithHttpInfo}. + *

See {@link #getMonitorUserTemplateWithHttpInfo}. * - * @return MonitorConfigPolicyListResponse + * @param templateId ID of the monitor user template. (required) + * @return MonitorUserTemplateResponse * @throws ApiException if fails to make API call */ - public MonitorConfigPolicyListResponse listMonitorConfigPolicies() throws ApiException { - return listMonitorConfigPoliciesWithHttpInfo().getData(); + public MonitorUserTemplateResponse getMonitorUserTemplate(String templateId) throws ApiException { + return getMonitorUserTemplateWithHttpInfo( + templateId, new GetMonitorUserTemplateOptionalParameters()) + .getData(); } /** - * Get all monitor configuration policies. + * Get a monitor user template. * - *

See {@link #listMonitorConfigPoliciesWithHttpInfoAsync}. + *

See {@link #getMonitorUserTemplateWithHttpInfoAsync}. * - * @return CompletableFuture<MonitorConfigPolicyListResponse> + * @param templateId ID of the monitor user template. (required) + * @return CompletableFuture<MonitorUserTemplateResponse> */ - public CompletableFuture listMonitorConfigPoliciesAsync() { - return listMonitorConfigPoliciesWithHttpInfoAsync() + public CompletableFuture getMonitorUserTemplateAsync( + String templateId) { + return getMonitorUserTemplateWithHttpInfoAsync( + templateId, new GetMonitorUserTemplateOptionalParameters()) .thenApply( response -> { return response.getData(); @@ -1211,10 +1546,211 @@ public CompletableFuture listMonitorConfigPolic } /** - * Get all monitor configuration policies. + * Get a monitor user template. * - * @return ApiResponse<MonitorConfigPolicyListResponse> - * @throws ApiException if fails to make API call + *

See {@link #getMonitorUserTemplateWithHttpInfo}. + * + * @param templateId ID of the monitor user template. (required) + * @param parameters Optional parameters for the request. + * @return MonitorUserTemplateResponse + * @throws ApiException if fails to make API call + */ + public MonitorUserTemplateResponse getMonitorUserTemplate( + String templateId, GetMonitorUserTemplateOptionalParameters parameters) throws ApiException { + return getMonitorUserTemplateWithHttpInfo(templateId, parameters).getData(); + } + + /** + * Get a monitor user template. + * + *

See {@link #getMonitorUserTemplateWithHttpInfoAsync}. + * + * @param templateId ID of the monitor user template. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<MonitorUserTemplateResponse> + */ + public CompletableFuture getMonitorUserTemplateAsync( + String templateId, GetMonitorUserTemplateOptionalParameters parameters) { + return getMonitorUserTemplateWithHttpInfoAsync(templateId, parameters) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve a monitor user template by its ID. + * + * @param templateId ID of the monitor user template. (required) + * @param parameters Optional parameters for the request. + * @return ApiResponse<MonitorUserTemplateResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse getMonitorUserTemplateWithHttpInfo( + String templateId, GetMonitorUserTemplateOptionalParameters parameters) throws ApiException { + // Check if unstable operation is enabled + String operationId = "getMonitorUserTemplate"; + 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 'templateId' is set + if (templateId == null) { + throw new ApiException( + 400, "Missing the required parameter 'templateId' when calling getMonitorUserTemplate"); + } + Boolean withAllVersions = parameters.withAllVersions; + // create path and map variables + String localVarPath = + "/api/v2/monitor/template/{template_id}" + .replaceAll( + "\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "with_all_versions", withAllVersions)); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.MonitorsApi.getMonitorUserTemplate", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get a monitor user template. + * + *

See {@link #getMonitorUserTemplateWithHttpInfo}. + * + * @param templateId ID of the monitor user template. (required) + * @param parameters Optional parameters for the request. + * @return CompletableFuture<ApiResponse<MonitorUserTemplateResponse>> + */ + public CompletableFuture> + getMonitorUserTemplateWithHttpInfoAsync( + String templateId, GetMonitorUserTemplateOptionalParameters parameters) { + // Check if unstable operation is enabled + String operationId = "getMonitorUserTemplate"; + 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 'templateId' is set + if (templateId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'templateId' when calling getMonitorUserTemplate")); + return result; + } + Boolean withAllVersions = parameters.withAllVersions; + // create path and map variables + String localVarPath = + "/api/v2/monitor/template/{template_id}" + .replaceAll( + "\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); + + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + + localVarQueryParams.addAll( + apiClient.parameterToPairs("", "with_all_versions", withAllVersions)); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.MonitorsApi.getMonitorUserTemplate", + localVarPath, + localVarQueryParams, + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + + /** + * Get all monitor configuration policies. + * + *

See {@link #listMonitorConfigPoliciesWithHttpInfo}. + * + * @return MonitorConfigPolicyListResponse + * @throws ApiException if fails to make API call + */ + public MonitorConfigPolicyListResponse listMonitorConfigPolicies() throws ApiException { + return listMonitorConfigPoliciesWithHttpInfo().getData(); + } + + /** + * Get all monitor configuration policies. + * + *

See {@link #listMonitorConfigPoliciesWithHttpInfoAsync}. + * + * @return CompletableFuture<MonitorConfigPolicyListResponse> + */ + public CompletableFuture listMonitorConfigPoliciesAsync() { + return listMonitorConfigPoliciesWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Get all monitor configuration policies. + * + * @return ApiResponse<MonitorConfigPolicyListResponse> + * @throws ApiException if fails to make API call * @http.response.details * * @@ -1295,6 +1831,135 @@ public ApiResponse listMonitorConfigPoliciesWit new GenericType() {}); } + /** + * Get all monitor user templates. + * + *

See {@link #listMonitorUserTemplatesWithHttpInfo}. + * + * @return MonitorUserTemplateListResponse + * @throws ApiException if fails to make API call + */ + public MonitorUserTemplateListResponse listMonitorUserTemplates() throws ApiException { + return listMonitorUserTemplatesWithHttpInfo().getData(); + } + + /** + * Get all monitor user templates. + * + *

See {@link #listMonitorUserTemplatesWithHttpInfoAsync}. + * + * @return CompletableFuture<MonitorUserTemplateListResponse> + */ + public CompletableFuture listMonitorUserTemplatesAsync() { + return listMonitorUserTemplatesWithHttpInfoAsync() + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Retrieve all monitor user templates. + * + * @return ApiResponse<MonitorUserTemplateListResponse> + * @throws ApiException if fails to make API call + * @http.response.details + *

Response details
+ * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
429 Too many requests -
+ */ + public ApiResponse listMonitorUserTemplatesWithHttpInfo() + throws ApiException { + // Check if unstable operation is enabled + String operationId = "listMonitorUserTemplates"; + 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; + // create path and map variables + String localVarPath = "/api/v2/monitor/template"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.MonitorsApi.listMonitorUserTemplates", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "GET", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Get all monitor user templates. + * + *

See {@link #listMonitorUserTemplatesWithHttpInfo}. + * + * @return CompletableFuture<ApiResponse<MonitorUserTemplateListResponse>> + */ + public CompletableFuture> + listMonitorUserTemplatesWithHttpInfoAsync() { + // Check if unstable operation is enabled + String operationId = "listMonitorUserTemplates"; + 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; + // create path and map variables + String localVarPath = "/api/v2/monitor/template"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.MonitorsApi.listMonitorUserTemplates", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + /** * Edit a monitor configuration policy. * @@ -1639,4 +2304,518 @@ public ApiResponse updateMonitorNotificationRul false, new GenericType() {}); } + + /** + * Update a monitor user template to a new version. + * + *

See {@link #updateMonitorUserTemplateWithHttpInfo}. + * + * @param templateId ID of the monitor user template. (required) + * @param body (required) + * @return MonitorUserTemplateResponse + * @throws ApiException if fails to make API call + */ + public MonitorUserTemplateResponse updateMonitorUserTemplate( + String templateId, MonitorUserTemplateUpdateRequest body) throws ApiException { + return updateMonitorUserTemplateWithHttpInfo(templateId, body).getData(); + } + + /** + * Update a monitor user template to a new version. + * + *

See {@link #updateMonitorUserTemplateWithHttpInfoAsync}. + * + * @param templateId ID of the monitor user template. (required) + * @param body (required) + * @return CompletableFuture<MonitorUserTemplateResponse> + */ + public CompletableFuture updateMonitorUserTemplateAsync( + String templateId, MonitorUserTemplateUpdateRequest body) { + return updateMonitorUserTemplateWithHttpInfoAsync(templateId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Creates a new version of an existing monitor user template. + * + * @param templateId ID of the monitor user template. (required) + * @param body (required) + * @return ApiResponse<MonitorUserTemplateResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse updateMonitorUserTemplateWithHttpInfo( + String templateId, MonitorUserTemplateUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "updateMonitorUserTemplate"; + 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 'templateId' is set + if (templateId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'templateId' when calling updateMonitorUserTemplate"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling updateMonitorUserTemplate"); + } + // create path and map variables + String localVarPath = + "/api/v2/monitor/template/{template_id}" + .replaceAll( + "\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.MonitorsApi.updateMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a monitor user template to a new version. + * + *

See {@link #updateMonitorUserTemplateWithHttpInfo}. + * + * @param templateId ID of the monitor user template. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<MonitorUserTemplateResponse>> + */ + public CompletableFuture> + updateMonitorUserTemplateWithHttpInfoAsync( + String templateId, MonitorUserTemplateUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "updateMonitorUserTemplate"; + 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 'templateId' is set + if (templateId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'templateId' when calling" + + " updateMonitorUserTemplate")); + 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 updateMonitorUserTemplate")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/monitor/template/{template_id}" + .replaceAll( + "\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.MonitorsApi.updateMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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() {}); + } + + /** + * Validate an existing monitor user template. + * + *

See {@link #validateExistingMonitorUserTemplateWithHttpInfo}. + * + * @param templateId ID of the monitor user template. (required) + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void validateExistingMonitorUserTemplate( + String templateId, MonitorUserTemplateUpdateRequest body) throws ApiException { + validateExistingMonitorUserTemplateWithHttpInfo(templateId, body); + } + + /** + * Validate an existing monitor user template. + * + *

See {@link #validateExistingMonitorUserTemplateWithHttpInfoAsync}. + * + * @param templateId ID of the monitor user template. (required) + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture validateExistingMonitorUserTemplateAsync( + String templateId, MonitorUserTemplateUpdateRequest body) { + return validateExistingMonitorUserTemplateWithHttpInfoAsync(templateId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Validate the structure and content of an existing monitor user template being updated to a new + * version. + * + * @param templateId ID of the monitor user template. (required) + * @param body (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 -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse validateExistingMonitorUserTemplateWithHttpInfo( + String templateId, MonitorUserTemplateUpdateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "validateExistingMonitorUserTemplate"; + 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 'templateId' is set + if (templateId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'templateId' when calling" + + " validateExistingMonitorUserTemplate"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling validateExistingMonitorUserTemplate"); + } + // create path and map variables + String localVarPath = + "/api/v2/monitor/template/{template_id}/validate" + .replaceAll( + "\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.MonitorsApi.validateExistingMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Validate an existing monitor user template. + * + *

See {@link #validateExistingMonitorUserTemplateWithHttpInfo}. + * + * @param templateId ID of the monitor user template. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> validateExistingMonitorUserTemplateWithHttpInfoAsync( + String templateId, MonitorUserTemplateUpdateRequest body) { + // Check if unstable operation is enabled + String operationId = "validateExistingMonitorUserTemplate"; + 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 'templateId' is set + if (templateId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'templateId' when calling" + + " validateExistingMonitorUserTemplate")); + 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" + + " validateExistingMonitorUserTemplate")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/monitor/template/{template_id}/validate" + .replaceAll( + "\\{" + "template_id" + "\\}", apiClient.escapeString(templateId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.MonitorsApi.validateExistingMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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, + null); + } + + /** + * Validate a monitor user template. + * + *

See {@link #validateMonitorUserTemplateWithHttpInfo}. + * + * @param body (required) + * @throws ApiException if fails to make API call + */ + public void validateMonitorUserTemplate(MonitorUserTemplateCreateRequest body) + throws ApiException { + validateMonitorUserTemplateWithHttpInfo(body); + } + + /** + * Validate a monitor user template. + * + *

See {@link #validateMonitorUserTemplateWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture + */ + public CompletableFuture validateMonitorUserTemplateAsync( + MonitorUserTemplateCreateRequest body) { + return validateMonitorUserTemplateWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Validate the structure and content of a monitor user template. + * + * @param body (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 -
429 Too many requests -
+ */ + public ApiResponse validateMonitorUserTemplateWithHttpInfo( + MonitorUserTemplateCreateRequest body) throws ApiException { + // Check if unstable operation is enabled + String operationId = "validateMonitorUserTemplate"; + 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 validateMonitorUserTemplate"); + } + // create path and map variables + String localVarPath = "/api/v2/monitor/template/validate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.MonitorsApi.validateMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + null); + } + + /** + * Validate a monitor user template. + * + *

See {@link #validateMonitorUserTemplateWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<Void>> + */ + public CompletableFuture> validateMonitorUserTemplateWithHttpInfoAsync( + MonitorUserTemplateCreateRequest body) { + // Check if unstable operation is enabled + String operationId = "validateMonitorUserTemplate"; + 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 validateMonitorUserTemplate")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/monitor/template/validate"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.MonitorsApi.validateMonitorUserTemplate", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"*/*"}, + new String[] {"AuthZ", "apiKeyAuth", "appKeyAuth"}); + } 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, + null); + } } diff --git a/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplate.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplate.java new file mode 100644 index 00000000000..99f31c8d11c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplate.java @@ -0,0 +1,408 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A monitor user template object. */ +@JsonPropertyOrder({ + MonitorUserTemplate.JSON_PROPERTY_CREATED, + MonitorUserTemplate.JSON_PROPERTY_DESCRIPTION, + MonitorUserTemplate.JSON_PROPERTY_MODIFIED, + MonitorUserTemplate.JSON_PROPERTY_MONITOR_DEFINITION, + MonitorUserTemplate.JSON_PROPERTY_TAGS, + MonitorUserTemplate.JSON_PROPERTY_TEMPLATE_VARIABLES, + MonitorUserTemplate.JSON_PROPERTY_TITLE, + MonitorUserTemplate.JSON_PROPERTY_VERSION, + MonitorUserTemplate.JSON_PROPERTY_VERSIONS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED = "created"; + private OffsetDateTime created; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_MODIFIED = "modified"; + private OffsetDateTime modified; + + public static final String JSON_PROPERTY_MONITOR_DEFINITION = "monitor_definition"; + private Map monitorDefinition = null; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + public static final String JSON_PROPERTY_TEMPLATE_VARIABLES = "template_variables"; + private List templateVariables = null; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_VERSION = "version"; + private JsonNullable version = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_VERSIONS = "versions"; + private List versions = null; + + /** + * The created timestamp of the template. + * + * @return created + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreated() { + return created; + } + + public MonitorUserTemplate description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * A brief description of the monitor user template. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + /** + * The last modified timestamp. When the template version was created. + * + * @return modified + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MODIFIED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getModified() { + return modified; + } + + public MonitorUserTemplate monitorDefinition(Map monitorDefinition) { + this.monitorDefinition = monitorDefinition; + return this; + } + + public MonitorUserTemplate putMonitorDefinitionItem(String key, Object monitorDefinitionItem) { + if (this.monitorDefinition == null) { + this.monitorDefinition = new HashMap<>(); + } + this.monitorDefinition.put(key, monitorDefinitionItem); + return this; + } + + /** + * A valid monitor definition in the same format as the V1 Monitor API. + * + * @return monitorDefinition + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MONITOR_DEFINITION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMonitorDefinition() { + return monitorDefinition; + } + + public void setMonitorDefinition(Map monitorDefinition) { + this.monitorDefinition = monitorDefinition; + } + + public MonitorUserTemplate tags(List tags) { + this.tags = tags; + return this; + } + + public MonitorUserTemplate addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The definition of MonitorUserTemplateTags object. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public MonitorUserTemplate templateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + for (MonitorUserTemplateTemplateVariablesItems item : templateVariables) { + this.unparsed |= item.unparsed; + } + return this; + } + + public MonitorUserTemplate addTemplateVariablesItem( + MonitorUserTemplateTemplateVariablesItems templateVariablesItem) { + if (this.templateVariables == null) { + this.templateVariables = new ArrayList<>(); + } + this.templateVariables.add(templateVariablesItem); + this.unparsed |= templateVariablesItem.unparsed; + return this; + } + + /** + * The definition of MonitorUserTemplateTemplateVariables object. + * + * @return templateVariables + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEMPLATE_VARIABLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTemplateVariables() { + return templateVariables; + } + + public void setTemplateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + } + + public MonitorUserTemplate title(String title) { + this.title = title; + return this; + } + + /** + * The title of the monitor user template. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * The version of the monitor user template. + * + * @return version + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getVersion() { + + if (version == null) { + version = JsonNullable.undefined(); + } + return version.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getVersion_JsonNullable() { + return version; + } + + @JsonProperty(JSON_PROPERTY_VERSION) + private void setVersion_JsonNullable(JsonNullable version) { + this.version = version; + } + + public MonitorUserTemplate versions(List versions) { + this.versions = versions; + for (SimpleMonitorUserTemplate item : versions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public MonitorUserTemplate addVersionsItem(SimpleMonitorUserTemplate versionsItem) { + if (this.versions == null) { + this.versions = new ArrayList<>(); + } + this.versions.add(versionsItem); + this.unparsed |= versionsItem.unparsed; + return this; + } + + /** + * All versions of the monitor user template. + * + * @return versions + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VERSIONS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getVersions() { + return versions; + } + + public void setVersions(List versions) { + this.versions = versions; + } + + /** + * 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 MonitorUserTemplate + */ + @JsonAnySetter + public MonitorUserTemplate 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 MonitorUserTemplate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplate monitorUserTemplate = (MonitorUserTemplate) o; + return Objects.equals(this.created, monitorUserTemplate.created) + && Objects.equals(this.description, monitorUserTemplate.description) + && Objects.equals(this.modified, monitorUserTemplate.modified) + && Objects.equals(this.monitorDefinition, monitorUserTemplate.monitorDefinition) + && Objects.equals(this.tags, monitorUserTemplate.tags) + && Objects.equals(this.templateVariables, monitorUserTemplate.templateVariables) + && Objects.equals(this.title, monitorUserTemplate.title) + && Objects.equals(this.version, monitorUserTemplate.version) + && Objects.equals(this.versions, monitorUserTemplate.versions) + && Objects.equals(this.additionalProperties, monitorUserTemplate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + created, + description, + modified, + monitorDefinition, + tags, + templateVariables, + title, + version, + versions, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplate {\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" modified: ").append(toIndentedString(modified)).append("\n"); + sb.append(" monitorDefinition: ").append(toIndentedString(monitorDefinition)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" templateVariables: ").append(toIndentedString(templateVariables)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" versions: ").append(toIndentedString(versions)).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/MonitorUserTemplateCreateData.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateCreateData.java new file mode 100644 index 00000000000..899ec1cb4b2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateCreateData.java @@ -0,0 +1,184 @@ +/* + * 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; + +/** Monitor user template data. */ +@JsonPropertyOrder({ + MonitorUserTemplateCreateData.JSON_PROPERTY_ATTRIBUTES, + MonitorUserTemplateCreateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateCreateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private MonitorUserTemplateRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private MonitorUserTemplateResourceType type = + MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE; + + public MonitorUserTemplateCreateData() {} + + @JsonCreator + public MonitorUserTemplateCreateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + MonitorUserTemplateRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + MonitorUserTemplateResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public MonitorUserTemplateCreateData attributes(MonitorUserTemplateRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for a monitor user template. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MonitorUserTemplateRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(MonitorUserTemplateRequestAttributes attributes) { + this.attributes = attributes; + } + + public MonitorUserTemplateCreateData type(MonitorUserTemplateResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Monitor user template resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MonitorUserTemplateResourceType getType() { + return type; + } + + public void setType(MonitorUserTemplateResourceType 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 MonitorUserTemplateCreateData + */ + @JsonAnySetter + public MonitorUserTemplateCreateData 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 MonitorUserTemplateCreateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateCreateData monitorUserTemplateCreateData = (MonitorUserTemplateCreateData) o; + return Objects.equals(this.attributes, monitorUserTemplateCreateData.attributes) + && Objects.equals(this.type, monitorUserTemplateCreateData.type) + && Objects.equals( + this.additionalProperties, monitorUserTemplateCreateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateCreateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).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/MonitorUserTemplateCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateCreateRequest.java new file mode 100644 index 00000000000..2d9ded21131 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateCreateRequest.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; + +/** Request for creating a monitor user template. */ +@JsonPropertyOrder({MonitorUserTemplateCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private MonitorUserTemplateCreateData data; + + public MonitorUserTemplateCreateRequest() {} + + @JsonCreator + public MonitorUserTemplateCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + MonitorUserTemplateCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public MonitorUserTemplateCreateRequest data(MonitorUserTemplateCreateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Monitor user template data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MonitorUserTemplateCreateData getData() { + return data; + } + + public void setData(MonitorUserTemplateCreateData 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 MonitorUserTemplateCreateRequest + */ + @JsonAnySetter + public MonitorUserTemplateCreateRequest 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 MonitorUserTemplateCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateCreateRequest monitorUserTemplateCreateRequest = + (MonitorUserTemplateCreateRequest) o; + return Objects.equals(this.data, monitorUserTemplateCreateRequest.data) + && Objects.equals( + this.additionalProperties, monitorUserTemplateCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateCreateRequest {\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/MonitorUserTemplateCreateResponse.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateCreateResponse.java new file mode 100644 index 00000000000..86d3817a81b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateCreateResponse.java @@ -0,0 +1,138 @@ +/* + * 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 for creating a monitor user template. */ +@JsonPropertyOrder({MonitorUserTemplateCreateResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateCreateResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private MonitorUserTemplateResponseData data; + + public MonitorUserTemplateCreateResponse data(MonitorUserTemplateResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Monitor user template list response data. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorUserTemplateResponseData getData() { + return data; + } + + public void setData(MonitorUserTemplateResponseData 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 MonitorUserTemplateCreateResponse + */ + @JsonAnySetter + public MonitorUserTemplateCreateResponse 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 MonitorUserTemplateCreateResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateCreateResponse monitorUserTemplateCreateResponse = + (MonitorUserTemplateCreateResponse) o; + return Objects.equals(this.data, monitorUserTemplateCreateResponse.data) + && Objects.equals( + this.additionalProperties, monitorUserTemplateCreateResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateCreateResponse {\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/MonitorUserTemplateListResponse.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateListResponse.java new file mode 100644 index 00000000000..453436117b2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateListResponse.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.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 for retrieving all monitor user templates. */ +@JsonPropertyOrder({MonitorUserTemplateListResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateListResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = null; + + public MonitorUserTemplateListResponse data(List data) { + this.data = data; + for (MonitorUserTemplateResponseData item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public MonitorUserTemplateListResponse addDataItem(MonitorUserTemplateResponseData dataItem) { + if (this.data == null) { + this.data = new ArrayList<>(); + } + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * An array of monitor user templates. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getData() { + return data; + } + + public void setData(List 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 MonitorUserTemplateListResponse + */ + @JsonAnySetter + public MonitorUserTemplateListResponse 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 MonitorUserTemplateListResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateListResponse monitorUserTemplateListResponse = + (MonitorUserTemplateListResponse) o; + return Objects.equals(this.data, monitorUserTemplateListResponse.data) + && Objects.equals( + this.additionalProperties, monitorUserTemplateListResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateListResponse {\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/MonitorUserTemplateRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateRequestAttributes.java new file mode 100644 index 00000000000..8244c7d6b75 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateRequestAttributes.java @@ -0,0 +1,248 @@ +/* + * 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.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; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes for a monitor user template. */ +@JsonPropertyOrder({ + MonitorUserTemplateRequestAttributes.JSON_PROPERTY_DESCRIPTION, + MonitorUserTemplateRequestAttributes.JSON_PROPERTY_MONITOR_DEFINITION, + MonitorUserTemplateRequestAttributes.JSON_PROPERTY_TAGS, + MonitorUserTemplateRequestAttributes.JSON_PROPERTY_TEMPLATE_VARIABLES, + MonitorUserTemplateRequestAttributes.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_MONITOR_DEFINITION = "monitor_definition"; + private Map monitorDefinition = new HashMap(); + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = new ArrayList<>(); + + public static final String JSON_PROPERTY_TEMPLATE_VARIABLES = "template_variables"; + private List templateVariables = null; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public MonitorUserTemplateRequestAttributes() {} + + @JsonCreator + public MonitorUserTemplateRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_MONITOR_DEFINITION) + Map monitorDefinition, + @JsonProperty(required = true, value = JSON_PROPERTY_TAGS) List tags, + @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title) { + this.monitorDefinition = monitorDefinition; + this.tags = tags; + this.title = title; + } + + public MonitorUserTemplateRequestAttributes description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * A brief description of the monitor user template. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + public MonitorUserTemplateRequestAttributes monitorDefinition( + Map monitorDefinition) { + this.monitorDefinition = monitorDefinition; + return this; + } + + public MonitorUserTemplateRequestAttributes putMonitorDefinitionItem( + String key, Object monitorDefinitionItem) { + this.monitorDefinition.put(key, monitorDefinitionItem); + return this; + } + + /** + * A valid monitor definition in the same format as the V1 Monitor API. + * + * @return monitorDefinition + */ + @JsonProperty(JSON_PROPERTY_MONITOR_DEFINITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Map getMonitorDefinition() { + return monitorDefinition; + } + + public void setMonitorDefinition(Map monitorDefinition) { + this.monitorDefinition = monitorDefinition; + } + + public MonitorUserTemplateRequestAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public MonitorUserTemplateRequestAttributes addTagsItem(String tagsItem) { + this.tags.add(tagsItem); + return this; + } + + /** + * The definition of MonitorUserTemplateTags object. + * + * @return tags + */ + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public MonitorUserTemplateRequestAttributes templateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + for (MonitorUserTemplateTemplateVariablesItems item : templateVariables) { + this.unparsed |= item.unparsed; + } + return this; + } + + public MonitorUserTemplateRequestAttributes addTemplateVariablesItem( + MonitorUserTemplateTemplateVariablesItems templateVariablesItem) { + if (this.templateVariables == null) { + this.templateVariables = new ArrayList<>(); + } + this.templateVariables.add(templateVariablesItem); + this.unparsed |= templateVariablesItem.unparsed; + return this; + } + + /** + * The definition of MonitorUserTemplateTemplateVariables object. + * + * @return templateVariables + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEMPLATE_VARIABLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTemplateVariables() { + return templateVariables; + } + + public void setTemplateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + } + + public MonitorUserTemplateRequestAttributes title(String title) { + this.title = title; + return this; + } + + /** + * The title of the monitor user template. + * + * @return title + */ + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** Return true if this MonitorUserTemplateRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateRequestAttributes monitorUserTemplateRequestAttributes = + (MonitorUserTemplateRequestAttributes) o; + return Objects.equals(this.description, monitorUserTemplateRequestAttributes.description) + && Objects.equals( + this.monitorDefinition, monitorUserTemplateRequestAttributes.monitorDefinition) + && Objects.equals(this.tags, monitorUserTemplateRequestAttributes.tags) + && Objects.equals( + this.templateVariables, monitorUserTemplateRequestAttributes.templateVariables) + && Objects.equals(this.title, monitorUserTemplateRequestAttributes.title); + } + + @Override + public int hashCode() { + return Objects.hash(description, monitorDefinition, tags, templateVariables, title); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateRequestAttributes {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" monitorDefinition: ").append(toIndentedString(monitorDefinition)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" templateVariables: ").append(toIndentedString(templateVariables)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).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/MonitorUserTemplateResourceType.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResourceType.java new file mode 100644 index 00000000000..8f8a446331b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResourceType.java @@ -0,0 +1,58 @@ +/* + * 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; + +/** Monitor user template resource type. */ +@JsonSerialize( + using = MonitorUserTemplateResourceType.MonitorUserTemplateResourceTypeSerializer.class) +public class MonitorUserTemplateResourceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("monitor-user-template")); + + public static final MonitorUserTemplateResourceType MONITOR_USER_TEMPLATE = + new MonitorUserTemplateResourceType("monitor-user-template"); + + MonitorUserTemplateResourceType(String value) { + super(value, allowedValues); + } + + public static class MonitorUserTemplateResourceTypeSerializer + extends StdSerializer { + public MonitorUserTemplateResourceTypeSerializer(Class t) { + super(t); + } + + public MonitorUserTemplateResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + MonitorUserTemplateResourceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static MonitorUserTemplateResourceType fromValue(String value) { + return new MonitorUserTemplateResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponse.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponse.java new file mode 100644 index 00000000000..deb03b320f9 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponse.java @@ -0,0 +1,137 @@ +/* + * 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 for retrieving a monitor user template. */ +@JsonPropertyOrder({MonitorUserTemplateResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private MonitorUserTemplateResponseDataWithVersions data; + + public MonitorUserTemplateResponse data(MonitorUserTemplateResponseDataWithVersions data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Monitor user template data. + * + * @return data + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorUserTemplateResponseDataWithVersions getData() { + return data; + } + + public void setData(MonitorUserTemplateResponseDataWithVersions 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 MonitorUserTemplateResponse + */ + @JsonAnySetter + public MonitorUserTemplateResponse 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 MonitorUserTemplateResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateResponse monitorUserTemplateResponse = (MonitorUserTemplateResponse) o; + return Objects.equals(this.data, monitorUserTemplateResponse.data) + && Objects.equals( + this.additionalProperties, monitorUserTemplateResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateResponse {\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/MonitorUserTemplateResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseAttributes.java new file mode 100644 index 00000000000..6addce83eb6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseAttributes.java @@ -0,0 +1,374 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Attributes for a monitor user template. */ +@JsonPropertyOrder({ + MonitorUserTemplateResponseAttributes.JSON_PROPERTY_CREATED, + MonitorUserTemplateResponseAttributes.JSON_PROPERTY_DESCRIPTION, + MonitorUserTemplateResponseAttributes.JSON_PROPERTY_MODIFIED, + MonitorUserTemplateResponseAttributes.JSON_PROPERTY_MONITOR_DEFINITION, + MonitorUserTemplateResponseAttributes.JSON_PROPERTY_TAGS, + MonitorUserTemplateResponseAttributes.JSON_PROPERTY_TEMPLATE_VARIABLES, + MonitorUserTemplateResponseAttributes.JSON_PROPERTY_TITLE, + MonitorUserTemplateResponseAttributes.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED = "created"; + private OffsetDateTime created; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_MODIFIED = "modified"; + private OffsetDateTime modified; + + public static final String JSON_PROPERTY_MONITOR_DEFINITION = "monitor_definition"; + private Map monitorDefinition = null; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + public static final String JSON_PROPERTY_TEMPLATE_VARIABLES = "template_variables"; + private List templateVariables = null; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_VERSION = "version"; + private JsonNullable version = JsonNullable.undefined(); + + /** + * The created timestamp of the template. + * + * @return created + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreated() { + return created; + } + + public MonitorUserTemplateResponseAttributes description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * A brief description of the monitor user template. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + /** + * The last modified timestamp. When the template version was created. + * + * @return modified + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MODIFIED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getModified() { + return modified; + } + + public MonitorUserTemplateResponseAttributes monitorDefinition( + Map monitorDefinition) { + this.monitorDefinition = monitorDefinition; + return this; + } + + public MonitorUserTemplateResponseAttributes putMonitorDefinitionItem( + String key, Object monitorDefinitionItem) { + if (this.monitorDefinition == null) { + this.monitorDefinition = new HashMap<>(); + } + this.monitorDefinition.put(key, monitorDefinitionItem); + return this; + } + + /** + * A valid monitor definition in the same format as the V1 Monitor API. + * + * @return monitorDefinition + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MONITOR_DEFINITION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMonitorDefinition() { + return monitorDefinition; + } + + public void setMonitorDefinition(Map monitorDefinition) { + this.monitorDefinition = monitorDefinition; + } + + public MonitorUserTemplateResponseAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public MonitorUserTemplateResponseAttributes addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The definition of MonitorUserTemplateTags object. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public MonitorUserTemplateResponseAttributes templateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + for (MonitorUserTemplateTemplateVariablesItems item : templateVariables) { + this.unparsed |= item.unparsed; + } + return this; + } + + public MonitorUserTemplateResponseAttributes addTemplateVariablesItem( + MonitorUserTemplateTemplateVariablesItems templateVariablesItem) { + if (this.templateVariables == null) { + this.templateVariables = new ArrayList<>(); + } + this.templateVariables.add(templateVariablesItem); + this.unparsed |= templateVariablesItem.unparsed; + return this; + } + + /** + * The definition of MonitorUserTemplateTemplateVariables object. + * + * @return templateVariables + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEMPLATE_VARIABLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTemplateVariables() { + return templateVariables; + } + + public void setTemplateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + } + + public MonitorUserTemplateResponseAttributes title(String title) { + this.title = title; + return this; + } + + /** + * The title of the monitor user template. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * The version of the monitor user template. + * + * @return version + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getVersion() { + + if (version == null) { + version = JsonNullable.undefined(); + } + return version.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getVersion_JsonNullable() { + return version; + } + + @JsonProperty(JSON_PROPERTY_VERSION) + private void setVersion_JsonNullable(JsonNullable version) { + this.version = version; + } + + /** + * 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 MonitorUserTemplateResponseAttributes + */ + @JsonAnySetter + public MonitorUserTemplateResponseAttributes 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 MonitorUserTemplateResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateResponseAttributes monitorUserTemplateResponseAttributes = + (MonitorUserTemplateResponseAttributes) o; + return Objects.equals(this.created, monitorUserTemplateResponseAttributes.created) + && Objects.equals(this.description, monitorUserTemplateResponseAttributes.description) + && Objects.equals(this.modified, monitorUserTemplateResponseAttributes.modified) + && Objects.equals( + this.monitorDefinition, monitorUserTemplateResponseAttributes.monitorDefinition) + && Objects.equals(this.tags, monitorUserTemplateResponseAttributes.tags) + && Objects.equals( + this.templateVariables, monitorUserTemplateResponseAttributes.templateVariables) + && Objects.equals(this.title, monitorUserTemplateResponseAttributes.title) + && Objects.equals(this.version, monitorUserTemplateResponseAttributes.version) + && Objects.equals( + this.additionalProperties, monitorUserTemplateResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + created, + description, + modified, + monitorDefinition, + tags, + templateVariables, + title, + version, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateResponseAttributes {\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" modified: ").append(toIndentedString(modified)).append("\n"); + sb.append(" monitorDefinition: ").append(toIndentedString(monitorDefinition)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" templateVariables: ").append(toIndentedString(templateVariables)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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/MonitorUserTemplateResponseData.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseData.java new file mode 100644 index 00000000000..2f2528d6e03 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseData.java @@ -0,0 +1,200 @@ +/* + * 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; + +/** Monitor user template list response data. */ +@JsonPropertyOrder({ + MonitorUserTemplateResponseData.JSON_PROPERTY_ATTRIBUTES, + MonitorUserTemplateResponseData.JSON_PROPERTY_ID, + MonitorUserTemplateResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private MonitorUserTemplateResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private MonitorUserTemplateResourceType type = + MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE; + + public MonitorUserTemplateResponseData attributes( + MonitorUserTemplateResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for a monitor user template. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorUserTemplateResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(MonitorUserTemplateResponseAttributes attributes) { + this.attributes = attributes; + } + + public MonitorUserTemplateResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public MonitorUserTemplateResponseData type(MonitorUserTemplateResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Monitor user template resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorUserTemplateResourceType getType() { + return type; + } + + public void setType(MonitorUserTemplateResourceType 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 MonitorUserTemplateResponseData + */ + @JsonAnySetter + public MonitorUserTemplateResponseData 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 MonitorUserTemplateResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateResponseData monitorUserTemplateResponseData = + (MonitorUserTemplateResponseData) o; + return Objects.equals(this.attributes, monitorUserTemplateResponseData.attributes) + && Objects.equals(this.id, monitorUserTemplateResponseData.id) + && Objects.equals(this.type, monitorUserTemplateResponseData.type) + && Objects.equals( + this.additionalProperties, monitorUserTemplateResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\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/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseDataWithVersions.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseDataWithVersions.java new file mode 100644 index 00000000000..1f50e4d8f5e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateResponseDataWithVersions.java @@ -0,0 +1,201 @@ +/* + * 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; + +/** Monitor user template data. */ +@JsonPropertyOrder({ + MonitorUserTemplateResponseDataWithVersions.JSON_PROPERTY_ATTRIBUTES, + MonitorUserTemplateResponseDataWithVersions.JSON_PROPERTY_ID, + MonitorUserTemplateResponseDataWithVersions.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateResponseDataWithVersions { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private MonitorUserTemplate attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private MonitorUserTemplateResourceType type = + MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE; + + public MonitorUserTemplateResponseDataWithVersions attributes(MonitorUserTemplate attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * A monitor user template object. + * + * @return attributes + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorUserTemplate getAttributes() { + return attributes; + } + + public void setAttributes(MonitorUserTemplate attributes) { + this.attributes = attributes; + } + + public MonitorUserTemplateResponseDataWithVersions id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public MonitorUserTemplateResponseDataWithVersions type(MonitorUserTemplateResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Monitor user template resource type. + * + * @return type + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public MonitorUserTemplateResourceType getType() { + return type; + } + + public void setType(MonitorUserTemplateResourceType 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 MonitorUserTemplateResponseDataWithVersions + */ + @JsonAnySetter + public MonitorUserTemplateResponseDataWithVersions 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 MonitorUserTemplateResponseDataWithVersions object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateResponseDataWithVersions monitorUserTemplateResponseDataWithVersions = + (MonitorUserTemplateResponseDataWithVersions) o; + return Objects.equals(this.attributes, monitorUserTemplateResponseDataWithVersions.attributes) + && Objects.equals(this.id, monitorUserTemplateResponseDataWithVersions.id) + && Objects.equals(this.type, monitorUserTemplateResponseDataWithVersions.type) + && Objects.equals( + this.additionalProperties, + monitorUserTemplateResponseDataWithVersions.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateResponseDataWithVersions {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\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/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateTemplateVariablesItems.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateTemplateVariablesItems.java new file mode 100644 index 00000000000..8f124f2d8dd --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateTemplateVariablesItems.java @@ -0,0 +1,195 @@ +/* + * 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.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.List; +import java.util.Objects; + +/** + * List of objects representing template variables on the monitor which can have selectable values. + */ +@JsonPropertyOrder({ + MonitorUserTemplateTemplateVariablesItems.JSON_PROPERTY_AVAILABLE_VALUES, + MonitorUserTemplateTemplateVariablesItems.JSON_PROPERTY_DEFAULTS, + MonitorUserTemplateTemplateVariablesItems.JSON_PROPERTY_NAME, + MonitorUserTemplateTemplateVariablesItems.JSON_PROPERTY_TAG_KEY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateTemplateVariablesItems { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AVAILABLE_VALUES = "available_values"; + private List availableValues = null; + + public static final String JSON_PROPERTY_DEFAULTS = "defaults"; + private List defaults = null; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TAG_KEY = "tag_key"; + private String tagKey; + + public MonitorUserTemplateTemplateVariablesItems() {} + + @JsonCreator + public MonitorUserTemplateTemplateVariablesItems( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.name = name; + } + + public MonitorUserTemplateTemplateVariablesItems availableValues(List availableValues) { + this.availableValues = availableValues; + return this; + } + + public MonitorUserTemplateTemplateVariablesItems addAvailableValuesItem( + String availableValuesItem) { + if (this.availableValues == null) { + this.availableValues = new ArrayList<>(); + } + this.availableValues.add(availableValuesItem); + return this; + } + + /** + * Available values for the variable. + * + * @return availableValues + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_AVAILABLE_VALUES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getAvailableValues() { + return availableValues; + } + + public void setAvailableValues(List availableValues) { + this.availableValues = availableValues; + } + + public MonitorUserTemplateTemplateVariablesItems defaults(List defaults) { + this.defaults = defaults; + return this; + } + + public MonitorUserTemplateTemplateVariablesItems addDefaultsItem(String defaultsItem) { + if (this.defaults == null) { + this.defaults = new ArrayList<>(); + } + this.defaults.add(defaultsItem); + return this; + } + + /** + * Default values of the template variable. + * + * @return defaults + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DEFAULTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getDefaults() { + return defaults; + } + + public void setDefaults(List defaults) { + this.defaults = defaults; + } + + public MonitorUserTemplateTemplateVariablesItems name(String name) { + this.name = name; + return this; + } + + /** + * The name of the template variable. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public MonitorUserTemplateTemplateVariablesItems tagKey(String tagKey) { + this.tagKey = tagKey; + return this; + } + + /** + * The tag key associated with the variable. This works the same as dashboard template variables. + * + * @return tagKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAG_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTagKey() { + return tagKey; + } + + public void setTagKey(String tagKey) { + this.tagKey = tagKey; + } + + /** Return true if this MonitorUserTemplateTemplateVariablesItems object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateTemplateVariablesItems monitorUserTemplateTemplateVariablesItems = + (MonitorUserTemplateTemplateVariablesItems) o; + return Objects.equals( + this.availableValues, monitorUserTemplateTemplateVariablesItems.availableValues) + && Objects.equals(this.defaults, monitorUserTemplateTemplateVariablesItems.defaults) + && Objects.equals(this.name, monitorUserTemplateTemplateVariablesItems.name) + && Objects.equals(this.tagKey, monitorUserTemplateTemplateVariablesItems.tagKey); + } + + @Override + public int hashCode() { + return Objects.hash(availableValues, defaults, name, tagKey); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateTemplateVariablesItems {\n"); + sb.append(" availableValues: ").append(toIndentedString(availableValues)).append("\n"); + sb.append(" defaults: ").append(toIndentedString(defaults)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" tagKey: ").append(toIndentedString(tagKey)).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/MonitorUserTemplateUpdateData.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateUpdateData.java new file mode 100644 index 00000000000..e364b081a7c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateUpdateData.java @@ -0,0 +1,212 @@ +/* + * 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; + +/** Monitor user template data. */ +@JsonPropertyOrder({ + MonitorUserTemplateUpdateData.JSON_PROPERTY_ATTRIBUTES, + MonitorUserTemplateUpdateData.JSON_PROPERTY_ID, + MonitorUserTemplateUpdateData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateUpdateData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private MonitorUserTemplateRequestAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private MonitorUserTemplateResourceType type = + MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE; + + public MonitorUserTemplateUpdateData() {} + + @JsonCreator + public MonitorUserTemplateUpdateData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + MonitorUserTemplateRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + MonitorUserTemplateResourceType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public MonitorUserTemplateUpdateData attributes(MonitorUserTemplateRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes for a monitor user template. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MonitorUserTemplateRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(MonitorUserTemplateRequestAttributes attributes) { + this.attributes = attributes; + } + + public MonitorUserTemplateUpdateData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public MonitorUserTemplateUpdateData type(MonitorUserTemplateResourceType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * Monitor user template resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MonitorUserTemplateResourceType getType() { + return type; + } + + public void setType(MonitorUserTemplateResourceType 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 MonitorUserTemplateUpdateData + */ + @JsonAnySetter + public MonitorUserTemplateUpdateData 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 MonitorUserTemplateUpdateData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateUpdateData monitorUserTemplateUpdateData = (MonitorUserTemplateUpdateData) o; + return Objects.equals(this.attributes, monitorUserTemplateUpdateData.attributes) + && Objects.equals(this.id, monitorUserTemplateUpdateData.id) + && Objects.equals(this.type, monitorUserTemplateUpdateData.type) + && Objects.equals( + this.additionalProperties, monitorUserTemplateUpdateData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateUpdateData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\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/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateUpdateRequest.java b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateUpdateRequest.java new file mode 100644 index 00000000000..2213df83a1d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/MonitorUserTemplateUpdateRequest.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; + +/** Request for creating a new monitor user template version. */ +@JsonPropertyOrder({MonitorUserTemplateUpdateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class MonitorUserTemplateUpdateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private MonitorUserTemplateUpdateData data; + + public MonitorUserTemplateUpdateRequest() {} + + @JsonCreator + public MonitorUserTemplateUpdateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + MonitorUserTemplateUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public MonitorUserTemplateUpdateRequest data(MonitorUserTemplateUpdateData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Monitor user template data. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public MonitorUserTemplateUpdateData getData() { + return data; + } + + public void setData(MonitorUserTemplateUpdateData 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 MonitorUserTemplateUpdateRequest + */ + @JsonAnySetter + public MonitorUserTemplateUpdateRequest 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 MonitorUserTemplateUpdateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MonitorUserTemplateUpdateRequest monitorUserTemplateUpdateRequest = + (MonitorUserTemplateUpdateRequest) o; + return Objects.equals(this.data, monitorUserTemplateUpdateRequest.data) + && Objects.equals( + this.additionalProperties, monitorUserTemplateUpdateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MonitorUserTemplateUpdateRequest {\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/SimpleMonitorUserTemplate.java b/src/main/java/com/datadog/api/client/v2/model/SimpleMonitorUserTemplate.java new file mode 100644 index 00000000000..85714b11b46 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/SimpleMonitorUserTemplate.java @@ -0,0 +1,379 @@ +/* + * 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.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** A simplified version of a monitor user template. */ +@JsonPropertyOrder({ + SimpleMonitorUserTemplate.JSON_PROPERTY_CREATED, + SimpleMonitorUserTemplate.JSON_PROPERTY_DESCRIPTION, + SimpleMonitorUserTemplate.JSON_PROPERTY_ID, + SimpleMonitorUserTemplate.JSON_PROPERTY_MONITOR_DEFINITION, + SimpleMonitorUserTemplate.JSON_PROPERTY_TAGS, + SimpleMonitorUserTemplate.JSON_PROPERTY_TEMPLATE_VARIABLES, + SimpleMonitorUserTemplate.JSON_PROPERTY_TITLE, + SimpleMonitorUserTemplate.JSON_PROPERTY_VERSION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class SimpleMonitorUserTemplate { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED = "created"; + private OffsetDateTime created; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private JsonNullable description = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_MONITOR_DEFINITION = "monitor_definition"; + private Map monitorDefinition = null; + + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + + public static final String JSON_PROPERTY_TEMPLATE_VARIABLES = "template_variables"; + private List templateVariables = null; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public static final String JSON_PROPERTY_VERSION = "version"; + private JsonNullable version = JsonNullable.undefined(); + + /** + * The created timestamp of the template. + * + * @return created + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreated() { + return created; + } + + public SimpleMonitorUserTemplate description(String description) { + this.description = JsonNullable.of(description); + return this; + } + + /** + * A brief description of the monitor user template. + * + * @return description + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getDescription() { + return description.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getDescription_JsonNullable() { + return description; + } + + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + public void setDescription_JsonNullable(JsonNullable description) { + this.description = description; + } + + public void setDescription(String description) { + this.description = JsonNullable.of(description); + } + + public SimpleMonitorUserTemplate id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier. The initial version will match the template ID. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public SimpleMonitorUserTemplate monitorDefinition(Map monitorDefinition) { + this.monitorDefinition = monitorDefinition; + return this; + } + + public SimpleMonitorUserTemplate putMonitorDefinitionItem( + String key, Object monitorDefinitionItem) { + if (this.monitorDefinition == null) { + this.monitorDefinition = new HashMap<>(); + } + this.monitorDefinition.put(key, monitorDefinitionItem); + return this; + } + + /** + * A valid monitor definition in the same format as the V1 Monitor API. + * + * @return monitorDefinition + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_MONITOR_DEFINITION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Map getMonitorDefinition() { + return monitorDefinition; + } + + public void setMonitorDefinition(Map monitorDefinition) { + this.monitorDefinition = monitorDefinition; + } + + public SimpleMonitorUserTemplate tags(List tags) { + this.tags = tags; + return this; + } + + public SimpleMonitorUserTemplate addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The definition of MonitorUserTemplateTags object. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public SimpleMonitorUserTemplate templateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + for (MonitorUserTemplateTemplateVariablesItems item : templateVariables) { + this.unparsed |= item.unparsed; + } + return this; + } + + public SimpleMonitorUserTemplate addTemplateVariablesItem( + MonitorUserTemplateTemplateVariablesItems templateVariablesItem) { + if (this.templateVariables == null) { + this.templateVariables = new ArrayList<>(); + } + this.templateVariables.add(templateVariablesItem); + this.unparsed |= templateVariablesItem.unparsed; + return this; + } + + /** + * The definition of MonitorUserTemplateTemplateVariables object. + * + * @return templateVariables + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TEMPLATE_VARIABLES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTemplateVariables() { + return templateVariables; + } + + public void setTemplateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + } + + public SimpleMonitorUserTemplate title(String title) { + this.title = title; + return this; + } + + /** + * The title of the monitor user template. + * + * @return title + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * The version of the monitor user template. + * + * @return version + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getVersion() { + + if (version == null) { + version = JsonNullable.undefined(); + } + return version.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_VERSION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getVersion_JsonNullable() { + return version; + } + + @JsonProperty(JSON_PROPERTY_VERSION) + private void setVersion_JsonNullable(JsonNullable version) { + this.version = version; + } + + /** + * 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 SimpleMonitorUserTemplate + */ + @JsonAnySetter + public SimpleMonitorUserTemplate 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 SimpleMonitorUserTemplate object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SimpleMonitorUserTemplate simpleMonitorUserTemplate = (SimpleMonitorUserTemplate) o; + return Objects.equals(this.created, simpleMonitorUserTemplate.created) + && Objects.equals(this.description, simpleMonitorUserTemplate.description) + && Objects.equals(this.id, simpleMonitorUserTemplate.id) + && Objects.equals(this.monitorDefinition, simpleMonitorUserTemplate.monitorDefinition) + && Objects.equals(this.tags, simpleMonitorUserTemplate.tags) + && Objects.equals(this.templateVariables, simpleMonitorUserTemplate.templateVariables) + && Objects.equals(this.title, simpleMonitorUserTemplate.title) + && Objects.equals(this.version, simpleMonitorUserTemplate.version) + && Objects.equals( + this.additionalProperties, simpleMonitorUserTemplate.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + created, + description, + id, + monitorDefinition, + tags, + templateVariables, + title, + version, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SimpleMonitorUserTemplate {\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" monitorDefinition: ").append(toIndentedString(monitorDefinition)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" templateVariables: ").append(toIndentedString(templateVariables)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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_a_monitor_configuration_policy_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_Bad_Request_response.freeze index f465efe8f03..4066503df4b 100644 --- a/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_Bad_Request_response.freeze +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_Bad_Request_response.freeze @@ -1 +1 @@ -2023-04-27T20:34:58.955Z \ No newline at end of file +2025-05-29T02:36:15.011Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_OK_response.freeze index 83a11894fbd..fcae6e77ede 100644 --- a/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_OK_response.freeze @@ -1 +1 @@ -2023-04-27T20:34:59.311Z \ No newline at end of file +2025-05-29T02:36:15.129Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_OK_response.json index 0ad8b6868dd..6f245ab9fa3 100644 --- a/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_configuration_policy_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testcreateamonitorconfigurationpolicyreturnsokresponse1682627699\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" + "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testcreateamonitorconfigurationpolicyreturnsokresponse1748486175\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"id\":\"fabd0b6e-e53a-11ed-a07b-da7ad0900002\",\"attributes\":{\"policy\":{\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key_required\":false,\"tag_key\":\"testcreateamonitorconfigurationpolicyreturnsokresponse1682627699\"},\"policy_type\":\"tag\"}}}\n", + "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy_type\":\"tag\",\"policy\":{\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key\":\"testcreateamonitorconfigurationpolicyreturnsokresponse1748486175\"}},\"id\":\"edb99130-4a6a-4970-b6df-83b5cba1182a\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,13 +27,13 @@ "timeToLive": { "unlimited": true }, - "id": "34ccf19e-84f9-5ca9-a5ce-9abc55740131" + "id": "5c775d71-e26a-468c-1c50-19f49491afde" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/policy/fabd0b6e-e53a-11ed-a07b-da7ad0900002", + "path": "/api/v2/monitor/policy/edb99130-4a6a-4970-b6df-83b5cba1182a", "keepAlive": false, "secure": true }, @@ -52,6 +52,6 @@ "timeToLive": { "unlimited": true }, - "id": "851156f6-1954-b2f7-ef5a-3aca57b00d80" + "id": "14428c3e-677d-7eb5-6efd-3a938730678f" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_Bad_Request_response.freeze index 454c4bb29a3..a29e72739cc 100644 --- a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_Bad_Request_response.freeze +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_Bad_Request_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:43.940Z \ No newline at end of file +2025-05-29T02:36:15.400Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_Bad_Request_response.json index a61faa94749..607d3ab0604 100644 --- a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_Bad_Request_response.json +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_Bad_Request_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_returns_bad_request_response-1744280983\",\"host:abc\"]},\"name\":\"test rule\",\"recipients\":[\"@slack-test-channel\",\"@jira-test\"]},\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_returns_bad_request_response-1748486175\",\"host:abc\"]},\"name\":\"test rule\",\"recipients\":[\"@slack-test-channel\",\"@jira-test\"]},\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "POST", @@ -27,6 +27,6 @@ "timeToLive": { "unlimited": true }, - "id": "ca715863-18d9-8dab-d956-c3de955ebfc6" + "id": "92aea172-258a-bbf0-9a11-3892318ac403" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_OK_response.freeze index 86ab3de39bc..f7e7180ce18 100644 --- a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_OK_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:44.273Z \ No newline at end of file +2025-05-29T02:36:15.486Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_OK_response.json index f50e201c482..c1f14d74974 100644 --- a/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_notification_rule_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_returns_ok_response-1744280984\"]},\"name\":\"test rule\",\"recipients\":[\"slack-test-channel\",\"jira-test\"]},\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_returns_ok_response-1748486175\"]},\"name\":\"test rule\",\"recipients\":[\"slack-test-channel\",\"jira-test\"]},\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_returns_ok_response-1744280984\"]},\"recipients\":[\"slack-test-channel\",\"jira-test\"],\"name\":\"test rule\",\"created_at\":\"2025-04-10T10:29:44.595607+00:00\",\"modified_at\":\"1970-01-01T00:00:00+00:00\"},\"id\":\"a3323ef6-2a04-4ef9-8de8-cbcff5c3c203\",\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-04-07T20:19:46.118466+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"created_at\":\"2025-05-29T02:36:15.639714+00:00\",\"filter\":{\"tags\":[\"test:test-create_a_monitor_notification_rule_returns_ok_response-1748486175\"]},\"recipients\":[\"slack-test-channel\",\"jira-test\"],\"modified_at\":\"1970-01-01T00:00:00+00:00\",\"name\":\"test rule\"},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}},\"id\":\"5dca07c7-267c-4159-9d8f-7dec1512fb77\"},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-05-06T01:37:11.870914+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", "headers": { "Content-Type": [ "application/json" @@ -27,13 +27,13 @@ "timeToLive": { "unlimited": true }, - "id": "662b9e66-b48e-20b0-3233-13a039dcef82" + "id": "99e07137-67bb-7708-3689-45b17181c393" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/notification_rule/a3323ef6-2a04-4ef9-8de8-cbcff5c3c203", + "path": "/api/v2/monitor/notification_rule/5dca07c7-267c-4159-9d8f-7dec1512fb77", "keepAlive": false, "secure": true }, @@ -52,6 +52,6 @@ "timeToLive": { "unlimited": true }, - "id": "2f4a98e8-f9f9-ea2f-a8b4-a9806400e47d" + "id": "58625966-801a-3e73-da19-a65d986c7214" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..99f122840a7 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:15.918Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_Bad_Request_response.json new file mode 100644 index 00000000000..941c1844064 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-create_a_monitor_user_template_returns_bad_request_response-1748486175\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid monitor_definition or template variables: Monitor definition cannot be empty.\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8ec2c017-89a9-45e5-e2d1-299b06661e5b" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_OK_response.freeze new file mode 100644 index 00000000000..d617ccf69f0 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:16.048Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_OK_response.json new file mode 100644 index 00000000000..9a3052b95ba --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_a_monitor_user_template_returns_OK_response.json @@ -0,0 +1,57 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{\"message\":\"A msg.\",\"name\":\"A name test-create_a_monitor_user_template_returns_ok_response-1748486176\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-create_a_monitor_user_template_returns_ok_response-1748486176\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-user-template\",\"attributes\":{\"modified\":\"2025-05-29T02:36:16.272266+00:00\",\"tags\":[\"integration:Azure\"],\"monitor_definition\":{\"message\":\"A msg.\",\"name\":\"A name test-create_a_monitor_user_template_returns_ok_response-1748486176\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"tag_key\":\"datacenter\",\"name\":\"regionName\"}],\"description\":\"A description.\",\"version\":0,\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"created\":\"2025-05-29T02:36:16.272266+00:00\",\"title\":\"Postgres DB test-create_a_monitor_user_template_returns_ok_response-1748486176\"},\"id\":\"15c66feb-f77d-407b-bf4c-615d3dc4fa50\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "214c7178-b917-c060-ef39-9acae4df489d" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/template/15c66feb-f77d-407b-bf4c-615d3dc4fa50", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "09aec19a-cf78-505e-ca41-e6dc75dda553" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_Bad_Request_response.freeze index 94a2d0766cc..1010ce4749f 100644 --- a/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_Bad_Request_response.freeze +++ b/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_Bad_Request_response.freeze @@ -1 +1 @@ -2023-04-27T20:34:59.820Z \ No newline at end of file +2025-05-29T02:36:16.452Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_Not_Found_response.freeze index 844a6642df2..7ae4617a1d1 100644 --- a/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_Not_Found_response.freeze +++ b/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_Not_Found_response.freeze @@ -1 +1 @@ -2023-04-27T20:35:00.006Z \ No newline at end of file +2025-05-29T02:36:16.549Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_OK_response.freeze index b0d9464efa8..284f2e61ee0 100644 --- a/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_OK_response.freeze @@ -1 +1 @@ -2023-04-27T20:35:00.311Z \ No newline at end of file +2025-05-29T02:36:16.671Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_OK_response.json index 11007658f64..da925273972 100644 --- a/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Delete_a_monitor_configuration_policy_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testdeleteamonitorconfigurationpolicyreturnsokresponse1682627700\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" + "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testdeleteamonitorconfigurationpolicyreturnsokresponse1748486176\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy_type\":\"tag\",\"policy\":{\"tag_key_required\":false,\"tag_key\":\"testdeleteamonitorconfigurationpolicyreturnsokresponse1682627700\",\"valid_tag_values\":[\"prod\",\"staging\"]}},\"id\":\"fb4a2490-e53a-11ed-a5db-da7ad0900002\"}}\n", + "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy_type\":\"tag\",\"policy\":{\"tag_key\":\"testdeleteamonitorconfigurationpolicyreturnsokresponse1748486176\",\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key_required\":false}},\"id\":\"f0b1ee92-9635-45ed-8a18-a1631a8397d2\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,13 +27,13 @@ "timeToLive": { "unlimited": true }, - "id": "fb8ec162-e8fb-b64b-b79d-4edeed6b11a0" + "id": "b6365bcc-39be-2b77-c052-82822ed13738" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/policy/fb4a2490-e53a-11ed-a5db-da7ad0900002", + "path": "/api/v2/monitor/policy/f0b1ee92-9635-45ed-8a18-a1631a8397d2", "keepAlive": false, "secure": true }, @@ -52,13 +52,13 @@ "timeToLive": { "unlimited": true }, - "id": "bf072b76-37e1-84fa-1d62-7e9bb9ca4f44" + "id": "860ccf92-1cb9-1156-54a2-8e93321333eb" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/policy/fb4a2490-e53a-11ed-a5db-da7ad0900002", + "path": "/api/v2/monitor/policy/f0b1ee92-9635-45ed-8a18-a1631a8397d2", "keepAlive": false, "secure": true }, @@ -78,6 +78,6 @@ "timeToLive": { "unlimited": true }, - "id": "bf072b76-37e1-84fa-1d62-7e9bb9ca4f45" + "id": "860ccf92-1cb9-1156-54a2-8e93321333ec" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_Not_Found_response.freeze index 2590d462ecd..57a7f6d2e7e 100644 --- a/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_Not_Found_response.freeze +++ b/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_Not_Found_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:46.694Z \ No newline at end of file +2025-05-29T02:36:17.047Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_OK_response.freeze index c1dc706f2cb..23f9fba845c 100644 --- a/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_OK_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:47.053Z \ No newline at end of file +2025-05-29T02:36:17.179Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_OK_response.json index 884bef3c895..0f3b72f37bd 100644 --- a/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Delete_a_monitor_notification_rule_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-delete_a_monitor_notification_rule_returns_ok_response-1744280987\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-delete_a_monitor_notification_rule_returns_ok_response-1748486177\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}},\"attributes\":{\"filter\":{\"tags\":[\"app:test-delete_a_monitor_notification_rule_returns_ok_response-1744280987\"]},\"created_at\":\"2025-04-10T10:29:47.326243+00:00\",\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"],\"modified_at\":\"1970-01-01T00:00:00+00:00\"},\"id\":\"66e399af-c07e-414d-b4f2-93e196d7b7b7\"},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-04-07T20:19:46.118466+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"created_at\":\"2025-05-29T02:36:17.310680+00:00\",\"filter\":{\"tags\":[\"app:test-delete_a_monitor_notification_rule_returns_ok_response-1748486177\"]},\"modified_at\":\"1970-01-01T00:00:00+00:00\",\"recipients\":[\"slack-monitor-app\"],\"name\":\"test rule\"},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}},\"id\":\"ae73c449-eadb-40ce-9eb3-9d56d8216254\"},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-05-06T01:37:11.870914+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", "headers": { "Content-Type": [ "application/json" @@ -27,13 +27,13 @@ "timeToLive": { "unlimited": true }, - "id": "f29d6b1a-1390-0907-8849-e50300212a7b" + "id": "3065cafd-88d5-e3ce-8e2d-c0da9f51ebde" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/notification_rule/66e399af-c07e-414d-b4f2-93e196d7b7b7", + "path": "/api/v2/monitor/notification_rule/ae73c449-eadb-40ce-9eb3-9d56d8216254", "keepAlive": false, "secure": true }, @@ -52,13 +52,13 @@ "timeToLive": { "unlimited": true }, - "id": "eb4ba1ca-e100-619c-3b62-8ac1142bd6df" + "id": "06ad04f9-04a4-2408-8e7f-b93bf715d2b3" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/notification_rule/66e399af-c07e-414d-b4f2-93e196d7b7b7", + "path": "/api/v2/monitor/notification_rule/ae73c449-eadb-40ce-9eb3-9d56d8216254", "keepAlive": false, "secure": true }, @@ -78,6 +78,6 @@ "timeToLive": { "unlimited": true }, - "id": "eb4ba1ca-e100-619c-3b62-8ac1142bd6e0" + "id": "06ad04f9-04a4-2408-8e7f-b93bf715d2b4" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_monitor_user_template_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Delete_a_monitor_user_template_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..5e8ee5338f6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_monitor_user_template_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:17.713Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Delete_a_monitor_user_template_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Delete_a_monitor_user_template_returns_Not_Found_response.json new file mode 100644 index 00000000000..569c097ac87 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Delete_a_monitor_user_template_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/template/00000000-0000-1234-0000-000000000000", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Monitor template not found\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "30b92dd5-13fe-ec50-65f8-96afdc66fa88" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Not_Found_response.freeze index cf29ebf6e08..bee5a97d5c4 100644 --- a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Not_Found_response.freeze +++ b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Not_Found_response.freeze @@ -1 +1 @@ -2023-04-27T20:35:01.028Z \ No newline at end of file +2025-05-29T02:36:17.896Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_OK_response.freeze index 054169c0733..2b9bd5902e8 100644 --- a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_OK_response.freeze @@ -1 +1 @@ -2023-04-27T20:35:01.273Z \ No newline at end of file +2025-05-29T02:36:18.010Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_OK_response.json index 004454186a6..dda8aca747f 100644 --- a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsokresponse1682627701\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" + "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsokresponse1748486178\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"id\":\"fbdb67de-e53a-11ed-9e4a-da7ad0900002\",\"attributes\":{\"policy\":{\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key_required\":false,\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsokresponse1682627701\"},\"policy_type\":\"tag\"}}}\n", + "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy\":{\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsokresponse1748486178\",\"tag_key_required\":false},\"policy_type\":\"tag\"},\"id\":\"b967c47e-8f9b-49f5-bdff-744b4d50b26f\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,22 +27,22 @@ "timeToLive": { "unlimited": true }, - "id": "0e0e3e9b-4d5e-9e00-8c53-986992041a43" + "id": "9696eda5-c991-93fd-b3c4-0c80c0122bd2" }, { "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsokresponse1682627701\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"id\":\"fbdb67de-e53a-11ed-9e4a-da7ad0900002\",\"type\":\"monitor-config-policy\"}}" + "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsokresponse1748486178\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"id\":\"b967c47e-8f9b-49f5-bdff-744b4d50b26f\",\"type\":\"monitor-config-policy\"}}" }, "headers": {}, "method": "PATCH", - "path": "/api/v2/monitor/policy/fbdb67de-e53a-11ed-9e4a-da7ad0900002", + "path": "/api/v2/monitor/policy/b967c47e-8f9b-49f5-bdff-744b4d50b26f", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy_type\":\"tag\",\"policy\":{\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsokresponse1682627701\",\"tag_key_required\":false}},\"id\":\"fbdb67de-e53a-11ed-9e4a-da7ad0900002\"}}\n", + "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy_type\":\"tag\",\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsokresponse1748486178\",\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key_required\":false}},\"id\":\"b967c47e-8f9b-49f5-bdff-744b4d50b26f\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -57,13 +57,13 @@ "timeToLive": { "unlimited": true }, - "id": "186405ab-b350-c0d0-7c85-7b37eefb7a24" + "id": "66157fe6-5372-faa3-b1bd-dc4077bb6484" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/policy/fbdb67de-e53a-11ed-9e4a-da7ad0900002", + "path": "/api/v2/monitor/policy/b967c47e-8f9b-49f5-bdff-744b4d50b26f", "keepAlive": false, "secure": true }, @@ -82,6 +82,6 @@ "timeToLive": { "unlimited": true }, - "id": "1a4a8a0b-098f-3a25-7b7a-2130961c76d4" + "id": "d2c4361b-7da2-cddb-38d8-44fc134dc122" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Unprocessable_Entity_response.freeze b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Unprocessable_Entity_response.freeze index da44ed34e7a..0c25447bf3a 100644 --- a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Unprocessable_Entity_response.freeze +++ b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Unprocessable_Entity_response.freeze @@ -1 +1 @@ -2023-04-27T20:35:01.901Z \ No newline at end of file +2025-05-29T02:36:18.429Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Unprocessable_Entity_response.json b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Unprocessable_Entity_response.json index ddf25a541ba..c7d2e1e3b35 100644 --- a/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Unprocessable_Entity_response.json +++ b/src/test/resources/cassettes/features/v2/Edit_a_monitor_configuration_policy_returns_Unprocessable_Entity_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsunprocessableentityresponse1682627701\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" + "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsunprocessableentityresponse1748486178\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsunprocessableentityresponse1682627701\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"id\":\"fc38f7f0-e53a-11ed-947f-da7ad0900002\"}}\n", + "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsunprocessableentityresponse1748486178\",\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key_required\":false},\"policy_type\":\"tag\"},\"id\":\"f2f83512-b2c2-4dc4-a8db-c785cd818d6f\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,17 +27,17 @@ "timeToLive": { "unlimited": true }, - "id": "f73a1e04-a46a-afee-2f9a-4f686d2e03c4" + "id": "1279eac4-3fcd-e892-6676-46c1255d2f8c" }, { "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsunprocessableentityresponse1682627701\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-config-policy\"}}" + "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testeditamonitorconfigurationpolicyreturnsunprocessableentityresponse1748486178\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-config-policy\"}}" }, "headers": {}, "method": "PATCH", - "path": "/api/v2/monitor/policy/fc38f7f0-e53a-11ed-947f-da7ad0900002", + "path": "/api/v2/monitor/policy/f2f83512-b2c2-4dc4-a8db-c785cd818d6f", "keepAlive": false, "secure": true }, @@ -57,13 +57,13 @@ "timeToLive": { "unlimited": true }, - "id": "9a404b45-283d-1dba-a5c1-22902f88fcfc" + "id": "937be9c1-c424-4a6a-bcfc-ecada84b00d1" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/policy/fc38f7f0-e53a-11ed-947f-da7ad0900002", + "path": "/api/v2/monitor/policy/f2f83512-b2c2-4dc4-a8db-c785cd818d6f", "keepAlive": false, "secure": true }, @@ -82,6 +82,6 @@ "timeToLive": { "unlimited": true }, - "id": "93ccb037-d37a-1ad7-b5b6-0ac50481dfcb" + "id": "2f514e1d-9cd9-6d3f-0003-8346926553ac" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_Not_Found_response.freeze index 4fab297722f..4cc7aa02cc4 100644 --- a/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_Not_Found_response.freeze +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_Not_Found_response.freeze @@ -1 +1 @@ -2023-04-27T20:35:02.620Z \ No newline at end of file +2025-05-29T02:36:18.835Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_OK_response.freeze index d650deaf594..c4817e4665a 100644 --- a/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_OK_response.freeze @@ -1 +1 @@ -2023-04-27T20:35:02.925Z \ No newline at end of file +2025-05-29T02:36:18.939Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_OK_response.json index ec8ba3da132..81af3e2c093 100644 --- a/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_configuration_policy_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testgetamonitorconfigurationpolicyreturnsokresponse1682627702\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" + "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testgetamonitorconfigurationpolicyreturnsokresponse1748486178\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy_type\":\"tag\",\"policy\":{\"tag_key\":\"testgetamonitorconfigurationpolicyreturnsokresponse1682627702\",\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key_required\":false}},\"id\":\"fcd6f8ec-e53a-11ed-8b5f-da7ad0900002\"}}\n", + "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy\":{\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key_required\":false,\"tag_key\":\"testgetamonitorconfigurationpolicyreturnsokresponse1748486178\"},\"policy_type\":\"tag\"},\"id\":\"7916e37f-b0fe-4f9d-bf9e-37ee3e7a5460\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,18 +27,18 @@ "timeToLive": { "unlimited": true }, - "id": "1f4941fb-cb5f-5cec-5c02-91b57a95b4db" + "id": "72d86188-25b1-3dfb-4909-9e2316c48d59" }, { "httpRequest": { "headers": {}, "method": "GET", - "path": "/api/v2/monitor/policy/fcd6f8ec-e53a-11ed-8b5f-da7ad0900002", + "path": "/api/v2/monitor/policy/7916e37f-b0fe-4f9d-bf9e-37ee3e7a5460", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy_type\":\"tag\",\"policy\":{\"tag_key_required\":false,\"tag_key\":\"testgetamonitorconfigurationpolicyreturnsokresponse1682627702\",\"valid_tag_values\":[\"prod\",\"staging\"]}},\"id\":\"fcd6f8ec-e53a-11ed-8b5f-da7ad0900002\"}}\n", + "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy_type\":\"tag\",\"policy\":{\"tag_key_required\":false,\"tag_key\":\"testgetamonitorconfigurationpolicyreturnsokresponse1748486178\",\"valid_tag_values\":[\"prod\",\"staging\"]}},\"id\":\"7916e37f-b0fe-4f9d-bf9e-37ee3e7a5460\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -53,13 +53,13 @@ "timeToLive": { "unlimited": true }, - "id": "da97e038-20a9-df98-e065-88ccf2c675f4" + "id": "64e4d84d-9a20-9622-937b-e4ad8cbdd6ff" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/policy/fcd6f8ec-e53a-11ed-8b5f-da7ad0900002", + "path": "/api/v2/monitor/policy/7916e37f-b0fe-4f9d-bf9e-37ee3e7a5460", "keepAlive": false, "secure": true }, @@ -78,6 +78,6 @@ "timeToLive": { "unlimited": true }, - "id": "70ef8bd5-0ed6-24d5-a0cc-e4293efdfc47" + "id": "31490beb-4e57-4545-7f8c-18292d74718c" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_Not_Found_response.freeze index 4d52b4ac383..6648dee66af 100644 --- a/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_Not_Found_response.freeze +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_Not_Found_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:52.213Z \ No newline at end of file +2025-05-29T02:36:19.291Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_OK_response.freeze index 23fa2591c91..0234c33b29e 100644 --- a/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_OK_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:52.537Z \ No newline at end of file +2025-05-29T02:36:19.434Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_OK_response.json index f637687d5af..b235aa4fb31 100644 --- a/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_notification_rule_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-get_a_monitor_notification_rule_returns_ok_response-1744280992\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-get_a_monitor_notification_rule_returns_ok_response-1748486179\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"created_at\":\"2025-04-10T10:29:52.938158+00:00\",\"filter\":{\"tags\":[\"app:test-get_a_monitor_notification_rule_returns_ok_response-1744280992\"]},\"recipients\":[\"slack-monitor-app\"],\"name\":\"test rule\",\"modified_at\":\"1970-01-01T00:00:00+00:00\"},\"id\":\"97afb4ac-6953-445f-9a0a-d225673449a6\",\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-04-07T20:19:46.118466+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"78f7ac92-7bba-4f1f-838f-a6fdc2a08778\",\"attributes\":{\"created_at\":\"2025-05-29T02:36:19.570654+00:00\",\"name\":\"test rule\",\"filter\":{\"tags\":[\"app:test-get_a_monitor_notification_rule_returns_ok_response-1748486179\"]},\"recipients\":[\"slack-monitor-app\"],\"modified_at\":\"1970-01-01T00:00:00+00:00\"},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-05-06T01:37:11.870914+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", "headers": { "Content-Type": [ "application/json" @@ -27,18 +27,18 @@ "timeToLive": { "unlimited": true }, - "id": "593cae6e-8ecc-720f-3d97-37e2a6c63bce" + "id": "ab270e10-295e-cc81-b844-9a7a8cf17fd8" }, { "httpRequest": { "headers": {}, "method": "GET", - "path": "/api/v2/monitor/notification_rule/97afb4ac-6953-445f-9a0a-d225673449a6", + "path": "/api/v2/monitor/notification_rule/78f7ac92-7bba-4f1f-838f-a6fdc2a08778", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"name\":\"test rule\",\"created_at\":\"2025-04-10T10:29:52.938158+00:00\",\"recipients\":[\"slack-monitor-app\"],\"filter\":{\"tags\":[\"app:test-get_a_monitor_notification_rule_returns_ok_response-1744280992\"]},\"modified_at\":\"2025-04-10T10:29:52.948837+00:00\"},\"id\":\"97afb4ac-6953-445f-9a0a-d225673449a6\"}}\n", + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"modified_at\":\"2025-05-29T02:36:19.582092+00:00\",\"created_at\":\"2025-05-29T02:36:19.570655+00:00\",\"recipients\":[\"slack-monitor-app\"],\"filter\":{\"tags\":[\"app:test-get_a_monitor_notification_rule_returns_ok_response-1748486179\"]},\"name\":\"test rule\"},\"id\":\"78f7ac92-7bba-4f1f-838f-a6fdc2a08778\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -53,13 +53,13 @@ "timeToLive": { "unlimited": true }, - "id": "13218d68-83b2-80c6-ceb6-9913c766f95b" + "id": "131e67fb-133e-aaa9-a09e-ad77136ea656" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/notification_rule/97afb4ac-6953-445f-9a0a-d225673449a6", + "path": "/api/v2/monitor/notification_rule/78f7ac92-7bba-4f1f-838f-a6fdc2a08778", "keepAlive": false, "secure": true }, @@ -78,6 +78,6 @@ "timeToLive": { "unlimited": true }, - "id": "d9e984e4-948b-aaa6-c707-88340a9b930f" + "id": "a274408d-894f-1807-e5df-e945b1459e87" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..958f77273b6 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:19.940Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_Not_Found_response.json new file mode 100644 index 00000000000..110d56b67ee --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_Not_Found_response.json @@ -0,0 +1,28 @@ +[ + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/monitor/template/00000000-0000-1234-0000-000000000000", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Monitor template not found\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "6a412447-8947-f80d-ced6-337eb798f916" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_OK_response.freeze new file mode 100644 index 00000000000..722dd6639ab --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:20.064Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_OK_response.json new file mode 100644 index 00000000000..cc5e0222b03 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_a_monitor_user_template_returns_OK_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"It's a threshold\",\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"category:test\"],\"template_variables\":[{\"available_values\":[],\"defaults\":[\"cats\"],\"name\":\"scope\"}],\"title\":\"api spec given template test-get_a_monitor_user_template_returns_ok_response-1748486180\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-user-template\",\"attributes\":{\"tags\":[\"category:test\"],\"created\":\"2025-05-29T02:36:20.380109+00:00\",\"title\":\"api spec given template test-get_a_monitor_user_template_returns_ok_response-1748486180\",\"version\":0,\"description\":\"It's a threshold\",\"template_variables\":[{\"defaults\":[\"cats\"],\"available_values\":[],\"name\":\"scope\"}],\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"modified\":\"2025-05-29T02:36:20.380109+00:00\",\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"},\"id\":\"90eb2b79-fc96-43a5-af65-bf4408f47d9d\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f0420c75-fab3-a68f-6ae4-6321d032a63a" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/monitor/template/90eb2b79-fc96-43a5-af65-bf4408f47d9d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-user-template\",\"attributes\":{\"created\":\"2025-05-29T02:36:20.380109+00:00\",\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"version\":0,\"tags\":[\"category:test\"],\"title\":\"api spec given template test-get_a_monitor_user_template_returns_ok_response-1748486180\",\"modified\":\"2025-05-29T02:36:20.380109+00:00\",\"monitor_definition\":{\"name\":\"High Error Rate on service\",\"type\":\"query alert\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"message\":\"cats\"},\"description\":\"It's a threshold\",\"template_variables\":[{\"defaults\":[\"cats\"],\"name\":\"scope\",\"available_values\":[]}]},\"id\":\"90eb2b79-fc96-43a5-af65-bf4408f47d9d\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c77e1a7d-a160-90bc-e9aa-ccac714759f2" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/template/90eb2b79-fc96-43a5-af65-bf4408f47d9d", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "f5cba157-3dec-f27e-0781-8ad7dcbe0c92" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_monitor_configuration_policies_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_all_monitor_configuration_policies_returns_OK_response.freeze index ad2811e9e93..2e9129e1749 100644 --- a/src/test/resources/cassettes/features/v2/Get_all_monitor_configuration_policies_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Get_all_monitor_configuration_policies_returns_OK_response.freeze @@ -1 +1 @@ -2023-04-27T20:35:03.574Z \ No newline at end of file +2025-05-29T02:36:20.663Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_monitor_configuration_policies_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_all_monitor_configuration_policies_returns_OK_response.json index faf67b4ba29..60ac09e6e82 100644 --- a/src/test/resources/cassettes/features/v2/Get_all_monitor_configuration_policies_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Get_all_monitor_configuration_policies_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testgetallmonitorconfigurationpoliciesreturnsokresponse1682627703\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" + "json": "{\"data\":{\"attributes\":{\"policy\":{\"tag_key\":\"testgetallmonitorconfigurationpoliciesreturnsokresponse1748486180\",\"tag_key_required\":false,\"valid_tag_values\":[\"prod\",\"staging\"]},\"policy_type\":\"tag\"},\"type\":\"monitor-config-policy\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy\":{\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key_required\":false,\"tag_key\":\"testgetallmonitorconfigurationpoliciesreturnsokresponse1682627703\"},\"policy_type\":\"tag\"},\"id\":\"fd3bfd14-e53a-11ed-975d-da7ad0900002\"}}\n", + "body": "{\"data\":{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy\":{\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key\":\"testgetallmonitorconfigurationpoliciesreturnsokresponse1748486180\",\"tag_key_required\":false},\"policy_type\":\"tag\"},\"id\":\"426917ea-f9b0-4c7d-938d-902208db50f8\"}}\n", "headers": { "Content-Type": [ "application/json" @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "d561b038-547c-904c-29c9-50c56b53a2ec" + "id": "4785ba76-3810-54e9-2223-e04927f0c4c5" }, { "httpRequest": { @@ -38,7 +38,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":[{\"type\":\"monitor-config-policy\",\"id\":\"fd3bfd14-e53a-11ed-975d-da7ad0900002\",\"attributes\":{\"policy\":{\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key_required\":false,\"tag_key\":\"testgetallmonitorconfigurationpoliciesreturnsokresponse1682627703\"},\"policy_type\":\"tag\"}}]}\n", + "body": "{\"data\":[{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy\":{\"valid_tag_values\":[\"value\"],\"tag_key\":\"tagKey\",\"tag_key_required\":false},\"policy_type\":\"tag\"},\"id\":\"2817dfb9-d616-4a75-8a6b-c34f20493b76\"},{\"type\":\"monitor-config-policy\",\"attributes\":{\"policy\":{\"valid_tag_values\":[\"prod\",\"staging\"],\"tag_key\":\"testgetallmonitorconfigurationpoliciesreturnsokresponse1748486180\",\"tag_key_required\":false},\"policy_type\":\"tag\"},\"id\":\"426917ea-f9b0-4c7d-938d-902208db50f8\"}]}\n", "headers": { "Content-Type": [ "application/json" @@ -59,7 +59,7 @@ "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/policy/fd3bfd14-e53a-11ed-975d-da7ad0900002", + "path": "/api/v2/monitor/policy/426917ea-f9b0-4c7d-938d-902208db50f8", "keepAlive": false, "secure": true }, @@ -78,6 +78,6 @@ "timeToLive": { "unlimited": true }, - "id": "505c2cbd-235b-8c7f-009a-12119c87d3e8" + "id": "1f1717d8-1246-028c-6a63-30053981aa93" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_monitor_notification_rules_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_all_monitor_notification_rules_returns_OK_response.freeze index 2681e367739..e92416751b5 100644 --- a/src/test/resources/cassettes/features/v2/Get_all_monitor_notification_rules_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Get_all_monitor_notification_rules_returns_OK_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:54.937Z \ No newline at end of file +2025-05-29T02:36:21.000Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_monitor_notification_rules_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_all_monitor_notification_rules_returns_OK_response.json index 01480b1d5d8..a6db0ad8a61 100644 --- a/src/test/resources/cassettes/features/v2/Get_all_monitor_notification_rules_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Get_all_monitor_notification_rules_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-get_all_monitor_notification_rules_returns_ok_response-1744280994\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-get_all_monitor_notification_rules_returns_ok_response-1748486181\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"name\":\"test rule\",\"filter\":{\"tags\":[\"app:test-get_all_monitor_notification_rules_returns_ok_response-1744280994\"]},\"recipients\":[\"slack-monitor-app\"],\"modified_at\":\"1970-01-01T00:00:00+00:00\",\"created_at\":\"2025-04-10T10:29:55.362004+00:00\"},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}},\"id\":\"b7122864-6517-45d3-8dc1-f226a08dd8f4\"},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-04-07T20:19:46.118466+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"created_at\":\"2025-05-29T02:36:21.133807+00:00\",\"filter\":{\"tags\":[\"app:test-get_all_monitor_notification_rules_returns_ok_response-1748486181\"]},\"modified_at\":\"1970-01-01T00:00:00+00:00\",\"recipients\":[\"slack-monitor-app\"],\"name\":\"test rule\"},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}},\"id\":\"dbb04d74-98e6-4f3b-905b-f42d7f0cd9e3\"},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-05-06T01:37:11.870914+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", "headers": { "Content-Type": [ "application/json" @@ -27,7 +27,7 @@ "timeToLive": { "unlimited": true }, - "id": "4231adbc-f9e7-f24e-f44b-96ee4320eb78" + "id": "1f286d5b-87f8-efa6-5c89-5f06adbf445c" }, { "httpRequest": { @@ -38,7 +38,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":[{\"type\":\"monitor-notification-rule\",\"attributes\":{\"filter\":{\"tags\":[\"app:test-get_all_monitor_notification_rules_returns_ok_response-1744280994\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"],\"modified_at\":\"2025-04-10T10:29:55.373154+00:00\",\"created_at\":\"2025-04-10T10:29:55.362004+00:00\"},\"id\":\"b7122864-6517-45d3-8dc1-f226a08dd8f4\"}]}\n", + "body": "{\"data\":[{\"type\":\"monitor-notification-rule\",\"attributes\":{\"created_at\":\"2025-05-29T02:36:21.133807+00:00\",\"filter\":{\"tags\":[\"app:test-get_all_monitor_notification_rules_returns_ok_response-1748486181\"]},\"recipients\":[\"slack-monitor-app\"],\"modified_at\":\"2025-05-29T02:36:21.141964+00:00\",\"name\":\"test rule\"},\"id\":\"dbb04d74-98e6-4f3b-905b-f42d7f0cd9e3\"}]}\n", "headers": { "Content-Type": [ "application/json" @@ -59,7 +59,7 @@ "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/notification_rule/b7122864-6517-45d3-8dc1-f226a08dd8f4", + "path": "/api/v2/monitor/notification_rule/dbb04d74-98e6-4f3b-905b-f42d7f0cd9e3", "keepAlive": false, "secure": true }, @@ -78,6 +78,6 @@ "timeToLive": { "unlimited": true }, - "id": "9f8eb621-10d7-51ea-8e56-0410896e60e9" + "id": "5c2516a3-f5a6-35cf-0cb2-d4b700cb3272" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_monitor_user_templates_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Get_all_monitor_user_templates_returns_OK_response.freeze new file mode 100644 index 00000000000..fd52edc3bce --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_monitor_user_templates_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:21.470Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Get_all_monitor_user_templates_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Get_all_monitor_user_templates_returns_OK_response.json new file mode 100644 index 00000000000..9fdd58d43ea --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Get_all_monitor_user_templates_returns_OK_response.json @@ -0,0 +1,83 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"It's a threshold\",\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"category:test\"],\"template_variables\":[{\"available_values\":[],\"defaults\":[\"cats\"],\"name\":\"scope\"}],\"title\":\"api spec given template test-get_all_monitor_user_templates_returns_ok_response-1748486181\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-user-template\",\"attributes\":{\"description\":\"It's a threshold\",\"created\":\"2025-05-29T02:36:21.696273+00:00\",\"template_variables\":[{\"available_values\":[],\"defaults\":[\"cats\"],\"name\":\"scope\"}],\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"version\":0,\"tags\":[\"category:test\"],\"modified\":\"2025-05-29T02:36:21.696273+00:00\",\"title\":\"api spec given template test-get_all_monitor_user_templates_returns_ok_response-1748486181\",\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"}},\"id\":\"900b870a-1f9d-4b6c-95b7-9859bbb0a778\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "18c7f673-57e0-eb4f-7038-2467a82c6d06" + }, + { + "httpRequest": { + "headers": {}, + "method": "GET", + "path": "/api/v2/monitor/template", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":[{\"type\":\"monitor-user-template\",\"attributes\":{\"created\":\"2025-05-29T02:36:21.696273+00:00\",\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"version\":0,\"tags\":[\"category:test\"],\"title\":\"api spec given template test-get_all_monitor_user_templates_returns_ok_response-1748486181\",\"modified\":\"2025-05-29T02:36:21.696273+00:00\",\"monitor_definition\":{\"name\":\"High Error Rate on service\",\"type\":\"query alert\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"message\":\"cats\"},\"description\":\"It's a threshold\",\"template_variables\":[{\"defaults\":[\"cats\"],\"name\":\"scope\",\"available_values\":[]}]},\"id\":\"900b870a-1f9d-4b6c-95b7-9859bbb0a778\"}]}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "562225db-c581-6227-28a2-1773abd0c05e" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/template/900b870a-1f9d-4b6c-95b7-9859bbb0a778", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "50be29aa-2786-5d63-0c9d-7cc0238bc70f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Bad_Request_response.freeze index c547acf2ee0..5e9f21486df 100644 --- a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Bad_Request_response.freeze +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Bad_Request_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:56.210Z \ No newline at end of file +2025-05-29T02:36:21.941Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Bad_Request_response.json index 8665dc95916..62a77b5f47b 100644 --- a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Bad_Request_response.json +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Bad_Request_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_returns_bad_request_response-1744280996\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_returns_bad_request_response-1748486181\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_returns_bad_request_response-1744280996\"]},\"created_at\":\"2025-04-10T10:29:56.523436+00:00\",\"recipients\":[\"slack-monitor-app\"],\"name\":\"test rule\",\"modified_at\":\"1970-01-01T00:00:00+00:00\"},\"id\":\"f26ba0a6-1e84-4984-b061-4172a25a1332\",\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-04-07T20:19:46.118466+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"name\":\"test rule\",\"created_at\":\"2025-05-29T02:36:22.099271+00:00\",\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_returns_bad_request_response-1748486181\"]},\"recipients\":[\"slack-monitor-app\"],\"modified_at\":\"1970-01-01T00:00:00+00:00\"},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}},\"id\":\"571a01f1-8f6f-4792-9f4a-0aa99f9b2365\"},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-05-06T01:37:11.870914+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", "headers": { "Content-Type": [ "application/json" @@ -27,17 +27,17 @@ "timeToLive": { "unlimited": true }, - "id": "dc68b267-3b60-6e54-9c23-8bc58515432e" + "id": "4e92ac56-598b-6991-503e-6d824f97a785" }, { "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_returns_bad_request_response-1744280996\",\"host:abc\"]},\"name\":\"updated rule\",\"recipients\":[\"@slack-test-channel\"]},\"id\":\"f26ba0a6-1e84-4984-b061-4172a25a1332\",\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_returns_bad_request_response-1748486181\",\"host:abc\"]},\"name\":\"updated rule\",\"recipients\":[\"@slack-test-channel\"]},\"id\":\"571a01f1-8f6f-4792-9f4a-0aa99f9b2365\",\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "PATCH", - "path": "/api/v2/monitor/notification_rule/f26ba0a6-1e84-4984-b061-4172a25a1332", + "path": "/api/v2/monitor/notification_rule/571a01f1-8f6f-4792-9f4a-0aa99f9b2365", "keepAlive": false, "secure": true }, @@ -57,13 +57,13 @@ "timeToLive": { "unlimited": true }, - "id": "57bf6c51-f4db-330f-379d-7d3e18591084" + "id": "d80aa034-6e6d-4e40-8a1a-cdb19c9dba13" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/notification_rule/f26ba0a6-1e84-4984-b061-4172a25a1332", + "path": "/api/v2/monitor/notification_rule/571a01f1-8f6f-4792-9f4a-0aa99f9b2365", "keepAlive": false, "secure": true }, @@ -82,6 +82,6 @@ "timeToLive": { "unlimited": true }, - "id": "64bffc53-e078-952e-2d43-bfbd00d555dc" + "id": "e0d12c48-24ac-7b48-9497-18b168cbcd68" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Not_Found_response.freeze index 2eae355308b..37ff149ae90 100644 --- a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Not_Found_response.freeze +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Not_Found_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:57.263Z \ No newline at end of file +2025-05-29T02:36:22.374Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Not_Found_response.json index 9d1212e64d0..138c0fdcb3d 100644 --- a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Not_Found_response.json +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_Not_Found_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_returns_not_found_response-1744280997\",\"host:abc\"]},\"name\":\"updated rule\",\"recipients\":[\"slack-test-channel\",\"jira-test\"]},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_returns_not_found_response-1748486182\",\"host:abc\"]},\"name\":\"updated rule\",\"recipients\":[\"slack-test-channel\",\"jira-test\"]},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "PATCH", @@ -27,6 +27,6 @@ "timeToLive": { "unlimited": true }, - "id": "628841ca-a128-299d-5e13-8b1a9470b263" + "id": "a9de509d-62f4-9d26-1eff-21d4a2437bd3" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_OK_response.freeze index b7d42a44890..c2c5ef4ceb1 100644 --- a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_OK_response.freeze +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_OK_response.freeze @@ -1 +1 @@ -2025-04-10T10:29:57.629Z \ No newline at end of file +2025-05-29T02:36:22.508Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_OK_response.json index c08d53de830..6c257db516e 100644 --- a/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_OK_response.json +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_notification_rule_returns_OK_response.json @@ -3,7 +3,7 @@ "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_returns_ok_response-1744280997\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_returns_ok_response-1748486182\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "POST", @@ -12,7 +12,7 @@ "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"],\"modified_at\":\"1970-01-01T00:00:00+00:00\",\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_returns_ok_response-1744280997\"]},\"created_at\":\"2025-04-10T10:29:57.930349+00:00\"},\"id\":\"da2c8a3b-94ea-49be-a85b-39c5eff99d6a\",\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-04-07T20:19:46.118466+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"modified_at\":\"1970-01-01T00:00:00+00:00\",\"created_at\":\"2025-05-29T02:36:22.625956+00:00\",\"filter\":{\"tags\":[\"app:test-update_a_monitor_notification_rule_returns_ok_response-1748486182\"]},\"name\":\"test rule\",\"recipients\":[\"slack-monitor-app\"]},\"id\":\"48a37c74-cf93-488c-b070-210d650b5687\",\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-05-06T01:37:11.870914+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", "headers": { "Content-Type": [ "application/json" @@ -27,22 +27,22 @@ "timeToLive": { "unlimited": true }, - "id": "a98f8ac4-d010-c01c-7e07-bc74f9c6448f" + "id": "61afae98-d999-1f21-37f6-5b260be78349" }, { "httpRequest": { "body": { "type": "JSON", - "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_returns_ok_response-1744280997\",\"host:abc\"]},\"name\":\"updated rule\",\"recipients\":[\"slack-test-channel\"]},\"id\":\"da2c8a3b-94ea-49be-a85b-39c5eff99d6a\",\"type\":\"monitor-notification-rule\"}}" + "json": "{\"data\":{\"attributes\":{\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_returns_ok_response-1748486182\",\"host:abc\"]},\"name\":\"updated rule\",\"recipients\":[\"slack-test-channel\"]},\"id\":\"48a37c74-cf93-488c-b070-210d650b5687\",\"type\":\"monitor-notification-rule\"}}" }, "headers": {}, "method": "PATCH", - "path": "/api/v2/monitor/notification_rule/da2c8a3b-94ea-49be-a85b-39c5eff99d6a", + "path": "/api/v2/monitor/notification_rule/48a37c74-cf93-488c-b070-210d650b5687", "keepAlive": false, "secure": true }, "httpResponse": { - "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"id\":\"da2c8a3b-94ea-49be-a85b-39c5eff99d6a\",\"attributes\":{\"modified_at\":\"2025-04-10T10:29:58.320928+00:00\",\"recipients\":[\"slack-test-channel\"],\"name\":\"updated rule\",\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_returns_ok_response-1744280997\",\"host:abc\"]},\"created_at\":\"2025-04-10T10:29:57.930349+00:00\"},\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-04-07T20:19:46.118466+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", + "body": "{\"data\":{\"type\":\"monitor-notification-rule\",\"attributes\":{\"recipients\":[\"slack-test-channel\"],\"modified_at\":\"2025-05-29T02:36:22.798426+00:00\",\"name\":\"updated rule\",\"filter\":{\"tags\":[\"test:test-update_a_monitor_notification_rule_returns_ok_response-1748486182\",\"host:abc\"]},\"created_at\":\"2025-05-29T02:36:22.625956+00:00\"},\"id\":\"48a37c74-cf93-488c-b070-210d650b5687\",\"relationships\":{\"created_by\":{\"data\":{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\"}}}},\"included\":[{\"type\":\"users\",\"id\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"attributes\":{\"name\":\"frog\",\"handle\":\"frog@datadoghq.com\",\"created_at\":\"2019-10-02T08:15:39.795051+00:00\",\"modified_at\":\"2025-05-06T01:37:11.870914+00:00\",\"email\":\"frog@datadoghq.com\",\"icon\":\"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro\",\"title\":null,\"verified\":true,\"service_account\":false,\"disabled\":false,\"allowed_login_methods\":[],\"status\":\"Active\"}}]}\n", "headers": { "Content-Type": [ "application/json" @@ -57,13 +57,13 @@ "timeToLive": { "unlimited": true }, - "id": "5d8a915a-d4fb-ca3f-07db-dbf76f88609f" + "id": "66a3b972-21ce-2687-3596-39b061c3daf2" }, { "httpRequest": { "headers": {}, "method": "DELETE", - "path": "/api/v2/monitor/notification_rule/da2c8a3b-94ea-49be-a85b-39c5eff99d6a", + "path": "/api/v2/monitor/notification_rule/48a37c74-cf93-488c-b070-210d650b5687", "keepAlive": false, "secure": true }, @@ -82,6 +82,6 @@ "timeToLive": { "unlimited": true }, - "id": "730c60e4-fa7f-30e5-8a1a-146641ea7397" + "id": "a61fe2eb-8985-ff53-5dac-642b9a1b9efc" } ] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..a212bb13287 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:22.996Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Bad_Request_response.json new file mode 100644 index 00000000000..510260ba33f --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Bad_Request_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"It's a threshold\",\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"category:test\"],\"template_variables\":[{\"available_values\":[],\"defaults\":[\"cats\"],\"name\":\"scope\"}],\"title\":\"api spec given template test-update_a_monitor_user_template_to_a_new_version_returns_bad_request_response-1748486182\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-user-template\",\"attributes\":{\"version\":0,\"created\":\"2025-05-29T02:36:23.224659+00:00\",\"template_variables\":[{\"available_values\":[],\"name\":\"scope\",\"defaults\":[\"cats\"]}],\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"title\":\"api spec given template test-update_a_monitor_user_template_to_a_new_version_returns_bad_request_response-1748486182\",\"description\":\"It's a threshold\",\"tags\":[\"category:test\"],\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"modified\":\"2025-05-29T02:36:23.224659+00:00\"},\"id\":\"a68243ec-7e1c-40da-a99d-8966282c3726\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5f7c7e0e-7548-cae7-657e-7b0cb01071e2" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-update_a_monitor_user_template_to_a_new_version_returns_bad_request_response-1748486182\"},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/monitor/template/a68243ec-7e1c-40da-a99d-8966282c3726", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid monitor_definition or template variables: Monitor definition cannot be empty.\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ba10741e-3fbd-d0be-47a8-66aa776ab89f" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/template/a68243ec-7e1c-40da-a99d-8966282c3726", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "c1fe368b-d92a-189e-658b-c07fb32b79cf" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..ab9a0c9a5ac --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:23.616Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Not_Found_response.json new file mode 100644 index 00000000000..a220609b666 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{\"message\":\"A msg.\",\"name\":\"A name test-update_a_monitor_user_template_to_a_new_version_returns_not_found_response-1748486183\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-update_a_monitor_user_template_to_a_new_version_returns_not_found_response-1748486183\"},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/monitor/template/00000000-0000-1234-0000-000000000000", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Monitor template not found\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "49265aee-fbf0-7b74-3b93-7d14e665bc81" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_OK_response.freeze new file mode 100644 index 00000000000..5eb2e193484 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:23.765Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_OK_response.json new file mode 100644 index 00000000000..8123a248ad2 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_a_monitor_user_template_to_a_new_version_returns_OK_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"It's a threshold\",\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"category:test\"],\"template_variables\":[{\"available_values\":[],\"defaults\":[\"cats\"],\"name\":\"scope\"}],\"title\":\"api spec given template test-update_a_monitor_user_template_to_a_new_version_returns_ok_response-1748486183\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-user-template\",\"attributes\":{\"template_variables\":[{\"name\":\"scope\",\"available_values\":[],\"defaults\":[\"cats\"]}],\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"created\":\"2025-05-29T02:36:23.954533+00:00\",\"modified\":\"2025-05-29T02:36:23.954533+00:00\",\"version\":0,\"title\":\"api spec given template test-update_a_monitor_user_template_to_a_new_version_returns_ok_response-1748486183\",\"tags\":[\"category:test\"],\"description\":\"It's a threshold\"},\"id\":\"fefd62df-924a-4438-a697-f7e6ccbad77e\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "aa114b0f-169c-f487-f4b2-341b51774ad4" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{\"message\":\"A msg.\",\"name\":\"A name test-update_a_monitor_user_template_to_a_new_version_returns_ok_response-1748486183\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-update_a_monitor_user_template_to_a_new_version_returns_ok_response-1748486183\"},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/monitor/template/fefd62df-924a-4438-a697-f7e6ccbad77e", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-user-template\",\"attributes\":{\"title\":\"Postgres DB test-update_a_monitor_user_template_to_a_new_version_returns_ok_response-1748486183\",\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"modified\":\"2025-05-29T02:36:24.215009+00:00\",\"version\":1,\"description\":\"A description.\",\"versions\":[{\"title\":\"api spec given template test-update_a_monitor_user_template_to_a_new_version_returns_ok_response-1748486183\",\"version\":0,\"description\":\"It's a threshold\",\"id\":\"fefd62df-924a-4438-a697-f7e6ccbad77e\",\"created\":\"2025-05-29T02:36:23.954533+00:00\",\"monitor_definition\":{\"name\":\"High Error Rate on service\",\"type\":\"query alert\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"message\":\"cats\"},\"template_variables\":[{\"defaults\":[\"cats\"],\"available_values\":[],\"name\":\"scope\"}],\"tags\":[\"category:test\"]},{\"title\":\"Postgres DB test-update_a_monitor_user_template_to_a_new_version_returns_ok_response-1748486183\",\"version\":1,\"description\":\"A description.\",\"id\":\"5e4cd0de-4940-4060-8ffd-2ff13a0b3f5e\",\"created\":\"2025-05-29T02:36:23.954533+00:00\",\"monitor_definition\":{\"name\":\"A name test-update_a_monitor_user_template_to_a_new_version_returns_ok_response-1748486183\",\"type\":\"query alert\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"message\":\"A msg.\"},\"template_variables\":[{\"defaults\":[\"defaultValue\"],\"available_values\":[\"value1\",\"value2\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"tags\":[\"integration:Azure\"]}],\"created\":\"2025-05-29T02:36:23.954533+00:00\",\"monitor_definition\":{\"message\":\"A msg.\",\"name\":\"A name test-update_a_monitor_user_template_to_a_new_version_returns_ok_response-1748486183\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"template_variables\":[{\"defaults\":[\"defaultValue\"],\"available_values\":[\"value1\",\"value2\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"tags\":[\"integration:Azure\"]},\"id\":\"fefd62df-924a-4438-a697-f7e6ccbad77e\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "8f1bb6ea-78bd-d7f2-1e89-ff3248aa5817" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/template/fefd62df-924a-4438-a697-f7e6ccbad77e", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5eec2035-24bb-9530-a8e0-991d5abee3f4" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..d87de5207ba --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:24.411Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_Bad_Request_response.json new file mode 100644 index 00000000000..39276cf5774 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_Bad_Request_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-validate_a_monitor_user_template_returns_bad_request_response-1748486184\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template/validate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid monitor_definition or template variables: Monitor definition cannot be empty.\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "516b3efa-66db-0ada-454f-d38a46ed246f" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_OK_response.freeze new file mode 100644 index 00000000000..31ae01fbc05 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:24.538Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_OK_response.json new file mode 100644 index 00000000000..cfc3cfcb63b --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_a_monitor_user_template_returns_OK_response.json @@ -0,0 +1,31 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{\"message\":\"A msg.\",\"name\":\"A name test-validate_a_monitor_user_template_returns_ok_response-1748486184\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-validate_a_monitor_user_template_returns_ok_response-1748486184\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template/validate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "834da5c5-d0cd-4ac6-96c6-b65e3d0b737e" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Bad_Request_response.freeze b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..e32f4a20fc3 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:24.721Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Bad_Request_response.json b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Bad_Request_response.json new file mode 100644 index 00000000000..82eb47c48db --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Bad_Request_response.json @@ -0,0 +1,87 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"It's a threshold\",\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"category:test\"],\"template_variables\":[{\"available_values\":[],\"defaults\":[\"cats\"],\"name\":\"scope\"}],\"title\":\"api spec given template test-validate_an_existing_monitor_user_template_returns_bad_request_response-1748486184\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-user-template\",\"attributes\":{\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"category:test\"],\"created\":\"2025-05-29T02:36:24.928104+00:00\",\"modified\":\"2025-05-29T02:36:24.928104+00:00\",\"title\":\"api spec given template test-validate_an_existing_monitor_user_template_returns_bad_request_response-1748486184\",\"version\":0,\"template_variables\":[{\"name\":\"scope\",\"defaults\":[\"cats\"],\"available_values\":[]}],\"description\":\"It's a threshold\"},\"id\":\"599fecff-7834-42bd-976b-c2d145f42579\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "ddfc78f4-a566-1d0d-1134-3323017fd741" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-validate_an_existing_monitor_user_template_returns_bad_request_response-1748486184\"},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template/599fecff-7834-42bd-976b-c2d145f42579/validate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Invalid monitor_definition or template variables: Monitor definition cannot be empty.\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 400, + "reasonPhrase": "Bad Request" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "76e50755-e254-da14-2814-97ac556b6d92" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/template/599fecff-7834-42bd-976b-c2d145f42579", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "3c5ab1e3-12b9-a3ff-baf3-41fc65bf7896" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Not_Found_response.freeze b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..5262ab4af97 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:25.252Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Not_Found_response.json b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Not_Found_response.json new file mode 100644 index 00000000000..add5af0408d --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_Not_Found_response.json @@ -0,0 +1,32 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{\"message\":\"A msg.\",\"name\":\"A name test-validate_an_existing_monitor_user_template_returns_not_found_response-1748486185\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-validate_an_existing_monitor_user_template_returns_not_found_response-1748486185\"},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template/00000000-0000-1234-0000-000000000000/validate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"errors\":[\"Monitor template not found\"]}", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 404, + "reasonPhrase": "Not Found" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2d5f324f-cfb4-4b04-2c79-d4d6aea0f37c" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_OK_response.freeze new file mode 100644 index 00000000000..84fcf64770a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-05-29T02:36:25.384Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_OK_response.json new file mode 100644 index 00000000000..90b12a7845a --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Validate_an_existing_monitor_user_template_returns_OK_response.json @@ -0,0 +1,86 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"It's a threshold\",\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"category:test\"],\"template_variables\":[{\"available_values\":[],\"defaults\":[\"cats\"],\"name\":\"scope\"}],\"title\":\"api spec given template test-validate_an_existing_monitor_user_template_returns_ok_response-1748486185\"},\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"data\":{\"type\":\"monitor-user-template\",\"attributes\":{\"created\":\"2025-05-29T02:36:25.594440+00:00\",\"version\":0,\"description\":\"It's a threshold\",\"tags\":[\"category:test\"],\"modified\":\"2025-05-29T02:36:25.594440+00:00\",\"template_variables\":[{\"defaults\":[\"cats\"],\"available_values\":[],\"name\":\"scope\"}],\"creator_uuid\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"monitor_definition\":{\"message\":\"cats\",\"name\":\"High Error Rate on service\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"title\":\"api spec given template test-validate_an_existing_monitor_user_template_returns_ok_response-1748486185\"},\"id\":\"dc86b1ba-9e7c-40cf-8859-777c53e4f1a2\"}}\n", + "headers": { + "Content-Type": [ + "application/json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a1f1ed04-0686-1a63-df03-201b95f61c3c" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"data\":{\"attributes\":{\"description\":\"A description.\",\"monitor_definition\":{\"message\":\"A msg.\",\"name\":\"A name test-validate_an_existing_monitor_user_template_returns_ok_response-1748486185\",\"query\":\"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\"type\":\"query alert\"},\"tags\":[\"integration:Azure\"],\"template_variables\":[{\"available_values\":[\"value1\",\"value2\"],\"defaults\":[\"defaultValue\"],\"name\":\"regionName\",\"tag_key\":\"datacenter\"}],\"title\":\"Postgres DB test-validate_an_existing_monitor_user_template_returns_ok_response-1748486185\"},\"id\":\"00000000-0000-1234-0000-000000000000\",\"type\":\"monitor-user-template\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/monitor/template/dc86b1ba-9e7c-40cf-8859-777c53e4f1a2/validate", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "44843b13-a4fb-bc2b-9a6f-4b0cc7939173" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/monitor/template/dc86b1ba-9e7c-40cf-8859-777c53e4f1a2", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": { + "Content-Type": [ + "text/html; charset=utf-8" + ] + }, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "cca70ead-64a7-b4e9-48c8-27025fee95f4" + } +] \ No newline at end of file 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 85541755d9e..9a7a5557689 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 @@ -484,6 +484,18 @@ "tag": "Monitors", "operationId": "CreateMonitorConfigPolicy" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"monitor-user-template\",\n \"attributes\": {\n \"description\": \"It's a threshold\",\n \"title\": \"api spec given template {{ unique_lower }}\",\n \"monitor_definition\": {\n \"message\": \"cats\",\n \"name\": \"High Error Rate on service\",\n \"query\": \"avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100\",\n \"type\": \"query alert\"\n },\n \"template_variables\": [{\"name\": \"scope\", \"available_values\": [], \"defaults\": [\"cats\"]}],\n \"tags\": [\"category:test\"]\n }\n }\n}" + } + ], + "step": "there is a valid \"monitor_user_template\" in the system", + "key": "monitor_user_template", + "tag": "Monitors", + "operationId": "CreateMonitorUserTemplate" + }, { "parameters": [ { diff --git a/src/test/resources/com/datadog/api/client/v2/api/monitors.feature b/src/test/resources/com/datadog/api/client/v2/api/monitors.feature index 5620258697d..ddc106e02b9 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/monitors.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/monitors.feature @@ -46,6 +46,22 @@ Feature: Monitors Then the response status is 200 OK And the response "data.attributes.name" is equal to "test rule" + @skip-validation @team:DataDog/monitor-app + Scenario: Create a monitor user template returns "Bad Request" response + Given new "CreateMonitorUserTemplate" request + And operation "CreateMonitorUserTemplate" enabled + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "type": "monitor-user-template"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/monitor-app + Scenario: Create a monitor user template returns "OK" response + Given new "CreateMonitorUserTemplate" request + And operation "CreateMonitorUserTemplate" enabled + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {"message": "A msg.", "name": "A name {{ unique_lower }}", "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100", "type": "query alert"}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "type": "monitor-user-template"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/monitor-app Scenario: Delete a monitor configuration policy returns "Bad Request" response Given new "DeleteMonitorConfigPolicy" request @@ -85,6 +101,22 @@ Feature: Monitors When the request is sent Then the response status is 204 OK + @team:DataDog/monitor-app + Scenario: Delete a monitor user template returns "Not Found" response + Given new "DeleteMonitorUserTemplate" request + And operation "DeleteMonitorUserTemplate" enabled + And request contains "template_id" parameter with value "00000000-0000-1234-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/monitor-app + Scenario: Delete a monitor user template returns "OK" response + Given operation "DeleteMonitorUserTemplate" enabled + And new "DeleteMonitorUserTemplate" request + And request contains "template_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 204 OK + @team:DataDog/monitor-app Scenario: Edit a monitor configuration policy returns "Not Found" response Given new "UpdateMonitorConfigPolicy" request @@ -154,6 +186,24 @@ Feature: Monitors Then the response status is 200 OK And the response "data.attributes.name" is equal to "test rule" + @team:DataDog/monitor-app + Scenario: Get a monitor user template returns "Not Found" response + Given new "GetMonitorUserTemplate" request + And operation "GetMonitorUserTemplate" enabled + And request contains "template_id" parameter with value "00000000-0000-1234-0000-000000000000" + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/monitor-app + Scenario: Get a monitor user template returns "OK" response + Given there is a valid "monitor_user_template" in the system + And new "GetMonitorUserTemplate" request + And operation "GetMonitorUserTemplate" enabled + And request contains "template_id" parameter from "monitor_user_template.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.type" is equal to "monitor-user-template" + @team:DataDog/monitor-app Scenario: Get all monitor configuration policies returns "OK" response Given there is a valid "monitor_configuration_policy" in the system @@ -176,6 +226,15 @@ Feature: Monitors And the response "data" has length 1 And the response "data" has item with field "attributes.name" with value "test rule" + @team:DataDog/monitor-app + Scenario: Get all monitor user templates returns "OK" response + Given there is a valid "monitor_user_template" in the system + And new "ListMonitorUserTemplates" request + And operation "ListMonitorUserTemplates" enabled + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + @skip-validation @team:DataDog/monitor-app Scenario: Update a monitor notification rule returns "Bad Request" response Given operation "UpdateMonitorNotificationRule" enabled @@ -205,3 +264,77 @@ Feature: Monitors When the request is sent Then the response status is 200 OK And the response "data.attributes.name" is equal to "updated rule" + + @skip-validation @team:DataDog/monitor-app + Scenario: Update a monitor user template to a new version returns "Bad Request" response + Given there is a valid "monitor_user_template" in the system + And operation "UpdateMonitorUserTemplate" enabled + And new "UpdateMonitorUserTemplate" request + And request contains "template_id" parameter from "monitor_user_template.data.id" + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "id": "00000000-0000-1234-0000-000000000000", "type": "monitor-user-template"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/monitor-app + Scenario: Update a monitor user template to a new version returns "Not Found" response + Given new "UpdateMonitorUserTemplate" request + And operation "UpdateMonitorUserTemplate" enabled + And request contains "template_id" parameter with value "00000000-0000-1234-0000-000000000000" + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {"message": "A msg.", "name": "A name {{ unique_lower }}", "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100", "type": "query alert"}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "id": "00000000-0000-1234-0000-000000000000", "type": "monitor-user-template"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/monitor-app + Scenario: Update a monitor user template to a new version returns "OK" response + Given there is a valid "monitor_user_template" in the system + And new "UpdateMonitorUserTemplate" request + And operation "UpdateMonitorUserTemplate" enabled + And request contains "template_id" parameter from "monitor_user_template.data.id" + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {"message": "A msg.", "name": "A name {{ unique_lower }}", "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100", "type": "query alert"}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "id": "00000000-0000-1234-0000-000000000000", "type": "monitor-user-template"}} + When the request is sent + Then the response status is 200 OK + + @skip-validation @team:DataDog/monitor-app + Scenario: Validate a monitor user template returns "Bad Request" response + Given new "ValidateMonitorUserTemplate" request + And operation "ValidateMonitorUserTemplate" enabled + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "type": "monitor-user-template"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/monitor-app + Scenario: Validate a monitor user template returns "OK" response + Given new "ValidateMonitorUserTemplate" request + And operation "ValidateMonitorUserTemplate" enabled + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {"message": "A msg.", "name": "A name {{ unique_lower }}", "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100", "type": "query alert"}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "type": "monitor-user-template"}} + When the request is sent + Then the response status is 204 OK + + @skip-validation @team:DataDog/monitor-app + Scenario: Validate an existing monitor user template returns "Bad Request" response + Given there is a valid "monitor_user_template" in the system + And new "ValidateExistingMonitorUserTemplate" request + And operation "ValidateExistingMonitorUserTemplate" enabled + And request contains "template_id" parameter from "monitor_user_template.data.id" + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "id": "00000000-0000-1234-0000-000000000000", "type": "monitor-user-template"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/monitor-app + Scenario: Validate an existing monitor user template returns "Not Found" response + Given new "ValidateExistingMonitorUserTemplate" request + And operation "ValidateExistingMonitorUserTemplate" enabled + And request contains "template_id" parameter with value "00000000-0000-1234-0000-000000000000" + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {"message": "A msg.", "name": "A name {{ unique_lower }}", "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100", "type": "query alert"}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "id": "00000000-0000-1234-0000-000000000000", "type": "monitor-user-template"}} + When the request is sent + Then the response status is 404 Not Found + + @team:DataDog/monitor-app + Scenario: Validate an existing monitor user template returns "OK" response + Given there is a valid "monitor_user_template" in the system + And new "ValidateExistingMonitorUserTemplate" request + And operation "ValidateExistingMonitorUserTemplate" enabled + And request contains "template_id" parameter from "monitor_user_template.data.id" + And body with value {"data": {"attributes": {"description": "A description.", "monitor_definition": {"message": "A msg.", "name": "A name {{ unique_lower }}", "query": "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100", "type": "query alert"}, "tags": ["integration:Azure"], "template_variables": [{"available_values": ["value1", "value2"], "defaults": ["defaultValue"], "name": "regionName", "tag_key": "datacenter"}], "title": "Postgres DB {{ unique_lower }}"}, "id": "00000000-0000-1234-0000-000000000000", "type": "monitor-user-template"}} + When the request is sent + Then the response status is 204 OK 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 e81cb7b7ce1..761a726fc68 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 @@ -1884,6 +1884,55 @@ "type": "idempotent" } }, + "ListMonitorUserTemplates": { + "tag": "Monitors", + "undo": { + "type": "safe" + } + }, + "CreateMonitorUserTemplate": { + "tag": "Monitors", + "undo": { + "operationId": "DeleteMonitorUserTemplate", + "parameters": [ + { + "name": "template_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "ValidateMonitorUserTemplate": { + "tag": "Monitors", + "undo": { + "type": "idempotent" + } + }, + "DeleteMonitorUserTemplate": { + "tag": "Monitors", + "undo": { + "type": "idempotent" + } + }, + "GetMonitorUserTemplate": { + "tag": "Monitors", + "undo": { + "type": "safe" + } + }, + "UpdateMonitorUserTemplate": { + "tag": "Monitors", + "undo": { + "type": "idempotent" + } + }, + "ValidateExistingMonitorUserTemplate": { + "tag": "Monitors", + "undo": { + "type": "idempotent" + } + }, "ListMonitorDowntimes": { "tag": "Downtimes", "undo": {