diff --git a/.apigentools-info b/.apigentools-info index af060411d1..349148b6b4 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:47.832678", - "spec_repo_commit": "837c2656" + "regenerated": "2025-06-24 13:19:24.810779", + "spec_repo_commit": "8772660e" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2025-06-23 20:34:47.969661", - "spec_repo_commit": "837c2656" + "regenerated": "2025-06-24 13:19:24.828140", + "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 115918b18d..6f33dcc74d 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/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 220067a1f4..6f46b12883 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -10154,6 +10154,104 @@ datadog\_api\_client.v2.model.monitor\_type module :members: :show-inheritance: +datadog\_api\_client.v2.model.monitor\_user\_template module +------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.monitor_user_template + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_create\_data module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_create_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_create\_request module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_create_request + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_create\_response module +------------------------------------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_create_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_list\_response module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_list_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_request\_attributes module +--------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_request_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_resource\_type module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_resource_type + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_response module +---------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_response + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_response\_attributes module +---------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_response_attributes + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_response\_data module +---------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_response_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_response\_data\_with\_versions module +-------------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_response_data_with_versions + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_template\_variables\_items module +---------------------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_template_variables_items + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_update\_data module +-------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_update_data + :members: + :show-inheritance: + +datadog\_api\_client.v2.model.monitor\_user\_template\_update\_request module +----------------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.monitor_user_template_update_request + :members: + :show-inheritance: + datadog\_api\_client.v2.model.monthly\_cost\_attribution\_attributes module --------------------------------------------------------------------------- @@ -15908,6 +16006,13 @@ datadog\_api\_client.v2.model.shift\_included module :members: :show-inheritance: +datadog\_api\_client.v2.model.simple\_monitor\_user\_template module +-------------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.simple_monitor_user_template + :members: + :show-inheritance: + datadog\_api\_client.v2.model.single\_aggregated\_connection\_response\_array module ------------------------------------------------------------------------------------ diff --git a/examples/v2/monitors/CreateMonitorUserTemplate.py b/examples/v2/monitors/CreateMonitorUserTemplate.py new file mode 100644 index 0000000000..f1fad408d7 --- /dev/null +++ b/examples/v2/monitors/CreateMonitorUserTemplate.py @@ -0,0 +1,55 @@ +""" +Create a monitor user template returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.monitors_api import MonitorsApi +from datadog_api_client.v2.model.monitor_user_template_create_data import MonitorUserTemplateCreateData +from datadog_api_client.v2.model.monitor_user_template_create_request import MonitorUserTemplateCreateRequest +from datadog_api_client.v2.model.monitor_user_template_request_attributes import MonitorUserTemplateRequestAttributes +from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType +from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, +) + +body = MonitorUserTemplateCreateRequest( + data=MonitorUserTemplateCreateData( + attributes=MonitorUserTemplateRequestAttributes( + description="A description.", + monitor_definition=dict( + [ + ("message", "A msg."), + ("name", "A name example-monitor"), + ("query", "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100"), + ("type", "query alert"), + ] + ), + tags=[ + "integration:Azure", + ], + template_variables=[ + MonitorUserTemplateTemplateVariablesItems( + available_values=[ + "value1", + "value2", + ], + defaults=[ + "defaultValue", + ], + name="regionName", + tag_key="datacenter", + ), + ], + title="Postgres DB example-monitor", + ), + type=MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_monitor_user_template"] = True +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + response = api_instance.create_monitor_user_template(body=body) + + print(response) diff --git a/examples/v2/monitors/DeleteMonitorUserTemplate.py b/examples/v2/monitors/DeleteMonitorUserTemplate.py new file mode 100644 index 0000000000..d51941b243 --- /dev/null +++ b/examples/v2/monitors/DeleteMonitorUserTemplate.py @@ -0,0 +1,14 @@ +""" +Delete a monitor user template returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.monitors_api import MonitorsApi + +configuration = Configuration() +configuration.unstable_operations["delete_monitor_user_template"] = True +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + api_instance.delete_monitor_user_template( + template_id="template_id", + ) diff --git a/examples/v2/monitors/GetMonitorUserTemplate.py b/examples/v2/monitors/GetMonitorUserTemplate.py new file mode 100644 index 0000000000..ede6e9f199 --- /dev/null +++ b/examples/v2/monitors/GetMonitorUserTemplate.py @@ -0,0 +1,20 @@ +""" +Get a monitor user template returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.monitors_api import MonitorsApi + +# there is a valid "monitor_user_template" in the system +MONITOR_USER_TEMPLATE_DATA_ID = environ["MONITOR_USER_TEMPLATE_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["get_monitor_user_template"] = True +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + response = api_instance.get_monitor_user_template( + template_id=MONITOR_USER_TEMPLATE_DATA_ID, + ) + + print(response) diff --git a/examples/v2/monitors/ListMonitorUserTemplates.py b/examples/v2/monitors/ListMonitorUserTemplates.py new file mode 100644 index 0000000000..f2af7ea9c9 --- /dev/null +++ b/examples/v2/monitors/ListMonitorUserTemplates.py @@ -0,0 +1,14 @@ +""" +Get all monitor user templates returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.monitors_api import MonitorsApi + +configuration = Configuration() +configuration.unstable_operations["list_monitor_user_templates"] = True +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + response = api_instance.list_monitor_user_templates() + + print(response) diff --git a/examples/v2/monitors/UpdateMonitorUserTemplate.py b/examples/v2/monitors/UpdateMonitorUserTemplate.py new file mode 100644 index 0000000000..256c5b46d5 --- /dev/null +++ b/examples/v2/monitors/UpdateMonitorUserTemplate.py @@ -0,0 +1,60 @@ +""" +Update a monitor user template to a new version returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.monitors_api import MonitorsApi +from datadog_api_client.v2.model.monitor_user_template_request_attributes import MonitorUserTemplateRequestAttributes +from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType +from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, +) +from datadog_api_client.v2.model.monitor_user_template_update_data import MonitorUserTemplateUpdateData +from datadog_api_client.v2.model.monitor_user_template_update_request import MonitorUserTemplateUpdateRequest + +# there is a valid "monitor_user_template" in the system +MONITOR_USER_TEMPLATE_DATA_ID = environ["MONITOR_USER_TEMPLATE_DATA_ID"] + +body = MonitorUserTemplateUpdateRequest( + data=MonitorUserTemplateUpdateData( + attributes=MonitorUserTemplateRequestAttributes( + description="A description.", + monitor_definition=dict( + [ + ("message", "A msg."), + ("name", "A name example-monitor"), + ("query", "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100"), + ("type", "query alert"), + ] + ), + tags=[ + "integration:Azure", + ], + template_variables=[ + MonitorUserTemplateTemplateVariablesItems( + available_values=[ + "value1", + "value2", + ], + defaults=[ + "defaultValue", + ], + name="regionName", + tag_key="datacenter", + ), + ], + title="Postgres DB example-monitor", + ), + id=MONITOR_USER_TEMPLATE_DATA_ID, + type=MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_monitor_user_template"] = True +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + response = api_instance.update_monitor_user_template(template_id=MONITOR_USER_TEMPLATE_DATA_ID, body=body) + + print(response) diff --git a/examples/v2/monitors/ValidateExistingMonitorUserTemplate.py b/examples/v2/monitors/ValidateExistingMonitorUserTemplate.py new file mode 100644 index 0000000000..7fb102c85d --- /dev/null +++ b/examples/v2/monitors/ValidateExistingMonitorUserTemplate.py @@ -0,0 +1,58 @@ +""" +Validate an existing monitor user template returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.monitors_api import MonitorsApi +from datadog_api_client.v2.model.monitor_user_template_request_attributes import MonitorUserTemplateRequestAttributes +from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType +from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, +) +from datadog_api_client.v2.model.monitor_user_template_update_data import MonitorUserTemplateUpdateData +from datadog_api_client.v2.model.monitor_user_template_update_request import MonitorUserTemplateUpdateRequest + +# there is a valid "monitor_user_template" in the system +MONITOR_USER_TEMPLATE_DATA_ID = environ["MONITOR_USER_TEMPLATE_DATA_ID"] + +body = MonitorUserTemplateUpdateRequest( + data=MonitorUserTemplateUpdateData( + attributes=MonitorUserTemplateRequestAttributes( + description="A description.", + monitor_definition=dict( + [ + ("message", "A msg."), + ("name", "A name example-monitor"), + ("query", "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100"), + ("type", "query alert"), + ] + ), + tags=[ + "integration:Azure", + ], + template_variables=[ + MonitorUserTemplateTemplateVariablesItems( + available_values=[ + "value1", + "value2", + ], + defaults=[ + "defaultValue", + ], + name="regionName", + tag_key="datacenter", + ), + ], + title="Postgres DB example-monitor", + ), + id=MONITOR_USER_TEMPLATE_DATA_ID, + type=MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["validate_existing_monitor_user_template"] = True +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + api_instance.validate_existing_monitor_user_template(template_id=MONITOR_USER_TEMPLATE_DATA_ID, body=body) diff --git a/examples/v2/monitors/ValidateMonitorUserTemplate.py b/examples/v2/monitors/ValidateMonitorUserTemplate.py new file mode 100644 index 0000000000..ea794abdbc --- /dev/null +++ b/examples/v2/monitors/ValidateMonitorUserTemplate.py @@ -0,0 +1,53 @@ +""" +Validate a monitor user template returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.monitors_api import MonitorsApi +from datadog_api_client.v2.model.monitor_user_template_create_data import MonitorUserTemplateCreateData +from datadog_api_client.v2.model.monitor_user_template_create_request import MonitorUserTemplateCreateRequest +from datadog_api_client.v2.model.monitor_user_template_request_attributes import MonitorUserTemplateRequestAttributes +from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType +from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, +) + +body = MonitorUserTemplateCreateRequest( + data=MonitorUserTemplateCreateData( + attributes=MonitorUserTemplateRequestAttributes( + description="A description.", + monitor_definition=dict( + [ + ("message", "A msg."), + ("name", "A name example-monitor"), + ("query", "avg(last_5m):sum:system.net.bytes_rcvd{host:host0} > 100"), + ("type", "query alert"), + ] + ), + tags=[ + "integration:Azure", + ], + template_variables=[ + MonitorUserTemplateTemplateVariablesItems( + available_values=[ + "value1", + "value2", + ], + defaults=[ + "defaultValue", + ], + name="regionName", + tag_key="datacenter", + ), + ], + title="Postgres DB example-monitor", + ), + type=MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE, + ), +) + +configuration = Configuration() +configuration.unstable_operations["validate_monitor_user_template"] = True +with ApiClient(configuration) as api_client: + api_instance = MonitorsApi(api_client) + api_instance.validate_monitor_user_template(body=body) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 4c3927424c..0bb3b7d174 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -289,10 +289,17 @@ def __init__( "v2.update_aws_account": False, "v2.list_aws_logs_services": False, "v2.create_monitor_notification_rule": False, + "v2.create_monitor_user_template": False, "v2.delete_monitor_notification_rule": False, + "v2.delete_monitor_user_template": False, "v2.get_monitor_notification_rule": False, "v2.get_monitor_notification_rules": False, + "v2.get_monitor_user_template": False, + "v2.list_monitor_user_templates": False, "v2.update_monitor_notification_rule": False, + "v2.update_monitor_user_template": False, + "v2.validate_existing_monitor_user_template": False, + "v2.validate_monitor_user_template": False, "v2.get_aggregated_connections": False, "v2.create_pipeline": False, "v2.delete_pipeline": False, diff --git a/src/datadog_api_client/v2/api/monitors_api.py b/src/datadog_api_client/v2/api/monitors_api.py index a812f5d4cb..218d1df8fa 100644 --- a/src/datadog_api_client/v2/api/monitors_api.py +++ b/src/datadog_api_client/v2/api/monitors_api.py @@ -19,6 +19,11 @@ from datadog_api_client.v2.model.monitor_config_policy_response import MonitorConfigPolicyResponse from datadog_api_client.v2.model.monitor_config_policy_create_request import MonitorConfigPolicyCreateRequest from datadog_api_client.v2.model.monitor_config_policy_edit_request import MonitorConfigPolicyEditRequest +from datadog_api_client.v2.model.monitor_user_template_list_response import MonitorUserTemplateListResponse +from datadog_api_client.v2.model.monitor_user_template_create_response import MonitorUserTemplateCreateResponse +from datadog_api_client.v2.model.monitor_user_template_create_request import MonitorUserTemplateCreateRequest +from datadog_api_client.v2.model.monitor_user_template_response import MonitorUserTemplateResponse +from datadog_api_client.v2.model.monitor_user_template_update_request import MonitorUserTemplateUpdateRequest class MonitorsApi: @@ -75,6 +80,26 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._create_monitor_user_template_endpoint = _Endpoint( + settings={ + "response_type": (MonitorUserTemplateCreateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/monitor/template", + "operation_id": "create_monitor_user_template", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (MonitorUserTemplateCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + self._delete_monitor_config_policy_endpoint = _Endpoint( settings={ "response_type": None, @@ -121,6 +146,29 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._delete_monitor_user_template_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/monitor/template/{template_id}", + "operation_id": "delete_monitor_user_template", + "http_method": "DELETE", + "version": "v2", + }, + params_map={ + "template_id": { + "required": True, + "openapi_types": (str,), + "attribute": "template_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + }, + api_client=api_client, + ) + self._get_monitor_config_policy_endpoint = _Endpoint( settings={ "response_type": (MonitorConfigPolicyResponse,), @@ -194,6 +242,34 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._get_monitor_user_template_endpoint = _Endpoint( + settings={ + "response_type": (MonitorUserTemplateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/monitor/template/{template_id}", + "operation_id": "get_monitor_user_template", + "http_method": "GET", + "version": "v2", + }, + params_map={ + "template_id": { + "required": True, + "openapi_types": (str,), + "attribute": "template_id", + "location": "path", + }, + "with_all_versions": { + "openapi_types": (bool,), + "attribute": "with_all_versions", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._list_monitor_config_policies_endpoint = _Endpoint( settings={ "response_type": (MonitorConfigPolicyListResponse,), @@ -210,6 +286,22 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._list_monitor_user_templates_endpoint = _Endpoint( + settings={ + "response_type": (MonitorUserTemplateListResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/monitor/template", + "operation_id": "list_monitor_user_templates", + "http_method": "GET", + "version": "v2", + }, + params_map={}, + headers_map={ + "accept": ["application/json"], + }, + api_client=api_client, + ) + self._update_monitor_config_policy_endpoint = _Endpoint( settings={ "response_type": (MonitorConfigPolicyResponse,), @@ -262,6 +354,78 @@ def __init__(self, api_client=None): api_client=api_client, ) + self._update_monitor_user_template_endpoint = _Endpoint( + settings={ + "response_type": (MonitorUserTemplateResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/monitor/template/{template_id}", + "operation_id": "update_monitor_user_template", + "http_method": "PUT", + "version": "v2", + }, + params_map={ + "template_id": { + "required": True, + "openapi_types": (str,), + "attribute": "template_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (MonitorUserTemplateUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._validate_existing_monitor_user_template_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/monitor/template/{template_id}/validate", + "operation_id": "validate_existing_monitor_user_template", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "template_id": { + "required": True, + "openapi_types": (str,), + "attribute": "template_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (MonitorUserTemplateUpdateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._validate_monitor_user_template_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/monitor/template/validate", + "operation_id": "validate_monitor_user_template", + "http_method": "POST", + "version": "v2", + }, + params_map={ + "body": { + "required": True, + "openapi_types": (MonitorUserTemplateCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["*/*"], "content_type": ["application/json"]}, + api_client=api_client, + ) + def create_monitor_config_policy( self, body: MonitorConfigPolicyCreateRequest, @@ -296,6 +460,22 @@ def create_monitor_notification_rule( return self._create_monitor_notification_rule_endpoint.call_with_http_info(**kwargs) + def create_monitor_user_template( + self, + body: MonitorUserTemplateCreateRequest, + ) -> MonitorUserTemplateCreateResponse: + """Create a monitor user template. + + Create a new monitor user template. + + :type body: MonitorUserTemplateCreateRequest + :rtype: MonitorUserTemplateCreateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_monitor_user_template_endpoint.call_with_http_info(**kwargs) + def delete_monitor_config_policy( self, policy_id: str, @@ -330,6 +510,23 @@ def delete_monitor_notification_rule( return self._delete_monitor_notification_rule_endpoint.call_with_http_info(**kwargs) + def delete_monitor_user_template( + self, + template_id: str, + ) -> None: + """Delete a monitor user template. + + Delete an existing monitor user template by its ID. + + :param template_id: ID of the monitor user template. + :type template_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["template_id"] = template_id + + return self._delete_monitor_user_template_endpoint.call_with_http_info(**kwargs) + def get_monitor_config_policy( self, policy_id: str, @@ -392,6 +589,30 @@ def get_monitor_notification_rules( return self._get_monitor_notification_rules_endpoint.call_with_http_info(**kwargs) + def get_monitor_user_template( + self, + template_id: str, + *, + with_all_versions: Union[bool, UnsetType] = unset, + ) -> MonitorUserTemplateResponse: + """Get a monitor user template. + + Retrieve a monitor user template by its ID. + + :param template_id: ID of the monitor user template. + :type template_id: str + :param with_all_versions: Whether to include all versions of the template in the response in the versions field. + :type with_all_versions: bool, optional + :rtype: MonitorUserTemplateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["template_id"] = template_id + + if with_all_versions is not unset: + kwargs["with_all_versions"] = with_all_versions + + return self._get_monitor_user_template_endpoint.call_with_http_info(**kwargs) + def list_monitor_config_policies( self, ) -> MonitorConfigPolicyListResponse: @@ -404,6 +625,18 @@ def list_monitor_config_policies( kwargs: Dict[str, Any] = {} return self._list_monitor_config_policies_endpoint.call_with_http_info(**kwargs) + def list_monitor_user_templates( + self, + ) -> MonitorUserTemplateListResponse: + """Get all monitor user templates. + + Retrieve all monitor user templates. + + :rtype: MonitorUserTemplateListResponse + """ + kwargs: Dict[str, Any] = {} + return self._list_monitor_user_templates_endpoint.call_with_http_info(**kwargs) + def update_monitor_config_policy( self, policy_id: str, @@ -447,3 +680,61 @@ def update_monitor_notification_rule( kwargs["body"] = body return self._update_monitor_notification_rule_endpoint.call_with_http_info(**kwargs) + + def update_monitor_user_template( + self, + template_id: str, + body: MonitorUserTemplateUpdateRequest, + ) -> MonitorUserTemplateResponse: + """Update a monitor user template to a new version. + + Creates a new version of an existing monitor user template. + + :param template_id: ID of the monitor user template. + :type template_id: str + :type body: MonitorUserTemplateUpdateRequest + :rtype: MonitorUserTemplateResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["template_id"] = template_id + + kwargs["body"] = body + + return self._update_monitor_user_template_endpoint.call_with_http_info(**kwargs) + + def validate_existing_monitor_user_template( + self, + template_id: str, + body: MonitorUserTemplateUpdateRequest, + ) -> None: + """Validate an existing monitor user template. + + Validate the structure and content of an existing monitor user template being updated to a new version. + + :param template_id: ID of the monitor user template. + :type template_id: str + :type body: MonitorUserTemplateUpdateRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["template_id"] = template_id + + kwargs["body"] = body + + return self._validate_existing_monitor_user_template_endpoint.call_with_http_info(**kwargs) + + def validate_monitor_user_template( + self, + body: MonitorUserTemplateCreateRequest, + ) -> None: + """Validate a monitor user template. + + Validate the structure and content of a monitor user template. + + :type body: MonitorUserTemplateCreateRequest + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._validate_monitor_user_template_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/model/monitor_user_template.py b/src/datadog_api_client/v2/model/monitor_user_template.py new file mode 100644 index 0000000000..702c90d6c0 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template.py @@ -0,0 +1,140 @@ +# 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. +from __future__ import annotations + +from typing import Any, Dict, List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, + ) + from datadog_api_client.v2.model.simple_monitor_user_template import SimpleMonitorUserTemplate + + +class MonitorUserTemplate(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, + ) + from datadog_api_client.v2.model.simple_monitor_user_template import SimpleMonitorUserTemplate + + return { + "created": (datetime,), + "description": (str,), + "modified": (datetime,), + "monitor_definition": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "tags": ([str],), + "template_variables": ([MonitorUserTemplateTemplateVariablesItems],), + "title": (str,), + "version": (int,), + "versions": ([SimpleMonitorUserTemplate],), + } + + attribute_map = { + "created": "created", + "description": "description", + "modified": "modified", + "monitor_definition": "monitor_definition", + "tags": "tags", + "template_variables": "template_variables", + "title": "title", + "version": "version", + "versions": "versions", + } + read_only_vars = { + "created", + "modified", + "version", + } + + def __init__( + self_, + created: Union[datetime, UnsetType] = unset, + description: Union[str, none_type, UnsetType] = unset, + modified: Union[datetime, UnsetType] = unset, + monitor_definition: Union[Dict[str, Any], UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + template_variables: Union[List[MonitorUserTemplateTemplateVariablesItems], UnsetType] = unset, + title: Union[str, UnsetType] = unset, + version: Union[int, none_type, UnsetType] = unset, + versions: Union[List[SimpleMonitorUserTemplate], UnsetType] = unset, + **kwargs, + ): + """ + A monitor user template object. + + :param created: The created timestamp of the template. + :type created: datetime, optional + + :param description: A brief description of the monitor user template. + :type description: str, none_type, optional + + :param modified: The last modified timestamp. When the template version was created. + :type modified: datetime, optional + + :param monitor_definition: A valid monitor definition in the same format as the `V1 Monitor API `_. + :type monitor_definition: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + + :param tags: The definition of ``MonitorUserTemplateTags`` object. + :type tags: [str], optional + + :param template_variables: The definition of ``MonitorUserTemplateTemplateVariables`` object. + :type template_variables: [MonitorUserTemplateTemplateVariablesItems], optional + + :param title: The title of the monitor user template. + :type title: str, optional + + :param version: The version of the monitor user template. + :type version: int, none_type, optional + + :param versions: All versions of the monitor user template. + :type versions: [SimpleMonitorUserTemplate], optional + """ + if created is not unset: + kwargs["created"] = created + if description is not unset: + kwargs["description"] = description + if modified is not unset: + kwargs["modified"] = modified + if monitor_definition is not unset: + kwargs["monitor_definition"] = monitor_definition + if tags is not unset: + kwargs["tags"] = tags + if template_variables is not unset: + kwargs["template_variables"] = template_variables + if title is not unset: + kwargs["title"] = title + if version is not unset: + kwargs["version"] = version + if versions is not unset: + kwargs["versions"] = versions + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/monitor_user_template_create_data.py b/src/datadog_api_client/v2/model/monitor_user_template_create_data.py new file mode 100644 index 0000000000..73a4bcb643 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_create_data.py @@ -0,0 +1,54 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_request_attributes import ( + MonitorUserTemplateRequestAttributes, + ) + from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType + + +class MonitorUserTemplateCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_request_attributes import ( + MonitorUserTemplateRequestAttributes, + ) + from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType + + return { + "attributes": (MonitorUserTemplateRequestAttributes,), + "type": (MonitorUserTemplateResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__( + self_, attributes: MonitorUserTemplateRequestAttributes, type: MonitorUserTemplateResourceType, **kwargs + ): + """ + Monitor user template data. + + :param attributes: Attributes for a monitor user template. + :type attributes: MonitorUserTemplateRequestAttributes + + :param type: Monitor user template resource type. + :type type: MonitorUserTemplateResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/monitor_user_template_create_request.py b/src/datadog_api_client/v2/model/monitor_user_template_create_request.py new file mode 100644 index 0000000000..4654739e1c --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_create_request.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_create_data import MonitorUserTemplateCreateData + + +class MonitorUserTemplateCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_create_data import MonitorUserTemplateCreateData + + return { + "data": (MonitorUserTemplateCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: MonitorUserTemplateCreateData, **kwargs): + """ + Request for creating a monitor user template. + + :param data: Monitor user template data. + :type data: MonitorUserTemplateCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/monitor_user_template_create_response.py b/src/datadog_api_client/v2/model/monitor_user_template_create_response.py new file mode 100644 index 0000000000..7b7cd773cb --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_create_response.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_response_data import MonitorUserTemplateResponseData + + +class MonitorUserTemplateCreateResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_response_data import MonitorUserTemplateResponseData + + return { + "data": (MonitorUserTemplateResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[MonitorUserTemplateResponseData, UnsetType] = unset, **kwargs): + """ + Response for creating a monitor user template. + + :param data: Monitor user template list response data. + :type data: MonitorUserTemplateResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/monitor_user_template_list_response.py b/src/datadog_api_client/v2/model/monitor_user_template_list_response.py new file mode 100644 index 0000000000..51d21d94a6 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_list_response.py @@ -0,0 +1,42 @@ +# 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. +from __future__ import annotations + +from typing import List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_response_data import MonitorUserTemplateResponseData + + +class MonitorUserTemplateListResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_response_data import MonitorUserTemplateResponseData + + return { + "data": ([MonitorUserTemplateResponseData],), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[List[MonitorUserTemplateResponseData], UnsetType] = unset, **kwargs): + """ + Response for retrieving all monitor user templates. + + :param data: An array of monitor user templates. + :type data: [MonitorUserTemplateResponseData], optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/monitor_user_template_request_attributes.py b/src/datadog_api_client/v2/model/monitor_user_template_request_attributes.py new file mode 100644 index 0000000000..894327cb99 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_request_attributes.py @@ -0,0 +1,103 @@ +# 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. +from __future__ import annotations + +from typing import Any, Dict, List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, + ) + + +class MonitorUserTemplateRequestAttributes(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, + ) + + return { + "description": (str,), + "monitor_definition": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "tags": ([str],), + "template_variables": ([MonitorUserTemplateTemplateVariablesItems],), + "title": (str,), + } + + attribute_map = { + "description": "description", + "monitor_definition": "monitor_definition", + "tags": "tags", + "template_variables": "template_variables", + "title": "title", + } + + def __init__( + self_, + monitor_definition: Dict[str, Any], + tags: List[str], + title: str, + description: Union[str, none_type, UnsetType] = unset, + template_variables: Union[List[MonitorUserTemplateTemplateVariablesItems], UnsetType] = unset, + **kwargs, + ): + """ + Attributes for a monitor user template. + + :param description: A brief description of the monitor user template. + :type description: str, none_type, optional + + :param monitor_definition: A valid monitor definition in the same format as the `V1 Monitor API `_. + :type monitor_definition: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)} + + :param tags: The definition of ``MonitorUserTemplateTags`` object. + :type tags: [str] + + :param template_variables: The definition of ``MonitorUserTemplateTemplateVariables`` object. + :type template_variables: [MonitorUserTemplateTemplateVariablesItems], optional + + :param title: The title of the monitor user template. + :type title: str + """ + if description is not unset: + kwargs["description"] = description + if template_variables is not unset: + kwargs["template_variables"] = template_variables + super().__init__(kwargs) + + self_.monitor_definition = monitor_definition + self_.tags = tags + self_.title = title diff --git a/src/datadog_api_client/v2/model/monitor_user_template_resource_type.py b/src/datadog_api_client/v2/model/monitor_user_template_resource_type.py new file mode 100644 index 0000000000..7d0fc60f40 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_resource_type.py @@ -0,0 +1,35 @@ +# 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. +from __future__ import annotations + + +from datadog_api_client.model_utils import ( + ModelSimple, + cached_property, +) + +from typing import ClassVar + + +class MonitorUserTemplateResourceType(ModelSimple): + """ + Monitor user template resource type. + + :param value: If omitted defaults to "monitor-user-template". Must be one of ["monitor-user-template"]. + :type value: str + """ + + allowed_values = { + "monitor-user-template", + } + MONITOR_USER_TEMPLATE: ClassVar["MonitorUserTemplateResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +MonitorUserTemplateResourceType.MONITOR_USER_TEMPLATE = MonitorUserTemplateResourceType("monitor-user-template") diff --git a/src/datadog_api_client/v2/model/monitor_user_template_response.py b/src/datadog_api_client/v2/model/monitor_user_template_response.py new file mode 100644 index 0000000000..e9b5c233f7 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_response.py @@ -0,0 +1,46 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_response_data_with_versions import ( + MonitorUserTemplateResponseDataWithVersions, + ) + + +class MonitorUserTemplateResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_response_data_with_versions import ( + MonitorUserTemplateResponseDataWithVersions, + ) + + return { + "data": (MonitorUserTemplateResponseDataWithVersions,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[MonitorUserTemplateResponseDataWithVersions, UnsetType] = unset, **kwargs): + """ + Response for retrieving a monitor user template. + + :param data: Monitor user template data. + :type data: MonitorUserTemplateResponseDataWithVersions, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/monitor_user_template_response_attributes.py b/src/datadog_api_client/v2/model/monitor_user_template_response_attributes.py new file mode 100644 index 0000000000..01f84c4b2d --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_response_attributes.py @@ -0,0 +1,130 @@ +# 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. +from __future__ import annotations + +from typing import Any, Dict, List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, + ) + + +class MonitorUserTemplateResponseAttributes(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, + ) + + return { + "created": (datetime,), + "description": (str,), + "modified": (datetime,), + "monitor_definition": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "tags": ([str],), + "template_variables": ([MonitorUserTemplateTemplateVariablesItems],), + "title": (str,), + "version": (int,), + } + + attribute_map = { + "created": "created", + "description": "description", + "modified": "modified", + "monitor_definition": "monitor_definition", + "tags": "tags", + "template_variables": "template_variables", + "title": "title", + "version": "version", + } + read_only_vars = { + "created", + "modified", + "version", + } + + def __init__( + self_, + created: Union[datetime, UnsetType] = unset, + description: Union[str, none_type, UnsetType] = unset, + modified: Union[datetime, UnsetType] = unset, + monitor_definition: Union[Dict[str, Any], UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + template_variables: Union[List[MonitorUserTemplateTemplateVariablesItems], UnsetType] = unset, + title: Union[str, UnsetType] = unset, + version: Union[int, none_type, UnsetType] = unset, + **kwargs, + ): + """ + Attributes for a monitor user template. + + :param created: The created timestamp of the template. + :type created: datetime, optional + + :param description: A brief description of the monitor user template. + :type description: str, none_type, optional + + :param modified: The last modified timestamp. When the template version was created. + :type modified: datetime, optional + + :param monitor_definition: A valid monitor definition in the same format as the `V1 Monitor API `_. + :type monitor_definition: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + + :param tags: The definition of ``MonitorUserTemplateTags`` object. + :type tags: [str], optional + + :param template_variables: The definition of ``MonitorUserTemplateTemplateVariables`` object. + :type template_variables: [MonitorUserTemplateTemplateVariablesItems], optional + + :param title: The title of the monitor user template. + :type title: str, optional + + :param version: The version of the monitor user template. + :type version: int, none_type, optional + """ + if created is not unset: + kwargs["created"] = created + if description is not unset: + kwargs["description"] = description + if modified is not unset: + kwargs["modified"] = modified + if monitor_definition is not unset: + kwargs["monitor_definition"] = monitor_definition + if tags is not unset: + kwargs["tags"] = tags + if template_variables is not unset: + kwargs["template_variables"] = template_variables + if title is not unset: + kwargs["title"] = title + if version is not unset: + kwargs["version"] = version + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/monitor_user_template_response_data.py b/src/datadog_api_client/v2/model/monitor_user_template_response_data.py new file mode 100644 index 0000000000..9800b92a80 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_response_data.py @@ -0,0 +1,68 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_response_attributes import ( + MonitorUserTemplateResponseAttributes, + ) + from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType + + +class MonitorUserTemplateResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_response_attributes import ( + MonitorUserTemplateResponseAttributes, + ) + from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType + + return { + "attributes": (MonitorUserTemplateResponseAttributes,), + "id": (str,), + "type": (MonitorUserTemplateResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[MonitorUserTemplateResponseAttributes, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[MonitorUserTemplateResourceType, UnsetType] = unset, + **kwargs, + ): + """ + Monitor user template list response data. + + :param attributes: Attributes for a monitor user template. + :type attributes: MonitorUserTemplateResponseAttributes, optional + + :param id: The unique identifier. + :type id: str, optional + + :param type: Monitor user template resource type. + :type type: MonitorUserTemplateResourceType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/monitor_user_template_response_data_with_versions.py b/src/datadog_api_client/v2/model/monitor_user_template_response_data_with_versions.py new file mode 100644 index 0000000000..d8d41b2fa5 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_response_data_with_versions.py @@ -0,0 +1,64 @@ +# 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. +from __future__ import annotations + +from typing import Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template import MonitorUserTemplate + from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType + + +class MonitorUserTemplateResponseDataWithVersions(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template import MonitorUserTemplate + from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType + + return { + "attributes": (MonitorUserTemplate,), + "id": (str,), + "type": (MonitorUserTemplateResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[MonitorUserTemplate, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + type: Union[MonitorUserTemplateResourceType, UnsetType] = unset, + **kwargs, + ): + """ + Monitor user template data. + + :param attributes: A monitor user template object. + :type attributes: MonitorUserTemplate, optional + + :param id: The unique identifier. + :type id: str, optional + + :param type: Monitor user template resource type. + :type type: MonitorUserTemplateResourceType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/monitor_user_template_template_variables_items.py b/src/datadog_api_client/v2/model/monitor_user_template_template_variables_items.py new file mode 100644 index 0000000000..f5ca7d9d9e --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_template_variables_items.py @@ -0,0 +1,68 @@ +# 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. +from __future__ import annotations + +from typing import List, Union + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class MonitorUserTemplateTemplateVariablesItems(ModelNormal): + @cached_property + def additional_properties_type(_): + return None + + @cached_property + def openapi_types(_): + return { + "available_values": ([str],), + "defaults": ([str],), + "name": (str,), + "tag_key": (str,), + } + + attribute_map = { + "available_values": "available_values", + "defaults": "defaults", + "name": "name", + "tag_key": "tag_key", + } + + def __init__( + self_, + name: str, + available_values: Union[List[str], UnsetType] = unset, + defaults: Union[List[str], UnsetType] = unset, + tag_key: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + List of objects representing template variables on the monitor which can have selectable values. + + :param available_values: Available values for the variable. + :type available_values: [str], optional + + :param defaults: Default values of the template variable. + :type defaults: [str], optional + + :param name: The name of the template variable. + :type name: str + + :param tag_key: The tag key associated with the variable. This works the same as dashboard template variables. + :type tag_key: str, optional + """ + if available_values is not unset: + kwargs["available_values"] = available_values + if defaults is not unset: + kwargs["defaults"] = defaults + if tag_key is not unset: + kwargs["tag_key"] = tag_key + super().__init__(kwargs) + + self_.name = name diff --git a/src/datadog_api_client/v2/model/monitor_user_template_update_data.py b/src/datadog_api_client/v2/model/monitor_user_template_update_data.py new file mode 100644 index 0000000000..2a5825cb58 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_update_data.py @@ -0,0 +1,64 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_request_attributes import ( + MonitorUserTemplateRequestAttributes, + ) + from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType + + +class MonitorUserTemplateUpdateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_request_attributes import ( + MonitorUserTemplateRequestAttributes, + ) + from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType + + return { + "attributes": (MonitorUserTemplateRequestAttributes,), + "id": (str,), + "type": (MonitorUserTemplateResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: MonitorUserTemplateRequestAttributes, + id: str, + type: MonitorUserTemplateResourceType, + **kwargs, + ): + """ + Monitor user template data. + + :param attributes: Attributes for a monitor user template. + :type attributes: MonitorUserTemplateRequestAttributes + + :param id: The unique identifier. + :type id: str + + :param type: Monitor user template resource type. + :type type: MonitorUserTemplateResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/monitor_user_template_update_request.py b/src/datadog_api_client/v2/model/monitor_user_template_update_request.py new file mode 100644 index 0000000000..be4c2bfdf5 --- /dev/null +++ b/src/datadog_api_client/v2/model/monitor_user_template_update_request.py @@ -0,0 +1,40 @@ +# 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. +from __future__ import annotations + +from typing import TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_update_data import MonitorUserTemplateUpdateData + + +class MonitorUserTemplateUpdateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_update_data import MonitorUserTemplateUpdateData + + return { + "data": (MonitorUserTemplateUpdateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: MonitorUserTemplateUpdateData, **kwargs): + """ + Request for creating a new monitor user template version. + + :param data: Monitor user template data. + :type data: MonitorUserTemplateUpdateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/simple_monitor_user_template.py b/src/datadog_api_client/v2/model/simple_monitor_user_template.py new file mode 100644 index 0000000000..61a40b49b1 --- /dev/null +++ b/src/datadog_api_client/v2/model/simple_monitor_user_template.py @@ -0,0 +1,129 @@ +# 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. +from __future__ import annotations + +from typing import Any, Dict, List, Union, TYPE_CHECKING + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + date, + datetime, + none_type, + unset, + UnsetType, + UUID, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, + ) + + +class SimpleMonitorUserTemplate(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, + ) + + return { + "created": (datetime,), + "description": (str,), + "id": (str,), + "monitor_definition": ( + { + str: ( + bool, + date, + datetime, + dict, + float, + int, + list, + str, + UUID, + none_type, + ) + }, + ), + "tags": ([str],), + "template_variables": ([MonitorUserTemplateTemplateVariablesItems],), + "title": (str,), + "version": (int,), + } + + attribute_map = { + "created": "created", + "description": "description", + "id": "id", + "monitor_definition": "monitor_definition", + "tags": "tags", + "template_variables": "template_variables", + "title": "title", + "version": "version", + } + read_only_vars = { + "created", + "version", + } + + def __init__( + self_, + created: Union[datetime, UnsetType] = unset, + description: Union[str, none_type, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + monitor_definition: Union[Dict[str, Any], UnsetType] = unset, + tags: Union[List[str], UnsetType] = unset, + template_variables: Union[List[MonitorUserTemplateTemplateVariablesItems], UnsetType] = unset, + title: Union[str, UnsetType] = unset, + version: Union[int, none_type, UnsetType] = unset, + **kwargs, + ): + """ + A simplified version of a monitor user template. + + :param created: The created timestamp of the template. + :type created: datetime, optional + + :param description: A brief description of the monitor user template. + :type description: str, none_type, optional + + :param id: The unique identifier. The initial version will match the template ID. + :type id: str, optional + + :param monitor_definition: A valid monitor definition in the same format as the `V1 Monitor API `_. + :type monitor_definition: {str: (bool, date, datetime, dict, float, int, list, str, UUID, none_type,)}, optional + + :param tags: The definition of ``MonitorUserTemplateTags`` object. + :type tags: [str], optional + + :param template_variables: The definition of ``MonitorUserTemplateTemplateVariables`` object. + :type template_variables: [MonitorUserTemplateTemplateVariablesItems], optional + + :param title: The title of the monitor user template. + :type title: str, optional + + :param version: The version of the monitor user template. + :type version: int, none_type, optional + """ + if created is not unset: + kwargs["created"] = created + if description is not unset: + kwargs["description"] = description + if id is not unset: + kwargs["id"] = id + if monitor_definition is not unset: + kwargs["monitor_definition"] = monitor_definition + if tags is not unset: + kwargs["tags"] = tags + if template_variables is not unset: + kwargs["template_variables"] = template_variables + if title is not unset: + kwargs["title"] = title + if version is not unset: + kwargs["version"] = version + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index 189829c369..571a8eecf8 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -1881,6 +1881,24 @@ from datadog_api_client.v2.model.monitor_trigger import MonitorTrigger from datadog_api_client.v2.model.monitor_trigger_wrapper import MonitorTriggerWrapper from datadog_api_client.v2.model.monitor_type import MonitorType +from datadog_api_client.v2.model.monitor_user_template import MonitorUserTemplate +from datadog_api_client.v2.model.monitor_user_template_create_data import MonitorUserTemplateCreateData +from datadog_api_client.v2.model.monitor_user_template_create_request import MonitorUserTemplateCreateRequest +from datadog_api_client.v2.model.monitor_user_template_create_response import MonitorUserTemplateCreateResponse +from datadog_api_client.v2.model.monitor_user_template_list_response import MonitorUserTemplateListResponse +from datadog_api_client.v2.model.monitor_user_template_request_attributes import MonitorUserTemplateRequestAttributes +from datadog_api_client.v2.model.monitor_user_template_resource_type import MonitorUserTemplateResourceType +from datadog_api_client.v2.model.monitor_user_template_response import MonitorUserTemplateResponse +from datadog_api_client.v2.model.monitor_user_template_response_attributes import MonitorUserTemplateResponseAttributes +from datadog_api_client.v2.model.monitor_user_template_response_data import MonitorUserTemplateResponseData +from datadog_api_client.v2.model.monitor_user_template_response_data_with_versions import ( + MonitorUserTemplateResponseDataWithVersions, +) +from datadog_api_client.v2.model.monitor_user_template_template_variables_items import ( + MonitorUserTemplateTemplateVariablesItems, +) +from datadog_api_client.v2.model.monitor_user_template_update_data import MonitorUserTemplateUpdateData +from datadog_api_client.v2.model.monitor_user_template_update_request import MonitorUserTemplateUpdateRequest from datadog_api_client.v2.model.monthly_cost_attribution_attributes import MonthlyCostAttributionAttributes from datadog_api_client.v2.model.monthly_cost_attribution_body import MonthlyCostAttributionBody from datadog_api_client.v2.model.monthly_cost_attribution_meta import MonthlyCostAttributionMeta @@ -3163,6 +3181,7 @@ from datadog_api_client.v2.model.shift_data_relationships_user_data_type import ShiftDataRelationshipsUserDataType from datadog_api_client.v2.model.shift_data_type import ShiftDataType from datadog_api_client.v2.model.shift_included import ShiftIncluded +from datadog_api_client.v2.model.simple_monitor_user_template import SimpleMonitorUserTemplate from datadog_api_client.v2.model.single_aggregated_connection_response_array import ( SingleAggregatedConnectionResponseArray, ) @@ -4962,6 +4981,20 @@ "MonitorTrigger", "MonitorTriggerWrapper", "MonitorType", + "MonitorUserTemplate", + "MonitorUserTemplateCreateData", + "MonitorUserTemplateCreateRequest", + "MonitorUserTemplateCreateResponse", + "MonitorUserTemplateListResponse", + "MonitorUserTemplateRequestAttributes", + "MonitorUserTemplateResourceType", + "MonitorUserTemplateResponse", + "MonitorUserTemplateResponseAttributes", + "MonitorUserTemplateResponseData", + "MonitorUserTemplateResponseDataWithVersions", + "MonitorUserTemplateTemplateVariablesItems", + "MonitorUserTemplateUpdateData", + "MonitorUserTemplateUpdateRequest", "MonthlyCostAttributionAttributes", "MonthlyCostAttributionBody", "MonthlyCostAttributionMeta", @@ -5794,6 +5827,7 @@ "ShiftDataRelationshipsUserDataType", "ShiftDataType", "ShiftIncluded", + "SimpleMonitorUserTemplate", "SingleAggregatedConnectionResponseArray", "SingleAggregatedConnectionResponseData", "SingleAggregatedConnectionResponseDataAttributes", diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_bad_request_response.frozen index f465efe8f0..4066503df4 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_bad_request_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_bad_request_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_ok_response.frozen index 83a11894fb..fcae6e77ed 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_ok_response.yaml index 20991db031..78b092dad8 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_configuration_policy_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"policy":{"tag_key":"testcreateamonitorconfigurationpolicyreturnsokresponse1682627699","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' + body: '{"data":{"attributes":{"policy":{"tag_key":"testcreateamonitorconfigurationpolicyreturnsokresponse1748486175","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/policy response: body: - string: '{"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"}}} + string: '{"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"}} ' headers: @@ -25,7 +25,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/policy/fabd0b6e-e53a-11ed-a07b-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/edb99130-4a6a-4970-b6df-83b5cba1182a response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_bad_request_response.frozen index 454c4bb29a..a29e72739c 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_bad_request_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_bad_request_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_bad_request_response.yaml index cce8cd2cc1..37dac258f4 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_bad_request_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_bad_request_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"filter":{"tags":["test:test-create_a_monitor_notification_rule_returns_bad_request_response-1744280983","host:abc"]},"name":"test + body: '{"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: accept: diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_ok_response.frozen index 86ab3de39b..f7e7180ce1 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_ok_response.yaml index dc45878038..bec3c7444b 100644 --- a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_notification_rule_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"filter":{"tags":["test:test-create_a_monitor_notification_rule_returns_ok_response-1744280984"]},"name":"test + body: '{"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: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/notification_rule response: body: - string: '{"data":{"type":"monitor-notification-rule","attributes":{"filter":{"tags":["test:test-create_a_monitor_notification_rule_returns_ok_response-1744280984"]},"recipients":["slack-test-channel","jira-test"],"name":"test - rule","created_at":"2025-04-10T10:29:44.595607+00:00","modified_at":"1970-01-01T00:00:00+00:00"},"id":"a3323ef6-2a04-4ef9-8de8-cbcff5c3c203","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + string: '{"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"}}]} ' headers: @@ -27,7 +27,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/a3323ef6-2a04-4ef9-8de8-cbcff5c3c203 + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/5dca07c7-267c-4159-9d8f-7dec1512fb77 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_bad_request_response.frozen new file mode 100644 index 0000000000..99f122840a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:15.918Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_bad_request_response.yaml new file mode 100644 index 0000000000..640eadec54 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_bad_request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template + response: + body: + string: '{"errors":["Invalid monitor_definition or template variables: Monitor + definition cannot be empty."]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_ok_response.frozen new file mode 100644 index 0000000000..d617ccf69f --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:16.048Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_ok_response.yaml new file mode 100644 index 0000000000..9d1f4f0996 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_create_a_monitor_user_template_returns_ok_response.yaml @@ -0,0 +1,45 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template + response: + body: + string: '{"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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/template/15c66feb-f77d-407b-bf4c-615d3dc4fa50 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_bad_request_response.frozen index 94a2d0766c..1010ce4749 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_bad_request_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_bad_request_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_not_found_response.frozen index 844a6642df..7ae4617a1d 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_not_found_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_not_found_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_ok_response.frozen index b0d9464efa..284f2e61ee 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_ok_response.yaml index 6e639102bf..1407def814 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_configuration_policy_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"policy":{"tag_key":"testdeleteamonitorconfigurationpolicyreturnsokresponse1682627700","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' + body: '{"data":{"attributes":{"policy":{"tag_key":"testdeleteamonitorconfigurationpolicyreturnsokresponse1748486176","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/policy response: body: - string: '{"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"}} + string: '{"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"}} ' headers: @@ -25,7 +25,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/policy/fb4a2490-e53a-11ed-a5db-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/f0b1ee92-9635-45ed-8a18-a1631a8397d2 response: body: string: '' @@ -41,7 +41,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/policy/fb4a2490-e53a-11ed-a5db-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/f0b1ee92-9635-45ed-8a18-a1631a8397d2 response: body: string: '{"errors":["Monitor config policy not found"]}' diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_not_found_response.frozen index 2590d462ec..57a7f6d2e7 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_not_found_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_not_found_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_ok_response.frozen index c1dc706f2c..23f9fba845 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_ok_response.yaml index 63e33bbea1..e4819c821c 100644 --- a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_notification_rule_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"filter":{"tags":["app:test-delete_a_monitor_notification_rule_returns_ok_response-1744280987"]},"name":"test + body: '{"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: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/notification_rule response: body: - string: '{"data":{"type":"monitor-notification-rule","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}},"attributes":{"filter":{"tags":["app:test-delete_a_monitor_notification_rule_returns_ok_response-1744280987"]},"created_at":"2025-04-10T10:29:47.326243+00:00","name":"test - rule","recipients":["slack-monitor-app"],"modified_at":"1970-01-01T00:00:00+00:00"},"id":"66e399af-c07e-414d-b4f2-93e196d7b7b7"},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + string: '{"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"}}]} ' headers: @@ -27,7 +27,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/66e399af-c07e-414d-b4f2-93e196d7b7b7 + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/ae73c449-eadb-40ce-9eb3-9d56d8216254 response: body: string: '' @@ -43,7 +43,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/66e399af-c07e-414d-b4f2-93e196d7b7b7 + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/ae73c449-eadb-40ce-9eb3-9d56d8216254 response: body: string: '{"errors":["Monitor Notification Rule not found"]}' diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_user_template_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_user_template_returns_not_found_response.frozen new file mode 100644 index 0000000000..5e8ee5338f --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_user_template_returns_not_found_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:17.713Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_user_template_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_user_template_returns_not_found_response.yaml new file mode 100644 index 0000000000..1ca16ecc38 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_delete_a_monitor_user_template_returns_not_found_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/template/00000000-0000-1234-0000-000000000000 + response: + body: + string: '{"errors":["Monitor template not found"]}' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_not_found_response.frozen index cf29ebf6e0..bee5a97d5c 100644 --- a/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_not_found_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_not_found_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_ok_response.frozen index 054169c073..2b9bd5902e 100644 --- a/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_ok_response.yaml index 9b0942bf3e..d09083d534 100644 --- a/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"policy":{"tag_key":"testeditamonitorconfigurationpolicyreturnsokresponse1682627701","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' + body: '{"data":{"attributes":{"policy":{"tag_key":"testeditamonitorconfigurationpolicyreturnsokresponse1748486178","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/policy response: body: - string: '{"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"}}} + string: '{"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"}} ' headers: @@ -20,17 +20,17 @@ interactions: code: 200 message: OK - request: - body: '{"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"}}' + body: '{"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: accept: - application/json content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/monitor/policy/fbdb67de-e53a-11ed-9e4a-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/b967c47e-8f9b-49f5-bdff-744b4d50b26f response: body: - string: '{"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"}} + string: '{"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"}} ' headers: @@ -45,7 +45,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/policy/fbdb67de-e53a-11ed-9e4a-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/b967c47e-8f9b-49f5-bdff-744b4d50b26f response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_unprocessable_entity_response.frozen b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_unprocessable_entity_response.frozen index da44ed34e7..0c25447bf3 100644 --- a/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_unprocessable_entity_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_unprocessable_entity_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_unprocessable_entity_response.yaml b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_unprocessable_entity_response.yaml index 2ccd5b9981..9cb510654d 100644 --- a/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_unprocessable_entity_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_edit_a_monitor_configuration_policy_returns_unprocessable_entity_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"policy":{"tag_key":"testeditamonitorconfigurationpolicyreturnsunprocessableentityresponse1682627701","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' + body: '{"data":{"attributes":{"policy":{"tag_key":"testeditamonitorconfigurationpolicyreturnsunprocessableentityresponse1748486178","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/policy response: body: - string: '{"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"}} + string: '{"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"}} ' headers: @@ -20,14 +20,14 @@ interactions: code: 200 message: OK - request: - body: '{"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"}}' + body: '{"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: accept: - application/json content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/monitor/policy/fc38f7f0-e53a-11ed-947f-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/f2f83512-b2c2-4dc4-a8db-c785cd818d6f response: body: string: '{"errors":["Policy id in request body does not match id in URL param"]}' @@ -43,7 +43,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/policy/fc38f7f0-e53a-11ed-947f-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/f2f83512-b2c2-4dc4-a8db-c785cd818d6f response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_not_found_response.frozen index 4fab297722..4cc7aa02cc 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_not_found_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_not_found_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_ok_response.frozen index d650deaf59..c4817e4665 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_ok_response.yaml index 326524da9a..c7b6174049 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_configuration_policy_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"policy":{"tag_key":"testgetamonitorconfigurationpolicyreturnsokresponse1682627702","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' + body: '{"data":{"attributes":{"policy":{"tag_key":"testgetamonitorconfigurationpolicyreturnsokresponse1748486178","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/policy response: body: - string: '{"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"}} + string: '{"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"}} ' headers: @@ -25,10 +25,10 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/monitor/policy/fcd6f8ec-e53a-11ed-8b5f-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/7916e37f-b0fe-4f9d-bf9e-37ee3e7a5460 response: body: - string: '{"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"}} + string: '{"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"}} ' headers: @@ -43,7 +43,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/policy/fcd6f8ec-e53a-11ed-8b5f-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/7916e37f-b0fe-4f9d-bf9e-37ee3e7a5460 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_not_found_response.frozen index 4d52b4ac38..6648dee66a 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_not_found_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_not_found_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_ok_response.frozen index 23fa2591c9..0234c33b29 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_ok_response.yaml index 4735413fb7..017cf9eb48 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_notification_rule_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"filter":{"tags":["app:test-get_a_monitor_notification_rule_returns_ok_response-1744280992"]},"name":"test + body: '{"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: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/notification_rule response: body: - string: '{"data":{"type":"monitor-notification-rule","attributes":{"created_at":"2025-04-10T10:29:52.938158+00:00","filter":{"tags":["app:test-get_a_monitor_notification_rule_returns_ok_response-1744280992"]},"recipients":["slack-monitor-app"],"name":"test - rule","modified_at":"1970-01-01T00:00:00+00:00"},"id":"97afb4ac-6953-445f-9a0a-d225673449a6","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + string: '{"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"}}]} ' headers: @@ -27,11 +27,11 @@ interactions: accept: - application/json method: GET - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/97afb4ac-6953-445f-9a0a-d225673449a6 + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/78f7ac92-7bba-4f1f-838f-a6fdc2a08778 response: body: - string: '{"data":{"type":"monitor-notification-rule","attributes":{"name":"test - rule","created_at":"2025-04-10T10:29:52.938158+00:00","recipients":["slack-monitor-app"],"filter":{"tags":["app:test-get_a_monitor_notification_rule_returns_ok_response-1744280992"]},"modified_at":"2025-04-10T10:29:52.948837+00:00"},"id":"97afb4ac-6953-445f-9a0a-d225673449a6"}} + string: '{"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"}} ' headers: @@ -46,7 +46,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/97afb4ac-6953-445f-9a0a-d225673449a6 + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/78f7ac92-7bba-4f1f-838f-a6fdc2a08778 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_not_found_response.frozen new file mode 100644 index 0000000000..958f77273b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_not_found_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:19.940Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_not_found_response.yaml new file mode 100644 index 0000000000..0844139847 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_not_found_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/monitor/template/00000000-0000-1234-0000-000000000000 + response: + body: + string: '{"errors":["Monitor template not found"]}' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_ok_response.frozen new file mode 100644 index 0000000000..722dd6639a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:20.064Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_ok_response.yaml new file mode 100644 index 0000000000..c5895be7f9 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_monitor_user_template_returns_ok_response.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template + response: + body: + string: '{"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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/monitor/template/90eb2b79-fc96-43a5-af65-bf4408f47d9d + response: + body: + string: '{"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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/template/90eb2b79-fc96-43a5-af65-bf4408f47d9d + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_monitor_configuration_policies_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_configuration_policies_returns_ok_response.frozen index ad2811e9e9..2e9129e174 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_all_monitor_configuration_policies_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_configuration_policies_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_get_all_monitor_configuration_policies_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_configuration_policies_returns_ok_response.yaml index 3fa6b9f423..1f385504b6 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_all_monitor_configuration_policies_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_configuration_policies_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"policy":{"tag_key":"testgetallmonitorconfigurationpoliciesreturnsokresponse1682627703","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' + body: '{"data":{"attributes":{"policy":{"tag_key":"testgetallmonitorconfigurationpoliciesreturnsokresponse1748486180","tag_key_required":false,"valid_tag_values":["prod","staging"]},"policy_type":"tag"},"type":"monitor-config-policy"}}' headers: accept: - application/json @@ -10,7 +10,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/policy response: body: - string: '{"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"}} + string: '{"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"}} ' headers: @@ -28,7 +28,7 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/policy response: body: - string: '{"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"}}]} + string: '{"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"}]} ' headers: @@ -43,7 +43,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/policy/fd3bfd14-e53a-11ed-975d-da7ad0900002 + uri: https://api.datadoghq.com/api/v2/monitor/policy/426917ea-f9b0-4c7d-938d-902208db50f8 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_monitor_notification_rules_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_notification_rules_returns_ok_response.frozen index 2681e36773..e92416751b 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_all_monitor_notification_rules_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_notification_rules_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_get_all_monitor_notification_rules_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_notification_rules_returns_ok_response.yaml index 240a547129..efab5b917f 100644 --- a/tests/v2/cassettes/test_scenarios/test_get_all_monitor_notification_rules_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_notification_rules_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"filter":{"tags":["app:test-get_all_monitor_notification_rules_returns_ok_response-1744280994"]},"name":"test + body: '{"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: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/notification_rule response: body: - string: '{"data":{"type":"monitor-notification-rule","attributes":{"name":"test - rule","filter":{"tags":["app:test-get_all_monitor_notification_rules_returns_ok_response-1744280994"]},"recipients":["slack-monitor-app"],"modified_at":"1970-01-01T00:00:00+00:00","created_at":"2025-04-10T10:29:55.362004+00:00"},"relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}},"id":"b7122864-6517-45d3-8dc1-f226a08dd8f4"},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + string: '{"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"}}]} ' headers: @@ -30,8 +30,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/notification_rule response: body: - string: '{"data":[{"type":"monitor-notification-rule","attributes":{"filter":{"tags":["app:test-get_all_monitor_notification_rules_returns_ok_response-1744280994"]},"name":"test - rule","recipients":["slack-monitor-app"],"modified_at":"2025-04-10T10:29:55.373154+00:00","created_at":"2025-04-10T10:29:55.362004+00:00"},"id":"b7122864-6517-45d3-8dc1-f226a08dd8f4"}]} + string: '{"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"}]} ' headers: @@ -46,7 +46,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/b7122864-6517-45d3-8dc1-f226a08dd8f4 + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/dbb04d74-98e6-4f3b-905b-f42d7f0cd9e3 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_monitor_user_templates_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_user_templates_returns_ok_response.frozen new file mode 100644 index 0000000000..fd52edc3bc --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_user_templates_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:21.470Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_monitor_user_templates_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_user_templates_returns_ok_response.yaml new file mode 100644 index 0000000000..9a01c6013b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_monitor_user_templates_returns_ok_response.yaml @@ -0,0 +1,66 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template + response: + body: + string: '{"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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/monitor/template + response: + body: + string: '{"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"}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/template/900b870a-1f9d-4b6c-95b7-9859bbb0a778 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_bad_request_response.frozen index c547acf2ee..5e9f21486d 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_bad_request_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_bad_request_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_bad_request_response.yaml index 525bb7b3ef..43e8d6f05f 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_bad_request_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_bad_request_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_bad_request_response-1744280996"]},"name":"test + body: '{"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: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/notification_rule response: body: - string: '{"data":{"type":"monitor-notification-rule","attributes":{"filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_bad_request_response-1744280996"]},"created_at":"2025-04-10T10:29:56.523436+00:00","recipients":["slack-monitor-app"],"name":"test - rule","modified_at":"1970-01-01T00:00:00+00:00"},"id":"f26ba0a6-1e84-4984-b061-4172a25a1332","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + string: '{"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"}}]} ' headers: @@ -22,15 +22,15 @@ interactions: code: 200 message: OK - request: - body: '{"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"}}' + body: '{"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: accept: - application/json content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/f26ba0a6-1e84-4984-b061-4172a25a1332 + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/571a01f1-8f6f-4792-9f4a-0aa99f9b2365 response: body: string: '{"errors":["Invalid recipients: Recipient handle should not start with @@ -47,7 +47,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/f26ba0a6-1e84-4984-b061-4172a25a1332 + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/571a01f1-8f6f-4792-9f4a-0aa99f9b2365 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_not_found_response.frozen index 2eae355308..37ff149ae9 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_not_found_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_not_found_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_not_found_response.yaml index 8464bd0b74..9c9c07f25e 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_not_found_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_not_found_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_not_found_response-1744280997","host:abc"]},"name":"updated + body: '{"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: accept: diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_ok_response.frozen index b7d42a4489..c2c5ef4ceb 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_ok_response.frozen +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_ok_response.frozen @@ -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/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_ok_response.yaml index 917ed73291..4c0f50f984 100644 --- a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_ok_response.yaml +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_notification_rule_returns_ok_response.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{"data":{"attributes":{"filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_ok_response-1744280997"]},"name":"test + body: '{"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: accept: @@ -11,8 +11,8 @@ interactions: uri: https://api.datadoghq.com/api/v2/monitor/notification_rule response: body: - string: '{"data":{"type":"monitor-notification-rule","attributes":{"name":"test - rule","recipients":["slack-monitor-app"],"modified_at":"1970-01-01T00:00:00+00:00","filter":{"tags":["app:test-update_a_monitor_notification_rule_returns_ok_response-1744280997"]},"created_at":"2025-04-10T10:29:57.930349+00:00"},"id":"da2c8a3b-94ea-49be-a85b-39c5eff99d6a","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + string: '{"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"}}]} ' headers: @@ -22,19 +22,19 @@ interactions: code: 200 message: OK - request: - body: '{"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"}}' + body: '{"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: accept: - application/json content-type: - application/json method: PATCH - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/da2c8a3b-94ea-49be-a85b-39c5eff99d6a + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/48a37c74-cf93-488c-b070-210d650b5687 response: body: - string: '{"data":{"type":"monitor-notification-rule","id":"da2c8a3b-94ea-49be-a85b-39c5eff99d6a","attributes":{"modified_at":"2025-04-10T10:29:58.320928+00:00","recipients":["slack-test-channel"],"name":"updated - rule","filter":{"tags":["test:test-update_a_monitor_notification_rule_returns_ok_response-1744280997","host:abc"]},"created_at":"2025-04-10T10:29:57.930349+00:00"},"relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":"frog","handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2025-04-07T20:19:46.118466+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + string: '{"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"}}]} ' headers: @@ -49,7 +49,7 @@ interactions: accept: - '*/*' method: DELETE - uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/da2c8a3b-94ea-49be-a85b-39c5eff99d6a + uri: https://api.datadoghq.com/api/v2/monitor/notification_rule/48a37c74-cf93-488c-b070-210d650b5687 response: body: string: '' diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_bad_request_response.frozen new file mode 100644 index 0000000000..a212bb1328 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:22.996Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_bad_request_response.yaml new file mode 100644 index 0000000000..041aba2802 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_bad_request_response.yaml @@ -0,0 +1,64 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template + response: + body: + string: '{"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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/monitor/template/a68243ec-7e1c-40da-a99d-8966282c3726 + response: + body: + string: '{"errors":["Invalid monitor_definition or template variables: Monitor + definition cannot be empty."]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/template/a68243ec-7e1c-40da-a99d-8966282c3726 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_not_found_response.frozen new file mode 100644 index 0000000000..ab9a0c9a5a --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_not_found_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:23.616Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_not_found_response.yaml new file mode 100644 index 0000000000..8116d59912 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_not_found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/monitor/template/00000000-0000-1234-0000-000000000000 + response: + body: + string: '{"errors":["Monitor template not found"]}' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_ok_response.frozen new file mode 100644 index 0000000000..5eb2e19348 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:23.765Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_ok_response.yaml new file mode 100644 index 0000000000..15d09f0965 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_monitor_user_template_to_a_new_version_returns_ok_response.yaml @@ -0,0 +1,80 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template + response: + body: + string: '{"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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/monitor/template/fefd62df-924a-4438-a697-f7e6ccbad77e + response: + body: + string: '{"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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/template/fefd62df-924a-4438-a697-f7e6ccbad77e + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_bad_request_response.frozen new file mode 100644 index 0000000000..d87de5207b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:24.411Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_bad_request_response.yaml new file mode 100644 index 0000000000..9d93979037 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_bad_request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '{"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: + accept: + - '*/*' + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template/validate + response: + body: + string: '{"errors":["Invalid monitor_definition or template variables: Monitor + definition cannot be empty."]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_ok_response.frozen new file mode 100644 index 0000000000..31ae01fbc0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:24.538Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_ok_response.yaml new file mode 100644 index 0000000000..d9cc348565 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_a_monitor_user_template_returns_ok_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: '{"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: + accept: + - '*/*' + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template/validate + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_bad_request_response.frozen new file mode 100644 index 0000000000..e32f4a20fc --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:24.721Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_bad_request_response.yaml new file mode 100644 index 0000000000..85f630bc20 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_bad_request_response.yaml @@ -0,0 +1,65 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template + response: + body: + string: '{"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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"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: + accept: + - '*/*' + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template/599fecff-7834-42bd-976b-c2d145f42579/validate + response: + body: + string: '{"errors":["Invalid monitor_definition or template variables: Monitor + definition cannot be empty."]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/template/599fecff-7834-42bd-976b-c2d145f42579 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_not_found_response.frozen new file mode 100644 index 0000000000..5262ab4af9 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_not_found_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:25.252Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_not_found_response.yaml new file mode 100644 index 0000000000..f21d3237e9 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_not_found_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: '{"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: + accept: + - '*/*' + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template/00000000-0000-1234-0000-000000000000/validate + response: + body: + string: '{"errors":["Monitor template not found"]}' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_ok_response.frozen new file mode 100644 index 0000000000..84fcf64770 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_ok_response.frozen @@ -0,0 +1 @@ +2025-05-29T02:36:25.384Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_ok_response.yaml new file mode 100644 index 0000000000..04c931819d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_validate_an_existing_monitor_user_template_returns_ok_response.yaml @@ -0,0 +1,65 @@ +interactions: +- request: + body: '{"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: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template + response: + body: + string: '{"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"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"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: + accept: + - '*/*' + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/monitor/template/dc86b1ba-9e7c-40cf-8859-777c53e4f1a2/validate + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/monitor/template/dc86b1ba-9e7c-40cf-8859-777c53e4f1a2 + response: + body: + string: '' + headers: + content-type: + - text/html; charset=utf-8 + status: + code: 204 + message: No Content +version: 1 diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 85541755d9..9a7a555768 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/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/tests/v2/features/monitors.feature b/tests/v2/features/monitors.feature index 5620258697..ddc106e02b 100644 --- a/tests/v2/features/monitors.feature +++ b/tests/v2/features/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/tests/v2/features/undo.json b/tests/v2/features/undo.json index e81cb7b7ce..761a726fc6 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/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": {