diff --git a/.apigentools-info b/.apigentools-info index 2f4735f318..a2f4cadcc9 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.4", - "regenerated": "2023-06-06 18:38:45.076485", - "spec_repo_commit": "26e48ac5" + "regenerated": "2023-06-06 21:02:27.206020", + "spec_repo_commit": "384fa07c" }, "v2": { "apigentools_version": "1.6.4", - "regenerated": "2023-06-06 18:38:45.094631", - "spec_repo_commit": "26e48ac5" + "regenerated": "2023-06-06 21:02:27.218046", + "spec_repo_commit": "384fa07c" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 02f4190bbd..b52c76b0e2 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -2973,6 +2973,577 @@ components: type: string x-enum-varnames: - DETAILED_FINDING + DowntimeAttributeCreateRequest: + description: Downtime details. + properties: + display_timezone: + $ref: '#/components/schemas/DowntimeAttributeDisplayTimezone' + message: + $ref: '#/components/schemas/DowntimeAttributeMessage' + monitor_identifier: + $ref: '#/components/schemas/DowntimeAttributeMonitorIdentifier' + mute_first_recovery_notification: + $ref: '#/components/schemas/DowntimeAttributeMuteFirstRecoveryNotification' + notify_end_states: + $ref: '#/components/schemas/DowntimeAttributeNotifyEndStates' + notify_end_types: + $ref: '#/components/schemas/DowntimeAttributeNotifyEndTypes' + schedule: + $ref: '#/components/schemas/DowntimeAttributeScheduleCreateRequest' + scope: + $ref: '#/components/schemas/DowntimeAttributeScope' + required: + - scope + - monitor_identifier + type: object + DowntimeAttributeDisplayTimezone: + default: UTC + description: 'The timezone in which to display the downtime''s start and end + times in Datadog applications. This is not used + + as an offset for scheduling.' + example: America/New_York + nullable: true + type: string + DowntimeAttributeEditRequest: + description: Attributes of the downtime to update. + properties: + display_timezone: + $ref: '#/components/schemas/DowntimeAttributeDisplayTimezone' + message: + $ref: '#/components/schemas/DowntimeAttributeMessage' + monitor_identifier: + $ref: '#/components/schemas/DowntimeAttributeMonitorIdentifier' + mute_first_recovery_notification: + $ref: '#/components/schemas/DowntimeAttributeMuteFirstRecoveryNotification' + notify_end_states: + $ref: '#/components/schemas/DowntimeAttributeNotifyEndStates' + notify_end_types: + $ref: '#/components/schemas/DowntimeAttributeNotifyEndTypes' + schedule: + $ref: '#/components/schemas/DowntimeAttributeScheduleEditRequest' + scope: + $ref: '#/components/schemas/DowntimeAttributeScope' + type: object + DowntimeAttributeMessage: + description: 'A message to include with notifications for this downtime. Email + notifications can be sent to specific users + + by using the same `@username` notation as events.' + example: Message about the downtime + nullable: true + type: string + DowntimeAttributeMonitorIdentifier: + description: Monitor identifier for the downtime + oneOf: + - $ref: '#/components/schemas/DowntimeAttributeMonitorIdentifierId' + - $ref: '#/components/schemas/DowntimeAttributeMonitorIdentifierTags' + type: object + DowntimeAttributeMonitorIdentifierId: + additionalProperties: {} + description: Object of the monitor identifier. + properties: + monitor_id: + description: ID of the monitor to prevent notifications. + example: 123 + format: int64 + type: integer + required: + - monitor_id + type: object + DowntimeAttributeMonitorIdentifierTags: + additionalProperties: {} + description: Object of the monitor tags. + properties: + monitor_tags: + description: 'A list of monitor tags. For example, tags that are applied + directly to monitors, + + not tags that are used in monitor queries (which are filtered by the scope + parameter), to which the downtime applies. + + The resulting downtime applies to monitors that match ALL provided monitor + tags.' + example: + - service:postgres + - team:frontend + items: + description: A list of monitor tags. + example: service:postgres + type: string + type: array + required: + - monitor_tags + type: object + DowntimeAttributeMuteFirstRecoveryNotification: + description: If the first recovery notification during a downtime should be + muted. + example: false + type: boolean + DowntimeAttributeNotifyEndStateActions: + description: Action that will trigger a monitor notification if the downtime + is in the `notify_end_types` state. + enum: + - canceled + - expired + example: canceled + type: string + x-enum-varnames: + - CANCELED + - EXPIRED + DowntimeAttributeNotifyEndStateTypes: + description: State that will trigger a monitor notification when the `notify_end_types` + action occurs. + enum: + - alert + - no data + - warn + example: alert + type: string + x-enum-varnames: + - ALERT + - NO_DATA + - WARN + DowntimeAttributeNotifyEndStates: + description: States that will trigger a monitor notification when the `notify_end_types` + action occurs. + example: + - alert + - warn + items: + $ref: '#/components/schemas/DowntimeAttributeNotifyEndStateTypes' + type: array + DowntimeAttributeNotifyEndTypes: + description: Actions that will trigger a monitor notification if the downtime + is in the `notify_end_types` state. + example: + - canceled + - expired + items: + $ref: '#/components/schemas/DowntimeAttributeNotifyEndStateActions' + type: array + DowntimeAttributeResponse: + description: Downtime details. + properties: + created_at: + description: Creation time of the downtime. + example: 2020-01-02T03:04:05.282979+0000 + format: date-time + type: string + display_timezone: + $ref: '#/components/schemas/DowntimeAttributeDisplayTimezone' + message: + $ref: '#/components/schemas/DowntimeAttributeMessage' + modified_at: + description: Time that the downtime was last modified. + example: 2020-01-02T03:04:05.282979+0000 + format: date-time + type: string + monitor_identifier: + $ref: '#/components/schemas/DowntimeAttributeMonitorIdentifier' + mute_first_recovery_notification: + $ref: '#/components/schemas/DowntimeAttributeMuteFirstRecoveryNotification' + notify_end_states: + $ref: '#/components/schemas/DowntimeAttributeNotifyEndStates' + notify_end_types: + $ref: '#/components/schemas/DowntimeAttributeNotifyEndTypes' + schedule: + $ref: '#/components/schemas/DowntimeAttributeScheduleResponse' + scope: + $ref: '#/components/schemas/DowntimeAttributeScope' + status: + $ref: '#/components/schemas/DowntimeStatusEnum' + type: object + DowntimeAttributeScheduleCreateRequest: + description: Schedule for the downtime. + oneOf: + - $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrencesCreateRequest' + - $ref: '#/components/schemas/DowntimeAttributeScheduleOneTimeCreateEditRequest' + type: object + DowntimeAttributeScheduleCurrentDowntimeResponse: + description: 'The most recent actual start and end dates for a recurring downtime. + For a canceled downtime, + + this is the previously occurring downtime. For active downtimes, this is the + ongoing downtime, and for scheduled + + downtimes it is the upcoming downtime.' + properties: + end: + description: The end of the current downtime. + example: 2020-01-02 03:04:00+00:00 + format: date-time + nullable: true + type: string + start: + description: The start of the current downtime. + example: 2020-01-02 03:04:00+00:00 + format: date-time + type: string + type: object + DowntimeAttributeScheduleEditRequest: + description: Schedule for the downtime. + oneOf: + - $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrencesEditRequest' + - $ref: '#/components/schemas/DowntimeAttributeScheduleOneTimeCreateEditRequest' + type: object + DowntimeAttributeScheduleOneTimeCreateEditRequest: + additionalProperties: {} + description: A one-time downtime definition. + properties: + end: + description: 'ISO-8601 Datetime to end the downtime. Must include a UTC + offset of zero. If not provided, the + + downtime starts the moment it is created.' + example: 2020-01-02 03:04:00+00:00 + format: date-time + nullable: true + type: string + start: + description: 'ISO-8601 Datetime to start the downtime. Must include a UTC + offset of zero. If not provided, the + + downtime starts the moment it is created.' + example: 2020-01-02 03:04:00+00:00 + format: date-time + nullable: true + type: string + type: object + DowntimeAttributeScheduleOneTimeResponse: + description: A one-time downtime definition. + properties: + end: + description: ISO-8601 Datetime to end the downtime. + example: 2020-01-02 03:04:00+00:00 + format: date-time + nullable: true + type: string + start: + description: ISO-8601 Datetime to start the downtime. + example: 2020-01-02 03:04:00+00:00 + format: date-time + type: string + type: object + DowntimeAttributeScheduleRecurrenceCreateEditRequest: + additionalProperties: {} + description: An object defining the recurrence of the downtime. + properties: + duration: + $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrenceDuration' + rrule: + $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrenceRrule' + start: + description: 'ISO-8601 Datetime to start the downtime. Must not include + a UTC offset. If not provided, the + + downtime starts the moment it is created.' + example: 2020-01-02T03:04 + nullable: true + type: string + required: + - duration + - rrule + type: object + DowntimeAttributeScheduleRecurrenceDuration: + description: The length of the downtime. Must begin with an integer and end + with one of 'm', 'h', d', or 'w'. + example: 123d + type: string + DowntimeAttributeScheduleRecurrenceResponse: + description: An RRULE-based recurring downtime. + properties: + duration: + $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrenceDuration' + rrule: + $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrenceRrule' + start: + description: 'ISO-8601 Datetime to start the downtime. Must not include + a UTC offset. If not provided, the + + downtime starts the moment it is created.' + example: 2020-01-02T03:04 + type: string + type: object + DowntimeAttributeScheduleRecurrenceRrule: + description: 'The `RRULE` standard for defining recurring events. + + For example, to have a recurring event on the first day of each month, set + the type to `rrule` and set the `FREQ` to `MONTHLY` and `BYMONTHDAY` to `1`. + + Most common `rrule` options from the [iCalendar Spec](https://tools.ietf.org/html/rfc5545) + are supported. + + + **Note**: Attributes specifying the duration in `RRULE` are not supported + (for example, `DTSTART`, `DTEND`, `DURATION`). + + More examples available in this [downtime guide](https://docs.datadoghq.com/monitors/guide/suppress-alert-with-downtimes/?tab=api).' + example: FREQ=MONTHLY;BYSETPOS=3;BYDAY=WE;INTERVAL=1 + type: string + DowntimeAttributeScheduleRecurrencesCreateRequest: + description: A recurring downtime schedule definition. + properties: + recurrences: + description: A list of downtime recurrences. + items: + $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrenceCreateEditRequest' + type: array + timezone: + default: UTC + description: The timezone in which to schedule the downtime. + example: America/New_York + type: string + required: + - recurrences + type: object + DowntimeAttributeScheduleRecurrencesEditRequest: + description: A recurring downtime schedule definition. + properties: + recurrences: + description: A list of downtime recurrences. + items: + $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrenceCreateEditRequest' + type: array + timezone: + default: UTC + description: The timezone in which to schedule the downtime. + example: America/New_York + type: string + type: object + DowntimeAttributeScheduleRecurrencesResponse: + description: A recurring downtime schedule definition. + properties: + current_downtime: + $ref: '#/components/schemas/DowntimeAttributeScheduleCurrentDowntimeResponse' + recurrences: + description: A list of downtime recurrences. + items: + $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrenceResponse' + maxItems: 5 + minItems: 1 + type: array + timezone: + default: UTC + description: 'The timezone in which to schedule the downtime. This affects + recurring start and end dates. + + Must match `display_timezone`.' + example: America/New_York + type: string + required: + - recurrences + type: object + DowntimeAttributeScheduleResponse: + description: 'The schedule that defines when the monitor starts, stops, and + recurs. There are two types of schedules: + + one-time and recurring. Recurring schedules may have up to five RRULE-based + recurrences. If no schedules is + + provided, the downtime will begin immediately and never end.' + oneOf: + - $ref: '#/components/schemas/DowntimeAttributeScheduleRecurrencesResponse' + - $ref: '#/components/schemas/DowntimeAttributeScheduleOneTimeResponse' + type: object + DowntimeAttributeScope: + description: 'The scope to which the downtime applies. Must be in + + [simple grammar syntax](https://docs.datadoghq.com/logs/explorer/search_syntax/).' + example: env:(staging OR prod) AND datacenter:us-east-1 + type: string + DowntimeCreateData: + description: Object to create a downtime. + properties: + attributes: + $ref: '#/components/schemas/DowntimeAttributeCreateRequest' + type: + $ref: '#/components/schemas/DowntimeResourceType' + required: + - type + - attributes + type: object + DowntimeCreateRequest: + description: Request for creating a downtime. + properties: + data: + $ref: '#/components/schemas/DowntimeCreateData' + required: + - data + type: object + DowntimeEditData: + description: Object to update a downtime. + properties: + attributes: + $ref: '#/components/schemas/DowntimeAttributeEditRequest' + id: + description: ID of this downtime. + example: 00000000-0000-1234-0000-000000000000 + type: string + type: + $ref: '#/components/schemas/DowntimeResourceType' + required: + - id + - type + - attributes + type: object + DowntimeEditRequest: + description: Request for editing a downtime. + properties: + data: + $ref: '#/components/schemas/DowntimeEditData' + required: + - data + type: object + DowntimeIncludedMonitorType: + default: monitors + description: Monitor resource type. + enum: + - monitors + example: monitors + type: string + x-enum-varnames: + - MONITORS + DowntimeListItemResponse: + description: A downtime data. + properties: + data: + $ref: '#/components/schemas/DowntimeResponseData' + type: object + DowntimeMonitorIncludedAttributes: + description: Attributes of the monitor identified by the downtime. + properties: + name: + description: The name of the monitor identified by the downtime. + example: A monitor name + type: string + type: object + DowntimeMonitorIncludedItem: + description: Information about the monitor identified by the downtime. + properties: + attributes: + $ref: '#/components/schemas/DowntimeMonitorIncludedAttributes' + id: + description: ID of the monitor identified by the downtime. + example: 12345 + format: int64 + type: integer + type: + $ref: '#/components/schemas/DowntimeIncludedMonitorType' + type: object + DowntimeRelationships: + description: All relationships associated with downtime. + properties: + created_by: + $ref: '#/components/schemas/DowntimeRelationshipsCreatedBy' + monitor: + $ref: '#/components/schemas/DowntimeRelationshipsMonitor' + type: object + DowntimeRelationshipsCreatedBy: + description: The user who created the downtime. + properties: + data: + $ref: '#/components/schemas/DowntimeRelationshipsCreatedByData' + type: object + DowntimeRelationshipsCreatedByData: + description: Data for the user who created the downtime. + nullable: true + properties: + id: + description: User ID of the downtime creator. + example: 00000000-0000-1234-0000-000000000000 + type: string + type: + $ref: '#/components/schemas/DowntimeUserType' + type: object + DowntimeRelationshipsMonitor: + description: The monitor identified by the downtime. + properties: + data: + $ref: '#/components/schemas/DowntimeRelationshipsMonitorData' + type: object + DowntimeRelationshipsMonitorData: + description: Data for the monitor. + nullable: true + properties: + id: + description: Monitor ID of the downtime. + example: 12345 + format: int64 + type: integer + type: + $ref: '#/components/schemas/DowntimeIncludedMonitorType' + type: object + DowntimeResourceType: + default: downtime + description: Downtime resource type. + enum: + - downtime + example: downtime + type: string + x-enum-varnames: + - DOWNTIME + DowntimeResponse: + description: 'Downtiming gives you greater control over monitor notifications + by + + allowing you to globally exclude scopes from alerting. + + Downtime settings, which can be scheduled with start and end times, + + prevent all alerting related to specified Datadog tags.' + properties: + data: + $ref: '#/components/schemas/DowntimeResponseData' + included: + description: Array of objects related to the downtime that the user requested. + items: + $ref: '#/components/schemas/DowntimeResponseIncludedItem' + type: array + type: object + DowntimeResponseData: + description: Downtime data. + properties: + attributes: + $ref: '#/components/schemas/DowntimeAttributeResponse' + id: + description: The downtime ID. + example: 00000000-0000-1234-0000-000000000000 + type: string + relationships: + $ref: '#/components/schemas/DowntimeRelationships' + type: + $ref: '#/components/schemas/DowntimeResourceType' + type: object + DowntimeResponseIncludedItem: + description: An object related to a downtime. + oneOf: + - $ref: '#/components/schemas/User' + - $ref: '#/components/schemas/DowntimeMonitorIncludedItem' + type: object + DowntimeStatusEnum: + description: The current status of the downtime + enum: + - active + - canceled + - ended + - scheduled + example: active + type: string + x-enum-varnames: + - ACTIVE + - CANCELED + - ENDED + - SCHEDULED + DowntimeUserType: + default: users + description: User resource type. + enum: + - users + example: users + type: string + x-enum-varnames: + - USERS Event: description: The metadata associated with a request. properties: @@ -6184,6 +6755,20 @@ components: $ref: '#/components/schemas/ApplicationKeyResponseIncludedItem' type: array type: object + ListDowntimesResponse: + description: Response for retrieving all downtimes. + properties: + data: + description: An array of downtimes. + items: + $ref: '#/components/schemas/DowntimeListItemResponse' + type: array + included: + description: Array of objects related to the users. + items: + $ref: '#/components/schemas/UserResponseIncludedItem' + type: array + type: object ListFindingsData: description: Array of findings. items: @@ -16361,6 +16946,252 @@ paths: tags: - Dashboard Lists x-codegen-request-body-name: body + /api/v2/downtime: + get: + description: Get all scheduled downtimes. + operationId: ListDowntimes + parameters: + - description: Only return downtimes that are active when the request is made. + in: query + name: current_only + required: false + schema: + type: boolean + - description: 'Comma separated list of resource paths for related resources + to include in the response. Supported resource + + paths are `created_by` and `monitor`.' + in: query + name: include + required: false + schema: + example: created_by,monitor + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ListDowntimesResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_read + summary: Get all downtimes + tags: + - Downtimes + x-unstable: '**Note**: This endpoint is in private beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Schedule a downtime. + operationId: CreateDowntime + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DowntimeCreateRequest' + description: Schedule a downtime request body. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DowntimeResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_downtime + summary: Schedule a downtime + tags: + - Downtimes + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in private beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/)' + /api/v2/downtime/{downtime_id}: + delete: + description: Cancel a downtime. + operationId: CancelDowntime + parameters: + - description: ID of the downtime to cancel. + in: path + name: downtime_id + required: true + schema: + example: 00000000-0000-1234-0000-000000000000 + type: string + responses: + '204': + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Downtime not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_downtime + summary: Cancel a downtime + tags: + - Downtimes + x-unstable: '**Note**: This endpoint is in private beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/)' + get: + description: Get downtime detail by `downtime_id`. + operationId: GetDowntime + parameters: + - description: ID of the downtime to fetch. + in: path + name: downtime_id + required: true + schema: + example: 00000000-0000-1234-0000-000000000000 + type: string + - description: 'Comma separated list of resource paths for related resources + to include in the response. Supported resource + + paths are `created_by` and `monitor`.' + in: query + name: include + required: false + schema: + example: created_by,monitor + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DowntimeResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_read + summary: Get a downtime + tags: + - Downtimes + x-unstable: '**Note**: This endpoint is in private beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/)' + patch: + description: Update a downtime by `downtime_id`. + operationId: UpdateDowntime + parameters: + - description: ID of the downtime to update. + in: path + name: downtime_id + required: true + schema: + example: 00e000000-0000-1234-0000-000000000000 + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DowntimeEditRequest' + description: Update a downtime request body. + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/DowntimeResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Downtime not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - monitors_downtime + summary: Update a downtime + tags: + - Downtimes + x-codegen-request-body-name: body + x-unstable: '**Note**: This endpoint is in private beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/)' /api/v2/events: get: description: 'List endpoint returns events that match an events search query. @@ -16439,7 +17270,7 @@ paths: cursorPath: meta.page.after limitParam: page[limit] resultsPath: data - x-unstable: '**Note**: This endpoint is in beta. + x-unstable: '**Note**: This endpoint is in private beta. For access, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/events/search: @@ -16484,7 +17315,7 @@ paths: cursorPath: meta.page.after limitParam: body.page.limit resultsPath: data - x-unstable: '**Note**: This endpoint is in beta. + x-unstable: '**Note**: This endpoint is in private beta. For access, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/incidents: @@ -24878,6 +25709,18 @@ tags: organization.' name: Dashboard Lists +- description: '**Note**: Downtime V2 is currently in private beta. To request access, + contact [Datadog support](https://docs.datadoghq.com/help/). + + + [Downtiming](https://docs.datadoghq.com/monitors/notify/downtimes) gives + + you greater control over monitor notifications by allowing you to globally exclude + + scopes from alerting. Downtime settings, which can be scheduled with start and + + end times, prevent all alerting related to specified Datadog tags.' + name: Downtimes - description: 'The events service allows you to programmatically post events to the event stream diff --git a/docs/datadog_api_client.v2.api.rst b/docs/datadog_api_client.v2.api.rst index fd107a6feb..ba9bdb48f6 100644 --- a/docs/datadog_api_client.v2.api.rst +++ b/docs/datadog_api_client.v2.api.rst @@ -57,6 +57,13 @@ dashboard\_lists\_api :members: :show-inheritance: +downtimes\_api +-------------- + +.. automodule:: datadog_api_client.v2.api.downtimes_api + :members: + :show-inheritance: + events\_api ----------- diff --git a/docs/datadog_api_client.v2.model.rst b/docs/datadog_api_client.v2.model.rst index 5aa364f9ea..8258a26676 100644 --- a/docs/datadog_api_client.v2.model.rst +++ b/docs/datadog_api_client.v2.model.rst @@ -1191,6 +1191,272 @@ detailed\_finding\_type :members: :show-inheritance: +downtime\_attribute\_create\_request +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_create_request + :members: + :show-inheritance: + +downtime\_attribute\_edit\_request +---------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_edit_request + :members: + :show-inheritance: + +downtime\_attribute\_monitor\_identifier +---------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_monitor_identifier + :members: + :show-inheritance: + +downtime\_attribute\_monitor\_identifier\_id +-------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_monitor_identifier_id + :members: + :show-inheritance: + +downtime\_attribute\_monitor\_identifier\_tags +---------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_monitor_identifier_tags + :members: + :show-inheritance: + +downtime\_attribute\_notify\_end\_state\_actions +------------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_notify_end_state_actions + :members: + :show-inheritance: + +downtime\_attribute\_notify\_end\_state\_types +---------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_notify_end_state_types + :members: + :show-inheritance: + +downtime\_attribute\_response +----------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_response + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_create\_request +---------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_create_request + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_current\_downtime\_response +---------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_current_downtime_response + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_edit\_request +-------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_edit_request + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_one\_time\_create\_edit\_request +--------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_one_time_create_edit_request + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_one\_time\_response +-------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_one_time_response + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_recurrence\_create\_edit\_request +---------------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_recurrence_create_edit_request + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_recurrence\_response +--------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_recurrence_response + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_recurrences\_create\_request +----------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_create_request + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_recurrences\_edit\_request +--------------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_edit_request + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_recurrences\_response +---------------------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_response + :members: + :show-inheritance: + +downtime\_attribute\_schedule\_response +--------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_attribute_schedule_response + :members: + :show-inheritance: + +downtime\_create\_data +---------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_create_data + :members: + :show-inheritance: + +downtime\_create\_request +------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_create_request + :members: + :show-inheritance: + +downtime\_edit\_data +-------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_edit_data + :members: + :show-inheritance: + +downtime\_edit\_request +----------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_edit_request + :members: + :show-inheritance: + +downtime\_included\_monitor\_type +--------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_included_monitor_type + :members: + :show-inheritance: + +downtime\_list\_item\_response +------------------------------ + +.. automodule:: datadog_api_client.v2.model.downtime_list_item_response + :members: + :show-inheritance: + +downtime\_monitor\_included\_attributes +--------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_monitor_included_attributes + :members: + :show-inheritance: + +downtime\_monitor\_included\_item +--------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_monitor_included_item + :members: + :show-inheritance: + +downtime\_relationships +----------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_relationships + :members: + :show-inheritance: + +downtime\_relationships\_created\_by +------------------------------------ + +.. automodule:: datadog_api_client.v2.model.downtime_relationships_created_by + :members: + :show-inheritance: + +downtime\_relationships\_created\_by\_data +------------------------------------------ + +.. automodule:: datadog_api_client.v2.model.downtime_relationships_created_by_data + :members: + :show-inheritance: + +downtime\_relationships\_monitor +-------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_relationships_monitor + :members: + :show-inheritance: + +downtime\_relationships\_monitor\_data +-------------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_relationships_monitor_data + :members: + :show-inheritance: + +downtime\_resource\_type +------------------------ + +.. automodule:: datadog_api_client.v2.model.downtime_resource_type + :members: + :show-inheritance: + +downtime\_response +------------------ + +.. automodule:: datadog_api_client.v2.model.downtime_response + :members: + :show-inheritance: + +downtime\_response\_data +------------------------ + +.. automodule:: datadog_api_client.v2.model.downtime_response_data + :members: + :show-inheritance: + +downtime\_response\_included\_item +---------------------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_response_included_item + :members: + :show-inheritance: + +downtime\_status\_enum +---------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_status_enum + :members: + :show-inheritance: + +downtime\_user\_type +-------------------- + +.. automodule:: datadog_api_client.v2.model.downtime_user_type + :members: + :show-inheritance: + event ----- @@ -2689,6 +2955,13 @@ list\_application\_keys\_response :members: :show-inheritance: +list\_downtimes\_response +------------------------- + +.. automodule:: datadog_api_client.v2.model.list_downtimes_response + :members: + :show-inheritance: + list\_findings\_meta -------------------- diff --git a/examples/v2/downtimes/CancelDowntime.py b/examples/v2/downtimes/CancelDowntime.py new file mode 100644 index 0000000000..66f2c35ffa --- /dev/null +++ b/examples/v2/downtimes/CancelDowntime.py @@ -0,0 +1,18 @@ +""" +Cancel a downtime returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.downtimes_api import DowntimesApi + +# there is a valid "downtime_v2" in the system +DOWNTIME_V2_DATA_ID = environ["DOWNTIME_V2_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["cancel_downtime"] = True +with ApiClient(configuration) as api_client: + api_instance = DowntimesApi(api_client) + api_instance.cancel_downtime( + downtime_id=DOWNTIME_V2_DATA_ID, + ) diff --git a/examples/v2/downtimes/CreateDowntime.py b/examples/v2/downtimes/CreateDowntime.py new file mode 100644 index 0000000000..b97ca34e50 --- /dev/null +++ b/examples/v2/downtimes/CreateDowntime.py @@ -0,0 +1,42 @@ +""" +Schedule a downtime returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.downtimes_api import DowntimesApi +from datadog_api_client.v2.model.downtime_attribute_create_request import DowntimeAttributeCreateRequest +from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_tags import ( + DowntimeAttributeMonitorIdentifierTags, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_one_time_create_edit_request import ( + DowntimeAttributeScheduleOneTimeCreateEditRequest, +) +from datadog_api_client.v2.model.downtime_create_data import DowntimeCreateData +from datadog_api_client.v2.model.downtime_create_request import DowntimeCreateRequest +from datadog_api_client.v2.model.downtime_resource_type import DowntimeResourceType + +body = DowntimeCreateRequest( + data=DowntimeCreateData( + attributes=DowntimeAttributeCreateRequest( + message="dark forest", + monitor_identifier=DowntimeAttributeMonitorIdentifierTags( + monitor_tags=[ + "cat:hat", + ], + ), + scope="test:exampledowntime", + schedule=DowntimeAttributeScheduleOneTimeCreateEditRequest( + start=None, + ), + ), + type=DowntimeResourceType.DOWNTIME, + ), +) + +configuration = Configuration() +configuration.unstable_operations["create_downtime"] = True +with ApiClient(configuration) as api_client: + api_instance = DowntimesApi(api_client) + response = api_instance.create_downtime(body=body) + + print(response) diff --git a/examples/v2/downtimes/GetDowntime.py b/examples/v2/downtimes/GetDowntime.py new file mode 100644 index 0000000000..168e0e721e --- /dev/null +++ b/examples/v2/downtimes/GetDowntime.py @@ -0,0 +1,20 @@ +""" +Get a downtime returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.downtimes_api import DowntimesApi + +# there is a valid "downtime_v2" in the system +DOWNTIME_V2_DATA_ID = environ["DOWNTIME_V2_DATA_ID"] + +configuration = Configuration() +configuration.unstable_operations["get_downtime"] = True +with ApiClient(configuration) as api_client: + api_instance = DowntimesApi(api_client) + response = api_instance.get_downtime( + downtime_id=DOWNTIME_V2_DATA_ID, + ) + + print(response) diff --git a/examples/v2/downtimes/ListDowntimes.py b/examples/v2/downtimes/ListDowntimes.py new file mode 100644 index 0000000000..0c49c7a50b --- /dev/null +++ b/examples/v2/downtimes/ListDowntimes.py @@ -0,0 +1,14 @@ +""" +Get all downtimes returns "OK" response +""" + +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.downtimes_api import DowntimesApi + +configuration = Configuration() +configuration.unstable_operations["list_downtimes"] = True +with ApiClient(configuration) as api_client: + api_instance = DowntimesApi(api_client) + response = api_instance.list_downtimes() + + print(response) diff --git a/examples/v2/downtimes/UpdateDowntime.py b/examples/v2/downtimes/UpdateDowntime.py new file mode 100644 index 0000000000..3c356c5916 --- /dev/null +++ b/examples/v2/downtimes/UpdateDowntime.py @@ -0,0 +1,32 @@ +""" +Update a downtime returns "OK" response +""" + +from os import environ +from datadog_api_client import ApiClient, Configuration +from datadog_api_client.v2.api.downtimes_api import DowntimesApi +from datadog_api_client.v2.model.downtime_attribute_edit_request import DowntimeAttributeEditRequest +from datadog_api_client.v2.model.downtime_edit_data import DowntimeEditData +from datadog_api_client.v2.model.downtime_edit_request import DowntimeEditRequest +from datadog_api_client.v2.model.downtime_resource_type import DowntimeResourceType + +# there is a valid "downtime_v2" in the system +DOWNTIME_V2_DATA_ID = environ["DOWNTIME_V2_DATA_ID"] + +body = DowntimeEditRequest( + data=DowntimeEditData( + attributes=DowntimeAttributeEditRequest( + message="light speed", + ), + id=DOWNTIME_V2_DATA_ID, + type=DowntimeResourceType.DOWNTIME, + ), +) + +configuration = Configuration() +configuration.unstable_operations["update_downtime"] = True +with ApiClient(configuration) as api_client: + api_instance = DowntimesApi(api_client) + response = api_instance.update_downtime(downtime_id=DOWNTIME_V2_DATA_ID, body=body) + + print(response) diff --git a/src/datadog_api_client/configuration.py b/src/datadog_api_client/configuration.py index 002d143b43..2d5505a3d6 100644 --- a/src/datadog_api_client/configuration.py +++ b/src/datadog_api_client/configuration.py @@ -221,6 +221,11 @@ def __init__( # Keep track of unstable operations self.unstable_operations = _UnstableOperations( { + "v2.cancel_downtime": False, + "v2.create_downtime": False, + "v2.get_downtime": False, + "v2.list_downtimes": False, + "v2.update_downtime": False, "v2.list_events": False, "v2.search_events": False, "v2.create_incident": False, diff --git a/src/datadog_api_client/v2/api/downtimes_api.py b/src/datadog_api_client/v2/api/downtimes_api.py new file mode 100644 index 0000000000..7fe23431cd --- /dev/null +++ b/src/datadog_api_client/v2/api/downtimes_api.py @@ -0,0 +1,272 @@ +# 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, Union + +from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint +from datadog_api_client.configuration import Configuration +from datadog_api_client.model_utils import ( + UnsetType, + unset, +) +from datadog_api_client.v2.model.list_downtimes_response import ListDowntimesResponse +from datadog_api_client.v2.model.downtime_response import DowntimeResponse +from datadog_api_client.v2.model.downtime_create_request import DowntimeCreateRequest +from datadog_api_client.v2.model.downtime_edit_request import DowntimeEditRequest + + +class DowntimesApi: + """ + **Note** : Downtime V2 is currently in private beta. To request access, contact `Datadog support `_. + + `Downtiming `_ gives + you greater control over monitor notifications by allowing you to globally exclude + scopes from alerting. Downtime settings, which can be scheduled with start and + end times, prevent all alerting related to specified Datadog tags. + """ + + def __init__(self, api_client=None): + if api_client is None: + api_client = ApiClient(Configuration()) + self.api_client = api_client + + self._cancel_downtime_endpoint = _Endpoint( + settings={ + "response_type": None, + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/downtime/{downtime_id}", + "operation_id": "cancel_downtime", + "http_method": "DELETE", + "version": "v2", + "servers": None, + }, + params_map={ + "downtime_id": { + "required": True, + "openapi_types": (str,), + "attribute": "downtime_id", + "location": "path", + }, + }, + headers_map={ + "accept": ["*/*"], + "content_type": [], + }, + api_client=api_client, + ) + + self._create_downtime_endpoint = _Endpoint( + settings={ + "response_type": (DowntimeResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/downtime", + "operation_id": "create_downtime", + "http_method": "POST", + "version": "v2", + "servers": None, + }, + params_map={ + "body": { + "required": True, + "openapi_types": (DowntimeCreateRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + self._get_downtime_endpoint = _Endpoint( + settings={ + "response_type": (DowntimeResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/downtime/{downtime_id}", + "operation_id": "get_downtime", + "http_method": "GET", + "version": "v2", + "servers": None, + }, + params_map={ + "downtime_id": { + "required": True, + "openapi_types": (str,), + "attribute": "downtime_id", + "location": "path", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + "content_type": [], + }, + api_client=api_client, + ) + + self._list_downtimes_endpoint = _Endpoint( + settings={ + "response_type": (ListDowntimesResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/downtime", + "operation_id": "list_downtimes", + "http_method": "GET", + "version": "v2", + "servers": None, + }, + params_map={ + "current_only": { + "openapi_types": (bool,), + "attribute": "current_only", + "location": "query", + }, + "include": { + "openapi_types": (str,), + "attribute": "include", + "location": "query", + }, + }, + headers_map={ + "accept": ["application/json"], + "content_type": [], + }, + api_client=api_client, + ) + + self._update_downtime_endpoint = _Endpoint( + settings={ + "response_type": (DowntimeResponse,), + "auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"], + "endpoint_path": "/api/v2/downtime/{downtime_id}", + "operation_id": "update_downtime", + "http_method": "PATCH", + "version": "v2", + "servers": None, + }, + params_map={ + "downtime_id": { + "required": True, + "openapi_types": (str,), + "attribute": "downtime_id", + "location": "path", + }, + "body": { + "required": True, + "openapi_types": (DowntimeEditRequest,), + "location": "body", + }, + }, + headers_map={"accept": ["application/json"], "content_type": ["application/json"]}, + api_client=api_client, + ) + + def cancel_downtime( + self, + downtime_id: str, + ) -> None: + """Cancel a downtime. + + Cancel a downtime. + + :param downtime_id: ID of the downtime to cancel. + :type downtime_id: str + :rtype: None + """ + kwargs: Dict[str, Any] = {} + kwargs["downtime_id"] = downtime_id + + return self._cancel_downtime_endpoint.call_with_http_info(**kwargs) + + def create_downtime( + self, + body: DowntimeCreateRequest, + ) -> DowntimeResponse: + """Schedule a downtime. + + Schedule a downtime. + + :param body: Schedule a downtime request body. + :type body: DowntimeCreateRequest + :rtype: DowntimeResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["body"] = body + + return self._create_downtime_endpoint.call_with_http_info(**kwargs) + + def get_downtime( + self, + downtime_id: str, + *, + include: Union[str, UnsetType] = unset, + ) -> DowntimeResponse: + """Get a downtime. + + Get downtime detail by ``downtime_id``. + + :param downtime_id: ID of the downtime to fetch. + :type downtime_id: str + :param include: Comma separated list of resource paths for related resources to include in the response. Supported resource + paths are ``created_by`` and ``monitor``. + :type include: str, optional + :rtype: DowntimeResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["downtime_id"] = downtime_id + + if include is not unset: + kwargs["include"] = include + + return self._get_downtime_endpoint.call_with_http_info(**kwargs) + + def list_downtimes( + self, + *, + current_only: Union[bool, UnsetType] = unset, + include: Union[str, UnsetType] = unset, + ) -> ListDowntimesResponse: + """Get all downtimes. + + Get all scheduled downtimes. + + :param current_only: Only return downtimes that are active when the request is made. + :type current_only: bool, optional + :param include: Comma separated list of resource paths for related resources to include in the response. Supported resource + paths are ``created_by`` and ``monitor``. + :type include: str, optional + :rtype: ListDowntimesResponse + """ + kwargs: Dict[str, Any] = {} + if current_only is not unset: + kwargs["current_only"] = current_only + + if include is not unset: + kwargs["include"] = include + + return self._list_downtimes_endpoint.call_with_http_info(**kwargs) + + def update_downtime( + self, + downtime_id: str, + body: DowntimeEditRequest, + ) -> DowntimeResponse: + """Update a downtime. + + Update a downtime by ``downtime_id``. + + :param downtime_id: ID of the downtime to update. + :type downtime_id: str + :param body: Update a downtime request body. + :type body: DowntimeEditRequest + :rtype: DowntimeResponse + """ + kwargs: Dict[str, Any] = {} + kwargs["downtime_id"] = downtime_id + + kwargs["body"] = body + + return self._update_downtime_endpoint.call_with_http_info(**kwargs) diff --git a/src/datadog_api_client/v2/apis/__init__.py b/src/datadog_api_client/v2/apis/__init__.py index a603b4b60b..60bf14cc9b 100644 --- a/src/datadog_api_client/v2/apis/__init__.py +++ b/src/datadog_api_client/v2/apis/__init__.py @@ -6,6 +6,7 @@ from datadog_api_client.v2.api.cloudflare_integration_api import CloudflareIntegrationApi from datadog_api_client.v2.api.confluent_cloud_api import ConfluentCloudApi from datadog_api_client.v2.api.dashboard_lists_api import DashboardListsApi +from datadog_api_client.v2.api.downtimes_api import DowntimesApi from datadog_api_client.v2.api.events_api import EventsApi from datadog_api_client.v2.api.fastly_integration_api import FastlyIntegrationApi from datadog_api_client.v2.api.gcp_integration_api import GCPIntegrationApi diff --git a/src/datadog_api_client/v2/model/downtime_attribute_create_request.py b/src/datadog_api_client/v2/model/downtime_attribute_create_request.py new file mode 100644 index 0000000000..be0b4f6334 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_create_request.py @@ -0,0 +1,144 @@ +# 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, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier import DowntimeAttributeMonitorIdentifier + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_types import ( + DowntimeAttributeNotifyEndStateTypes, + ) + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_actions import ( + DowntimeAttributeNotifyEndStateActions, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_create_request import ( + DowntimeAttributeScheduleCreateRequest, + ) + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_id import ( + DowntimeAttributeMonitorIdentifierId, + ) + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_tags import ( + DowntimeAttributeMonitorIdentifierTags, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_create_request import ( + DowntimeAttributeScheduleRecurrencesCreateRequest, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_one_time_create_edit_request import ( + DowntimeAttributeScheduleOneTimeCreateEditRequest, + ) + + +class DowntimeAttributeCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier import DowntimeAttributeMonitorIdentifier + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_types import ( + DowntimeAttributeNotifyEndStateTypes, + ) + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_actions import ( + DowntimeAttributeNotifyEndStateActions, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_create_request import ( + DowntimeAttributeScheduleCreateRequest, + ) + + return { + "display_timezone": (str,), + "message": (str,), + "monitor_identifier": (DowntimeAttributeMonitorIdentifier,), + "mute_first_recovery_notification": (bool,), + "notify_end_states": ([DowntimeAttributeNotifyEndStateTypes],), + "notify_end_types": ([DowntimeAttributeNotifyEndStateActions],), + "schedule": (DowntimeAttributeScheduleCreateRequest,), + "scope": (str,), + } + + attribute_map = { + "display_timezone": "display_timezone", + "message": "message", + "monitor_identifier": "monitor_identifier", + "mute_first_recovery_notification": "mute_first_recovery_notification", + "notify_end_states": "notify_end_states", + "notify_end_types": "notify_end_types", + "schedule": "schedule", + "scope": "scope", + } + + def __init__( + self_, + monitor_identifier: Union[ + DowntimeAttributeMonitorIdentifier, + DowntimeAttributeMonitorIdentifierId, + DowntimeAttributeMonitorIdentifierTags, + ], + scope: str, + display_timezone: Union[str, none_type, UnsetType] = unset, + message: Union[str, none_type, UnsetType] = unset, + mute_first_recovery_notification: Union[bool, UnsetType] = unset, + notify_end_states: Union[List[DowntimeAttributeNotifyEndStateTypes], UnsetType] = unset, + notify_end_types: Union[List[DowntimeAttributeNotifyEndStateActions], UnsetType] = unset, + schedule: Union[ + DowntimeAttributeScheduleCreateRequest, + DowntimeAttributeScheduleRecurrencesCreateRequest, + DowntimeAttributeScheduleOneTimeCreateEditRequest, + UnsetType, + ] = unset, + **kwargs, + ): + """ + Downtime details. + + :param display_timezone: The timezone in which to display the downtime's start and end times in Datadog applications. This is not used + as an offset for scheduling. + :type display_timezone: str, none_type, optional + + :param message: A message to include with notifications for this downtime. Email notifications can be sent to specific users + by using the same ``@username`` notation as events. + :type message: str, none_type, optional + + :param monitor_identifier: Monitor identifier for the downtime + :type monitor_identifier: DowntimeAttributeMonitorIdentifier + + :param mute_first_recovery_notification: If the first recovery notification during a downtime should be muted. + :type mute_first_recovery_notification: bool, optional + + :param notify_end_states: States that will trigger a monitor notification when the ``notify_end_types`` action occurs. + :type notify_end_states: [DowntimeAttributeNotifyEndStateTypes], optional + + :param notify_end_types: Actions that will trigger a monitor notification if the downtime is in the ``notify_end_types`` state. + :type notify_end_types: [DowntimeAttributeNotifyEndStateActions], optional + + :param schedule: Schedule for the downtime. + :type schedule: DowntimeAttributeScheduleCreateRequest, optional + + :param scope: The scope to which the downtime applies. Must be in + `simple grammar syntax `_. + :type scope: str + """ + if display_timezone is not unset: + kwargs["display_timezone"] = display_timezone + if message is not unset: + kwargs["message"] = message + if mute_first_recovery_notification is not unset: + kwargs["mute_first_recovery_notification"] = mute_first_recovery_notification + if notify_end_states is not unset: + kwargs["notify_end_states"] = notify_end_states + if notify_end_types is not unset: + kwargs["notify_end_types"] = notify_end_types + if schedule is not unset: + kwargs["schedule"] = schedule + super().__init__(kwargs) + + self_.monitor_identifier = monitor_identifier + self_.scope = scope diff --git a/src/datadog_api_client/v2/model/downtime_attribute_edit_request.py b/src/datadog_api_client/v2/model/downtime_attribute_edit_request.py new file mode 100644 index 0000000000..301b0ac1ef --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_edit_request.py @@ -0,0 +1,146 @@ +# 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, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier import DowntimeAttributeMonitorIdentifier + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_types import ( + DowntimeAttributeNotifyEndStateTypes, + ) + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_actions import ( + DowntimeAttributeNotifyEndStateActions, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_edit_request import ( + DowntimeAttributeScheduleEditRequest, + ) + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_id import ( + DowntimeAttributeMonitorIdentifierId, + ) + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_tags import ( + DowntimeAttributeMonitorIdentifierTags, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_edit_request import ( + DowntimeAttributeScheduleRecurrencesEditRequest, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_one_time_create_edit_request import ( + DowntimeAttributeScheduleOneTimeCreateEditRequest, + ) + + +class DowntimeAttributeEditRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier import DowntimeAttributeMonitorIdentifier + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_types import ( + DowntimeAttributeNotifyEndStateTypes, + ) + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_actions import ( + DowntimeAttributeNotifyEndStateActions, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_edit_request import ( + DowntimeAttributeScheduleEditRequest, + ) + + return { + "display_timezone": (str,), + "message": (str,), + "monitor_identifier": (DowntimeAttributeMonitorIdentifier,), + "mute_first_recovery_notification": (bool,), + "notify_end_states": ([DowntimeAttributeNotifyEndStateTypes],), + "notify_end_types": ([DowntimeAttributeNotifyEndStateActions],), + "schedule": (DowntimeAttributeScheduleEditRequest,), + "scope": (str,), + } + + attribute_map = { + "display_timezone": "display_timezone", + "message": "message", + "monitor_identifier": "monitor_identifier", + "mute_first_recovery_notification": "mute_first_recovery_notification", + "notify_end_states": "notify_end_states", + "notify_end_types": "notify_end_types", + "schedule": "schedule", + "scope": "scope", + } + + def __init__( + self_, + display_timezone: Union[str, none_type, UnsetType] = unset, + message: Union[str, none_type, UnsetType] = unset, + monitor_identifier: Union[ + DowntimeAttributeMonitorIdentifier, + DowntimeAttributeMonitorIdentifierId, + DowntimeAttributeMonitorIdentifierTags, + UnsetType, + ] = unset, + mute_first_recovery_notification: Union[bool, UnsetType] = unset, + notify_end_states: Union[List[DowntimeAttributeNotifyEndStateTypes], UnsetType] = unset, + notify_end_types: Union[List[DowntimeAttributeNotifyEndStateActions], UnsetType] = unset, + schedule: Union[ + DowntimeAttributeScheduleEditRequest, + DowntimeAttributeScheduleRecurrencesEditRequest, + DowntimeAttributeScheduleOneTimeCreateEditRequest, + UnsetType, + ] = unset, + scope: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + Attributes of the downtime to update. + + :param display_timezone: The timezone in which to display the downtime's start and end times in Datadog applications. This is not used + as an offset for scheduling. + :type display_timezone: str, none_type, optional + + :param message: A message to include with notifications for this downtime. Email notifications can be sent to specific users + by using the same ``@username`` notation as events. + :type message: str, none_type, optional + + :param monitor_identifier: Monitor identifier for the downtime + :type monitor_identifier: DowntimeAttributeMonitorIdentifier, optional + + :param mute_first_recovery_notification: If the first recovery notification during a downtime should be muted. + :type mute_first_recovery_notification: bool, optional + + :param notify_end_states: States that will trigger a monitor notification when the ``notify_end_types`` action occurs. + :type notify_end_states: [DowntimeAttributeNotifyEndStateTypes], optional + + :param notify_end_types: Actions that will trigger a monitor notification if the downtime is in the ``notify_end_types`` state. + :type notify_end_types: [DowntimeAttributeNotifyEndStateActions], optional + + :param schedule: Schedule for the downtime. + :type schedule: DowntimeAttributeScheduleEditRequest, optional + + :param scope: The scope to which the downtime applies. Must be in + `simple grammar syntax `_. + :type scope: str, optional + """ + if display_timezone is not unset: + kwargs["display_timezone"] = display_timezone + if message is not unset: + kwargs["message"] = message + if monitor_identifier is not unset: + kwargs["monitor_identifier"] = monitor_identifier + if mute_first_recovery_notification is not unset: + kwargs["mute_first_recovery_notification"] = mute_first_recovery_notification + if notify_end_states is not unset: + kwargs["notify_end_states"] = notify_end_states + if notify_end_types is not unset: + kwargs["notify_end_types"] = notify_end_types + if schedule is not unset: + kwargs["schedule"] = schedule + if scope is not unset: + kwargs["scope"] = scope + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_attribute_monitor_identifier.py b/src/datadog_api_client/v2/model/downtime_attribute_monitor_identifier.py new file mode 100644 index 0000000000..5e952350f4 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_monitor_identifier.py @@ -0,0 +1,49 @@ +# 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 ( + ModelComposed, + cached_property, +) + + +class DowntimeAttributeMonitorIdentifier(ModelComposed): + def __init__(self, **kwargs): + """ + Monitor identifier for the downtime + + :param monitor_id: ID of the monitor to prevent notifications. + :type monitor_id: int + + :param monitor_tags: A list of monitor tags. For example, tags that are applied directly to monitors, + not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. + The resulting downtime applies to monitors that match ALL provided monitor tags. + :type monitor_tags: [str] + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_id import ( + DowntimeAttributeMonitorIdentifierId, + ) + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_tags import ( + DowntimeAttributeMonitorIdentifierTags, + ) + + return { + "oneOf": [ + DowntimeAttributeMonitorIdentifierId, + DowntimeAttributeMonitorIdentifierTags, + ], + } diff --git a/src/datadog_api_client/v2/model/downtime_attribute_monitor_identifier_id.py b/src/datadog_api_client/v2/model/downtime_attribute_monitor_identifier_id.py new file mode 100644 index 0000000000..74d7bd46e1 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_monitor_identifier_id.py @@ -0,0 +1,33 @@ +# 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 ( + ModelNormal, + cached_property, +) + + +class DowntimeAttributeMonitorIdentifierId(ModelNormal): + @cached_property + def openapi_types(_): + return { + "monitor_id": (int,), + } + + attribute_map = { + "monitor_id": "monitor_id", + } + + def __init__(self_, monitor_id: int, **kwargs): + """ + Object of the monitor identifier. + + :param monitor_id: ID of the monitor to prevent notifications. + :type monitor_id: int + """ + super().__init__(kwargs) + + self_.monitor_id = monitor_id diff --git a/src/datadog_api_client/v2/model/downtime_attribute_monitor_identifier_tags.py b/src/datadog_api_client/v2/model/downtime_attribute_monitor_identifier_tags.py new file mode 100644 index 0000000000..288347a513 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_monitor_identifier_tags.py @@ -0,0 +1,36 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, +) + + +class DowntimeAttributeMonitorIdentifierTags(ModelNormal): + @cached_property + def openapi_types(_): + return { + "monitor_tags": ([str],), + } + + attribute_map = { + "monitor_tags": "monitor_tags", + } + + def __init__(self_, monitor_tags: List[str], **kwargs): + """ + Object of the monitor tags. + + :param monitor_tags: A list of monitor tags. For example, tags that are applied directly to monitors, + not tags that are used in monitor queries (which are filtered by the scope parameter), to which the downtime applies. + The resulting downtime applies to monitors that match ALL provided monitor tags. + :type monitor_tags: [str] + """ + super().__init__(kwargs) + + self_.monitor_tags = monitor_tags diff --git a/src/datadog_api_client/v2/model/downtime_attribute_notify_end_state_actions.py b/src/datadog_api_client/v2/model/downtime_attribute_notify_end_state_actions.py new file mode 100644 index 0000000000..64b8c052c9 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_notify_end_state_actions.py @@ -0,0 +1,38 @@ +# 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 DowntimeAttributeNotifyEndStateActions(ModelSimple): + """ + Action that will trigger a monitor notification if the downtime is in the `notify_end_types` state. + + :param value: Must be one of ["canceled", "expired"]. + :type value: str + """ + + allowed_values = { + "canceled", + "expired", + } + CANCELED: ClassVar["DowntimeAttributeNotifyEndStateActions"] + EXPIRED: ClassVar["DowntimeAttributeNotifyEndStateActions"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DowntimeAttributeNotifyEndStateActions.CANCELED = DowntimeAttributeNotifyEndStateActions("canceled") +DowntimeAttributeNotifyEndStateActions.EXPIRED = DowntimeAttributeNotifyEndStateActions("expired") diff --git a/src/datadog_api_client/v2/model/downtime_attribute_notify_end_state_types.py b/src/datadog_api_client/v2/model/downtime_attribute_notify_end_state_types.py new file mode 100644 index 0000000000..08bb918486 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_notify_end_state_types.py @@ -0,0 +1,41 @@ +# 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 DowntimeAttributeNotifyEndStateTypes(ModelSimple): + """ + State that will trigger a monitor notification when the `notify_end_types` action occurs. + + :param value: Must be one of ["alert", "no data", "warn"]. + :type value: str + """ + + allowed_values = { + "alert", + "no data", + "warn", + } + ALERT: ClassVar["DowntimeAttributeNotifyEndStateTypes"] + NO_DATA: ClassVar["DowntimeAttributeNotifyEndStateTypes"] + WARN: ClassVar["DowntimeAttributeNotifyEndStateTypes"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DowntimeAttributeNotifyEndStateTypes.ALERT = DowntimeAttributeNotifyEndStateTypes("alert") +DowntimeAttributeNotifyEndStateTypes.NO_DATA = DowntimeAttributeNotifyEndStateTypes("no data") +DowntimeAttributeNotifyEndStateTypes.WARN = DowntimeAttributeNotifyEndStateTypes("warn") diff --git a/src/datadog_api_client/v2/model/downtime_attribute_response.py b/src/datadog_api_client/v2/model/downtime_attribute_response.py new file mode 100644 index 0000000000..a60f586ebf --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_response.py @@ -0,0 +1,171 @@ +# 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, + datetime, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier import DowntimeAttributeMonitorIdentifier + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_types import ( + DowntimeAttributeNotifyEndStateTypes, + ) + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_actions import ( + DowntimeAttributeNotifyEndStateActions, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_response import DowntimeAttributeScheduleResponse + from datadog_api_client.v2.model.downtime_status_enum import DowntimeStatusEnum + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_id import ( + DowntimeAttributeMonitorIdentifierId, + ) + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_tags import ( + DowntimeAttributeMonitorIdentifierTags, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_response import ( + DowntimeAttributeScheduleRecurrencesResponse, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_one_time_response import ( + DowntimeAttributeScheduleOneTimeResponse, + ) + + +class DowntimeAttributeResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_attribute_monitor_identifier import DowntimeAttributeMonitorIdentifier + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_types import ( + DowntimeAttributeNotifyEndStateTypes, + ) + from datadog_api_client.v2.model.downtime_attribute_notify_end_state_actions import ( + DowntimeAttributeNotifyEndStateActions, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_response import DowntimeAttributeScheduleResponse + from datadog_api_client.v2.model.downtime_status_enum import DowntimeStatusEnum + + return { + "created_at": (datetime,), + "display_timezone": (str,), + "message": (str,), + "modified_at": (datetime,), + "monitor_identifier": (DowntimeAttributeMonitorIdentifier,), + "mute_first_recovery_notification": (bool,), + "notify_end_states": ([DowntimeAttributeNotifyEndStateTypes],), + "notify_end_types": ([DowntimeAttributeNotifyEndStateActions],), + "schedule": (DowntimeAttributeScheduleResponse,), + "scope": (str,), + "status": (DowntimeStatusEnum,), + } + + attribute_map = { + "created_at": "created_at", + "display_timezone": "display_timezone", + "message": "message", + "modified_at": "modified_at", + "monitor_identifier": "monitor_identifier", + "mute_first_recovery_notification": "mute_first_recovery_notification", + "notify_end_states": "notify_end_states", + "notify_end_types": "notify_end_types", + "schedule": "schedule", + "scope": "scope", + "status": "status", + } + + def __init__( + self_, + created_at: Union[datetime, UnsetType] = unset, + display_timezone: Union[str, none_type, UnsetType] = unset, + message: Union[str, none_type, UnsetType] = unset, + modified_at: Union[datetime, UnsetType] = unset, + monitor_identifier: Union[ + DowntimeAttributeMonitorIdentifier, + DowntimeAttributeMonitorIdentifierId, + DowntimeAttributeMonitorIdentifierTags, + UnsetType, + ] = unset, + mute_first_recovery_notification: Union[bool, UnsetType] = unset, + notify_end_states: Union[List[DowntimeAttributeNotifyEndStateTypes], UnsetType] = unset, + notify_end_types: Union[List[DowntimeAttributeNotifyEndStateActions], UnsetType] = unset, + schedule: Union[ + DowntimeAttributeScheduleResponse, + DowntimeAttributeScheduleRecurrencesResponse, + DowntimeAttributeScheduleOneTimeResponse, + UnsetType, + ] = unset, + scope: Union[str, UnsetType] = unset, + status: Union[DowntimeStatusEnum, UnsetType] = unset, + **kwargs, + ): + """ + Downtime details. + + :param created_at: Creation time of the downtime. + :type created_at: datetime, optional + + :param display_timezone: The timezone in which to display the downtime's start and end times in Datadog applications. This is not used + as an offset for scheduling. + :type display_timezone: str, none_type, optional + + :param message: A message to include with notifications for this downtime. Email notifications can be sent to specific users + by using the same ``@username`` notation as events. + :type message: str, none_type, optional + + :param modified_at: Time that the downtime was last modified. + :type modified_at: datetime, optional + + :param monitor_identifier: Monitor identifier for the downtime + :type monitor_identifier: DowntimeAttributeMonitorIdentifier, optional + + :param mute_first_recovery_notification: If the first recovery notification during a downtime should be muted. + :type mute_first_recovery_notification: bool, optional + + :param notify_end_states: States that will trigger a monitor notification when the ``notify_end_types`` action occurs. + :type notify_end_states: [DowntimeAttributeNotifyEndStateTypes], optional + + :param notify_end_types: Actions that will trigger a monitor notification if the downtime is in the ``notify_end_types`` state. + :type notify_end_types: [DowntimeAttributeNotifyEndStateActions], optional + + :param schedule: The schedule that defines when the monitor starts, stops, and recurs. There are two types of schedules: + one-time and recurring. Recurring schedules may have up to five RRULE-based recurrences. If no schedules is + provided, the downtime will begin immediately and never end. + :type schedule: DowntimeAttributeScheduleResponse, optional + + :param scope: The scope to which the downtime applies. Must be in + `simple grammar syntax `_. + :type scope: str, optional + + :param status: The current status of the downtime + :type status: DowntimeStatusEnum, optional + """ + if created_at is not unset: + kwargs["created_at"] = created_at + if display_timezone is not unset: + kwargs["display_timezone"] = display_timezone + if message is not unset: + kwargs["message"] = message + if modified_at is not unset: + kwargs["modified_at"] = modified_at + if monitor_identifier is not unset: + kwargs["monitor_identifier"] = monitor_identifier + if mute_first_recovery_notification is not unset: + kwargs["mute_first_recovery_notification"] = mute_first_recovery_notification + if notify_end_states is not unset: + kwargs["notify_end_states"] = notify_end_states + if notify_end_types is not unset: + kwargs["notify_end_types"] = notify_end_types + if schedule is not unset: + kwargs["schedule"] = schedule + if scope is not unset: + kwargs["scope"] = scope + if status is not unset: + kwargs["status"] = status + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_create_request.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_create_request.py new file mode 100644 index 0000000000..defa0a914d --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_create_request.py @@ -0,0 +1,55 @@ +# 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 ( + ModelComposed, + cached_property, +) + + +class DowntimeAttributeScheduleCreateRequest(ModelComposed): + def __init__(self, **kwargs): + """ + Schedule for the downtime. + + :param recurrences: A list of downtime recurrences. + :type recurrences: [DowntimeAttributeScheduleRecurrenceCreateEditRequest] + + :param timezone: The timezone in which to schedule the downtime. + :type timezone: str, optional + + :param end: ISO-8601 Datetime to end the downtime. Must include a UTC offset of zero. If not provided, the + downtime starts the moment it is created. + :type end: datetime, none_type, optional + + :param start: ISO-8601 Datetime to start the downtime. Must include a UTC offset of zero. If not provided, the + downtime starts the moment it is created. + :type start: datetime, none_type, optional + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_create_request import ( + DowntimeAttributeScheduleRecurrencesCreateRequest, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_one_time_create_edit_request import ( + DowntimeAttributeScheduleOneTimeCreateEditRequest, + ) + + return { + "oneOf": [ + DowntimeAttributeScheduleRecurrencesCreateRequest, + DowntimeAttributeScheduleOneTimeCreateEditRequest, + ], + } diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_current_downtime_response.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_current_downtime_response.py new file mode 100644 index 0000000000..75127bf3f8 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_current_downtime_response.py @@ -0,0 +1,49 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +class DowntimeAttributeScheduleCurrentDowntimeResponse(ModelNormal): + @cached_property + def openapi_types(_): + return { + "end": (datetime, none_type), + "start": (datetime,), + } + + attribute_map = { + "end": "end", + "start": "start", + } + + def __init__( + self_, end: Union[datetime, none_type, UnsetType] = unset, start: Union[datetime, UnsetType] = unset, **kwargs + ): + """ + The most recent actual start and end dates for a recurring downtime. For a canceled downtime, + this is the previously occurring downtime. For active downtimes, this is the ongoing downtime, and for scheduled + downtimes it is the upcoming downtime. + + :param end: The end of the current downtime. + :type end: datetime, none_type, optional + + :param start: The start of the current downtime. + :type start: datetime, optional + """ + if end is not unset: + kwargs["end"] = end + if start is not unset: + kwargs["start"] = start + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_edit_request.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_edit_request.py new file mode 100644 index 0000000000..8c7fe90829 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_edit_request.py @@ -0,0 +1,55 @@ +# 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 ( + ModelComposed, + cached_property, +) + + +class DowntimeAttributeScheduleEditRequest(ModelComposed): + def __init__(self, **kwargs): + """ + Schedule for the downtime. + + :param recurrences: A list of downtime recurrences. + :type recurrences: [DowntimeAttributeScheduleRecurrenceCreateEditRequest], optional + + :param timezone: The timezone in which to schedule the downtime. + :type timezone: str, optional + + :param end: ISO-8601 Datetime to end the downtime. Must include a UTC offset of zero. If not provided, the + downtime starts the moment it is created. + :type end: datetime, none_type, optional + + :param start: ISO-8601 Datetime to start the downtime. Must include a UTC offset of zero. If not provided, the + downtime starts the moment it is created. + :type start: datetime, none_type, optional + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_edit_request import ( + DowntimeAttributeScheduleRecurrencesEditRequest, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_one_time_create_edit_request import ( + DowntimeAttributeScheduleOneTimeCreateEditRequest, + ) + + return { + "oneOf": [ + DowntimeAttributeScheduleRecurrencesEditRequest, + DowntimeAttributeScheduleOneTimeCreateEditRequest, + ], + } diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_one_time_create_edit_request.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_one_time_create_edit_request.py new file mode 100644 index 0000000000..669a402ce3 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_one_time_create_edit_request.py @@ -0,0 +1,52 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +class DowntimeAttributeScheduleOneTimeCreateEditRequest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "end": (datetime, none_type), + "start": (datetime, none_type), + } + + attribute_map = { + "end": "end", + "start": "start", + } + + def __init__( + self_, + end: Union[datetime, none_type, UnsetType] = unset, + start: Union[datetime, none_type, UnsetType] = unset, + **kwargs, + ): + """ + A one-time downtime definition. + + :param end: ISO-8601 Datetime to end the downtime. Must include a UTC offset of zero. If not provided, the + downtime starts the moment it is created. + :type end: datetime, none_type, optional + + :param start: ISO-8601 Datetime to start the downtime. Must include a UTC offset of zero. If not provided, the + downtime starts the moment it is created. + :type start: datetime, none_type, optional + """ + if end is not unset: + kwargs["end"] = end + if start is not unset: + kwargs["start"] = start + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_one_time_response.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_one_time_response.py new file mode 100644 index 0000000000..1b6baca493 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_one_time_response.py @@ -0,0 +1,47 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + datetime, + none_type, + unset, + UnsetType, +) + + +class DowntimeAttributeScheduleOneTimeResponse(ModelNormal): + @cached_property + def openapi_types(_): + return { + "end": (datetime, none_type), + "start": (datetime,), + } + + attribute_map = { + "end": "end", + "start": "start", + } + + def __init__( + self_, end: Union[datetime, none_type, UnsetType] = unset, start: Union[datetime, UnsetType] = unset, **kwargs + ): + """ + A one-time downtime definition. + + :param end: ISO-8601 Datetime to end the downtime. + :type end: datetime, none_type, optional + + :param start: ISO-8601 Datetime to start the downtime. + :type start: datetime, optional + """ + if end is not unset: + kwargs["end"] = end + if start is not unset: + kwargs["start"] = start + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrence_create_edit_request.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrence_create_edit_request.py new file mode 100644 index 0000000000..828a8da574 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrence_create_edit_request.py @@ -0,0 +1,56 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + none_type, + unset, + UnsetType, +) + + +class DowntimeAttributeScheduleRecurrenceCreateEditRequest(ModelNormal): + @cached_property + def openapi_types(_): + return { + "duration": (str,), + "rrule": (str,), + "start": (str, none_type), + } + + attribute_map = { + "duration": "duration", + "rrule": "rrule", + "start": "start", + } + + def __init__(self_, duration: str, rrule: str, start: Union[str, none_type, UnsetType] = unset, **kwargs): + """ + An object defining the recurrence of the downtime. + + :param duration: The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'. + :type duration: str + + :param rrule: The ``RRULE`` standard for defining recurring events. + For example, to have a recurring event on the first day of each month, set the type to ``rrule`` and set the ``FREQ`` to ``MONTHLY`` and ``BYMONTHDAY`` to ``1``. + Most common ``rrule`` options from the `iCalendar Spec `_ are supported. + + **Note** : Attributes specifying the duration in ``RRULE`` are not supported (for example, ``DTSTART`` , ``DTEND`` , ``DURATION`` ). + More examples available in this `downtime guide `_. + :type rrule: str + + :param start: ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the + downtime starts the moment it is created. + :type start: str, none_type, optional + """ + if start is not unset: + kwargs["start"] = start + super().__init__(kwargs) + + self_.duration = duration + self_.rrule = rrule diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrence_response.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrence_response.py new file mode 100644 index 0000000000..99e5e03df6 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrence_response.py @@ -0,0 +1,62 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DowntimeAttributeScheduleRecurrenceResponse(ModelNormal): + @cached_property + def openapi_types(_): + return { + "duration": (str,), + "rrule": (str,), + "start": (str,), + } + + attribute_map = { + "duration": "duration", + "rrule": "rrule", + "start": "start", + } + + def __init__( + self_, + duration: Union[str, UnsetType] = unset, + rrule: Union[str, UnsetType] = unset, + start: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + An RRULE-based recurring downtime. + + :param duration: The length of the downtime. Must begin with an integer and end with one of 'm', 'h', d', or 'w'. + :type duration: str, optional + + :param rrule: The ``RRULE`` standard for defining recurring events. + For example, to have a recurring event on the first day of each month, set the type to ``rrule`` and set the ``FREQ`` to ``MONTHLY`` and ``BYMONTHDAY`` to ``1``. + Most common ``rrule`` options from the `iCalendar Spec `_ are supported. + + **Note** : Attributes specifying the duration in ``RRULE`` are not supported (for example, ``DTSTART`` , ``DTEND`` , ``DURATION`` ). + More examples available in this `downtime guide `_. + :type rrule: str, optional + + :param start: ISO-8601 Datetime to start the downtime. Must not include a UTC offset. If not provided, the + downtime starts the moment it is created. + :type start: str, optional + """ + if duration is not unset: + kwargs["duration"] = duration + if rrule is not unset: + kwargs["rrule"] = rrule + if start is not unset: + kwargs["start"] = start + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrences_create_request.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrences_create_request.py new file mode 100644 index 0000000000..145fc3ea5f --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrences_create_request.py @@ -0,0 +1,58 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +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.downtime_attribute_schedule_recurrence_create_edit_request import ( + DowntimeAttributeScheduleRecurrenceCreateEditRequest, + ) + + +class DowntimeAttributeScheduleRecurrencesCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrence_create_edit_request import ( + DowntimeAttributeScheduleRecurrenceCreateEditRequest, + ) + + return { + "recurrences": ([DowntimeAttributeScheduleRecurrenceCreateEditRequest],), + "timezone": (str,), + } + + attribute_map = { + "recurrences": "recurrences", + "timezone": "timezone", + } + + def __init__( + self_, + recurrences: List[DowntimeAttributeScheduleRecurrenceCreateEditRequest], + timezone: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A recurring downtime schedule definition. + + :param recurrences: A list of downtime recurrences. + :type recurrences: [DowntimeAttributeScheduleRecurrenceCreateEditRequest] + + :param timezone: The timezone in which to schedule the downtime. + :type timezone: str, optional + """ + if timezone is not unset: + kwargs["timezone"] = timezone + super().__init__(kwargs) + + self_.recurrences = recurrences diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrences_edit_request.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrences_edit_request.py new file mode 100644 index 0000000000..b79b4fa56e --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrences_edit_request.py @@ -0,0 +1,58 @@ +# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +# This product includes software developed at Datadog (https://www.datadoghq.com/). +# Copyright 2019-Present Datadog, Inc. +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.downtime_attribute_schedule_recurrence_create_edit_request import ( + DowntimeAttributeScheduleRecurrenceCreateEditRequest, + ) + + +class DowntimeAttributeScheduleRecurrencesEditRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrence_create_edit_request import ( + DowntimeAttributeScheduleRecurrenceCreateEditRequest, + ) + + return { + "recurrences": ([DowntimeAttributeScheduleRecurrenceCreateEditRequest],), + "timezone": (str,), + } + + attribute_map = { + "recurrences": "recurrences", + "timezone": "timezone", + } + + def __init__( + self_, + recurrences: Union[List[DowntimeAttributeScheduleRecurrenceCreateEditRequest], UnsetType] = unset, + timezone: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A recurring downtime schedule definition. + + :param recurrences: A list of downtime recurrences. + :type recurrences: [DowntimeAttributeScheduleRecurrenceCreateEditRequest], optional + + :param timezone: The timezone in which to schedule the downtime. + :type timezone: str, optional + """ + if recurrences is not unset: + kwargs["recurrences"] = recurrences + if timezone is not unset: + kwargs["timezone"] = timezone + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrences_response.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrences_response.py new file mode 100644 index 0000000000..d16594befd --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_recurrences_response.py @@ -0,0 +1,82 @@ +# 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.downtime_attribute_schedule_current_downtime_response import ( + DowntimeAttributeScheduleCurrentDowntimeResponse, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrence_response import ( + DowntimeAttributeScheduleRecurrenceResponse, + ) + + +class DowntimeAttributeScheduleRecurrencesResponse(ModelNormal): + validations = { + "recurrences": { + "max_items": 5, + "min_items": 1, + }, + } + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_attribute_schedule_current_downtime_response import ( + DowntimeAttributeScheduleCurrentDowntimeResponse, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrence_response import ( + DowntimeAttributeScheduleRecurrenceResponse, + ) + + return { + "current_downtime": (DowntimeAttributeScheduleCurrentDowntimeResponse,), + "recurrences": ([DowntimeAttributeScheduleRecurrenceResponse],), + "timezone": (str,), + } + + attribute_map = { + "current_downtime": "current_downtime", + "recurrences": "recurrences", + "timezone": "timezone", + } + + def __init__( + self_, + recurrences: List[DowntimeAttributeScheduleRecurrenceResponse], + current_downtime: Union[DowntimeAttributeScheduleCurrentDowntimeResponse, UnsetType] = unset, + timezone: Union[str, UnsetType] = unset, + **kwargs, + ): + """ + A recurring downtime schedule definition. + + :param current_downtime: The most recent actual start and end dates for a recurring downtime. For a canceled downtime, + this is the previously occurring downtime. For active downtimes, this is the ongoing downtime, and for scheduled + downtimes it is the upcoming downtime. + :type current_downtime: DowntimeAttributeScheduleCurrentDowntimeResponse, optional + + :param recurrences: A list of downtime recurrences. + :type recurrences: [DowntimeAttributeScheduleRecurrenceResponse] + + :param timezone: The timezone in which to schedule the downtime. This affects recurring start and end dates. + Must match ``display_timezone``. + :type timezone: str, optional + """ + if current_downtime is not unset: + kwargs["current_downtime"] = current_downtime + if timezone is not unset: + kwargs["timezone"] = timezone + super().__init__(kwargs) + + self_.recurrences = recurrences diff --git a/src/datadog_api_client/v2/model/downtime_attribute_schedule_response.py b/src/datadog_api_client/v2/model/downtime_attribute_schedule_response.py new file mode 100644 index 0000000000..53abf25a4b --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_attribute_schedule_response.py @@ -0,0 +1,61 @@ +# 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 ( + ModelComposed, + cached_property, +) + + +class DowntimeAttributeScheduleResponse(ModelComposed): + def __init__(self, **kwargs): + """ + The schedule that defines when the monitor starts, stops, and recurs. There are two types of schedules: + one-time and recurring. Recurring schedules may have up to five RRULE-based recurrences. If no schedules is + provided, the downtime will begin immediately and never end. + + :param current_downtime: The most recent actual start and end dates for a recurring downtime. For a canceled downtime, + this is the previously occurring downtime. For active downtimes, this is the ongoing downtime, and for scheduled + downtimes it is the upcoming downtime. + :type current_downtime: DowntimeAttributeScheduleCurrentDowntimeResponse, optional + + :param recurrences: A list of downtime recurrences. + :type recurrences: [DowntimeAttributeScheduleRecurrenceResponse] + + :param timezone: The timezone in which to schedule the downtime. This affects recurring start and end dates. + Must match `display_timezone`. + :type timezone: str, optional + + :param end: ISO-8601 Datetime to end the downtime. + :type end: datetime, none_type, optional + + :param start: ISO-8601 Datetime to start the downtime. + :type start: datetime, optional + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_response import ( + DowntimeAttributeScheduleRecurrencesResponse, + ) + from datadog_api_client.v2.model.downtime_attribute_schedule_one_time_response import ( + DowntimeAttributeScheduleOneTimeResponse, + ) + + return { + "oneOf": [ + DowntimeAttributeScheduleRecurrencesResponse, + DowntimeAttributeScheduleOneTimeResponse, + ], + } diff --git a/src/datadog_api_client/v2/model/downtime_create_data.py b/src/datadog_api_client/v2/model/downtime_create_data.py new file mode 100644 index 0000000000..3cdc92ae89 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_create_data.py @@ -0,0 +1,48 @@ +# 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.downtime_attribute_create_request import DowntimeAttributeCreateRequest + from datadog_api_client.v2.model.downtime_resource_type import DowntimeResourceType + + +class DowntimeCreateData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_attribute_create_request import DowntimeAttributeCreateRequest + from datadog_api_client.v2.model.downtime_resource_type import DowntimeResourceType + + return { + "attributes": (DowntimeAttributeCreateRequest,), + "type": (DowntimeResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "type": "type", + } + + def __init__(self_, attributes: DowntimeAttributeCreateRequest, type: DowntimeResourceType, **kwargs): + """ + Object to create a downtime. + + :param attributes: Downtime details. + :type attributes: DowntimeAttributeCreateRequest + + :param type: Downtime resource type. + :type type: DowntimeResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.type = type diff --git a/src/datadog_api_client/v2/model/downtime_create_request.py b/src/datadog_api_client/v2/model/downtime_create_request.py new file mode 100644 index 0000000000..43a398bc5d --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_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.downtime_create_data import DowntimeCreateData + + +class DowntimeCreateRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_create_data import DowntimeCreateData + + return { + "data": (DowntimeCreateData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: DowntimeCreateData, **kwargs): + """ + Request for creating a downtime. + + :param data: Object to create a downtime. + :type data: DowntimeCreateData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/downtime_edit_data.py b/src/datadog_api_client/v2/model/downtime_edit_data.py new file mode 100644 index 0000000000..7f98b4741a --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_edit_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.downtime_attribute_edit_request import DowntimeAttributeEditRequest + from datadog_api_client.v2.model.downtime_resource_type import DowntimeResourceType + + +class DowntimeEditData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_attribute_edit_request import DowntimeAttributeEditRequest + from datadog_api_client.v2.model.downtime_resource_type import DowntimeResourceType + + return { + "attributes": (DowntimeAttributeEditRequest,), + "id": (str,), + "type": (DowntimeResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__(self_, attributes: DowntimeAttributeEditRequest, id: str, type: DowntimeResourceType, **kwargs): + """ + Object to update a downtime. + + :param attributes: Attributes of the downtime to update. + :type attributes: DowntimeAttributeEditRequest + + :param id: ID of this downtime. + :type id: str + + :param type: Downtime resource type. + :type type: DowntimeResourceType + """ + super().__init__(kwargs) + + self_.attributes = attributes + self_.id = id + self_.type = type diff --git a/src/datadog_api_client/v2/model/downtime_edit_request.py b/src/datadog_api_client/v2/model/downtime_edit_request.py new file mode 100644 index 0000000000..49f0dd9bd6 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_edit_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.downtime_edit_data import DowntimeEditData + + +class DowntimeEditRequest(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_edit_data import DowntimeEditData + + return { + "data": (DowntimeEditData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: DowntimeEditData, **kwargs): + """ + Request for editing a downtime. + + :param data: Object to update a downtime. + :type data: DowntimeEditData + """ + super().__init__(kwargs) + + self_.data = data diff --git a/src/datadog_api_client/v2/model/downtime_included_monitor_type.py b/src/datadog_api_client/v2/model/downtime_included_monitor_type.py new file mode 100644 index 0000000000..cc187ff30d --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_included_monitor_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 DowntimeIncludedMonitorType(ModelSimple): + """ + Monitor resource type. + + :param value: If omitted defaults to "monitors". Must be one of ["monitors"]. + :type value: str + """ + + allowed_values = { + "monitors", + } + MONITORS: ClassVar["DowntimeIncludedMonitorType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DowntimeIncludedMonitorType.MONITORS = DowntimeIncludedMonitorType("monitors") diff --git a/src/datadog_api_client/v2/model/downtime_list_item_response.py b/src/datadog_api_client/v2/model/downtime_list_item_response.py new file mode 100644 index 0000000000..6cc955092f --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_list_item_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.downtime_response_data import DowntimeResponseData + + +class DowntimeListItemResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_response_data import DowntimeResponseData + + return { + "data": (DowntimeResponseData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[DowntimeResponseData, UnsetType] = unset, **kwargs): + """ + A downtime data. + + :param data: Downtime data. + :type data: DowntimeResponseData, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_monitor_included_attributes.py b/src/datadog_api_client/v2/model/downtime_monitor_included_attributes.py new file mode 100644 index 0000000000..56c587068d --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_monitor_included_attributes.py @@ -0,0 +1,36 @@ +# 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 + +from datadog_api_client.model_utils import ( + ModelNormal, + cached_property, + unset, + UnsetType, +) + + +class DowntimeMonitorIncludedAttributes(ModelNormal): + @cached_property + def openapi_types(_): + return { + "name": (str,), + } + + attribute_map = { + "name": "name", + } + + def __init__(self_, name: Union[str, UnsetType] = unset, **kwargs): + """ + Attributes of the monitor identified by the downtime. + + :param name: The name of the monitor identified by the downtime. + :type name: str, optional + """ + if name is not unset: + kwargs["name"] = name + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_monitor_included_item.py b/src/datadog_api_client/v2/model/downtime_monitor_included_item.py new file mode 100644 index 0000000000..b15216036a --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_monitor_included_item.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.downtime_monitor_included_attributes import DowntimeMonitorIncludedAttributes + from datadog_api_client.v2.model.downtime_included_monitor_type import DowntimeIncludedMonitorType + + +class DowntimeMonitorIncludedItem(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_monitor_included_attributes import DowntimeMonitorIncludedAttributes + from datadog_api_client.v2.model.downtime_included_monitor_type import DowntimeIncludedMonitorType + + return { + "attributes": (DowntimeMonitorIncludedAttributes,), + "id": (int,), + "type": (DowntimeIncludedMonitorType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "type": "type", + } + + def __init__( + self_, + attributes: Union[DowntimeMonitorIncludedAttributes, UnsetType] = unset, + id: Union[int, UnsetType] = unset, + type: Union[DowntimeIncludedMonitorType, UnsetType] = unset, + **kwargs, + ): + """ + Information about the monitor identified by the downtime. + + :param attributes: Attributes of the monitor identified by the downtime. + :type attributes: DowntimeMonitorIncludedAttributes, optional + + :param id: ID of the monitor identified by the downtime. + :type id: int, optional + + :param type: Monitor resource type. + :type type: DowntimeIncludedMonitorType, 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/downtime_relationships.py b/src/datadog_api_client/v2/model/downtime_relationships.py new file mode 100644 index 0000000000..38491f1770 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_relationships.py @@ -0,0 +1,56 @@ +# 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.downtime_relationships_created_by import DowntimeRelationshipsCreatedBy + from datadog_api_client.v2.model.downtime_relationships_monitor import DowntimeRelationshipsMonitor + + +class DowntimeRelationships(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_relationships_created_by import DowntimeRelationshipsCreatedBy + from datadog_api_client.v2.model.downtime_relationships_monitor import DowntimeRelationshipsMonitor + + return { + "created_by": (DowntimeRelationshipsCreatedBy,), + "monitor": (DowntimeRelationshipsMonitor,), + } + + attribute_map = { + "created_by": "created_by", + "monitor": "monitor", + } + + def __init__( + self_, + created_by: Union[DowntimeRelationshipsCreatedBy, UnsetType] = unset, + monitor: Union[DowntimeRelationshipsMonitor, UnsetType] = unset, + **kwargs, + ): + """ + All relationships associated with downtime. + + :param created_by: The user who created the downtime. + :type created_by: DowntimeRelationshipsCreatedBy, optional + + :param monitor: The monitor identified by the downtime. + :type monitor: DowntimeRelationshipsMonitor, optional + """ + if created_by is not unset: + kwargs["created_by"] = created_by + if monitor is not unset: + kwargs["monitor"] = monitor + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_relationships_created_by.py b/src/datadog_api_client/v2/model/downtime_relationships_created_by.py new file mode 100644 index 0000000000..2dcb5b5bea --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_relationships_created_by.py @@ -0,0 +1,45 @@ +# 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, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.downtime_relationships_created_by_data import DowntimeRelationshipsCreatedByData + + +class DowntimeRelationshipsCreatedBy(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_relationships_created_by_data import ( + DowntimeRelationshipsCreatedByData, + ) + + return { + "data": (DowntimeRelationshipsCreatedByData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[DowntimeRelationshipsCreatedByData, none_type, UnsetType] = unset, **kwargs): + """ + The user who created the downtime. + + :param data: Data for the user who created the downtime. + :type data: DowntimeRelationshipsCreatedByData, none_type, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_relationships_created_by_data.py b/src/datadog_api_client/v2/model/downtime_relationships_created_by_data.py new file mode 100644 index 0000000000..133777b3e3 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_relationships_created_by_data.py @@ -0,0 +1,51 @@ +# 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.downtime_user_type import DowntimeUserType + + +class DowntimeRelationshipsCreatedByData(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_user_type import DowntimeUserType + + return { + "id": (str,), + "type": (DowntimeUserType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__(self_, id: Union[str, UnsetType] = unset, type: Union[DowntimeUserType, UnsetType] = unset, **kwargs): + """ + Data for the user who created the downtime. + + :param id: User ID of the downtime creator. + :type id: str, optional + + :param type: User resource type. + :type type: DowntimeUserType, optional + """ + 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/downtime_relationships_monitor.py b/src/datadog_api_client/v2/model/downtime_relationships_monitor.py new file mode 100644 index 0000000000..2bf3423d8e --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_relationships_monitor.py @@ -0,0 +1,43 @@ +# 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, + none_type, + unset, + UnsetType, +) + + +if TYPE_CHECKING: + from datadog_api_client.v2.model.downtime_relationships_monitor_data import DowntimeRelationshipsMonitorData + + +class DowntimeRelationshipsMonitor(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_relationships_monitor_data import DowntimeRelationshipsMonitorData + + return { + "data": (DowntimeRelationshipsMonitorData,), + } + + attribute_map = { + "data": "data", + } + + def __init__(self_, data: Union[DowntimeRelationshipsMonitorData, none_type, UnsetType] = unset, **kwargs): + """ + The monitor identified by the downtime. + + :param data: Data for the monitor. + :type data: DowntimeRelationshipsMonitorData, none_type, optional + """ + if data is not unset: + kwargs["data"] = data + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_relationships_monitor_data.py b/src/datadog_api_client/v2/model/downtime_relationships_monitor_data.py new file mode 100644 index 0000000000..27216b0ff6 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_relationships_monitor_data.py @@ -0,0 +1,53 @@ +# 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.downtime_included_monitor_type import DowntimeIncludedMonitorType + + +class DowntimeRelationshipsMonitorData(ModelNormal): + _nullable = True + + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_included_monitor_type import DowntimeIncludedMonitorType + + return { + "id": (int,), + "type": (DowntimeIncludedMonitorType,), + } + + attribute_map = { + "id": "id", + "type": "type", + } + + def __init__( + self_, id: Union[int, UnsetType] = unset, type: Union[DowntimeIncludedMonitorType, UnsetType] = unset, **kwargs + ): + """ + Data for the monitor. + + :param id: Monitor ID of the downtime. + :type id: int, optional + + :param type: Monitor resource type. + :type type: DowntimeIncludedMonitorType, optional + """ + 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/downtime_resource_type.py b/src/datadog_api_client/v2/model/downtime_resource_type.py new file mode 100644 index 0000000000..38c39211f3 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_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 DowntimeResourceType(ModelSimple): + """ + Downtime resource type. + + :param value: If omitted defaults to "downtime". Must be one of ["downtime"]. + :type value: str + """ + + allowed_values = { + "downtime", + } + DOWNTIME: ClassVar["DowntimeResourceType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DowntimeResourceType.DOWNTIME = DowntimeResourceType("downtime") diff --git a/src/datadog_api_client/v2/model/downtime_response.py b/src/datadog_api_client/v2/model/downtime_response.py new file mode 100644 index 0000000000..ccf3ce61f5 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_response.py @@ -0,0 +1,63 @@ +# 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.downtime_response_data import DowntimeResponseData + from datadog_api_client.v2.model.downtime_response_included_item import DowntimeResponseIncludedItem + from datadog_api_client.v2.model.user import User + from datadog_api_client.v2.model.downtime_monitor_included_item import DowntimeMonitorIncludedItem + + +class DowntimeResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_response_data import DowntimeResponseData + from datadog_api_client.v2.model.downtime_response_included_item import DowntimeResponseIncludedItem + + return { + "data": (DowntimeResponseData,), + "included": ([DowntimeResponseIncludedItem],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__( + self_, + data: Union[DowntimeResponseData, UnsetType] = unset, + included: Union[ + List[Union[DowntimeResponseIncludedItem, User, DowntimeMonitorIncludedItem]], UnsetType + ] = unset, + **kwargs, + ): + """ + Downtiming gives you greater control over monitor notifications by + allowing you to globally exclude scopes from alerting. + Downtime settings, which can be scheduled with start and end times, + prevent all alerting related to specified Datadog tags. + + :param data: Downtime data. + :type data: DowntimeResponseData, optional + + :param included: Array of objects related to the downtime that the user requested. + :type included: [DowntimeResponseIncludedItem], optional + """ + if data is not unset: + kwargs["data"] = data + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_response_data.py b/src/datadog_api_client/v2/model/downtime_response_data.py new file mode 100644 index 0000000000..5d20143cc7 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_response_data.py @@ -0,0 +1,74 @@ +# 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.downtime_attribute_response import DowntimeAttributeResponse + from datadog_api_client.v2.model.downtime_relationships import DowntimeRelationships + from datadog_api_client.v2.model.downtime_resource_type import DowntimeResourceType + + +class DowntimeResponseData(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_attribute_response import DowntimeAttributeResponse + from datadog_api_client.v2.model.downtime_relationships import DowntimeRelationships + from datadog_api_client.v2.model.downtime_resource_type import DowntimeResourceType + + return { + "attributes": (DowntimeAttributeResponse,), + "id": (str,), + "relationships": (DowntimeRelationships,), + "type": (DowntimeResourceType,), + } + + attribute_map = { + "attributes": "attributes", + "id": "id", + "relationships": "relationships", + "type": "type", + } + + def __init__( + self_, + attributes: Union[DowntimeAttributeResponse, UnsetType] = unset, + id: Union[str, UnsetType] = unset, + relationships: Union[DowntimeRelationships, UnsetType] = unset, + type: Union[DowntimeResourceType, UnsetType] = unset, + **kwargs, + ): + """ + Downtime data. + + :param attributes: Downtime details. + :type attributes: DowntimeAttributeResponse, optional + + :param id: The downtime ID. + :type id: str, optional + + :param relationships: All relationships associated with downtime. + :type relationships: DowntimeRelationships, optional + + :param type: Downtime resource type. + :type type: DowntimeResourceType, optional + """ + if attributes is not unset: + kwargs["attributes"] = attributes + if id is not unset: + kwargs["id"] = id + if relationships is not unset: + kwargs["relationships"] = relationships + if type is not unset: + kwargs["type"] = type + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/model/downtime_response_included_item.py b/src/datadog_api_client/v2/model/downtime_response_included_item.py new file mode 100644 index 0000000000..8f2715415c --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_response_included_item.py @@ -0,0 +1,49 @@ +# 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 ( + ModelComposed, + cached_property, +) + + +class DowntimeResponseIncludedItem(ModelComposed): + def __init__(self, **kwargs): + """ + An object related to a downtime. + + :param attributes: Attributes of user object returned by the API. + :type attributes: UserAttributes, optional + + :param id: ID of the user. + :type id: str, optional + + :param relationships: Relationships of the user object returned by the API. + :type relationships: UserResponseRelationships, optional + + :param type: Users resource type. + :type type: UsersType, optional + """ + super().__init__(kwargs) + + @cached_property + def _composed_schemas(_): + # we need this here to make our import statements work + # we must store _composed_schemas in here so the code is only run + # when we invoke this method. If we kept this at the class + # level we would get an error because the class level + # code would be run when this module is imported, and these composed + # classes don't exist yet because their module has not finished + # loading + from datadog_api_client.v2.model.user import User + from datadog_api_client.v2.model.downtime_monitor_included_item import DowntimeMonitorIncludedItem + + return { + "oneOf": [ + User, + DowntimeMonitorIncludedItem, + ], + } diff --git a/src/datadog_api_client/v2/model/downtime_status_enum.py b/src/datadog_api_client/v2/model/downtime_status_enum.py new file mode 100644 index 0000000000..0ce0521186 --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_status_enum.py @@ -0,0 +1,44 @@ +# 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 DowntimeStatusEnum(ModelSimple): + """ + The current status of the downtime + + :param value: Must be one of ["active", "canceled", "ended", "scheduled"]. + :type value: str + """ + + allowed_values = { + "active", + "canceled", + "ended", + "scheduled", + } + ACTIVE: ClassVar["DowntimeStatusEnum"] + CANCELED: ClassVar["DowntimeStatusEnum"] + ENDED: ClassVar["DowntimeStatusEnum"] + SCHEDULED: ClassVar["DowntimeStatusEnum"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DowntimeStatusEnum.ACTIVE = DowntimeStatusEnum("active") +DowntimeStatusEnum.CANCELED = DowntimeStatusEnum("canceled") +DowntimeStatusEnum.ENDED = DowntimeStatusEnum("ended") +DowntimeStatusEnum.SCHEDULED = DowntimeStatusEnum("scheduled") diff --git a/src/datadog_api_client/v2/model/downtime_user_type.py b/src/datadog_api_client/v2/model/downtime_user_type.py new file mode 100644 index 0000000000..61f5c4836d --- /dev/null +++ b/src/datadog_api_client/v2/model/downtime_user_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 DowntimeUserType(ModelSimple): + """ + User resource type. + + :param value: If omitted defaults to "users". Must be one of ["users"]. + :type value: str + """ + + allowed_values = { + "users", + } + USERS: ClassVar["DowntimeUserType"] + + @cached_property + def openapi_types(_): + return { + "value": (str,), + } + + +DowntimeUserType.USERS = DowntimeUserType("users") diff --git a/src/datadog_api_client/v2/model/list_downtimes_response.py b/src/datadog_api_client/v2/model/list_downtimes_response.py new file mode 100644 index 0000000000..fc324d0dcf --- /dev/null +++ b/src/datadog_api_client/v2/model/list_downtimes_response.py @@ -0,0 +1,59 @@ +# 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.downtime_list_item_response import DowntimeListItemResponse + from datadog_api_client.v2.model.user_response_included_item import UserResponseIncludedItem + from datadog_api_client.v2.model.organization import Organization + from datadog_api_client.v2.model.permission import Permission + from datadog_api_client.v2.model.role import Role + + +class ListDowntimesResponse(ModelNormal): + @cached_property + def openapi_types(_): + from datadog_api_client.v2.model.downtime_list_item_response import DowntimeListItemResponse + from datadog_api_client.v2.model.user_response_included_item import UserResponseIncludedItem + + return { + "data": ([DowntimeListItemResponse],), + "included": ([UserResponseIncludedItem],), + } + + attribute_map = { + "data": "data", + "included": "included", + } + + def __init__( + self_, + data: Union[List[DowntimeListItemResponse], UnsetType] = unset, + included: Union[List[Union[UserResponseIncludedItem, Organization, Permission, Role]], UnsetType] = unset, + **kwargs, + ): + """ + Response for retrieving all downtimes. + + :param data: An array of downtimes. + :type data: [DowntimeListItemResponse], optional + + :param included: Array of objects related to the users. + :type included: [UserResponseIncludedItem], optional + """ + if data is not unset: + kwargs["data"] = data + if included is not unset: + kwargs["included"] = included + super().__init__(kwargs) diff --git a/src/datadog_api_client/v2/models/__init__.py b/src/datadog_api_client/v2/models/__init__.py index a6fd262341..6c445367b4 100644 --- a/src/datadog_api_client/v2/models/__init__.py +++ b/src/datadog_api_client/v2/models/__init__.py @@ -208,6 +208,66 @@ from datadog_api_client.v2.model.detailed_finding import DetailedFinding from datadog_api_client.v2.model.detailed_finding_attributes import DetailedFindingAttributes from datadog_api_client.v2.model.detailed_finding_type import DetailedFindingType +from datadog_api_client.v2.model.downtime_attribute_create_request import DowntimeAttributeCreateRequest +from datadog_api_client.v2.model.downtime_attribute_edit_request import DowntimeAttributeEditRequest +from datadog_api_client.v2.model.downtime_attribute_monitor_identifier import DowntimeAttributeMonitorIdentifier +from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_id import DowntimeAttributeMonitorIdentifierId +from datadog_api_client.v2.model.downtime_attribute_monitor_identifier_tags import ( + DowntimeAttributeMonitorIdentifierTags, +) +from datadog_api_client.v2.model.downtime_attribute_notify_end_state_actions import ( + DowntimeAttributeNotifyEndStateActions, +) +from datadog_api_client.v2.model.downtime_attribute_notify_end_state_types import DowntimeAttributeNotifyEndStateTypes +from datadog_api_client.v2.model.downtime_attribute_response import DowntimeAttributeResponse +from datadog_api_client.v2.model.downtime_attribute_schedule_create_request import ( + DowntimeAttributeScheduleCreateRequest, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_current_downtime_response import ( + DowntimeAttributeScheduleCurrentDowntimeResponse, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_edit_request import DowntimeAttributeScheduleEditRequest +from datadog_api_client.v2.model.downtime_attribute_schedule_one_time_create_edit_request import ( + DowntimeAttributeScheduleOneTimeCreateEditRequest, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_one_time_response import ( + DowntimeAttributeScheduleOneTimeResponse, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_recurrence_create_edit_request import ( + DowntimeAttributeScheduleRecurrenceCreateEditRequest, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_recurrence_response import ( + DowntimeAttributeScheduleRecurrenceResponse, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_create_request import ( + DowntimeAttributeScheduleRecurrencesCreateRequest, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_edit_request import ( + DowntimeAttributeScheduleRecurrencesEditRequest, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_recurrences_response import ( + DowntimeAttributeScheduleRecurrencesResponse, +) +from datadog_api_client.v2.model.downtime_attribute_schedule_response import DowntimeAttributeScheduleResponse +from datadog_api_client.v2.model.downtime_create_data import DowntimeCreateData +from datadog_api_client.v2.model.downtime_create_request import DowntimeCreateRequest +from datadog_api_client.v2.model.downtime_edit_data import DowntimeEditData +from datadog_api_client.v2.model.downtime_edit_request import DowntimeEditRequest +from datadog_api_client.v2.model.downtime_included_monitor_type import DowntimeIncludedMonitorType +from datadog_api_client.v2.model.downtime_list_item_response import DowntimeListItemResponse +from datadog_api_client.v2.model.downtime_monitor_included_attributes import DowntimeMonitorIncludedAttributes +from datadog_api_client.v2.model.downtime_monitor_included_item import DowntimeMonitorIncludedItem +from datadog_api_client.v2.model.downtime_relationships import DowntimeRelationships +from datadog_api_client.v2.model.downtime_relationships_created_by import DowntimeRelationshipsCreatedBy +from datadog_api_client.v2.model.downtime_relationships_created_by_data import DowntimeRelationshipsCreatedByData +from datadog_api_client.v2.model.downtime_relationships_monitor import DowntimeRelationshipsMonitor +from datadog_api_client.v2.model.downtime_relationships_monitor_data import DowntimeRelationshipsMonitorData +from datadog_api_client.v2.model.downtime_resource_type import DowntimeResourceType +from datadog_api_client.v2.model.downtime_response import DowntimeResponse +from datadog_api_client.v2.model.downtime_response_data import DowntimeResponseData +from datadog_api_client.v2.model.downtime_response_included_item import DowntimeResponseIncludedItem +from datadog_api_client.v2.model.downtime_status_enum import DowntimeStatusEnum +from datadog_api_client.v2.model.downtime_user_type import DowntimeUserType from datadog_api_client.v2.model.event import Event from datadog_api_client.v2.model.event_attributes import EventAttributes from datadog_api_client.v2.model.event_priority import EventPriority @@ -454,6 +514,7 @@ from datadog_api_client.v2.model.jira_integration_metadata import JiraIntegrationMetadata from datadog_api_client.v2.model.jira_integration_metadata_issues_item import JiraIntegrationMetadataIssuesItem from datadog_api_client.v2.model.list_application_keys_response import ListApplicationKeysResponse +from datadog_api_client.v2.model.list_downtimes_response import ListDowntimesResponse from datadog_api_client.v2.model.list_findings_meta import ListFindingsMeta from datadog_api_client.v2.model.list_findings_page import ListFindingsPage from datadog_api_client.v2.model.list_findings_response import ListFindingsResponse diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_downtime_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_downtime_not_found_response.frozen new file mode 100644 index 0000000000..a90a96a754 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_downtime_not_found_response.frozen @@ -0,0 +1 @@ +2023-05-25T20:24:18.346Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_downtime_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_downtime_not_found_response.yaml new file mode 100644 index 0000000000..0ac3c40802 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_downtime_not_found_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/downtime/00000000-0000-1234-0000-000000000000 + response: + body: + string: '{"errors":["Downtime 00000000-0000-1234-0000-000000000000 not found"]}' + headers: + content-type: + - application/json + status: + code: 404 + message: Not Found +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_ok_response.frozen new file mode 100644 index 0000000000..dadcb98638 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-06-02T20:53:22.584Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_ok_response.yaml new file mode 100644 index 0000000000..bf56ddeaee --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_cancel_a_downtime_returns_ok_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: '{"data":{"attributes":{"message":"test message","monitor_identifier":{"monitor_tags":["cat:hat"]},"schedule":{"start":null},"scope":"test:testcanceladowntimereturnsokresponse1685739202"},"type":"downtime"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/downtime + response: + body: + string: '{"data":{"type":"downtime","attributes":{"mute_first_recovery_notification":false,"status":"active","created":"2023-06-02T20:53:23.252025+00:00","notify_end_states":["alert","no + data","warn"],"canceled":null,"display_timezone":"UTC","modified":"2023-06-02T20:53:23.252025+00:00","monitor_identifier":{"monitor_tags":["cat:hat"]},"scope":"test:testcanceladowntimereturnsokresponse1685739202","schedule":{"start":"2023-06-02T20:53:23.238403+00:00","end":null},"message":"test + message","notify_end_types":["expired"]},"id":"83718756-0187-11ee-8c18-da7ad0900002","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"monitor":{"data":null}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/downtime/83718756-0187-11ee-8c18-da7ad0900002 + 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/downtime/83718756-0187-11ee-8c18-da7ad0900002 + 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_a_downtime_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_bad_request_response.frozen new file mode 100644 index 0000000000..868fa23055 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2023-05-25T20:24:19.765Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_bad_request_response.yaml new file mode 100644 index 0000000000..b56a204b0c --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_bad_request_response.yaml @@ -0,0 +1,18 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/downtime/INVALID_UUID_LENGTH + response: + body: + string: '{"errors":["Invalid URL param: downtime_id must be an uuid"]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_not_found_response.frozen new file mode 100644 index 0000000000..4e1511c89b --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_not_found_response.frozen @@ -0,0 +1 @@ +2023-05-25T20:24:20.021Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_not_found_response.yaml new file mode 100644 index 0000000000..1f71ec5797 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_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/downtime/00000000-0000-1234-0000-000000000000 + response: + body: + string: '{"errors":["Downtime 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_downtime_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_ok_response.frozen new file mode 100644 index 0000000000..c8b3ce717d --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-06-02T20:53:24.573Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_ok_response.yaml new file mode 100644 index 0000000000..9fed339945 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_a_downtime_returns_ok_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: '{"data":{"attributes":{"message":"test message","monitor_identifier":{"monitor_tags":["cat:hat"]},"schedule":{"start":null},"scope":"test:testgetadowntimereturnsokresponse1685739204"},"type":"downtime"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/downtime + response: + body: + string: '{"data":{"type":"downtime","attributes":{"display_timezone":"UTC","scope":"test:testgetadowntimereturnsokresponse1685739204","notify_end_states":["warn","alert","no + data"],"message":"test message","created":"2023-06-02T20:53:24.806100+00:00","status":"active","modified":"2023-06-02T20:53:24.806100+00:00","canceled":null,"monitor_identifier":{"monitor_tags":["cat:hat"]},"schedule":{"end":null,"start":"2023-06-02T20:53:24.791647+00:00"},"notify_end_types":["expired"],"mute_first_recovery_notification":false},"relationships":{"monitor":{"data":null},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}},"id":"845e9a1e-0187-11ee-817a-da7ad0900002"},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/downtime/845e9a1e-0187-11ee-817a-da7ad0900002 + response: + body: + string: '{"data":{"type":"downtime","attributes":{"notify_end_types":["expired"],"modified":"2023-06-02T20:53:24.806100+00:00","monitor_identifier":{"monitor_tags":["cat:hat"]},"scope":"test:testgetadowntimereturnsokresponse1685739204","schedule":{"end":null,"start":"2023-06-02T20:53:24.791647+00:00"},"notify_end_states":["warn","no + data","alert"],"created":"2023-06-02T20:53:24.806100+00:00","canceled":null,"mute_first_recovery_notification":false,"message":"test + message","display_timezone":"UTC","status":"active"},"id":"845e9a1e-0187-11ee-817a-da7ad0900002"}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/downtime/845e9a1e-0187-11ee-817a-da7ad0900002 + 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_downtimes_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_get_all_downtimes_returns_ok_response.frozen new file mode 100644 index 0000000000..34a6dce0e0 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_downtimes_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-05-25T20:24:20.897Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_get_all_downtimes_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_get_all_downtimes_returns_ok_response.yaml new file mode 100644 index 0000000000..d633cbfde7 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_get_all_downtimes_returns_ok_response.yaml @@ -0,0 +1,50 @@ +interactions: +- request: + body: null + headers: + accept: + - application/json + method: GET + uri: https://api.datadoghq.com/api/v2/downtime + response: + body: + string: '{"data":[{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-28T14:17:52.420429+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-28T14:17:52.420429+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635430672","schedule":{"end":null,"start":"2021-10-28T14:17:52.399817+00:00"},"status":"active"},"id":"1d9e7eee-b23a-11ed-a0dc-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-28T14:33:48.622821+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-28T14:33:48.622821+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635431628","schedule":{"end":null,"start":"2021-10-28T14:33:48.620257+00:00"},"status":"active"},"id":"1d9ec3cc-b23a-11ed-a0ea-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-28T14:48:50.581496+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-28T14:48:50.581496+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635432530","schedule":{"end":null,"start":"2021-10-28T14:48:50.575549+00:00"},"status":"active"},"id":"1da042ec-b23a-11ed-a16b-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-28T14:56:22.879389+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-28T14:56:22.879389+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635432982","schedule":{"end":null,"start":"2021-10-28T14:56:22.875090+00:00"},"status":"active"},"id":"1da0495e-b23a-11ed-a16c-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-28T15:16:54.480401+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-28T15:16:54.480401+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635434214","schedule":{"end":null,"start":"2021-10-28T15:16:54.477880+00:00"},"status":"active"},"id":"1da06d30-b23a-11ed-a178-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-28T16:08:31.571892+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-28T16:08:31.571892+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635437311","schedule":{"end":null,"start":"2021-10-28T16:08:31.562562+00:00"},"status":"active"},"id":"1da0eabc-b23a-11ed-a193-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-29T03:11:14.667351+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-29T03:11:14.667351+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635477074","schedule":{"end":null,"start":"2021-10-29T03:11:14.662838+00:00"},"status":"active"},"id":"1da8e726-b23a-11ed-a3ab-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-29T08:07:08.893065+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-29T08:07:08.893065+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635494828","schedule":{"end":null,"start":"2021-10-29T08:07:08.868526+00:00"},"status":"active"},"id":"1db7e4f6-b23a-11ed-a86e-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-29T08:41:03.157018+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-29T08:41:03.157018+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635496863","schedule":{"end":null,"start":"2021-10-29T08:41:03.154098+00:00"},"status":"active"},"id":"1db8d8ac-b23a-11ed-a879-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-29T17:21:23.756952+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-29T17:21:23.756952+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635528083","schedule":{"end":null,"start":"2021-10-29T17:21:23.754124+00:00"},"status":"active"},"id":"1dc7e13a-b23a-11ed-ad75-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-30T03:11:07.935370+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-30T03:11:07.935370+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635563467","schedule":{"end":null,"start":"2021-10-30T03:11:07.931742+00:00"},"status":"active"},"id":"1dcb33f8-b23a-11ed-ae77-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-30T16:06:10.276649+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-30T16:06:10.276649+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635609970","schedule":{"end":null,"start":"2021-10-30T16:06:10.273151+00:00"},"status":"active"},"id":"1dcd0b9c-b23a-11ed-af06-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-10-31T03:11:11.316510+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-10-31T03:11:11.316510+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635649871","schedule":{"end":null,"start":"2021-10-31T03:11:11.312216+00:00"},"status":"active"},"id":"1dce8d64-b23a-11ed-af88-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-01T03:08:39.804462+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-01T03:08:39.804462+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635736119","schedule":{"end":null,"start":"2021-11-01T03:08:39.802027+00:00"},"status":"active"},"id":"1dd35b50-b23a-11ed-b0e9-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T03:10:15.532889+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T03:10:15.532889+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635822615","schedule":{"end":null,"start":"2021-11-02T03:10:15.528871+00:00"},"status":"active"},"id":"1de58d3e-b23a-11ed-b608-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T09:20:28.614860+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T09:20:28.614860+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635844828","schedule":{"end":null,"start":"2021-11-02T09:20:28.611532+00:00"},"status":"active"},"id":"1de8bb30-b23a-11ed-b6d9-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T09:34:53.765122+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T09:34:53.765122+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635845693","schedule":{"end":null,"start":"2021-11-02T09:34:53.761176+00:00"},"status":"active"},"id":"1de8f14a-b23a-11ed-b6e7-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T09:48:14.313975+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T09:48:14.313975+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635846494","schedule":{"end":null,"start":"2021-11-02T09:48:14.311153+00:00"},"status":"active"},"id":"1de919c2-b23a-11ed-b6f4-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T09:55:05.587914+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T09:55:05.587914+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635846905","schedule":{"end":null,"start":"2021-11-02T09:55:05.584723+00:00"},"status":"active"},"id":"1de92250-b23a-11ed-b6f8-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T10:45:12.687669+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T10:45:12.687669+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635849912","schedule":{"end":null,"start":"2021-11-02T10:45:12.683837+00:00"},"status":"active"},"id":"1de9870e-b23a-11ed-b70e-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T10:57:27.536018+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T10:57:27.536018+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635850647","schedule":{"end":null,"start":"2021-11-02T10:57:27.532780+00:00"},"status":"active"},"id":"1de99172-b23a-11ed-b713-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T11:07:15.081382+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T11:07:15.081382+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635851234","schedule":{"end":null,"start":"2021-11-02T11:07:15.078037+00:00"},"status":"active"},"id":"1de9e398-b23a-11ed-b72e-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T11:15:16.847749+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T11:15:16.847749+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635851716","schedule":{"end":null,"start":"2021-11-02T11:15:16.845135+00:00"},"status":"active"},"id":"1de9e5be-b23a-11ed-b72f-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T14:12:24.714186+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T14:12:24.714186+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635862344","schedule":{"end":null,"start":"2021-11-02T14:12:24.710625+00:00"},"status":"active"},"id":"1deb279e-b23a-11ed-b784-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T14:46:14.802545+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T14:46:14.802545+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635864374","schedule":{"end":null,"start":"2021-11-02T14:46:14.800340+00:00"},"status":"active"},"id":"1deb73a2-b23a-11ed-b797-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T15:16:48.477972+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T15:16:48.477972+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635866208","schedule":{"end":null,"start":"2021-11-02T15:16:48.469517+00:00"},"status":"active"},"id":"1debd126-b23a-11ed-b7b0-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-02T18:28:35.537425+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-02T18:28:35.537425+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635877715","schedule":{"end":null,"start":"2021-11-02T18:28:35.532968+00:00"},"status":"active"},"id":"1deefd9c-b23a-11ed-b8b8-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-03T03:08:05.553644+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-03T03:08:05.553644+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635908885","schedule":{"end":null,"start":"2021-11-03T03:08:05.547972+00:00"},"status":"active"},"id":"1df2a096-b23a-11ed-b9b4-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-03T08:58:07.316209+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-03T08:58:07.316209+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635929887","schedule":{"end":null,"start":"2021-11-03T08:58:07.312866+00:00"},"status":"active"},"id":"1df51538-b23a-11ed-ba64-da7ad0900002"},{"type":"downtime","attributes":{"monitor_identifier":{"monitor_tags":["*"]},"notify_end_states":["warn","no + data","alert"],"created":"2021-11-03T10:28:12.844618+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_types":["expired"],"message":null,"canceled":null,"modified":"2021-11-03T10:28:12.844618+00:00","scope":"host:java-hostsMuteErrorsTest-local-1635935292","schedule":{"end":null,"start":"2021-11-03T10:28:12.841116+00:00"},"status":"active"},"id":"1df5e13e-b23a-11ed-baa2-da7ad0900002"}],"meta":{"page":{"total_filtered_count":1049}}} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_bad_request_response.frozen new file mode 100644 index 0000000000..23e427ac1c --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2023-06-02T20:53:25.827Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_bad_request_response.yaml new file mode 100644 index 0000000000..c8dded63d1 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_bad_request_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '{"data":{"attributes":{"monitor_identifier":{"monitor_tags":["cat:hat"]},"schedule":{"start":null},"scope":"BAD_SCOPE_MISSING_KEY_VALUE_FORMAT"},"type":"downtime"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/downtime + response: + body: + string: '{"errors":["All values must have a key"]}' + headers: + content-type: + - application/json + status: + code: 400 + message: Bad Request +version: 1 diff --git a/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_ok_response.frozen new file mode 100644 index 0000000000..73fc56694e --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-06-02T20:53:26.050Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_ok_response.yaml new file mode 100644 index 0000000000..a129b39b73 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_schedule_a_downtime_returns_ok_response.yaml @@ -0,0 +1,39 @@ +interactions: +- request: + body: '{"data":{"attributes":{"message":"dark forest","monitor_identifier":{"monitor_tags":["cat:hat"]},"schedule":{"start":null},"scope":"test:testscheduleadowntimereturnsokresponse1685739206"},"type":"downtime"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/downtime + response: + body: + string: '{"data":{"type":"downtime","attributes":{"display_timezone":"UTC","scope":"test:testscheduleadowntimereturnsokresponse1685739206","notify_end_states":["warn","alert","no + data"],"message":"dark forest","created":"2023-06-02T20:53:26.300497+00:00","status":"active","modified":"2023-06-02T20:53:26.300497+00:00","canceled":null,"monitor_identifier":{"monitor_tags":["cat:hat"]},"schedule":{"end":null,"start":"2023-06-02T20:53:26.286133+00:00"},"notify_end_types":["expired"],"mute_first_recovery_notification":false},"relationships":{"monitor":{"data":null},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}},"id":"85428b34-0187-11ee-bb05-da7ad0900002"},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/downtime/85428b34-0187-11ee-bb05-da7ad0900002 + 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_downtime_returns_bad_request_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_bad_request_response.frozen new file mode 100644 index 0000000000..206adccca8 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_bad_request_response.frozen @@ -0,0 +1 @@ +2023-06-02T20:53:26.666Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_bad_request_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_bad_request_response.yaml new file mode 100644 index 0000000000..e105bf5989 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_bad_request_response.yaml @@ -0,0 +1,59 @@ +interactions: +- request: + body: '{"data":{"attributes":{"message":"test message","monitor_identifier":{"monitor_tags":["cat:hat"]},"schedule":{"start":null},"scope":"test:testupdateadowntimereturnsbadrequestresponse1685739206"},"type":"downtime"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/downtime + response: + body: + string: '{"data":{"type":"downtime","attributes":{"schedule":{"start":"2023-06-02T20:53:26.854449+00:00","end":null},"canceled":null,"modified":"2023-06-02T20:53:26.869296+00:00","created":"2023-06-02T20:53:26.869296+00:00","status":"active","monitor_identifier":{"monitor_tags":["cat:hat"]},"scope":"test:testupdateadowntimereturnsbadrequestresponse1685739206","message":"test + message","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_states":["no + data","warn","alert"],"notify_end_types":["expired"]},"relationships":{"monitor":{"data":null},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}},"id":"85997dfe-0187-11ee-a1c1-da7ad0900002"},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"invalid_field":"sophon"},"id":"85997dfe-0187-11ee-a1c1-da7ad0900002","type":"downtime"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/downtime/85997dfe-0187-11ee-a1c1-da7ad0900002 + response: + body: + string: '{"errors":["Additional properties are not allowed (''invalid_field'' + was unexpected)"]}' + 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/downtime/85997dfe-0187-11ee-a1c1-da7ad0900002 + 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_downtime_returns_downtime_not_found_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_downtime_not_found_response.frozen new file mode 100644 index 0000000000..91f2c6b32f --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_downtime_not_found_response.frozen @@ -0,0 +1 @@ +2023-05-25T20:24:22.729Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_downtime_not_found_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_downtime_not_found_response.yaml new file mode 100644 index 0000000000..722671d814 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_downtime_not_found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '{"data":{"attributes":{"message":"test msg"},"id":"00000000-0000-1234-0000-000000000000","type":"downtime"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/downtime/00000000-0000-1234-0000-000000000000 + response: + body: + string: '{"errors":["Downtime 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_downtime_returns_ok_response.frozen b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_ok_response.frozen new file mode 100644 index 0000000000..d484e57c55 --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_ok_response.frozen @@ -0,0 +1 @@ +2023-06-02T20:53:27.909Z \ No newline at end of file diff --git a/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_ok_response.yaml b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_ok_response.yaml new file mode 100644 index 0000000000..970b7e9bcd --- /dev/null +++ b/tests/v2/cassettes/test_scenarios/test_update_a_downtime_returns_ok_response.yaml @@ -0,0 +1,62 @@ +interactions: +- request: + body: '{"data":{"attributes":{"message":"test message","monitor_identifier":{"monitor_tags":["cat:hat"]},"schedule":{"start":null},"scope":"test:testupdateadowntimereturnsokresponse1685739207"},"type":"downtime"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/downtime + response: + body: + string: '{"data":{"type":"downtime","relationships":{"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}},"monitor":{"data":null}},"id":"865c7f20-0187-11ee-ac0a-da7ad0900002","attributes":{"monitor_identifier":{"monitor_tags":["cat:hat"]},"status":"active","message":"test + message","created":"2023-06-02T20:53:28.147387+00:00","schedule":{"end":null,"start":"2023-06-02T20:53:28.134493+00:00"},"modified":"2023-06-02T20:53:28.147387+00:00","display_timezone":"UTC","mute_first_recovery_notification":false,"notify_end_states":["no + data","warn","alert"],"scope":"test:testupdateadowntimereturnsokresponse1685739207","notify_end_types":["expired"],"canceled":null}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: '{"data":{"attributes":{"message":"light speed"},"id":"865c7f20-0187-11ee-ac0a-da7ad0900002","type":"downtime"}}' + headers: + accept: + - application/json + content-type: + - application/json + method: PATCH + uri: https://api.datadoghq.com/api/v2/downtime/865c7f20-0187-11ee-ac0a-da7ad0900002 + response: + body: + string: '{"data":{"type":"downtime","attributes":{"display_timezone":"UTC","status":"active","message":"light + speed","created":"2023-06-02T20:53:28.147387+00:00","canceled":null,"modified":"2023-06-02T20:53:28.386158+00:00","notify_end_types":["expired"],"mute_first_recovery_notification":false,"notify_end_states":["no + data","alert","warn"],"monitor_identifier":{"monitor_tags":["cat:hat"]},"schedule":{"end":null,"start":"2023-06-02T20:53:28.134493+00:00"},"scope":"test:testupdateadowntimereturnsokresponse1685739207"},"id":"865c7f20-0187-11ee-ac0a-da7ad0900002","relationships":{"monitor":{"data":null},"created_by":{"data":{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0"}}}},"included":[{"type":"users","id":"3ad549bf-eba0-11e9-a77a-0705486660d0","attributes":{"name":null,"handle":"frog@datadoghq.com","created_at":"2019-10-02T08:15:39.795051+00:00","modified_at":"2020-06-15T12:33:12.884459+00:00","email":"frog@datadoghq.com","icon":"https://secure.gravatar.com/avatar/28a16dfe36e73b60c1d55872cb0f1172?s=48&d=retro","title":null,"verified":true,"service_account":false,"disabled":false,"allowed_login_methods":[],"status":"Active"}}]} + + ' + headers: + content-type: + - application/json + status: + code: 200 + message: OK +- request: + body: null + headers: + accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/downtime/865c7f20-0187-11ee-ac0a-da7ad0900002 + 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/downtimes.feature b/tests/v2/features/downtimes.feature new file mode 100644 index 0000000000..ba58ff68d4 --- /dev/null +++ b/tests/v2/features/downtimes.feature @@ -0,0 +1,111 @@ +@endpoint(downtimes) @endpoint(downtimes-v2) +Feature: Downtimes + **Note**: Downtime V2 is currently in private beta. To request access, + contact [Datadog support](https://docs.datadoghq.com/help/). + [Downtiming](https://docs.datadoghq.com/monitors/notify/downtimes) gives + you greater control over monitor notifications by allowing you to globally + exclude scopes from alerting. Downtime settings, which can be scheduled + with start and end times, prevent all alerting related to specified + Datadog tags. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "Downtimes" API + + @skip-validation @team:DataDog/monitor-app + Scenario: Cancel a downtime returns "Downtime not found" response + Given new "CancelDowntime" request + And operation "CancelDowntime" enabled + And request contains "downtime_id" parameter with value "00000000-0000-1234-0000-000000000000" + When the request is sent + Then the response status is 404 Downtime not found + + @team:DataDog/monitor-app + Scenario: Cancel a downtime returns "OK" response + Given there is a valid "downtime_v2" in the system + And operation "CancelDowntime" enabled + And new "CancelDowntime" request + And request contains "downtime_id" parameter from "downtime_v2.data.id" + When the request is sent + Then the response status is 204 OK + + @skip-validation @team:DataDog/monitor-app + Scenario: Get a downtime returns "Bad Request" response + Given new "GetDowntime" request + And operation "GetDowntime" enabled + And request contains "downtime_id" parameter with value "INVALID_UUID_LENGTH" + When the request is sent + Then the response status is 400 Bad Request + + @skip-validation @team:DataDog/monitor-app + Scenario: Get a downtime returns "Not Found" response + Given new "GetDowntime" request + And operation "GetDowntime" enabled + And request contains "downtime_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 downtime returns "OK" response + Given there is a valid "downtime_v2" in the system + And operation "GetDowntime" enabled + And new "GetDowntime" request + And request contains "downtime_id" parameter from "downtime_v2.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.message" is equal to "test message" + + @team:DataDog/monitor-app + Scenario: Get all downtimes returns "OK" response + Given new "ListDowntimes" request + And operation "ListDowntimes" enabled + When the request is sent + Then the response status is 200 OK + + @skip-validation @team:DataDog/monitor-app + Scenario: Schedule a downtime returns "Bad Request" response + Given new "CreateDowntime" request + And operation "CreateDowntime" enabled + And body with value { "data": { "attributes": { "monitor_identifier": { "monitor_tags": ["cat:hat"] }, "scope": "BAD_SCOPE_MISSING_KEY_VALUE_FORMAT", "schedule": {"start": null } }, "type": "downtime" } } + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/monitor-app + Scenario: Schedule a downtime returns "OK" response + Given new "CreateDowntime" request + And operation "CreateDowntime" enabled + And body with value { "data": { "attributes": { "message": "dark forest", "monitor_identifier": { "monitor_tags": ["cat:hat"] }, "scope": "test:{{ unique_lower_alnum }}", "schedule": {"start": null } }, "type": "downtime" } } + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.message" is equal to "dark forest" + + @skip-java @skip-python @skip-ruby @skip-typescript @skip-validation @team:DataDog/monitor-app + Scenario: Update a downtime returns "Bad Request" response + Given there is a valid "downtime_v2" in the system + And operation "UpdateDowntime" enabled + And new "UpdateDowntime" request + And request contains "downtime_id" parameter from "downtime_v2.data.id" + And body with value {"data": {"attributes": {"invalid_field": "sophon"}, "id": "{{ downtime_v2.data.id }}", "type": "downtime"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip-validation @team:DataDog/monitor-app + Scenario: Update a downtime returns "Downtime not found" response + Given new "UpdateDowntime" request + And operation "UpdateDowntime" enabled + And request contains "downtime_id" parameter with value "00000000-0000-1234-0000-000000000000" + And body with value {"data": {"attributes": {"message": "test msg"}, "id": "00000000-0000-1234-0000-000000000000", "type": "downtime"}} + When the request is sent + Then the response status is 404 Downtime not found + + @team:DataDog/monitor-app + Scenario: Update a downtime returns "OK" response + Given there is a valid "downtime_v2" in the system + And operation "UpdateDowntime" enabled + And new "UpdateDowntime" request + And request contains "downtime_id" parameter from "downtime_v2.data.id" + And body with value {"data": {"attributes": {"message": "light speed"}, "id": "{{ downtime_v2.data.id }}", "type": "downtime"}} + When the request is sent + Then the response status is 200 OK + And the response "data.attributes.message" is equal to "light speed" diff --git a/tests/v2/features/given.json b/tests/v2/features/given.json index 15db40f70c..98bcdbf65f 100644 --- a/tests/v2/features/given.json +++ b/tests/v2/features/given.json @@ -79,6 +79,18 @@ "tag": "Dashboard Lists", "operationId": "CreateDashboardListItems" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n\t\"data\": {\n\t\t\"attributes\": {\n \"message\": \"test message\",\n\t\t\t\"monitor_identifier\": {\n\t\t\t\t\"monitor_tags\": [\"cat:hat\"]\n\t\t\t},\n\t\t\t\"scope\": \"test:{{ unique_lower_alnum }}\",\n \"schedule\": {\"start\": null }\n\t\t},\n\t\t\"type\": \"downtime\"\n\t}\n}" + } + ], + "step": "there is a valid \"downtime_v2\" in the system", + "key": "downtime_v2", + "tag": "Downtimes", + "operationId": "CreateDowntime" + }, { "parameters": [ { diff --git a/tests/v2/features/undo.json b/tests/v2/features/undo.json index 8958efda75..b67c945eec 100644 --- a/tests/v2/features/undo.json +++ b/tests/v2/features/undo.json @@ -243,6 +243,43 @@ "type": "safe" } }, + "ListDowntimes": { + "tag": "Downtimes", + "undo": { + "type": "safe" + } + }, + "CreateDowntime": { + "tag": "Downtimes", + "undo": { + "operationId": "CancelDowntime", + "parameters": [ + { + "name": "downtime_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "CancelDowntime": { + "tag": "Downtimes", + "undo": { + "type": "idempotent" + } + }, + "GetDowntime": { + "tag": "Downtimes", + "undo": { + "type": "safe" + } + }, + "UpdateDowntime": { + "tag": "Downtimes", + "undo": { + "type": "idempotent" + } + }, "ListEvents": { "tag": "Events", "undo": {