diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 4dd4eb9c3140..979c2d661e97 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -78126,7 +78126,7 @@ components: type: array timeframe: description: The relative timeframe of data to include in the report. - example: "calendar_month" + example: "1w" type: string timezone: description: The IANA time zone identifier the recurrence rule is evaluated in. @@ -78178,6 +78178,269 @@ components: description: A related resource included with a report schedule. oneOf: - $ref: "#/components/schemas/ReportScheduleAuthor" + - $ref: "#/components/schemas/ReportScheduleResource" + ReportScheduleIncludedResourceType: + description: JSON:API resource type for an included report resource. + enum: + - resource + example: resource + type: string + x-enum-varnames: + - RESOURCE + ReportScheduleIndexTemplateVariable: + description: Template variable metadata from a dashboard index. + properties: + available_values: + description: Available values for the template variable. + example: + - prod + - staging + items: + type: string + nullable: true + type: array + defaults: + description: Default values for the template variable. + example: + - prod + items: + type: string + nullable: true + type: array + name: + description: The template variable name. + example: env + nullable: true + type: string + prefix: + description: The tag prefix for the template variable, when available. + example: env + nullable: true + type: string + type: object + ReportScheduleListResourceRelationship: + description: Relationship to the report target resource. + properties: + data: + $ref: "#/components/schemas/ReportScheduleListResourceRelationshipData" + required: + - data + type: object + ReportScheduleListResourceRelationshipData: + description: Relationship data for the report target resource. + properties: + id: + description: The resource identifier. + example: "abc-def-ghi" + type: string + type: + $ref: "#/components/schemas/ReportScheduleIncludedResourceType" + required: + - id + - type + type: object + ReportScheduleListResponse: + description: Response containing a list of report schedules. + properties: + data: + description: The list of report schedules. + items: + $ref: "#/components/schemas/ReportScheduleListResponseData" + type: array + included: + description: Related resources included with the report schedules, such as authors and rendered resources. + items: + $ref: "#/components/schemas/ReportScheduleIncludedResource" + type: array + links: + $ref: "#/components/schemas/ReportScheduleListResponseLinks" + meta: + $ref: "#/components/schemas/ReportScheduleListResponseMeta" + required: + - data + type: object + ReportScheduleListResponseAttributes: + description: The configuration and derived state of a report schedule in a list response. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleResponseAttributesDeliveryFormat" + description: + description: The description of the report. + example: "Weekly summary of infrastructure health." + type: string + next_recurrence: + description: The Unix timestamp, in milliseconds, of the next scheduled delivery, or `null` if none is scheduled. + example: 1780923600000 + format: int64 + nullable: true + type: integer + recipients: + description: The recipients of the report (email addresses, Slack channel references, or Microsoft Teams channel references). + example: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + items: + description: A single recipient (email address, Slack channel reference, or Microsoft Teams channel reference). + type: string + type: array + resource_id: + description: The identifier of the resource rendered in the report. + example: "abc-def-ghi" + type: string + resource_type: + $ref: "#/components/schemas/ReportScheduleResourceType" + rrule: + description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + example: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + type: string + status: + $ref: "#/components/schemas/ReportScheduleStatus" + template_variables: + description: The dashboard template variables applied when rendering the report. + items: + $ref: "#/components/schemas/ReportScheduleTemplateVariable" + type: array + timeframe: + description: The relative timeframe of data included in the report, or `null` if not set. + example: "1w" + nullable: true + type: string + timezone: + description: The IANA time zone identifier the recurrence rule is evaluated in. + example: "America/New_York" + type: string + title: + description: The title of the report. + example: "Weekly Infrastructure Report" + type: string + required: + - status + - resource_id + - resource_type + - recipients + - rrule + - timezone + - template_variables + - title + - description + - timeframe + - next_recurrence + type: object + ReportScheduleListResponseData: + description: The JSON:API data object representing a report schedule in a list response. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleListResponseAttributes" + id: + description: The unique identifier of the report schedule. + example: "11111111-2222-3333-4444-555555555555" + type: string + relationships: + $ref: "#/components/schemas/ReportScheduleListResponseRelationships" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - id + - type + - attributes + - relationships + type: object + ReportScheduleListResponseLinks: + description: Pagination links for navigating a report schedule list response. + properties: + first: + description: Link to the first page. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=0&page[limit]=25" + nullable: true + type: string + last: + description: Link to the last page, or `null` if it is unavailable. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=0&page[limit]=25" + nullable: true + type: string + next: + description: Link to the next page, or `null` if it is unavailable. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=25&page[limit]=25" + nullable: true + type: string + prev: + description: Link to the previous page, or `null` if it is unavailable. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=0&page[limit]=25" + nullable: true + type: string + self: + description: Link to the current page. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[limit]=25" + nullable: true + type: string + type: object + ReportScheduleListResponseMeta: + description: Metadata for a paginated report schedule list response. + properties: + pagination: + $ref: "#/components/schemas/ReportScheduleListResponsePagination" + type: object + ReportScheduleListResponsePagination: + description: Offset and limit pagination metadata for a report schedule list response. + properties: + first_offset: + description: The first offset. + example: 0 + format: int64 + type: integer + last_offset: + description: The last offset when the total count is known, or `null` if it is unavailable. + example: 0 + format: int64 + nullable: true + type: integer + limit: + description: The maximum number of schedules returned. + example: 25 + format: int64 + type: integer + next_offset: + description: The next offset. + example: 25 + format: int64 + type: integer + offset: + description: The current offset. + example: 0 + format: int64 + type: integer + prev_offset: + description: The previous offset. + example: 0 + format: int64 + type: integer + total: + description: The total number of matching schedules. + example: 1 + format: int64 + type: integer + type: + $ref: "#/components/schemas/ReportScheduleListResponsePaginationType" + type: object + ReportScheduleListResponsePaginationType: + description: The pagination type. + enum: + - offset_limit + example: offset_limit + type: string + x-enum-varnames: + - OFFSET_LIMIT + ReportScheduleListResponseRelationships: + description: Relationships for a report schedule in a list response. + properties: + author: + $ref: "#/components/schemas/ReportScheduleAuthorRelationship" + resource: + $ref: "#/components/schemas/ReportScheduleListResourceRelationship" + required: + - author + type: object ReportSchedulePatchRequest: description: Request body for updating a report schedule. properties: @@ -78227,7 +78490,7 @@ components: type: array timeframe: description: The relative timeframe of data to include in the report. - example: "calendar_month" + example: "1w" type: string timezone: description: The IANA time zone identifier the recurrence rule is evaluated in. @@ -78259,6 +78522,41 @@ components: - type - attributes type: object + ReportScheduleResource: + description: A report target resource included as a related JSON:API resource. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleResourceAttributes" + id: + description: The resource identifier. + example: "abc-def-ghi" + type: string + type: + $ref: "#/components/schemas/ReportScheduleIncludedResourceType" + required: + - type + - id + - attributes + type: object + ReportScheduleResourceAttributes: + description: Attributes of an included report target resource. + properties: + resource_type: + $ref: "#/components/schemas/ReportScheduleResourceType" + template_variables: + description: Template variable metadata from the dashboard resource, when available. + items: + $ref: "#/components/schemas/ReportScheduleIndexTemplateVariable" + nullable: true + type: array + title: + description: The title of the dashboard or integration dashboard resource, when available. + example: "Infrastructure Overview" + nullable: true + type: string + required: + - resource_type + type: object ReportScheduleResourceType: description: The type of dashboard resource the report schedule targets. enum: @@ -78315,7 +78613,7 @@ components: $ref: "#/components/schemas/ReportScheduleResourceType" rrule: description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. - example: "FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + example: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" type: string status: $ref: "#/components/schemas/ReportScheduleStatus" @@ -78425,6 +78723,33 @@ components: - name - values type: object + ReportScheduleToggleRequest: + description: Request body for toggling a report schedule. + properties: + data: + $ref: "#/components/schemas/ReportScheduleToggleRequestData" + required: + - data + type: object + ReportScheduleToggleRequestAttributes: + description: The status to set on the report schedule. + properties: + status: + $ref: "#/components/schemas/ReportScheduleStatus" + required: + - status + type: object + ReportScheduleToggleRequestData: + description: The JSON:API data object for a report schedule toggle request. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleToggleRequestAttributes" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - type + - attributes + type: object ReportScheduleType: description: JSON:API resource type for report schedules. enum: @@ -165095,7 +165420,384 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/reporting/schedule/list: + get: + description: |- + List dashboard and integration dashboard report schedules for the organization. + The response is paginated and can be filtered by title, author UUID, or recipients. + Requires the `generate_dashboard_reports` permission. + operationId: ListReportSchedules + parameters: + - description: The maximum number of schedules to return. The maximum value is 50. + example: 25 + in: query + name: page[limit] + required: false + schema: + default: 25 + format: int64 + maximum: 50 + minimum: 1 + type: integer + - description: The offset from which to start returning schedules. + example: 0 + in: query + name: page[offset] + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + - description: Filter schedules by report title. + example: "Weekly" + in: query + name: filter[title] + required: false + schema: + type: string + - description: Filter schedules by author UUID. + example: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + in: query + name: filter[author_uuid] + required: false + schema: + format: uuid + type: string + - description: Filter schedules by a comma-separated list of recipients. + example: "user@example.com,team@example.com" + in: query + name: filter[recipients] + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + relationships: + author: + data: + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + resource: + data: + id: "abc-def-ghi" + type: resource + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + - attributes: + resource_type: dashboard + template_variables: + - available_values: + - "prod" + - "staging" + defaults: + - "prod" + name: "env" + prefix: "env" + title: "Infrastructure Overview" + id: "abc-def-ghi" + type: resource + links: + first: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=0&page[limit]=25" + last: + next: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=25&page[limit]=25" + prev: + self: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[limit]=25" + meta: + pagination: + first_offset: 0 + last_offset: 0 + limit: 25 + next_offset: 25 + offset: 0 + prev_offset: 0 + total: 1 + type: offset_limit + schema: + $ref: "#/components/schemas/ReportScheduleListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List report schedules + tags: + - Report Schedules + /api/v2/reporting/schedule/{resource_type}/{resource_id}: + get: + description: |- + Get all report schedules that target a dashboard or integration dashboard resource. + Requires a reporting read permission appropriate to the targeted resource type. + operationId: GetReportSchedulesForResource + parameters: + - description: The type of resource to fetch report schedules for. + example: dashboard + in: path + name: resource_type + required: true + schema: + $ref: "#/components/schemas/ReportScheduleResourceType" + - description: The identifier of the resource to fetch report schedules for. + example: "abc-def-ghi" + in: path + name: resource_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get report schedules for a resource + tags: + - Report Schedules /api/v2/reporting/schedule/{schedule_uuid}: + delete: + description: |- + Delete a report schedule by its unique identifier. The response returns the deleted schedule. + Requires a reporting write permission appropriate to the targeted resource type and schedule ownership. + operationId: DeleteReportSchedule + parameters: + - description: The unique identifier of the report schedule to delete. + example: "11111111-2222-3333-4444-555555555555" + in: path + name: schedule_uuid + required: true + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: inactive + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a report schedule + tags: + - Report Schedules + get: + description: |- + Get a report schedule by its unique identifier. + Requires a reporting read permission appropriate to the targeted resource type. + operationId: GetReportSchedule + parameters: + - description: The unique identifier of the report schedule to fetch. + example: "11111111-2222-3333-4444-555555555555" + in: path + name: schedule_uuid + required: true + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a report schedule + tags: + - Report Schedules patch: description: |- Update an existing scheduled report by its identifier. The editable attributes @@ -165209,6 +165911,95 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/reporting/schedule/{schedule_uuid}/toggle: + patch: + description: |- + Activate or pause a report schedule by setting its status to `active` or `inactive`. + Requires a reporting write permission appropriate to the targeted resource type and schedule ownership. + operationId: ToggleReportSchedule + parameters: + - description: The unique identifier of the report schedule to toggle. + example: "11111111-2222-3333-4444-555555555555" + in: path + name: schedule_uuid + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + status: inactive + type: schedule + schema: + $ref: "#/components/schemas/ReportScheduleToggleRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: inactive + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Toggle a report schedule + tags: + - Report Schedules + x-codegen-request-body-name: body /api/v2/restriction_policy/{resource_id}: delete: description: Deletes the restriction policy associated with a specified resource. diff --git a/features/v2/report_schedules.feature b/features/v2/report_schedules.feature index 7d2ffafbc65b..aa62a5e35063 100644 --- a/features/v2/report_schedules.feature +++ b/features/v2/report_schedules.feature @@ -13,7 +13,7 @@ Feature: Report Schedules Scenario: Create a report schedule returns "Bad Request" response Given operation "CreateReportSchedule" enabled And new "CreateReportSchedule" request - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 400 Bad Request @@ -21,7 +21,7 @@ Feature: Report Schedules Scenario: Create a report schedule returns "CREATED" response Given operation "CreateReportSchedule" enabled And new "CreateReportSchedule" request - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 201 CREATED @@ -29,16 +29,124 @@ Feature: Report Schedules Scenario: Create a report schedule returns "Not Found" response Given operation "CreateReportSchedule" enabled And new "CreateReportSchedule" request - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a report schedule returns "Bad Request" response + Given new "DeleteReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a report schedule returns "Not Found" response + Given new "DeleteReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a report schedule returns "OK" response + Given new "DeleteReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a report schedule returns "Bad Request" response + Given new "GetReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a report schedule returns "Not Found" response + Given new "GetReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a report schedule returns "OK" response + Given new "GetReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get report schedules for a resource returns "Bad Request" response + Given new "GetReportSchedulesForResource" request + And request contains "resource_type" parameter from "REPLACE.ME" + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get report schedules for a resource returns "Not Found" response + Given new "GetReportSchedulesForResource" request + And request contains "resource_type" parameter from "REPLACE.ME" + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get report schedules for a resource returns "OK" response + Given new "GetReportSchedulesForResource" request + And request contains "resource_type" parameter from "REPLACE.ME" + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: List report schedules returns "Bad Request" response + Given new "ListReportSchedules" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: List report schedules returns "Not Found" response + Given new "ListReportSchedules" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: List report schedules returns "OK" response + Given new "ListReportSchedules" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Toggle a report schedule returns "Bad Request" response + Given new "ToggleReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"status": "active"}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Toggle a report schedule returns "Not Found" response + Given new "ToggleReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"status": "active"}, "type": "schedule"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Toggle a report schedule returns "OK" response + Given new "ToggleReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"status": "active"}, "type": "schedule"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Update a report schedule returns "Bad Request" response Given operation "PatchReportSchedule" enabled And new "PatchReportSchedule" request And request contains "schedule_uuid" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 400 Bad Request @@ -47,7 +155,7 @@ Feature: Report Schedules Given operation "PatchReportSchedule" enabled And new "PatchReportSchedule" request And request contains "schedule_uuid" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 404 Not Found @@ -56,6 +164,6 @@ Feature: Report Schedules Given operation "PatchReportSchedule" enabled And new "PatchReportSchedule" request And request contains "schedule_uuid" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index 22dc7ad77fe4..c07e3792ac55 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -6396,9 +6396,40 @@ "CreateReportSchedule": { "tag": "Report Schedules", "undo": { + "operationId": "DeleteReportSchedule", + "parameters": [ + { + "name": "schedule_uuid", + "source": "data.id" + } + ], "type": "unsafe" } }, + "ListReportSchedules": { + "tag": "Report Schedules", + "undo": { + "type": "safe" + } + }, + "GetReportSchedulesForResource": { + "tag": "Report Schedules", + "undo": { + "type": "safe" + } + }, + "DeleteReportSchedule": { + "tag": "Report Schedules", + "undo": { + "type": "idempotent" + } + }, + "GetReportSchedule": { + "tag": "Report Schedules", + "undo": { + "type": "safe" + } + }, "PatchReportSchedule": { "tag": "Report Schedules", "undo": { @@ -6406,6 +6437,13 @@ "type": "idempotent" } }, + "ToggleReportSchedule": { + "tag": "Report Schedules", + "undo": { + "operationId": "ToggleReportSchedule", + "type": "idempotent" + } + }, "DeleteRestrictionPolicy": { "tag": "Restriction Policies", "undo": { diff --git a/private/bdd_runner/src/support/scenarios_model_mapping.ts b/private/bdd_runner/src/support/scenarios_model_mapping.ts index 4d0f1bf798a8..4060d8f7b4cd 100644 --- a/private/bdd_runner/src/support/scenarios_model_mapping.ts +++ b/private/bdd_runner/src/support/scenarios_model_mapping.ts @@ -13792,6 +13792,54 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "ReportScheduleResponse", }, + "ReportSchedulesApi.V2.ListReportSchedules": { + pageLimit: { + type: "number", + format: "int64", + }, + pageOffset: { + type: "number", + format: "int64", + }, + filterTitle: { + type: "string", + format: "", + }, + filterAuthorUuid: { + type: "string", + format: "uuid", + }, + filterRecipients: { + type: "string", + format: "", + }, + operationResponseType: "ReportScheduleListResponse", + }, + "ReportSchedulesApi.V2.GetReportSchedulesForResource": { + resourceType: { + type: "ReportScheduleResourceType", + format: "", + }, + resourceId: { + type: "string", + format: "", + }, + operationResponseType: "ReportScheduleListResponse", + }, + "ReportSchedulesApi.V2.GetReportSchedule": { + scheduleUuid: { + type: "string", + format: "uuid", + }, + operationResponseType: "ReportScheduleResponse", + }, + "ReportSchedulesApi.V2.DeleteReportSchedule": { + scheduleUuid: { + type: "string", + format: "uuid", + }, + operationResponseType: "ReportScheduleResponse", + }, "ReportSchedulesApi.V2.PatchReportSchedule": { scheduleUuid: { type: "string", @@ -13803,6 +13851,17 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = { }, operationResponseType: "ReportScheduleResponse", }, + "ReportSchedulesApi.V2.ToggleReportSchedule": { + scheduleUuid: { + type: "string", + format: "uuid", + }, + body: { + type: "ReportScheduleToggleRequest", + format: "", + }, + operationResponseType: "ReportScheduleResponse", + }, "RestrictionPoliciesApi.V2.GetRestrictionPolicy": { resourceId: { type: "string", diff --git a/services/report_schedules/src/v2/ReportSchedulesApi.ts b/services/report_schedules/src/v2/ReportSchedulesApi.ts index 29e9167e76d3..f43b51ec0734 100644 --- a/services/report_schedules/src/v2/ReportSchedulesApi.ts +++ b/services/report_schedules/src/v2/ReportSchedulesApi.ts @@ -25,8 +25,11 @@ import { TypingInfo } from "./models/TypingInfo"; import { APIErrorResponse } from "./models/APIErrorResponse"; import { JSONAPIErrorResponse } from "./models/JSONAPIErrorResponse"; import { ReportScheduleCreateRequest } from "./models/ReportScheduleCreateRequest"; +import { ReportScheduleListResponse } from "./models/ReportScheduleListResponse"; import { ReportSchedulePatchRequest } from "./models/ReportSchedulePatchRequest"; +import { ReportScheduleResourceType } from "./models/ReportScheduleResourceType"; import { ReportScheduleResponse } from "./models/ReportScheduleResponse"; +import { ReportScheduleToggleRequest } from "./models/ReportScheduleToggleRequest"; import { version } from "../version"; export class ReportSchedulesApiRequestFactory extends BaseAPIRequestFactory { @@ -96,6 +99,221 @@ export class ReportSchedulesApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async deleteReportSchedule( + scheduleUuid: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'scheduleUuid' is not null or undefined + if (scheduleUuid === null || scheduleUuid === undefined) { + throw new RequiredError("scheduleUuid", "deleteReportSchedule"); + } + + // Path Params + const localVarPath = "/api/v2/reporting/schedule/{schedule_uuid}".replace( + "{schedule_uuid}", + encodeURIComponent(String(scheduleUuid)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ReportSchedulesApi.v2.deleteReportSchedule", + ReportSchedulesApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.DELETE, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getReportSchedule( + scheduleUuid: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'scheduleUuid' is not null or undefined + if (scheduleUuid === null || scheduleUuid === undefined) { + throw new RequiredError("scheduleUuid", "getReportSchedule"); + } + + // Path Params + const localVarPath = "/api/v2/reporting/schedule/{schedule_uuid}".replace( + "{schedule_uuid}", + encodeURIComponent(String(scheduleUuid)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ReportSchedulesApi.v2.getReportSchedule", + ReportSchedulesApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async getReportSchedulesForResource( + resourceType: ReportScheduleResourceType, + resourceId: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'resourceType' is not null or undefined + if (resourceType === null || resourceType === undefined) { + throw new RequiredError("resourceType", "getReportSchedulesForResource"); + } + + // verify required parameter 'resourceId' is not null or undefined + if (resourceId === null || resourceId === undefined) { + throw new RequiredError("resourceId", "getReportSchedulesForResource"); + } + + // Path Params + const localVarPath = + "/api/v2/reporting/schedule/{resource_type}/{resource_id}" + .replace("{resource_type}", encodeURIComponent(String(resourceType))) + .replace("{resource_id}", encodeURIComponent(String(resourceId))); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ReportSchedulesApi.v2.getReportSchedulesForResource", + ReportSchedulesApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async listReportSchedules( + pageLimit?: number, + pageOffset?: number, + filterTitle?: string, + filterAuthorUuid?: string, + filterRecipients?: string, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // Path Params + const localVarPath = "/api/v2/reporting/schedule/list"; + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ReportSchedulesApi.v2.listReportSchedules", + ReportSchedulesApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.GET, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Query Params + if (pageLimit !== undefined) { + requestContext.setQueryParam( + "page[limit]", + serialize(pageLimit, TypingInfo, "number", "int64"), + "", + ); + } + if (pageOffset !== undefined) { + requestContext.setQueryParam( + "page[offset]", + serialize(pageOffset, TypingInfo, "number", "int64"), + "", + ); + } + if (filterTitle !== undefined) { + requestContext.setQueryParam( + "filter[title]", + serialize(filterTitle, TypingInfo, "string", ""), + "", + ); + } + if (filterAuthorUuid !== undefined) { + requestContext.setQueryParam( + "filter[author_uuid]", + serialize(filterAuthorUuid, TypingInfo, "string", "uuid"), + "", + ); + } + if (filterRecipients !== undefined) { + requestContext.setQueryParam( + "filter[recipients]", + serialize(filterRecipients, TypingInfo, "string", ""), + "", + ); + } + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async patchReportSchedule( scheduleUuid: string, body: ReportSchedulePatchRequest, @@ -116,67 +334,532 @@ export class ReportSchedulesApiRequestFactory extends BaseAPIRequestFactory { throw new RequiredError("scheduleUuid", "patchReportSchedule"); } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError("body", "patchReportSchedule"); + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "patchReportSchedule"); + } + + // Path Params + const localVarPath = "/api/v2/reporting/schedule/{schedule_uuid}".replace( + "{schedule_uuid}", + encodeURIComponent(String(scheduleUuid)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ReportSchedulesApi.v2.patchReportSchedule", + ReportSchedulesApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.PATCH, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "ReportSchedulePatchRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async toggleReportSchedule( + scheduleUuid: string, + body: ReportScheduleToggleRequest, + _options?: Configuration, + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'scheduleUuid' is not null or undefined + if (scheduleUuid === null || scheduleUuid === undefined) { + throw new RequiredError("scheduleUuid", "toggleReportSchedule"); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError("body", "toggleReportSchedule"); + } + + // Path Params + const localVarPath = + "/api/v2/reporting/schedule/{schedule_uuid}/toggle".replace( + "{schedule_uuid}", + encodeURIComponent(String(scheduleUuid)), + ); + + // Make Request Context + const { server, overrides } = _config.getServerAndOverrides( + "ReportSchedulesApi.v2.toggleReportSchedule", + ReportSchedulesApi.operationServers, + ); + const requestContext = server.makeRequestContext( + localVarPath, + HttpMethod.PATCH, + overrides, + ); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Set User-Agent + if (this.userAgent) { + requestContext.setHeaderParam("User-Agent", this.userAgent); + } + + // Body Params + const contentType = getPreferredMediaType(["application/json"]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = stringify( + serialize(body, TypingInfo, "ReportScheduleToggleRequest", ""), + contentType, + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } +} + +export class ReportSchedulesApiResponseProcessor { + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createReportSchedule + * @throws ApiException if the response code was not in [200, 299] + */ + public async createReportSchedule( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 201) { + const body: ReportScheduleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleResponse", + ) as ReportScheduleResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ReportScheduleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleResponse", + "", + ) as ReportScheduleResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to deleteReportSchedule + * @throws ApiException if the response code was not in [200, 299] + */ + public async deleteReportSchedule( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ReportScheduleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleResponse", + ) as ReportScheduleResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ReportScheduleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleResponse", + "", + ) as ReportScheduleResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getReportSchedule + * @throws ApiException if the response code was not in [200, 299] + */ + public async getReportSchedule( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ReportScheduleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleResponse", + ) as ReportScheduleResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ReportScheduleResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleResponse", + "", + ) as ReportScheduleResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to getReportSchedulesForResource + * @throws ApiException if the response code was not in [200, 299] + */ + public async getReportSchedulesForResource( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ReportScheduleListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleListResponse", + ) as ReportScheduleListResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ReportScheduleListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleListResponse", + "", + ) as ReportScheduleListResponse; + return body; } - // Path Params - const localVarPath = "/api/v2/reporting/schedule/{schedule_uuid}".replace( - "{schedule_uuid}", - encodeURIComponent(String(scheduleUuid)), + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', ); + } - // Make Request Context - const { server, overrides } = _config.getServerAndOverrides( - "ReportSchedulesApi.v2.patchReportSchedule", - ReportSchedulesApi.operationServers, - ); - const requestContext = server.makeRequestContext( - localVarPath, - HttpMethod.PATCH, - overrides, - ); - requestContext.setHeaderParam("Accept", "application/json"); - requestContext.setHttpConfig(_config.httpConfig); + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to listReportSchedules + * @throws ApiException if the response code was not in [200, 299] + */ + public async listReportSchedules( + response: ResponseContext, + ): Promise { + const contentType = normalizeMediaType(response.headers["content-type"]); + if (response.httpStatusCode === 200) { + const body: ReportScheduleListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleListResponse", + ) as ReportScheduleListResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 + ) { + const bodyText = parse(await response.body.text(), contentType); + let body: JSONAPIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "JSONAPIErrorResponse", + ) as JSONAPIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException( + response.httpStatusCode, + body, + ); + } + if (response.httpStatusCode === 429) { + const bodyText = parse(await response.body.text(), contentType); + let body: APIErrorResponse; + try { + body = deserialize( + bodyText, + TypingInfo, + "APIErrorResponse", + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText, + ); + } + throw new ApiException(response.httpStatusCode, body); + } - // Set User-Agent - if (this.userAgent) { - requestContext.setHeaderParam("User-Agent", this.userAgent); + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ReportScheduleListResponse = deserialize( + parse(await response.body.text(), contentType), + TypingInfo, + "ReportScheduleListResponse", + "", + ) as ReportScheduleListResponse; + return body; } - // Body Params - const contentType = getPreferredMediaType(["application/json"]); - requestContext.setHeaderParam("Content-Type", contentType); - const serializedBody = stringify( - serialize(body, TypingInfo, "ReportSchedulePatchRequest", ""), - contentType, + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"', ); - requestContext.setBody(serializedBody); - - // Apply auth methods - applySecurityAuthentication(_config, requestContext, [ - "apiKeyAuth", - "appKeyAuth", - ]); - - return requestContext; } -} -export class ReportSchedulesApiResponseProcessor { /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to createReportSchedule + * @params response Response returned by the server for a request to patchReportSchedule * @throws ApiException if the response code was not in [200, 299] */ - public async createReportSchedule( + public async patchReportSchedule( response: ResponseContext, ): Promise { const contentType = normalizeMediaType(response.headers["content-type"]); - if (response.httpStatusCode === 201) { + if (response.httpStatusCode === 200) { const body: ReportScheduleResponse = deserialize( parse(await response.body.text(), contentType), TypingInfo, @@ -250,10 +933,10 @@ export class ReportSchedulesApiResponseProcessor { * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * - * @params response Response returned by the server for a request to patchReportSchedule + * @params response Response returned by the server for a request to toggleReportSchedule * @throws ApiException if the response code was not in [200, 299] */ - public async patchReportSchedule( + public async toggleReportSchedule( response: ResponseContext, ): Promise { const contentType = normalizeMediaType(response.headers["content-type"]); @@ -335,6 +1018,63 @@ export interface ReportSchedulesApiCreateReportScheduleRequest { body: ReportScheduleCreateRequest; } +export interface ReportSchedulesApiDeleteReportScheduleRequest { + /** + * The unique identifier of the report schedule to delete. + * @type string + */ + scheduleUuid: string; +} + +export interface ReportSchedulesApiGetReportScheduleRequest { + /** + * The unique identifier of the report schedule to fetch. + * @type string + */ + scheduleUuid: string; +} + +export interface ReportSchedulesApiGetReportSchedulesForResourceRequest { + /** + * The type of resource to fetch report schedules for. + * @type ReportScheduleResourceType + */ + resourceType: ReportScheduleResourceType; + /** + * The identifier of the resource to fetch report schedules for. + * @type string + */ + resourceId: string; +} + +export interface ReportSchedulesApiListReportSchedulesRequest { + /** + * The maximum number of schedules to return. The maximum value is 50. + * @type number + */ + pageLimit?: number; + /** + * The offset from which to start returning schedules. + * @type number + */ + pageOffset?: number; + /** + * Filter schedules by report title. + * @type string + */ + filterTitle?: string; + /** + * Filter schedules by author UUID. + * @type string + */ + filterAuthorUuid?: string; + /** + * Filter schedules by a comma-separated list of recipients. + * @type string + */ + filterRecipients?: string; +} + export interface ReportSchedulesApiPatchReportScheduleRequest { /** * The unique identifier of the report schedule to update. @@ -347,6 +1087,18 @@ export interface ReportSchedulesApiPatchReportScheduleRequest { body: ReportSchedulePatchRequest; } +export interface ReportSchedulesApiToggleReportScheduleRequest { + /** + * The unique identifier of the report schedule to toggle. + * @type string + */ + scheduleUuid: string; + /** + * @type ReportScheduleToggleRequest + */ + body: ReportScheduleToggleRequest; +} + export class ReportSchedulesApi { private requestFactory: ReportSchedulesApiRequestFactory; private responseProcessor: ReportSchedulesApiResponseProcessor; @@ -391,6 +1143,103 @@ export class ReportSchedulesApi { }); } + /** + * Delete a report schedule by its unique identifier. The response returns the deleted schedule. + * Requires a reporting write permission appropriate to the targeted resource type and schedule ownership. + * @param param The request object + */ + public deleteReportSchedule( + param: ReportSchedulesApiDeleteReportScheduleRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.deleteReportSchedule( + param.scheduleUuid, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.deleteReportSchedule(responseContext); + }); + }); + } + + /** + * Get a report schedule by its unique identifier. + * Requires a reporting read permission appropriate to the targeted resource type. + * @param param The request object + */ + public getReportSchedule( + param: ReportSchedulesApiGetReportScheduleRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.getReportSchedule( + param.scheduleUuid, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getReportSchedule(responseContext); + }); + }); + } + + /** + * Get all report schedules that target a dashboard or integration dashboard resource. + * Requires a reporting read permission appropriate to the targeted resource type. + * @param param The request object + */ + public getReportSchedulesForResource( + param: ReportSchedulesApiGetReportSchedulesForResourceRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = + this.requestFactory.getReportSchedulesForResource( + param.resourceType, + param.resourceId, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.getReportSchedulesForResource( + responseContext, + ); + }); + }); + } + + /** + * List dashboard and integration dashboard report schedules for the organization. + * The response is paginated and can be filtered by title, author UUID, or recipients. + * Requires the `generate_dashboard_reports` permission. + * @param param The request object + */ + public listReportSchedules( + param: ReportSchedulesApiListReportSchedulesRequest = {}, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.listReportSchedules( + param.pageLimit, + param.pageOffset, + param.filterTitle, + param.filterAuthorUuid, + param.filterRecipients, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.listReportSchedules(responseContext); + }); + }); + } + /** * Update an existing scheduled report by its identifier. The editable attributes * are replaced with the supplied values; the targeted resource (`resource_id` and @@ -415,4 +1264,27 @@ export class ReportSchedulesApi { }); }); } + + /** + * Activate or pause a report schedule by setting its status to `active` or `inactive`. + * Requires a reporting write permission appropriate to the targeted resource type and schedule ownership. + * @param param The request object + */ + public toggleReportSchedule( + param: ReportSchedulesApiToggleReportScheduleRequest, + options?: Configuration, + ): Promise { + const requestContextPromise = this.requestFactory.toggleReportSchedule( + param.scheduleUuid, + param.body, + options, + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.toggleReportSchedule(responseContext); + }); + }); + } } diff --git a/services/report_schedules/src/v2/index.ts b/services/report_schedules/src/v2/index.ts index 808c0963ef0a..b7d2602c28be 100644 --- a/services/report_schedules/src/v2/index.ts +++ b/services/report_schedules/src/v2/index.ts @@ -1,6 +1,11 @@ export { ReportSchedulesApiCreateReportScheduleRequest, + ReportSchedulesApiDeleteReportScheduleRequest, + ReportSchedulesApiGetReportScheduleRequest, + ReportSchedulesApiGetReportSchedulesForResourceRequest, + ReportSchedulesApiListReportSchedulesRequest, ReportSchedulesApiPatchReportScheduleRequest, + ReportSchedulesApiToggleReportScheduleRequest, ReportSchedulesApi, } from "./ReportSchedulesApi"; @@ -18,9 +23,23 @@ export { ReportScheduleCreateRequestAttributes } from "./models/ReportScheduleCr export { ReportScheduleCreateRequestData } from "./models/ReportScheduleCreateRequestData"; export { ReportScheduleDeliveryFormat } from "./models/ReportScheduleDeliveryFormat"; export { ReportScheduleIncludedResource } from "./models/ReportScheduleIncludedResource"; +export { ReportScheduleIncludedResourceType } from "./models/ReportScheduleIncludedResourceType"; +export { ReportScheduleIndexTemplateVariable } from "./models/ReportScheduleIndexTemplateVariable"; +export { ReportScheduleListResourceRelationship } from "./models/ReportScheduleListResourceRelationship"; +export { ReportScheduleListResourceRelationshipData } from "./models/ReportScheduleListResourceRelationshipData"; +export { ReportScheduleListResponse } from "./models/ReportScheduleListResponse"; +export { ReportScheduleListResponseAttributes } from "./models/ReportScheduleListResponseAttributes"; +export { ReportScheduleListResponseData } from "./models/ReportScheduleListResponseData"; +export { ReportScheduleListResponseLinks } from "./models/ReportScheduleListResponseLinks"; +export { ReportScheduleListResponseMeta } from "./models/ReportScheduleListResponseMeta"; +export { ReportScheduleListResponsePagination } from "./models/ReportScheduleListResponsePagination"; +export { ReportScheduleListResponsePaginationType } from "./models/ReportScheduleListResponsePaginationType"; +export { ReportScheduleListResponseRelationships } from "./models/ReportScheduleListResponseRelationships"; export { ReportSchedulePatchRequest } from "./models/ReportSchedulePatchRequest"; export { ReportSchedulePatchRequestAttributes } from "./models/ReportSchedulePatchRequestAttributes"; export { ReportSchedulePatchRequestData } from "./models/ReportSchedulePatchRequestData"; +export { ReportScheduleResource } from "./models/ReportScheduleResource"; +export { ReportScheduleResourceAttributes } from "./models/ReportScheduleResourceAttributes"; export { ReportScheduleResourceType } from "./models/ReportScheduleResourceType"; export { ReportScheduleResponse } from "./models/ReportScheduleResponse"; export { ReportScheduleResponseAttributes } from "./models/ReportScheduleResponseAttributes"; @@ -29,4 +48,7 @@ export { ReportScheduleResponseData } from "./models/ReportScheduleResponseData" export { ReportScheduleResponseRelationships } from "./models/ReportScheduleResponseRelationships"; export { ReportScheduleStatus } from "./models/ReportScheduleStatus"; export { ReportScheduleTemplateVariable } from "./models/ReportScheduleTemplateVariable"; +export { ReportScheduleToggleRequest } from "./models/ReportScheduleToggleRequest"; +export { ReportScheduleToggleRequestAttributes } from "./models/ReportScheduleToggleRequestAttributes"; +export { ReportScheduleToggleRequestData } from "./models/ReportScheduleToggleRequestData"; export { ReportScheduleType } from "./models/ReportScheduleType"; diff --git a/services/report_schedules/src/v2/models/ReportScheduleIncludedResource.ts b/services/report_schedules/src/v2/models/ReportScheduleIncludedResource.ts index 21dbde959547..49e3159357ba 100644 --- a/services/report_schedules/src/v2/models/ReportScheduleIncludedResource.ts +++ b/services/report_schedules/src/v2/models/ReportScheduleIncludedResource.ts @@ -1,10 +1,12 @@ import { UnparsedObject } from "@datadog/datadog-api-client"; import { ReportScheduleAuthor } from "./ReportScheduleAuthor"; +import { ReportScheduleResource } from "./ReportScheduleResource"; /** * A related resource included with a report schedule. */ export type ReportScheduleIncludedResource = | ReportScheduleAuthor + | ReportScheduleResource | UnparsedObject; diff --git a/services/report_schedules/src/v2/models/ReportScheduleIncludedResourceType.ts b/services/report_schedules/src/v2/models/ReportScheduleIncludedResourceType.ts new file mode 100644 index 000000000000..3fa03bd7c361 --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleIncludedResourceType.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * JSON:API resource type for an included report resource. + */ +export type ReportScheduleIncludedResourceType = + | typeof RESOURCE + | UnparsedObject; +export const RESOURCE = "resource"; diff --git a/services/report_schedules/src/v2/models/ReportScheduleIndexTemplateVariable.ts b/services/report_schedules/src/v2/models/ReportScheduleIndexTemplateVariable.ts new file mode 100644 index 000000000000..7dd3eed6f0ce --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleIndexTemplateVariable.ts @@ -0,0 +1,68 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Template variable metadata from a dashboard index. + */ +export class ReportScheduleIndexTemplateVariable { + /** + * Available values for the template variable. + */ + "availableValues"?: Array; + /** + * Default values for the template variable. + */ + "defaults"?: Array; + /** + * The template variable name. + */ + "name"?: string; + /** + * The tag prefix for the template variable, when available. + */ + "prefix"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + availableValues: { + baseName: "available_values", + type: "Array", + }, + defaults: { + baseName: "defaults", + type: "Array", + }, + name: { + baseName: "name", + type: "string", + }, + prefix: { + baseName: "prefix", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleIndexTemplateVariable.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResourceRelationship.ts b/services/report_schedules/src/v2/models/ReportScheduleListResourceRelationship.ts new file mode 100644 index 000000000000..ee50d693fa7d --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResourceRelationship.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleListResourceRelationshipData } from "./ReportScheduleListResourceRelationshipData"; + +/** + * Relationship to the report target resource. + */ +export class ReportScheduleListResourceRelationship { + /** + * Relationship data for the report target resource. + */ + "data": ReportScheduleListResourceRelationshipData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "ReportScheduleListResourceRelationshipData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleListResourceRelationship.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResourceRelationshipData.ts b/services/report_schedules/src/v2/models/ReportScheduleListResourceRelationshipData.ts new file mode 100644 index 000000000000..cbb819bb4634 --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResourceRelationshipData.ts @@ -0,0 +1,56 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleIncludedResourceType } from "./ReportScheduleIncludedResourceType"; + +/** + * Relationship data for the report target resource. + */ +export class ReportScheduleListResourceRelationshipData { + /** + * The resource identifier. + */ + "id": string; + /** + * JSON:API resource type for an included report resource. + */ + "type": ReportScheduleIncludedResourceType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "ReportScheduleIncludedResourceType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleListResourceRelationshipData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResponse.ts b/services/report_schedules/src/v2/models/ReportScheduleListResponse.ts new file mode 100644 index 000000000000..02d34882ddeb --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResponse.ts @@ -0,0 +1,74 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleIncludedResource } from "./ReportScheduleIncludedResource"; +import { ReportScheduleListResponseData } from "./ReportScheduleListResponseData"; +import { ReportScheduleListResponseLinks } from "./ReportScheduleListResponseLinks"; +import { ReportScheduleListResponseMeta } from "./ReportScheduleListResponseMeta"; + +/** + * Response containing a list of report schedules. + */ +export class ReportScheduleListResponse { + /** + * The list of report schedules. + */ + "data": Array; + /** + * Related resources included with the report schedules, such as authors and rendered resources. + */ + "included"?: Array; + /** + * Pagination links for navigating a report schedule list response. + */ + "links"?: ReportScheduleListResponseLinks; + /** + * Metadata for a paginated report schedule list response. + */ + "meta"?: ReportScheduleListResponseMeta; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + included: { + baseName: "included", + type: "Array", + }, + links: { + baseName: "links", + type: "ReportScheduleListResponseLinks", + }, + meta: { + baseName: "meta", + type: "ReportScheduleListResponseMeta", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleListResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResponseAttributes.ts b/services/report_schedules/src/v2/models/ReportScheduleListResponseAttributes.ts new file mode 100644 index 000000000000..31abc2290776 --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResponseAttributes.ts @@ -0,0 +1,149 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleResourceType } from "./ReportScheduleResourceType"; +import { ReportScheduleResponseAttributesDeliveryFormat } from "./ReportScheduleResponseAttributesDeliveryFormat"; +import { ReportScheduleStatus } from "./ReportScheduleStatus"; +import { ReportScheduleTemplateVariable } from "./ReportScheduleTemplateVariable"; + +/** + * The configuration and derived state of a report schedule in a list response. + */ +export class ReportScheduleListResponseAttributes { + /** + * The delivery format for dashboard report schedules, or `null` if not set. + */ + "deliveryFormat"?: ReportScheduleResponseAttributesDeliveryFormat; + /** + * The description of the report. + */ + "description": string; + /** + * The Unix timestamp, in milliseconds, of the next scheduled delivery, or `null` if none is scheduled. + */ + "nextRecurrence": number | null; + /** + * The recipients of the report (email addresses, Slack channel references, or Microsoft Teams channel references). + */ + "recipients": Array; + /** + * The identifier of the resource rendered in the report. + */ + "resourceId": string; + /** + * The type of dashboard resource the report schedule targets. + */ + "resourceType": ReportScheduleResourceType; + /** + * The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + */ + "rrule": string; + /** + * Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + */ + "status": ReportScheduleStatus; + /** + * The dashboard template variables applied when rendering the report. + */ + "templateVariables": Array; + /** + * The relative timeframe of data included in the report, or `null` if not set. + */ + "timeframe": string | null; + /** + * The IANA time zone identifier the recurrence rule is evaluated in. + */ + "timezone": string; + /** + * The title of the report. + */ + "title": string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + deliveryFormat: { + baseName: "delivery_format", + type: "ReportScheduleResponseAttributesDeliveryFormat", + }, + description: { + baseName: "description", + type: "string", + required: true, + }, + nextRecurrence: { + baseName: "next_recurrence", + type: "number", + required: true, + format: "int64", + }, + recipients: { + baseName: "recipients", + type: "Array", + required: true, + }, + resourceId: { + baseName: "resource_id", + type: "string", + required: true, + }, + resourceType: { + baseName: "resource_type", + type: "ReportScheduleResourceType", + required: true, + }, + rrule: { + baseName: "rrule", + type: "string", + required: true, + }, + status: { + baseName: "status", + type: "ReportScheduleStatus", + required: true, + }, + templateVariables: { + baseName: "template_variables", + type: "Array", + required: true, + }, + timeframe: { + baseName: "timeframe", + type: "string", + required: true, + }, + timezone: { + baseName: "timezone", + type: "string", + required: true, + }, + title: { + baseName: "title", + type: "string", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleListResponseAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResponseData.ts b/services/report_schedules/src/v2/models/ReportScheduleListResponseData.ts new file mode 100644 index 000000000000..2240fcb6e18a --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResponseData.ts @@ -0,0 +1,76 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleListResponseAttributes } from "./ReportScheduleListResponseAttributes"; +import { ReportScheduleListResponseRelationships } from "./ReportScheduleListResponseRelationships"; +import { ReportScheduleType } from "./ReportScheduleType"; + +/** + * The JSON:API data object representing a report schedule in a list response. + */ +export class ReportScheduleListResponseData { + /** + * The configuration and derived state of a report schedule in a list response. + */ + "attributes": ReportScheduleListResponseAttributes; + /** + * The unique identifier of the report schedule. + */ + "id": string; + /** + * Relationships for a report schedule in a list response. + */ + "relationships": ReportScheduleListResponseRelationships; + /** + * JSON:API resource type for report schedules. + */ + "type": ReportScheduleType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "ReportScheduleListResponseAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + relationships: { + baseName: "relationships", + type: "ReportScheduleListResponseRelationships", + required: true, + }, + type: { + baseName: "type", + type: "ReportScheduleType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleListResponseData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResponseLinks.ts b/services/report_schedules/src/v2/models/ReportScheduleListResponseLinks.ts new file mode 100644 index 000000000000..b8b0cb211582 --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResponseLinks.ts @@ -0,0 +1,76 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +/** + * Pagination links for navigating a report schedule list response. + */ +export class ReportScheduleListResponseLinks { + /** + * Link to the first page. + */ + "first"?: string; + /** + * Link to the last page, or `null` if it is unavailable. + */ + "last"?: string; + /** + * Link to the next page, or `null` if it is unavailable. + */ + "next"?: string; + /** + * Link to the previous page, or `null` if it is unavailable. + */ + "prev"?: string; + /** + * Link to the current page. + */ + "self"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + first: { + baseName: "first", + type: "string", + }, + last: { + baseName: "last", + type: "string", + }, + next: { + baseName: "next", + type: "string", + }, + prev: { + baseName: "prev", + type: "string", + }, + self: { + baseName: "self", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleListResponseLinks.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResponseMeta.ts b/services/report_schedules/src/v2/models/ReportScheduleListResponseMeta.ts new file mode 100644 index 000000000000..29f1f4c70260 --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResponseMeta.ts @@ -0,0 +1,46 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleListResponsePagination } from "./ReportScheduleListResponsePagination"; + +/** + * Metadata for a paginated report schedule list response. + */ +export class ReportScheduleListResponseMeta { + /** + * Offset and limit pagination metadata for a report schedule list response. + */ + "pagination"?: ReportScheduleListResponsePagination; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + pagination: { + baseName: "pagination", + type: "ReportScheduleListResponsePagination", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleListResponseMeta.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResponsePagination.ts b/services/report_schedules/src/v2/models/ReportScheduleListResponsePagination.ts new file mode 100644 index 000000000000..6fbef5cb1d6c --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResponsePagination.ts @@ -0,0 +1,109 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleListResponsePaginationType } from "./ReportScheduleListResponsePaginationType"; + +/** + * Offset and limit pagination metadata for a report schedule list response. + */ +export class ReportScheduleListResponsePagination { + /** + * The first offset. + */ + "firstOffset"?: number; + /** + * The last offset when the total count is known, or `null` if it is unavailable. + */ + "lastOffset"?: number; + /** + * The maximum number of schedules returned. + */ + "limit"?: number; + /** + * The next offset. + */ + "nextOffset"?: number; + /** + * The current offset. + */ + "offset"?: number; + /** + * The previous offset. + */ + "prevOffset"?: number; + /** + * The total number of matching schedules. + */ + "total"?: number; + /** + * The pagination type. + */ + "type"?: ReportScheduleListResponsePaginationType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + firstOffset: { + baseName: "first_offset", + type: "number", + format: "int64", + }, + lastOffset: { + baseName: "last_offset", + type: "number", + format: "int64", + }, + limit: { + baseName: "limit", + type: "number", + format: "int64", + }, + nextOffset: { + baseName: "next_offset", + type: "number", + format: "int64", + }, + offset: { + baseName: "offset", + type: "number", + format: "int64", + }, + prevOffset: { + baseName: "prev_offset", + type: "number", + format: "int64", + }, + total: { + baseName: "total", + type: "number", + format: "int64", + }, + type: { + baseName: "type", + type: "ReportScheduleListResponsePaginationType", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleListResponsePagination.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResponsePaginationType.ts b/services/report_schedules/src/v2/models/ReportScheduleListResponsePaginationType.ts new file mode 100644 index 000000000000..e6052a77b4f4 --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResponsePaginationType.ts @@ -0,0 +1,9 @@ +import { UnparsedObject } from "@datadog/datadog-api-client"; + +/** + * The pagination type. + */ +export type ReportScheduleListResponsePaginationType = + | typeof OFFSET_LIMIT + | UnparsedObject; +export const OFFSET_LIMIT = "offset_limit"; diff --git a/services/report_schedules/src/v2/models/ReportScheduleListResponseRelationships.ts b/services/report_schedules/src/v2/models/ReportScheduleListResponseRelationships.ts new file mode 100644 index 000000000000..02b69f442d62 --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleListResponseRelationships.ts @@ -0,0 +1,56 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleAuthorRelationship } from "./ReportScheduleAuthorRelationship"; +import { ReportScheduleListResourceRelationship } from "./ReportScheduleListResourceRelationship"; + +/** + * Relationships for a report schedule in a list response. + */ +export class ReportScheduleListResponseRelationships { + /** + * Relationship to the author of the report schedule. + */ + "author": ReportScheduleAuthorRelationship; + /** + * Relationship to the report target resource. + */ + "resource"?: ReportScheduleListResourceRelationship; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + author: { + baseName: "author", + type: "ReportScheduleAuthorRelationship", + required: true, + }, + resource: { + baseName: "resource", + type: "ReportScheduleListResourceRelationship", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleListResponseRelationships.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleResource.ts b/services/report_schedules/src/v2/models/ReportScheduleResource.ts new file mode 100644 index 000000000000..7d20f0bd4ffb --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleResource.ts @@ -0,0 +1,66 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleIncludedResourceType } from "./ReportScheduleIncludedResourceType"; +import { ReportScheduleResourceAttributes } from "./ReportScheduleResourceAttributes"; + +/** + * A report target resource included as a related JSON:API resource. + */ +export class ReportScheduleResource { + /** + * Attributes of an included report target resource. + */ + "attributes": ReportScheduleResourceAttributes; + /** + * The resource identifier. + */ + "id": string; + /** + * JSON:API resource type for an included report resource. + */ + "type": ReportScheduleIncludedResourceType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "ReportScheduleResourceAttributes", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + }, + type: { + baseName: "type", + type: "ReportScheduleIncludedResourceType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleResource.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleResourceAttributes.ts b/services/report_schedules/src/v2/models/ReportScheduleResourceAttributes.ts new file mode 100644 index 000000000000..e38800b42c25 --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleResourceAttributes.ts @@ -0,0 +1,64 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleIndexTemplateVariable } from "./ReportScheduleIndexTemplateVariable"; +import { ReportScheduleResourceType } from "./ReportScheduleResourceType"; + +/** + * Attributes of an included report target resource. + */ +export class ReportScheduleResourceAttributes { + /** + * The type of dashboard resource the report schedule targets. + */ + "resourceType": ReportScheduleResourceType; + /** + * Template variable metadata from the dashboard resource, when available. + */ + "templateVariables"?: Array; + /** + * The title of the dashboard or integration dashboard resource, when available. + */ + "title"?: string; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + resourceType: { + baseName: "resource_type", + type: "ReportScheduleResourceType", + required: true, + }, + templateVariables: { + baseName: "template_variables", + type: "Array", + }, + title: { + baseName: "title", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleResourceAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleToggleRequest.ts b/services/report_schedules/src/v2/models/ReportScheduleToggleRequest.ts new file mode 100644 index 000000000000..ea54cfca5b0a --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleToggleRequest.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleToggleRequestData } from "./ReportScheduleToggleRequestData"; + +/** + * Request body for toggling a report schedule. + */ +export class ReportScheduleToggleRequest { + /** + * The JSON:API data object for a report schedule toggle request. + */ + "data": ReportScheduleToggleRequestData; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "ReportScheduleToggleRequestData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleToggleRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleToggleRequestAttributes.ts b/services/report_schedules/src/v2/models/ReportScheduleToggleRequestAttributes.ts new file mode 100644 index 000000000000..a3066b25402b --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleToggleRequestAttributes.ts @@ -0,0 +1,47 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleStatus } from "./ReportScheduleStatus"; + +/** + * The status to set on the report schedule. + */ +export class ReportScheduleToggleRequestAttributes { + /** + * Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + */ + "status": ReportScheduleStatus; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + status: { + baseName: "status", + type: "ReportScheduleStatus", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleToggleRequestAttributes.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/ReportScheduleToggleRequestData.ts b/services/report_schedules/src/v2/models/ReportScheduleToggleRequestData.ts new file mode 100644 index 000000000000..c2fafa27d11e --- /dev/null +++ b/services/report_schedules/src/v2/models/ReportScheduleToggleRequestData.ts @@ -0,0 +1,57 @@ +import { AttributeTypeMap } from "@datadog/datadog-api-client"; + +import { ReportScheduleToggleRequestAttributes } from "./ReportScheduleToggleRequestAttributes"; +import { ReportScheduleType } from "./ReportScheduleType"; + +/** + * The JSON:API data object for a report schedule toggle request. + */ +export class ReportScheduleToggleRequestData { + /** + * The status to set on the report schedule. + */ + "attributes": ReportScheduleToggleRequestAttributes; + /** + * JSON:API resource type for report schedules. + */ + "type": ReportScheduleType; + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "ReportScheduleToggleRequestAttributes", + required: true, + }, + type: { + baseName: "type", + type: "ReportScheduleType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ReportScheduleToggleRequestData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/services/report_schedules/src/v2/models/TypingInfo.ts b/services/report_schedules/src/v2/models/TypingInfo.ts index 4ea1b7cbc3ad..4534d33b4124 100644 --- a/services/report_schedules/src/v2/models/TypingInfo.ts +++ b/services/report_schedules/src/v2/models/TypingInfo.ts @@ -11,19 +11,36 @@ import { ReportScheduleAuthorRelationshipData } from "./ReportScheduleAuthorRela import { ReportScheduleCreateRequest } from "./ReportScheduleCreateRequest"; import { ReportScheduleCreateRequestAttributes } from "./ReportScheduleCreateRequestAttributes"; import { ReportScheduleCreateRequestData } from "./ReportScheduleCreateRequestData"; +import { ReportScheduleIndexTemplateVariable } from "./ReportScheduleIndexTemplateVariable"; +import { ReportScheduleListResourceRelationship } from "./ReportScheduleListResourceRelationship"; +import { ReportScheduleListResourceRelationshipData } from "./ReportScheduleListResourceRelationshipData"; +import { ReportScheduleListResponse } from "./ReportScheduleListResponse"; +import { ReportScheduleListResponseAttributes } from "./ReportScheduleListResponseAttributes"; +import { ReportScheduleListResponseData } from "./ReportScheduleListResponseData"; +import { ReportScheduleListResponseLinks } from "./ReportScheduleListResponseLinks"; +import { ReportScheduleListResponseMeta } from "./ReportScheduleListResponseMeta"; +import { ReportScheduleListResponsePagination } from "./ReportScheduleListResponsePagination"; +import { ReportScheduleListResponseRelationships } from "./ReportScheduleListResponseRelationships"; import { ReportSchedulePatchRequest } from "./ReportSchedulePatchRequest"; import { ReportSchedulePatchRequestAttributes } from "./ReportSchedulePatchRequestAttributes"; import { ReportSchedulePatchRequestData } from "./ReportSchedulePatchRequestData"; +import { ReportScheduleResource } from "./ReportScheduleResource"; +import { ReportScheduleResourceAttributes } from "./ReportScheduleResourceAttributes"; import { ReportScheduleResponse } from "./ReportScheduleResponse"; import { ReportScheduleResponseAttributes } from "./ReportScheduleResponseAttributes"; import { ReportScheduleResponseData } from "./ReportScheduleResponseData"; import { ReportScheduleResponseRelationships } from "./ReportScheduleResponseRelationships"; import { ReportScheduleTemplateVariable } from "./ReportScheduleTemplateVariable"; +import { ReportScheduleToggleRequest } from "./ReportScheduleToggleRequest"; +import { ReportScheduleToggleRequestAttributes } from "./ReportScheduleToggleRequestAttributes"; +import { ReportScheduleToggleRequestData } from "./ReportScheduleToggleRequestData"; export const TypingInfo: ModelTypingInfo = { enumsMap: { ReportScheduleAuthorType: ["users"], ReportScheduleDeliveryFormat: ["pdf", "png", "pdf_and_png"], + ReportScheduleIncludedResourceType: ["resource"], + ReportScheduleListResponsePaginationType: ["offset_limit"], ReportScheduleResourceType: ["dashboard", "integration_dashboard"], ReportScheduleResponseAttributesDeliveryFormat: [ "pdf", @@ -34,7 +51,10 @@ export const TypingInfo: ModelTypingInfo = { ReportScheduleType: ["schedule"], }, oneOfMap: { - ReportScheduleIncludedResource: ["ReportScheduleAuthor"], + ReportScheduleIncludedResource: [ + "ReportScheduleAuthor", + "ReportScheduleResource", + ], }, typeMap: { APIErrorResponse: APIErrorResponse, @@ -49,13 +69,32 @@ export const TypingInfo: ModelTypingInfo = { ReportScheduleCreateRequestAttributes: ReportScheduleCreateRequestAttributes, ReportScheduleCreateRequestData: ReportScheduleCreateRequestData, + ReportScheduleIndexTemplateVariable: ReportScheduleIndexTemplateVariable, + ReportScheduleListResourceRelationship: + ReportScheduleListResourceRelationship, + ReportScheduleListResourceRelationshipData: + ReportScheduleListResourceRelationshipData, + ReportScheduleListResponse: ReportScheduleListResponse, + ReportScheduleListResponseAttributes: ReportScheduleListResponseAttributes, + ReportScheduleListResponseData: ReportScheduleListResponseData, + ReportScheduleListResponseLinks: ReportScheduleListResponseLinks, + ReportScheduleListResponseMeta: ReportScheduleListResponseMeta, + ReportScheduleListResponsePagination: ReportScheduleListResponsePagination, + ReportScheduleListResponseRelationships: + ReportScheduleListResponseRelationships, ReportSchedulePatchRequest: ReportSchedulePatchRequest, ReportSchedulePatchRequestAttributes: ReportSchedulePatchRequestAttributes, ReportSchedulePatchRequestData: ReportSchedulePatchRequestData, + ReportScheduleResource: ReportScheduleResource, + ReportScheduleResourceAttributes: ReportScheduleResourceAttributes, ReportScheduleResponse: ReportScheduleResponse, ReportScheduleResponseAttributes: ReportScheduleResponseAttributes, ReportScheduleResponseData: ReportScheduleResponseData, ReportScheduleResponseRelationships: ReportScheduleResponseRelationships, ReportScheduleTemplateVariable: ReportScheduleTemplateVariable, + ReportScheduleToggleRequest: ReportScheduleToggleRequest, + ReportScheduleToggleRequestAttributes: + ReportScheduleToggleRequestAttributes, + ReportScheduleToggleRequestData: ReportScheduleToggleRequestData, }, };