diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 85c263148490..0864381d8655 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -71644,6 +71644,390 @@ components: type: string x-enum-varnames: - RULESET + ReportScheduleAuthor: + description: A user included as a related JSON:API resource. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleAuthorAttributes" + id: + description: The user UUID. + example: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: string + type: + $ref: "#/components/schemas/ReportScheduleAuthorType" + required: + - type + - id + - attributes + type: object + ReportScheduleAuthorAttributes: + description: Attributes of the report author. + properties: + email: + description: The email address of the report author, or `null` if unavailable. + example: "user@example.com" + nullable: true + type: string + name: + description: The display name of the report author, or `null` if unavailable. + example: "Example User" + nullable: true + type: string + required: + - name + - email + type: object + ReportScheduleAuthorType: + description: JSON:API resource type for the included report author. + enum: + - users + example: users + type: string + x-enum-varnames: + - USERS + ReportScheduleCreateRequest: + description: Request body for creating a report schedule. + properties: + data: + $ref: "#/components/schemas/ReportScheduleCreateRequestData" + required: + - data + type: object + ReportScheduleCreateRequestAttributes: + description: The configuration of the report schedule to create. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleDeliveryFormat" + description: + description: A description of the report, up to 4096 characters. + example: "Weekly summary of infrastructure health." + type: string + recipients: + description: |- + The recipients of the report. Each entry is an email address, a Slack channel + reference in the form `slack:{team_id}.{channel_id}.{channel_name}`, or a Microsoft + Teams channel reference in the form `teams:{tenant_id}|{team_id}|{channel_id}`. + 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 dashboard or integration dashboard to render 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 + tab_id: + description: The identifier of the dashboard tab to render, when the dashboard has tabs. + example: "66666666-7777-8888-9999-000000000000" + type: string + 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 to include in the report (for example, `1w`). + example: "1w" + 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, between 1 and 78 characters. + example: "Weekly Infrastructure Report" + type: string + required: + - resource_id + - resource_type + - recipients + - rrule + - timezone + - template_variables + - title + - description + type: object + ReportScheduleCreateRequestData: + description: The JSON:API data object for a report schedule creation request. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleCreateRequestAttributes" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - type + - attributes + type: object + ReportScheduleDeliveryFormat: + description: |- + How a PDF-export report is delivered. `pdf` attaches a PDF file, `png` embeds + an inline PNG image, and `pdf_and_png` delivers both. + enum: + - pdf + - png + - pdf_and_png + example: pdf + type: string + x-enum-varnames: + - PDF + - PNG + - PDF_AND_PNG + ReportScheduleIncludedResource: + description: A related resource included with a report schedule. + oneOf: + - $ref: "#/components/schemas/ReportScheduleAuthor" + ReportSchedulePatchRequest: + description: Request body for updating a report schedule. + properties: + data: + $ref: "#/components/schemas/ReportSchedulePatchRequestData" + required: + - data + type: object + ReportSchedulePatchRequestAttributes: + description: |- + The updated configuration of the report schedule. These values replace the existing + ones; the targeted resource (`resource_id` and `resource_type`) cannot be changed. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleDeliveryFormat" + description: + description: A description of the report, up to 4096 characters. + example: "Updated weekly summary of infrastructure health." + maxLength: 4096 + type: string + recipients: + description: |- + The recipients of the report. Each entry is an email address, a Slack channel + reference in the form `slack:{team_id}.{channel_id}.{channel_name}`, or a Microsoft + Teams channel reference in the form `teams:{tenant_id}|{team_id}|{channel_id}`. + 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 + 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 + tab_id: + description: The identifier of the dashboard tab to render, when the dashboard has tabs. + example: "66666666-7777-8888-9999-000000000000" + format: uuid + type: string + 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 to include in the report (for example, `1w`). + example: "1w" + 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, between 1 and 78 characters. + example: "Weekly Infrastructure Report" + maxLength: 78 + minLength: 1 + type: string + required: + - recipients + - rrule + - timezone + - template_variables + - title + - description + type: object + ReportSchedulePatchRequestData: + description: The JSON:API data object for a report schedule update request. + properties: + attributes: + $ref: "#/components/schemas/ReportSchedulePatchRequestAttributes" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - type + - attributes + type: object + ReportScheduleResourceType: + description: The type of dashboard resource the report schedule targets. + enum: + - dashboard + - integration_dashboard + example: dashboard + type: string + x-enum-varnames: + - DASHBOARD + - INTEGRATION_DASHBOARD + ReportScheduleResponse: + description: Response containing a single report schedule. + properties: + data: + $ref: "#/components/schemas/ReportScheduleResponseData" + included: + description: Related resources included with the report schedule, such as the author. + items: + $ref: "#/components/schemas/ReportScheduleIncludedResource" + type: array + required: + - data + type: object + ReportScheduleResponseAttributes: + description: The configuration and derived state of a report schedule. + 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: "FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + type: string + status: + $ref: "#/components/schemas/ReportScheduleStatus" + tab_id: + description: The identifier of the dashboard tab rendered in the report, or `null` if not set. + example: "66666666-7777-8888-9999-000000000000" + nullable: true + type: string + 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 + - tab_id + type: object + ReportScheduleResponseAttributesDeliveryFormat: + description: The delivery format for dashboard report schedules, or `null` if not set. + enum: + - pdf + - png + - pdf_and_png + example: pdf + nullable: true + type: string + x-enum-varnames: + - PDF + - PNG + - PDF_AND_PNG + ReportScheduleResponseData: + description: The JSON:API data object representing a report schedule. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleResponseAttributes" + id: + description: The unique identifier of the report schedule. + example: "11111111-2222-3333-4444-555555555555" + type: string + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - id + - type + - attributes + type: object + ReportScheduleStatus: + description: Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + enum: + - active + - inactive + example: active + type: string + x-enum-varnames: + - ACTIVE + - INACTIVE + ReportScheduleTemplateVariable: + description: A dashboard template variable applied when rendering the report. + properties: + name: + description: The name of the template variable. + example: env + type: string + values: + description: The selected values for the template variable. + example: + - "prod" + items: + description: A single selected template variable value. + type: string + type: array + required: + - name + - values + type: object + ReportScheduleType: + description: JSON:API resource type for report schedules. + enum: + - schedule + example: schedule + type: string + x-enum-varnames: + - SCHEDULE ResolveVulnerableSymbolsRequest: description: The top-level request object for resolving vulnerable symbols in a set of packages. properties: @@ -151082,6 +151466,211 @@ paths: summary: Update replay heatmap snapshot tags: - Rum Replay Heatmaps + /api/v2/reporting/schedule: + post: + description: |- + Create a new scheduled report. A schedule renders a dashboard or integration dashboard + on a recurring cadence and delivers it to the configured recipients over email, Slack, + or Microsoft Teams. + Requires the `generate_dashboard_reports` permission. + operationId: CreateReportSchedule + requestBody: + content: + application/json: + examples: + default: + 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" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + type: schedule + schema: + $ref: "#/components/schemas/ReportScheduleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + 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" + 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: CREATED + "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: Create a report schedule + tags: + - Report Schedules + x-codegen-request-body-name: body + /api/v2/reporting/schedule/{schedule_uuid}: + patch: + description: |- + Update an existing scheduled report by its identifier. The editable attributes + are replaced with the supplied values; the targeted resource (`resource_id` and + `resource_type`) cannot be changed after creation. + Requires the `generate_dashboard_reports` permission and schedule ownership. + operationId: PatchReportSchedule + parameters: + - description: The unique identifier of the report schedule to update. + 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: + 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" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + type: schedule + schema: + $ref: "#/components/schemas/ReportSchedulePatchRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Updated weekly summary of infrastructure health." + next_recurrence: 1780923600000 + 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" + 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: Update 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. @@ -178829,6 +179418,11 @@ tags: name: RUM Retention Filters Hardcoded - description: View and manage Reference Tables in your organization. name: Reference Tables + - description: |- + Create and manage scheduled reports. A scheduled report renders a dashboard or integration + dashboard on a recurring cadence and delivers it to a set of recipients over email, Slack, + or Microsoft Teams. + name: Report Schedules - description: |- A restriction policy defines the access control rules for a resource, mapping a set of relations (such as editor and viewer) to a set of allowed principals (such as roles, teams, or users). diff --git a/examples/v2/report-schedules/CreateReportSchedule.rb b/examples/v2/report-schedules/CreateReportSchedule.rb new file mode 100644 index 000000000000..bfc77deb0850 --- /dev/null +++ b/examples/v2/report-schedules/CreateReportSchedule.rb @@ -0,0 +1,35 @@ +# Create a report schedule returns "CREATED" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new + +body = DatadogAPIClient::V2::ReportScheduleCreateRequest.new({ + data: DatadogAPIClient::V2::ReportScheduleCreateRequestData.new({ + attributes: DatadogAPIClient::V2::ReportScheduleCreateRequestAttributes.new({ + delivery_format: DatadogAPIClient::V2::ReportScheduleDeliveryFormat::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: DatadogAPIClient::V2::ReportScheduleResourceType::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: [ + DatadogAPIClient::V2::ReportScheduleTemplateVariable.new({ + name: "env", + values: [ + "prod", + ], + }), + ], + timeframe: "1w", + timezone: "America/New_York", + title: "Weekly Infrastructure Report", + }), + type: DatadogAPIClient::V2::ReportScheduleType::SCHEDULE, + }), +}) +p api_instance.create_report_schedule(body) diff --git a/examples/v2/report-schedules/PatchReportSchedule.rb b/examples/v2/report-schedules/PatchReportSchedule.rb new file mode 100644 index 000000000000..8cae07995a4a --- /dev/null +++ b/examples/v2/report-schedules/PatchReportSchedule.rb @@ -0,0 +1,33 @@ +# Update a report schedule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new + +body = DatadogAPIClient::V2::ReportSchedulePatchRequest.new({ + data: DatadogAPIClient::V2::ReportSchedulePatchRequestData.new({ + attributes: DatadogAPIClient::V2::ReportSchedulePatchRequestAttributes.new({ + delivery_format: DatadogAPIClient::V2::ReportScheduleDeliveryFormat::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: [ + DatadogAPIClient::V2::ReportScheduleTemplateVariable.new({ + name: "env", + values: [ + "prod", + ], + }), + ], + timeframe: "1w", + timezone: "America/New_York", + title: "Weekly Infrastructure Report", + }), + type: DatadogAPIClient::V2::ReportScheduleType::SCHEDULE, + }), +}) +p api_instance.patch_report_schedule("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 403725296b92..7dd56f46774b 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4546,6 +4546,13 @@ "snapshot_id" => "String", "body" => "SnapshotUpdateRequest", }, + "v2.CreateReportSchedule" => { + "body" => "ReportScheduleCreateRequest", + }, + "v2.PatchReportSchedule" => { + "schedule_uuid" => "UUID", + "body" => "ReportSchedulePatchRequest", + }, "v2.DeleteRestrictionPolicy" => { "resource_id" => "String", }, diff --git a/features/v2/report_schedules.feature b/features/v2/report_schedules.feature new file mode 100644 index 000000000000..7f77c0ec9f88 --- /dev/null +++ b/features/v2/report_schedules.feature @@ -0,0 +1,55 @@ +@endpoint(report-schedules) @endpoint(report-schedules-v2) +Feature: Report Schedules + Create and manage scheduled reports. A scheduled report renders a + dashboard or integration dashboard on a recurring cadence and delivers it + to a set of recipients over email, Slack, or Microsoft Teams. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ReportSchedules" API + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a report schedule returns "Bad Request" response + Given 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": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a report schedule returns "CREATED" response + Given 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": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a report schedule returns "Not Found" response + Given 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": "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: Update a report schedule returns "Bad Request" response + Given 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": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a report schedule returns "Not Found" response + Given 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": "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: Update a report schedule returns "OK" response + Given 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": "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 a2ff6ce184cb..00dd85fb2cd5 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -5913,6 +5913,19 @@ "type": "idempotent" } }, + "CreateReportSchedule": { + "tag": "Report Schedules", + "undo": { + "type": "unsafe" + } + }, + "PatchReportSchedule": { + "tag": "Report Schedules", + "undo": { + "operationId": "PatchReportSchedule", + "type": "idempotent" + } + }, "DeleteRestrictionPolicy": { "tag": "Restriction Policies", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index c1dbc42206b8..0fa0a8593cd3 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5449,6 +5449,25 @@ def overrides "v2.reorder_ruleset_resource_array" => "ReorderRulesetResourceArray", "v2.reorder_ruleset_resource_data" => "ReorderRulesetResourceData", "v2.reorder_ruleset_resource_data_type" => "ReorderRulesetResourceDataType", + "v2.report_schedule_author" => "ReportScheduleAuthor", + "v2.report_schedule_author_attributes" => "ReportScheduleAuthorAttributes", + "v2.report_schedule_author_type" => "ReportScheduleAuthorType", + "v2.report_schedule_create_request" => "ReportScheduleCreateRequest", + "v2.report_schedule_create_request_attributes" => "ReportScheduleCreateRequestAttributes", + "v2.report_schedule_create_request_data" => "ReportScheduleCreateRequestData", + "v2.report_schedule_delivery_format" => "ReportScheduleDeliveryFormat", + "v2.report_schedule_included_resource" => "ReportScheduleIncludedResource", + "v2.report_schedule_patch_request" => "ReportSchedulePatchRequest", + "v2.report_schedule_patch_request_attributes" => "ReportSchedulePatchRequestAttributes", + "v2.report_schedule_patch_request_data" => "ReportSchedulePatchRequestData", + "v2.report_schedule_resource_type" => "ReportScheduleResourceType", + "v2.report_schedule_response" => "ReportScheduleResponse", + "v2.report_schedule_response_attributes" => "ReportScheduleResponseAttributes", + "v2.report_schedule_response_attributes_delivery_format" => "ReportScheduleResponseAttributesDeliveryFormat", + "v2.report_schedule_response_data" => "ReportScheduleResponseData", + "v2.report_schedule_status" => "ReportScheduleStatus", + "v2.report_schedule_template_variable" => "ReportScheduleTemplateVariable", + "v2.report_schedule_type" => "ReportScheduleType", "v2.resolve_vulnerable_symbols_request" => "ResolveVulnerableSymbolsRequest", "v2.resolve_vulnerable_symbols_request_data" => "ResolveVulnerableSymbolsRequestData", "v2.resolve_vulnerable_symbols_request_data_attributes" => "ResolveVulnerableSymbolsRequestDataAttributes", @@ -7450,6 +7469,7 @@ def overrides "v2.processes_api" => "ProcessesAPI", "v2.product_analytics_api" => "ProductAnalyticsAPI", "v2.reference_tables_api" => "ReferenceTablesAPI", + "v2.report_schedules_api" => "ReportSchedulesAPI", "v2.restriction_policies_api" => "RestrictionPoliciesAPI", "v2.roles_api" => "RolesAPI", "v2.rum_api" => "RUMAPI", diff --git a/lib/datadog_api_client/v2/api/report_schedules_api.rb b/lib/datadog_api_client/v2/api/report_schedules_api.rb new file mode 100644 index 000000000000..c2fe60668a58 --- /dev/null +++ b/lib/datadog_api_client/v2/api/report_schedules_api.rb @@ -0,0 +1,171 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'cgi' + +module DatadogAPIClient::V2 + class ReportSchedulesAPI + attr_accessor :api_client + + def initialize(api_client = DatadogAPIClient::APIClient.default) + @api_client = api_client + end + + # Create a report schedule. + # + # @see #create_report_schedule_with_http_info + def create_report_schedule(body, opts = {}) + data, _status_code, _headers = create_report_schedule_with_http_info(body, opts) + data + end + + # Create a report schedule. + # + # Create a new scheduled report. A schedule renders a dashboard or integration dashboard + # on a recurring cadence and delivers it to the configured recipients over email, Slack, + # or Microsoft Teams. + # Requires the `generate_dashboard_reports` permission. + # + # @param body [ReportScheduleCreateRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(ReportScheduleResponse, Integer, Hash)>] ReportScheduleResponse data, response status code and response headers + def create_report_schedule_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReportSchedulesAPI.create_report_schedule ...' + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ReportSchedulesAPI.create_report_schedule" + end + # resource path + local_var_path = '/api/v2/reporting/schedule' + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ReportScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_report_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReportSchedulesAPI#create_report_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Update a report schedule. + # + # @see #patch_report_schedule_with_http_info + def patch_report_schedule(schedule_uuid, body, opts = {}) + data, _status_code, _headers = patch_report_schedule_with_http_info(schedule_uuid, body, opts) + data + end + + # Update a report schedule. + # + # Update an existing scheduled report by its identifier. The editable attributes + # are replaced with the supplied values; the targeted resource (`resource_id` and + # `resource_type`) cannot be changed after creation. + # Requires the `generate_dashboard_reports` permission and schedule ownership. + # + # @param schedule_uuid [UUID] The unique identifier of the report schedule to update. + # @param body [ReportSchedulePatchRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(ReportScheduleResponse, Integer, Hash)>] ReportScheduleResponse data, response status code and response headers + def patch_report_schedule_with_http_info(schedule_uuid, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReportSchedulesAPI.patch_report_schedule ...' + end + # verify the required parameter 'schedule_uuid' is set + if @api_client.config.client_side_validation && schedule_uuid.nil? + fail ArgumentError, "Missing the required parameter 'schedule_uuid' when calling ReportSchedulesAPI.patch_report_schedule" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ReportSchedulesAPI.patch_report_schedule" + end + # resource path + local_var_path = '/api/v2/reporting/schedule/{schedule_uuid}'.sub('{schedule_uuid}', CGI.escape(schedule_uuid.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ReportScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :patch_report_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReportSchedulesAPI#patch_report_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_author.rb b/lib/datadog_api_client/v2/models/report_schedule_author.rb new file mode 100644 index 000000000000..506f21f2fb39 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_author.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A user included as a related JSON:API resource. + class ReportScheduleAuthor + include BaseGenericModel + + # Attributes of the report author. + attr_reader :attributes + + # The user UUID. + attr_reader :id + + # JSON:API resource type for the included report author. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ReportScheduleAuthorAttributes', + :'id' => :'String', + :'type' => :'ReportScheduleAuthorType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleAuthor` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_author_attributes.rb b/lib/datadog_api_client/v2/models/report_schedule_author_attributes.rb new file mode 100644 index 000000000000..c1bec047237f --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_author_attributes.rb @@ -0,0 +1,124 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of the report author. + class ReportScheduleAuthorAttributes + include BaseGenericModel + + # The email address of the report author, or `null` if unavailable. + attr_accessor :email + + # The display name of the report author, or `null` if unavailable. + attr_accessor :name + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'email' => :'email', + :'name' => :'name' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'email' => :'String', + :'name' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'email', + :'name', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleAuthorAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'email') + self.email = attributes[:'email'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + email == o.email && + name == o.name && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [email, name, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_author_type.rb b/lib/datadog_api_client/v2/models/report_schedule_author_type.rb new file mode 100644 index 000000000000..e20673b70ade --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_author_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for the included report author. + class ReportScheduleAuthorType + include BaseEnumModel + + USERS = "users".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_create_request.rb b/lib/datadog_api_client/v2/models/report_schedule_create_request.rb new file mode 100644 index 000000000000..e15661d53219 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_create_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for creating a report schedule. + class ReportScheduleCreateRequest + include BaseGenericModel + + # The JSON:API data object for a report schedule creation request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ReportScheduleCreateRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleCreateRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_create_request_attributes.rb b/lib/datadog_api_client/v2/models/report_schedule_create_request_attributes.rb new file mode 100644 index 000000000000..4b18de1ff1c7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_create_request_attributes.rb @@ -0,0 +1,307 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The configuration of the report schedule to create. + class ReportScheduleCreateRequestAttributes + include BaseGenericModel + + # How a PDF-export report is delivered. `pdf` attaches a PDF file, `png` embeds + # an inline PNG image, and `pdf_and_png` delivers both. + attr_accessor :delivery_format + + # A description of the report, up to 4096 characters. + attr_reader :description + + # The recipients of the report. Each entry is an email address, a Slack channel + # reference in the form `slack:{team_id}.{channel_id}.{channel_name}`, or a Microsoft + # Teams channel reference in the form `teams:{tenant_id}|{team_id}|{channel_id}`. + attr_reader :recipients + + # The identifier of the dashboard or integration dashboard to render in the report. + attr_reader :resource_id + + # The type of dashboard resource the report schedule targets. + attr_reader :resource_type + + # The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + attr_reader :rrule + + # The identifier of the dashboard tab to render, when the dashboard has tabs. + attr_accessor :tab_id + + # The dashboard template variables applied when rendering the report. + attr_reader :template_variables + + # The relative timeframe of data to include in the report (for example, `1w`). + attr_accessor :timeframe + + # The IANA time zone identifier the recurrence rule is evaluated in. + attr_reader :timezone + + # The title of the report, between 1 and 78 characters. + attr_reader :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'delivery_format' => :'delivery_format', + :'description' => :'description', + :'recipients' => :'recipients', + :'resource_id' => :'resource_id', + :'resource_type' => :'resource_type', + :'rrule' => :'rrule', + :'tab_id' => :'tab_id', + :'template_variables' => :'template_variables', + :'timeframe' => :'timeframe', + :'timezone' => :'timezone', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'delivery_format' => :'ReportScheduleDeliveryFormat', + :'description' => :'String', + :'recipients' => :'Array', + :'resource_id' => :'String', + :'resource_type' => :'ReportScheduleResourceType', + :'rrule' => :'String', + :'tab_id' => :'String', + :'template_variables' => :'Array', + :'timeframe' => :'String', + :'timezone' => :'String', + :'title' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleCreateRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'delivery_format') + self.delivery_format = attributes[:'delivery_format'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'recipients') + if (value = attributes[:'recipients']).is_a?(Array) + self.recipients = value + end + end + + if attributes.key?(:'resource_id') + self.resource_id = attributes[:'resource_id'] + end + + if attributes.key?(:'resource_type') + self.resource_type = attributes[:'resource_type'] + end + + if attributes.key?(:'rrule') + self.rrule = attributes[:'rrule'] + end + + if attributes.key?(:'tab_id') + self.tab_id = attributes[:'tab_id'] + end + + if attributes.key?(:'template_variables') + if (value = attributes[:'template_variables']).is_a?(Array) + self.template_variables = value + end + end + + if attributes.key?(:'timeframe') + self.timeframe = attributes[:'timeframe'] + end + + if attributes.key?(:'timezone') + self.timezone = attributes[:'timezone'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @description.nil? + return false if @recipients.nil? + return false if @resource_id.nil? + return false if @resource_type.nil? + return false if @rrule.nil? + return false if @template_variables.nil? + return false if @timezone.nil? + return false if @title.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param recipients [Object] Object to be assigned + # @!visibility private + def recipients=(recipients) + if recipients.nil? + fail ArgumentError, 'invalid value for "recipients", recipients cannot be nil.' + end + @recipients = recipients + end + + # Custom attribute writer method with validation + # @param resource_id [Object] Object to be assigned + # @!visibility private + def resource_id=(resource_id) + if resource_id.nil? + fail ArgumentError, 'invalid value for "resource_id", resource_id cannot be nil.' + end + @resource_id = resource_id + end + + # Custom attribute writer method with validation + # @param resource_type [Object] Object to be assigned + # @!visibility private + def resource_type=(resource_type) + if resource_type.nil? + fail ArgumentError, 'invalid value for "resource_type", resource_type cannot be nil.' + end + @resource_type = resource_type + end + + # Custom attribute writer method with validation + # @param rrule [Object] Object to be assigned + # @!visibility private + def rrule=(rrule) + if rrule.nil? + fail ArgumentError, 'invalid value for "rrule", rrule cannot be nil.' + end + @rrule = rrule + end + + # Custom attribute writer method with validation + # @param template_variables [Object] Object to be assigned + # @!visibility private + def template_variables=(template_variables) + if template_variables.nil? + fail ArgumentError, 'invalid value for "template_variables", template_variables cannot be nil.' + end + @template_variables = template_variables + end + + # Custom attribute writer method with validation + # @param timezone [Object] Object to be assigned + # @!visibility private + def timezone=(timezone) + if timezone.nil? + fail ArgumentError, 'invalid value for "timezone", timezone cannot be nil.' + end + @timezone = timezone + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if title.nil? + fail ArgumentError, 'invalid value for "title", title cannot be nil.' + end + @title = title + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + delivery_format == o.delivery_format && + description == o.description && + recipients == o.recipients && + resource_id == o.resource_id && + resource_type == o.resource_type && + rrule == o.rrule && + tab_id == o.tab_id && + template_variables == o.template_variables && + timeframe == o.timeframe && + timezone == o.timezone && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [delivery_format, description, recipients, resource_id, resource_type, rrule, tab_id, template_variables, timeframe, timezone, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_create_request_data.rb b/lib/datadog_api_client/v2/models/report_schedule_create_request_data.rb new file mode 100644 index 000000000000..acd1af217961 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_create_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API data object for a report schedule creation request. + class ReportScheduleCreateRequestData + include BaseGenericModel + + # The configuration of the report schedule to create. + attr_reader :attributes + + # JSON:API resource type for report schedules. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ReportScheduleCreateRequestAttributes', + :'type' => :'ReportScheduleType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleCreateRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_delivery_format.rb b/lib/datadog_api_client/v2/models/report_schedule_delivery_format.rb new file mode 100644 index 000000000000..b0eb4442a3de --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_delivery_format.rb @@ -0,0 +1,29 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # How a PDF-export report is delivered. `pdf` attaches a PDF file, `png` embeds + # an inline PNG image, and `pdf_and_png` delivers both. + class ReportScheduleDeliveryFormat + include BaseEnumModel + + PDF = "pdf".freeze + PNG = "png".freeze + PDF_AND_PNG = "pdf_and_png".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_included_resource.rb b/lib/datadog_api_client/v2/models/report_schedule_included_resource.rb new file mode 100644 index 000000000000..ade3a9f469a0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_included_resource.rb @@ -0,0 +1,62 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A related resource included with a report schedule. + module ReportScheduleIncludedResource + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'ReportScheduleAuthor' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_patch_request.rb b/lib/datadog_api_client/v2/models/report_schedule_patch_request.rb new file mode 100644 index 000000000000..91612c884c18 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_patch_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for updating a report schedule. + class ReportSchedulePatchRequest + include BaseGenericModel + + # The JSON:API data object for a report schedule update request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ReportSchedulePatchRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportSchedulePatchRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_patch_request_attributes.rb b/lib/datadog_api_client/v2/models/report_schedule_patch_request_attributes.rb new file mode 100644 index 000000000000..ce5a4aac676c --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_patch_request_attributes.rb @@ -0,0 +1,278 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The updated configuration of the report schedule. These values replace the existing + # ones; the targeted resource (`resource_id` and `resource_type`) cannot be changed. + class ReportSchedulePatchRequestAttributes + include BaseGenericModel + + # How a PDF-export report is delivered. `pdf` attaches a PDF file, `png` embeds + # an inline PNG image, and `pdf_and_png` delivers both. + attr_accessor :delivery_format + + # A description of the report, up to 4096 characters. + attr_reader :description + + # The recipients of the report. Each entry is an email address, a Slack channel + # reference in the form `slack:{team_id}.{channel_id}.{channel_name}`, or a Microsoft + # Teams channel reference in the form `teams:{tenant_id}|{team_id}|{channel_id}`. + attr_reader :recipients + + # The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + attr_reader :rrule + + # The identifier of the dashboard tab to render, when the dashboard has tabs. + attr_accessor :tab_id + + # The dashboard template variables applied when rendering the report. + attr_reader :template_variables + + # The relative timeframe of data to include in the report (for example, `1w`). + attr_accessor :timeframe + + # The IANA time zone identifier the recurrence rule is evaluated in. + attr_reader :timezone + + # The title of the report, between 1 and 78 characters. + attr_reader :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'delivery_format' => :'delivery_format', + :'description' => :'description', + :'recipients' => :'recipients', + :'rrule' => :'rrule', + :'tab_id' => :'tab_id', + :'template_variables' => :'template_variables', + :'timeframe' => :'timeframe', + :'timezone' => :'timezone', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'delivery_format' => :'ReportScheduleDeliveryFormat', + :'description' => :'String', + :'recipients' => :'Array', + :'rrule' => :'String', + :'tab_id' => :'UUID', + :'template_variables' => :'Array', + :'timeframe' => :'String', + :'timezone' => :'String', + :'title' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportSchedulePatchRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'delivery_format') + self.delivery_format = attributes[:'delivery_format'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'recipients') + if (value = attributes[:'recipients']).is_a?(Array) + self.recipients = value + end + end + + if attributes.key?(:'rrule') + self.rrule = attributes[:'rrule'] + end + + if attributes.key?(:'tab_id') + self.tab_id = attributes[:'tab_id'] + end + + if attributes.key?(:'template_variables') + if (value = attributes[:'template_variables']).is_a?(Array) + self.template_variables = value + end + end + + if attributes.key?(:'timeframe') + self.timeframe = attributes[:'timeframe'] + end + + if attributes.key?(:'timezone') + self.timezone = attributes[:'timezone'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @description.nil? + return false if @description.to_s.length > 4096 + return false if @recipients.nil? + return false if @rrule.nil? + return false if @template_variables.nil? + return false if @timezone.nil? + return false if @title.nil? + return false if @title.to_s.length > 78 + return false if @title.to_s.length < 1 + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + if description.to_s.length > 4096 + fail ArgumentError, 'invalid value for "description", the character length must be smaller than or equal to 4096.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param recipients [Object] Object to be assigned + # @!visibility private + def recipients=(recipients) + if recipients.nil? + fail ArgumentError, 'invalid value for "recipients", recipients cannot be nil.' + end + @recipients = recipients + end + + # Custom attribute writer method with validation + # @param rrule [Object] Object to be assigned + # @!visibility private + def rrule=(rrule) + if rrule.nil? + fail ArgumentError, 'invalid value for "rrule", rrule cannot be nil.' + end + @rrule = rrule + end + + # Custom attribute writer method with validation + # @param template_variables [Object] Object to be assigned + # @!visibility private + def template_variables=(template_variables) + if template_variables.nil? + fail ArgumentError, 'invalid value for "template_variables", template_variables cannot be nil.' + end + @template_variables = template_variables + end + + # Custom attribute writer method with validation + # @param timezone [Object] Object to be assigned + # @!visibility private + def timezone=(timezone) + if timezone.nil? + fail ArgumentError, 'invalid value for "timezone", timezone cannot be nil.' + end + @timezone = timezone + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if title.nil? + fail ArgumentError, 'invalid value for "title", title cannot be nil.' + end + if title.to_s.length > 78 + fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 78.' + end + if title.to_s.length < 1 + fail ArgumentError, 'invalid value for "title", the character length must be great than or equal to 1.' + end + @title = title + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + delivery_format == o.delivery_format && + description == o.description && + recipients == o.recipients && + rrule == o.rrule && + tab_id == o.tab_id && + template_variables == o.template_variables && + timeframe == o.timeframe && + timezone == o.timezone && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [delivery_format, description, recipients, rrule, tab_id, template_variables, timeframe, timezone, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_patch_request_data.rb b/lib/datadog_api_client/v2/models/report_schedule_patch_request_data.rb new file mode 100644 index 000000000000..c61a86d4b65d --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_patch_request_data.rb @@ -0,0 +1,145 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API data object for a report schedule update request. + class ReportSchedulePatchRequestData + include BaseGenericModel + + # The updated configuration of the report schedule. These values replace the existing + # ones; the targeted resource (`resource_id` and `resource_type`) cannot be changed. + attr_reader :attributes + + # JSON:API resource type for report schedules. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ReportSchedulePatchRequestAttributes', + :'type' => :'ReportScheduleType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportSchedulePatchRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_resource_type.rb b/lib/datadog_api_client/v2/models/report_schedule_resource_type.rb new file mode 100644 index 000000000000..34a7a67eef85 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_resource_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of dashboard resource the report schedule targets. + class ReportScheduleResourceType + include BaseEnumModel + + DASHBOARD = "dashboard".freeze + INTEGRATION_DASHBOARD = "integration_dashboard".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_response.rb b/lib/datadog_api_client/v2/models/report_schedule_response.rb new file mode 100644 index 000000000000..c79332c68f13 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_response.rb @@ -0,0 +1,135 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a single report schedule. + class ReportScheduleResponse + include BaseGenericModel + + # The JSON:API data object representing a report schedule. + attr_reader :data + + # Related resources included with the report schedule, such as the author. + attr_accessor :included + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ReportScheduleResponseData', + :'included' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_response_attributes.rb b/lib/datadog_api_client/v2/models/report_schedule_response_attributes.rb new file mode 100644 index 000000000000..3cf2437064a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_response_attributes.rb @@ -0,0 +1,346 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The configuration and derived state of a report schedule. + class ReportScheduleResponseAttributes + include BaseGenericModel + + # The delivery format for dashboard report schedules, or `null` if not set. + attr_accessor :delivery_format + + # The description of the report. + attr_reader :description + + # The Unix timestamp, in milliseconds, of the next scheduled delivery, or `null` if none is scheduled. + attr_accessor :next_recurrence + + # The recipients of the report (email addresses, Slack channel references, or Microsoft Teams channel references). + attr_reader :recipients + + # The identifier of the resource rendered in the report. + attr_reader :resource_id + + # The type of dashboard resource the report schedule targets. + attr_reader :resource_type + + # The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + attr_reader :rrule + + # Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + attr_reader :status + + # The identifier of the dashboard tab rendered in the report, or `null` if not set. + attr_accessor :tab_id + + # The dashboard template variables applied when rendering the report. + attr_reader :template_variables + + # The relative timeframe of data included in the report, or `null` if not set. + attr_accessor :timeframe + + # The IANA time zone identifier the recurrence rule is evaluated in. + attr_reader :timezone + + # The title of the report. + attr_reader :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'delivery_format' => :'delivery_format', + :'description' => :'description', + :'next_recurrence' => :'next_recurrence', + :'recipients' => :'recipients', + :'resource_id' => :'resource_id', + :'resource_type' => :'resource_type', + :'rrule' => :'rrule', + :'status' => :'status', + :'tab_id' => :'tab_id', + :'template_variables' => :'template_variables', + :'timeframe' => :'timeframe', + :'timezone' => :'timezone', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'delivery_format' => :'ReportScheduleResponseAttributesDeliveryFormat', + :'description' => :'String', + :'next_recurrence' => :'Integer', + :'recipients' => :'Array', + :'resource_id' => :'String', + :'resource_type' => :'ReportScheduleResourceType', + :'rrule' => :'String', + :'status' => :'ReportScheduleStatus', + :'tab_id' => :'String', + :'template_variables' => :'Array', + :'timeframe' => :'String', + :'timezone' => :'String', + :'title' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'delivery_format', + :'next_recurrence', + :'tab_id', + :'timeframe', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'delivery_format') + self.delivery_format = attributes[:'delivery_format'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'next_recurrence') + self.next_recurrence = attributes[:'next_recurrence'] + end + + if attributes.key?(:'recipients') + if (value = attributes[:'recipients']).is_a?(Array) + self.recipients = value + end + end + + if attributes.key?(:'resource_id') + self.resource_id = attributes[:'resource_id'] + end + + if attributes.key?(:'resource_type') + self.resource_type = attributes[:'resource_type'] + end + + if attributes.key?(:'rrule') + self.rrule = attributes[:'rrule'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'tab_id') + self.tab_id = attributes[:'tab_id'] + end + + if attributes.key?(:'template_variables') + if (value = attributes[:'template_variables']).is_a?(Array) + self.template_variables = value + end + end + + if attributes.key?(:'timeframe') + self.timeframe = attributes[:'timeframe'] + end + + if attributes.key?(:'timezone') + self.timezone = attributes[:'timezone'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @description.nil? + return false if @recipients.nil? + return false if @resource_id.nil? + return false if @resource_type.nil? + return false if @rrule.nil? + return false if @status.nil? + return false if @template_variables.nil? + return false if @timezone.nil? + return false if @title.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param recipients [Object] Object to be assigned + # @!visibility private + def recipients=(recipients) + if recipients.nil? + fail ArgumentError, 'invalid value for "recipients", recipients cannot be nil.' + end + @recipients = recipients + end + + # Custom attribute writer method with validation + # @param resource_id [Object] Object to be assigned + # @!visibility private + def resource_id=(resource_id) + if resource_id.nil? + fail ArgumentError, 'invalid value for "resource_id", resource_id cannot be nil.' + end + @resource_id = resource_id + end + + # Custom attribute writer method with validation + # @param resource_type [Object] Object to be assigned + # @!visibility private + def resource_type=(resource_type) + if resource_type.nil? + fail ArgumentError, 'invalid value for "resource_type", resource_type cannot be nil.' + end + @resource_type = resource_type + end + + # Custom attribute writer method with validation + # @param rrule [Object] Object to be assigned + # @!visibility private + def rrule=(rrule) + if rrule.nil? + fail ArgumentError, 'invalid value for "rrule", rrule cannot be nil.' + end + @rrule = rrule + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param template_variables [Object] Object to be assigned + # @!visibility private + def template_variables=(template_variables) + if template_variables.nil? + fail ArgumentError, 'invalid value for "template_variables", template_variables cannot be nil.' + end + @template_variables = template_variables + end + + # Custom attribute writer method with validation + # @param timezone [Object] Object to be assigned + # @!visibility private + def timezone=(timezone) + if timezone.nil? + fail ArgumentError, 'invalid value for "timezone", timezone cannot be nil.' + end + @timezone = timezone + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if title.nil? + fail ArgumentError, 'invalid value for "title", title cannot be nil.' + end + @title = title + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + delivery_format == o.delivery_format && + description == o.description && + next_recurrence == o.next_recurrence && + recipients == o.recipients && + resource_id == o.resource_id && + resource_type == o.resource_type && + rrule == o.rrule && + status == o.status && + tab_id == o.tab_id && + template_variables == o.template_variables && + timeframe == o.timeframe && + timezone == o.timezone && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [delivery_format, description, next_recurrence, recipients, resource_id, resource_type, rrule, status, tab_id, template_variables, timeframe, timezone, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_response_attributes_delivery_format.rb b/lib/datadog_api_client/v2/models/report_schedule_response_attributes_delivery_format.rb new file mode 100644 index 000000000000..dde4c6a1b24b --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_response_attributes_delivery_format.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The delivery format for dashboard report schedules, or `null` if not set. + class ReportScheduleResponseAttributesDeliveryFormat + include BaseEnumModel + + PDF = "pdf".freeze + PNG = "png".freeze + PDF_AND_PNG = "pdf_and_png".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_response_data.rb b/lib/datadog_api_client/v2/models/report_schedule_response_data.rb new file mode 100644 index 000000000000..bb03614eec52 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_response_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API data object representing a report schedule. + class ReportScheduleResponseData + include BaseGenericModel + + # The configuration and derived state of a report schedule. + attr_reader :attributes + + # The unique identifier of the report schedule. + attr_reader :id + + # JSON:API resource type for report schedules. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ReportScheduleResponseAttributes', + :'id' => :'String', + :'type' => :'ReportScheduleType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_status.rb b/lib/datadog_api_client/v2/models/report_schedule_status.rb new file mode 100644 index 000000000000..e7a62bcbb562 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_status.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + class ReportScheduleStatus + include BaseEnumModel + + ACTIVE = "active".freeze + INACTIVE = "inactive".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_template_variable.rb b/lib/datadog_api_client/v2/models/report_schedule_template_variable.rb new file mode 100644 index 000000000000..404eea2c441e --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_template_variable.rb @@ -0,0 +1,146 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A dashboard template variable applied when rendering the report. + class ReportScheduleTemplateVariable + include BaseGenericModel + + # The name of the template variable. + attr_reader :name + + # The selected values for the template variable. + attr_reader :values + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'name' => :'name', + :'values' => :'values' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'name' => :'String', + :'values' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleTemplateVariable` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'values') + if (value = attributes[:'values']).is_a?(Array) + self.values = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @name.nil? + return false if @values.nil? + true + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param values [Object] Object to be assigned + # @!visibility private + def values=(values) + if values.nil? + fail ArgumentError, 'invalid value for "values", values cannot be nil.' + end + @values = values + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + values == o.values && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [name, values, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_type.rb b/lib/datadog_api_client/v2/models/report_schedule_type.rb new file mode 100644 index 000000000000..2ba1a7d602af --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for report schedules. + class ReportScheduleType + include BaseEnumModel + + SCHEDULE = "schedule".freeze + end +end