From ed54b405f4fda83ea3a7161fd8e820ee34845340 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 07:15:16 +0000 Subject: [PATCH 1/3] Regenerate client from commit 12fe77b of spec repo (#3432) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 648 ++++++++++++++++++ .../report-schedules/CreateReportSchedule.rb | 38 + .../report-schedules/PatchReportSchedule.rb | 36 + features/scenarios_model_mapping.rb | 7 + features/v2/report_schedules.feature | 61 ++ features/v2/undo.json | 13 + lib/datadog_api_client/configuration.rb | 2 + lib/datadog_api_client/inflector.rb | 23 + .../v2/api/report_schedules_api.rb | 183 +++++ .../v2/models/report_schedule_author.rb | 165 +++++ .../report_schedule_author_attributes.rb | 124 ++++ .../report_schedule_author_relationship.rb | 123 ++++ ...eport_schedule_author_relationship_data.rb | 144 ++++ .../v2/models/report_schedule_author_type.rb | 26 + .../models/report_schedule_create_request.rb | 123 ++++ ...port_schedule_create_request_attributes.rb | 330 +++++++++ .../report_schedule_create_request_data.rb | 144 ++++ .../models/report_schedule_delivery_format.rb | 29 + .../report_schedule_included_resource.rb | 62 ++ .../models/report_schedule_patch_request.rb | 123 ++++ ...eport_schedule_patch_request_attributes.rb | 289 ++++++++ .../report_schedule_patch_request_data.rb | 145 ++++ .../models/report_schedule_resource_type.rb | 27 + .../v2/models/report_schedule_response.rb | 135 ++++ .../report_schedule_response_attributes.rb | 346 ++++++++++ ...ule_response_attributes_delivery_format.rb | 28 + .../models/report_schedule_response_data.rb | 186 +++++ .../report_schedule_response_relationships.rb | 123 ++++ .../v2/models/report_schedule_status.rb | 27 + .../report_schedule_template_variable.rb | 146 ++++ .../v2/models/report_schedule_type.rb | 26 + 31 files changed, 3882 insertions(+) create mode 100644 examples/v2/report-schedules/CreateReportSchedule.rb create mode 100644 examples/v2/report-schedules/PatchReportSchedule.rb create mode 100644 features/v2/report_schedules.feature create mode 100644 lib/datadog_api_client/v2/api/report_schedules_api.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_author.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_author_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_author_relationship.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_author_relationship_data.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_author_type.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_create_request.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_create_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_create_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_delivery_format.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_included_resource.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_patch_request.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_patch_request_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_patch_request_data.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_resource_type.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_response.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_response_attributes_delivery_format.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_response_relationships.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_status.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_template_variable.rb create mode 100644 lib/datadog_api_client/v2/models/report_schedule_type.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index e694506b53cd..3224be2a0e6d 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -73533,6 +73533,428 @@ 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 + ReportScheduleAuthorRelationship: + description: Relationship to the author of the report schedule. + properties: + data: + $ref: "#/components/schemas/ReportScheduleAuthorRelationshipData" + required: + - data + type: object + ReportScheduleAuthorRelationshipData: + description: Relationship data for the author of the report schedule. + properties: + id: + description: The user UUID of the report schedule author. + example: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: string + type: + $ref: "#/components/schemas/ReportScheduleAuthorType" + required: + - id + - type + 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." + 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 + 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" + 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. + example: "calendar_month" + 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: + - resource_id + - resource_type + - recipients + - rrule + - timezone + - template_variables + - timeframe + - 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. + example: "calendar_month" + 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 + - timeframe + - 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 + relationships: + $ref: "#/components/schemas/ReportScheduleResponseRelationships" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - id + - type + - attributes + - relationships + type: object + ReportScheduleResponseRelationships: + description: Relationships for the report schedule. + properties: + author: + $ref: "#/components/schemas/ReportScheduleAuthorRelationship" + required: + - author + 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: @@ -155698,6 +156120,227 @@ 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" + relationships: + author: + data: + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + 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 + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/reporting/schedule/{schedule_uuid}: + 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" + relationships: + author: + data: + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + 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 + x-unstable: |- + **Note**: This endpoint is in preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/restriction_policy/{resource_id}: delete: description: Deletes the restriction policy associated with a specified resource. @@ -183836,6 +184479,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..9e142a0ac17a --- /dev/null +++ b/examples/v2/report-schedules/CreateReportSchedule.rb @@ -0,0 +1,38 @@ +# Create a report schedule returns "CREATED" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.create_report_schedule".to_sym] = true +end +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: "calendar_month", + 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..93e9d34a94e4 --- /dev/null +++ b/examples/v2/report-schedules/PatchReportSchedule.rb @@ -0,0 +1,36 @@ +# Update a report schedule returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.patch_report_schedule".to_sym] = true +end +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: "calendar_month", + 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 9707cb7577db..534c4f02767b 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4653,6 +4653,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..7d2ffafbc65b --- /dev/null +++ b/features/v2/report_schedules.feature @@ -0,0 +1,61 @@ +@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 operation "CreateReportSchedule" enabled + And new "CreateReportSchedule" request + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + 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 operation "CreateReportSchedule" enabled + And new "CreateReportSchedule" request + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + 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 operation "CreateReportSchedule" enabled + And new "CreateReportSchedule" request + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + 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 operation "PatchReportSchedule" enabled + And new "PatchReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + 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 operation "PatchReportSchedule" enabled + And new "PatchReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + 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 operation "PatchReportSchedule" enabled + And new "PatchReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + 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 811e650c25b9..c0243828f259 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -6126,6 +6126,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/configuration.rb b/lib/datadog_api_client/configuration.rb index 1323e5b92ec1..fefe797663df 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -593,6 +593,8 @@ def initialize "v2.update_connection": false, "v2.get_pruned_trace_by_id": false, "v2.get_trace_by_id": false, + "v2.create_report_schedule": false, + "v2.patch_report_schedule": false, "v2.delete_sourcemaps": false, "v2.get_service_repository_info": false, "v2.get_sourcemaps": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 93b0106d173c..7216ee3ec4dd 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5554,6 +5554,28 @@ 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_relationship" => "ReportScheduleAuthorRelationship", + "v2.report_schedule_author_relationship_data" => "ReportScheduleAuthorRelationshipData", + "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_response_relationships" => "ReportScheduleResponseRelationships", + "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", @@ -7606,6 +7628,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..1fd9598abd54 --- /dev/null +++ b/lib/datadog_api_client/v2/api/report_schedules_api.rb @@ -0,0 +1,183 @@ +=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 = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.create_report_schedule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_report_schedule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_report_schedule")) + end + + 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 = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.patch_report_schedule".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.patch_report_schedule") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.patch_report_schedule")) + end + + 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_relationship.rb b/lib/datadog_api_client/v2/models/report_schedule_author_relationship.rb new file mode 100644 index 000000000000..a7e1d64345dc --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_author_relationship.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 + # Relationship to the author of the report schedule. + class ReportScheduleAuthorRelationship + include BaseGenericModel + + # Relationship data for the author of the report schedule. + 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' => :'ReportScheduleAuthorRelationshipData' + } + 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::ReportScheduleAuthorRelationship` 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_author_relationship_data.rb b/lib/datadog_api_client/v2/models/report_schedule_author_relationship_data.rb new file mode 100644 index 000000000000..2b66374a9e4b --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_author_relationship_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 + # Relationship data for the author of the report schedule. + class ReportScheduleAuthorRelationshipData + include BaseGenericModel + + # The user UUID of the report schedule author. + 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 + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'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::ReportScheduleAuthorRelationshipData` 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?(:'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 @id.nil? + return false if @type.nil? + true + 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 && + 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 + [id, type, 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..3d6a8d18c114 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_create_request_attributes.rb @@ -0,0 +1,330 @@ +=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. + attr_reader :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' => :'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::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 @description.to_s.length > 4096 + 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 @timeframe.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 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 timeframe [Object] Object to be assigned + # @!visibility private + def timeframe=(timeframe) + if timeframe.nil? + fail ArgumentError, 'invalid value for "timeframe", timeframe cannot be nil.' + end + @timeframe = timeframe + 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 && + 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..0d5a9c4c934f --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_patch_request_attributes.rb @@ -0,0 +1,289 @@ +=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. + attr_reader :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 @timeframe.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 timeframe [Object] Object to be assigned + # @!visibility private + def timeframe=(timeframe) + if timeframe.nil? + fail ArgumentError, 'invalid value for "timeframe", timeframe cannot be nil.' + end + @timeframe = timeframe + 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..b9edf41ca0d9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_response_data.rb @@ -0,0 +1,186 @@ +=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 + + # Relationships for the report schedule. + attr_reader :relationships + + # 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', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ReportScheduleResponseAttributes', + :'id' => :'String', + :'relationships' => :'ReportScheduleResponseRelationships', + :'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?(:'relationships') + self.relationships = attributes[:'relationships'] + 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 @relationships.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 relationships [Object] Object to be assigned + # @!visibility private + def relationships=(relationships) + if relationships.nil? + fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.' + end + @relationships = relationships + 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 && + relationships == o.relationships && + 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, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_response_relationships.rb b/lib/datadog_api_client/v2/models/report_schedule_response_relationships.rb new file mode 100644 index 000000000000..ce1762f91c26 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_response_relationships.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 + # Relationships for the report schedule. + class ReportScheduleResponseRelationships + include BaseGenericModel + + # Relationship to the author of the report schedule. + attr_reader :author + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'author' => :'author' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'author' => :'ReportScheduleAuthorRelationship' + } + 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::ReportScheduleResponseRelationships` 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?(:'author') + self.author = attributes[:'author'] + 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 @author.nil? + true + end + + # Custom attribute writer method with validation + # @param author [Object] Object to be assigned + # @!visibility private + def author=(author) + if author.nil? + fail ArgumentError, 'invalid value for "author", author cannot be nil.' + end + @author = author + 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 && + author == o.author && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [author, 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 From c904f5aedbf3906ad4e0c41aa40ae61b91068275 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 07:33:33 +0000 Subject: [PATCH 2/3] Regenerate client from commit 19949fa of spec repo (#3456) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 158 ++++++++++++++++++ ...tification-rule-returns-OK-response.frozen | 1 + ...-notification-rule-returns-OK-response.yml | 24 +++ ...ndSecurityMonitoringNotificationPreview.rb | 28 ++++ features/scenarios_model_mapping.rb | 3 + features/v2/security_monitoring.feature | 22 ++- features/v2/undo.json | 6 + lib/datadog_api_client/inflector.rb | 8 + .../v2/api/security_monitoring_api.rb | 67 ++++++++ ...ication_rule_parameters_data_attributes.rb | 12 +- ...cation_rule_preview_notification_status.rb | 28 ++++ .../notification_rule_preview_response.rb | 123 ++++++++++++++ ...cation_rule_preview_response_attributes.rb | 125 ++++++++++++++ ...notification_rule_preview_response_data.rb | 154 +++++++++++++++++ ...notification_rule_preview_response_type.rb | 26 +++ .../notification_rule_preview_result.rb | 149 +++++++++++++++++ .../v2/models/notification_rule_routing.rb | 123 ++++++++++++++ .../models/notification_rule_routing_mode.rb | 26 +++ ...ication_rule_parameters_data_attributes.rb | 12 +- 19 files changed, 1089 insertions(+), 6 deletions(-) create mode 100644 cassettes/features/v2/security_monitoring/Test-a-notification-rule-returns-OK-response.frozen create mode 100644 cassettes/features/v2/security_monitoring/Test-a-notification-rule-returns-OK-response.yml create mode 100644 examples/v2/security-monitoring/SendSecurityMonitoringNotificationPreview.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_preview_notification_status.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_preview_response.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_preview_response_attributes.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_preview_response_data.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_preview_response_type.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_preview_result.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_routing.rb create mode 100644 lib/datadog_api_client/v2/models/notification_rule_routing_mode.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3224be2a0e6d..3f8e27ef5d1e 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -23518,6 +23518,8 @@ components: $ref: "#/components/schemas/Enabled" name: $ref: "#/components/schemas/RuleName" + routing: + $ref: "#/components/schemas/NotificationRuleRouting" selectors: $ref: "#/components/schemas/Selectors" targets: @@ -59051,6 +59053,76 @@ components: - targets - version type: object + NotificationRulePreviewNotificationStatus: + description: The notification status for the given rule type. `SUCCESS` means a matching event was found and the notification was sent successfully. `DEFAULT` means no matching event was found and a default placeholder notification was sent instead. `ERROR` means an error occurred while sending the notification. + enum: + - SUCCESS + - DEFAULT + - ERROR + example: SUCCESS + type: string + x-enum-varnames: + - SUCCESS + - DEFAULT + - ERROR + NotificationRulePreviewResponse: + description: Response from the notification preview request. + properties: + data: + $ref: "#/components/schemas/NotificationRulePreviewResponseData" + required: + - data + type: object + NotificationRulePreviewResponseAttributes: + description: Attributes of the notification preview response. + properties: + preview_results: + $ref: "#/components/schemas/NotificationRulePreviewResults" + required: + - preview_results + type: object + NotificationRulePreviewResponseData: + description: The notification preview response data. + properties: + attributes: + $ref: "#/components/schemas/NotificationRulePreviewResponseAttributes" + id: + description: The ID of the notification preview response. + example: rka-loa-zwu + type: string + type: + $ref: "#/components/schemas/NotificationRulePreviewResponseType" + required: + - type + - attributes + type: object + NotificationRulePreviewResponseType: + description: The type of the notification preview response. + enum: + - notification_preview_response + example: notification_preview_response + type: string + x-enum-varnames: + - NOTIFICATION_PREVIEW_RESPONSE + NotificationRulePreviewResult: + description: The preview result for a single rule type. + properties: + notification_status: + $ref: "#/components/schemas/NotificationRulePreviewNotificationStatus" + rule_type: + $ref: "#/components/schemas/RuleTypesItems" + required: + - rule_type + - notification_status + type: object + NotificationRulePreviewResults: + description: List of preview results for each rule type matched by the notification rule. + example: + - notification_status: DEFAULT + rule_type: log_detection + items: + $ref: "#/components/schemas/NotificationRulePreviewResult" + type: array NotificationRuleQuery: description: The query is composed of one or several key:value pairs, which can be used to filter security issues on tags and attributes. example: (source:production_service OR env:prod) @@ -59061,6 +59133,22 @@ components: data: $ref: "#/components/schemas/NotificationRule" type: object + NotificationRuleRouting: + description: Routing configuration for the notification rule. + properties: + mode: + $ref: "#/components/schemas/NotificationRuleRoutingMode" + required: + - mode + type: object + NotificationRuleRoutingMode: + description: The routing mode for the notification rule. `manual` sends notifications to the configured targets. + enum: + - manual + example: manual + type: string + x-enum-varnames: + - MANUAL NotificationRulesListResponse: description: The list of notification rules. properties: @@ -68865,6 +68953,8 @@ components: $ref: "#/components/schemas/Enabled" name: $ref: "#/components/schemas/RuleName" + routing: + $ref: "#/components/schemas/NotificationRuleRouting" selectors: $ref: "#/components/schemas/Selectors" targets: @@ -75597,6 +75687,7 @@ components: - iac_misconfiguration - sast_vulnerability - secret_vulnerability + example: log_detection type: string x-enum-varnames: - APPLICATION_SECURITY @@ -164667,6 +164758,73 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/security_monitoring/configuration/notification_rules/send_notification_preview: + post: + description: Send a notification preview to test that a notification rule's targets are properly configured. + operationId: SendSecurityMonitoringNotificationPreview + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + enabled: true + name: Rule 1 + selectors: + query: env:prod + rule_types: + - log_detection + severities: + - critical + trigger_source: security_signals + targets: + - "@john.doe@email.com" + type: notification_rules + schema: + $ref: "#/components/schemas/CreateNotificationRuleParameters" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + preview_results: + - notification_status: DEFAULT + rule_type: log_detection + id: rka-loa-zwu + type: notification_preview_response + schema: + $ref: "#/components/schemas/NotificationRulePreviewResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - security_monitoring_notification_profiles_write + summary: Test a notification rule + tags: + - Security Monitoring + x-codegen-request-body-name: body + "x-permission": + operator: OR + permissions: + - security_monitoring_notification_profiles_write /api/v2/security_monitoring/configuration/security_filters: get: description: Get the list of configured security filters with their definitions. diff --git a/cassettes/features/v2/security_monitoring/Test-a-notification-rule-returns-OK-response.frozen b/cassettes/features/v2/security_monitoring/Test-a-notification-rule-returns-OK-response.frozen new file mode 100644 index 000000000000..dbdcb687dab6 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Test-a-notification-rule-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-06-10T09:27:59.116Z \ No newline at end of file diff --git a/cassettes/features/v2/security_monitoring/Test-a-notification-rule-returns-OK-response.yml b/cassettes/features/v2/security_monitoring/Test-a-notification-rule-returns-OK-response.yml new file mode 100644 index 000000000000..20d833d63242 --- /dev/null +++ b/cassettes/features/v2/security_monitoring/Test-a-notification-rule-returns-OK-response.yml @@ -0,0 +1,24 @@ +http_interactions: +- recorded_at: Wed, 10 Jun 2026 09:27:59 GMT + request: + body: + encoding: UTF-8 + string: '{"data":{"attributes":{"enabled":true,"name":"Rule 1","selectors":{"query":"env:prod","rule_types":["log_detection"],"severities":["critical"],"trigger_source":"security_signals"},"targets":["@john.doe@email.com"]},"type":"notification_rules"}}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/security_monitoring/configuration/notification_rules/send_notification_preview + response: + body: + encoding: UTF-8 + string: '{"data":{"id":"rka-loa-zwu","attributes":{"preview_results":[{"rule_type":"log_detection","notification_status":"DEFAULT"}]},"type":"notification_preview_response"}}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/security-monitoring/SendSecurityMonitoringNotificationPreview.rb b/examples/v2/security-monitoring/SendSecurityMonitoringNotificationPreview.rb new file mode 100644 index 000000000000..211e81fbb778 --- /dev/null +++ b/examples/v2/security-monitoring/SendSecurityMonitoringNotificationPreview.rb @@ -0,0 +1,28 @@ +# Test a notification rule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new + +body = DatadogAPIClient::V2::CreateNotificationRuleParameters.new({ + data: DatadogAPIClient::V2::CreateNotificationRuleParametersData.new({ + attributes: DatadogAPIClient::V2::CreateNotificationRuleParametersDataAttributes.new({ + enabled: true, + name: "Rule 1", + selectors: DatadogAPIClient::V2::Selectors.new({ + query: "env:prod", + rule_types: [ + DatadogAPIClient::V2::RuleTypesItems::LOG_DETECTION, + ], + severities: [ + DatadogAPIClient::V2::RuleSeverity::CRITICAL, + ], + trigger_source: DatadogAPIClient::V2::TriggerSource::SECURITY_SIGNALS, + }), + targets: [ + "@john.doe@email.com", + ], + }), + type: DatadogAPIClient::V2::NotificationRulesType::NOTIFICATION_RULES, + }), +}) +p api_instance.send_security_monitoring_notification_preview(body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 534c4f02767b..626226b236e0 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2212,6 +2212,9 @@ "v2.ValidateSecurityMonitoringIntegrationConfig" => { "integration_config_id" => "String", }, + "v2.SendSecurityMonitoringNotificationPreview" => { + "body" => "CreateNotificationRuleParameters", + }, "v2.CreateSecurityFilter" => { "body" => "SecurityFilterCreateRequest", }, diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index bae8918780ee..7e93f0077ade 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -759,7 +759,7 @@ Feature: Security Monitoring @generated @skip @team:DataDog/cloud-security-posture-management Scenario: Create a new signal-based notification rule returns "Bad Request" response Given new "CreateSignalNotificationRule" request - And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}} + And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}} When the request is sent Then the response status is 400 Bad Request @@ -773,7 +773,7 @@ Feature: Security Monitoring @generated @skip @team:DataDog/cloud-security-posture-management Scenario: Create a new vulnerability-based notification rule returns "Bad Request" response Given new "CreateVulnerabilityNotificationRule" request - And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}} + And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}} When the request is sent Then the response status is 400 Bad Request @@ -2470,7 +2470,7 @@ Feature: Security Monitoring Scenario: Patch a signal-based notification rule returns "The server cannot process the request because it contains invalid data." response Given new "PatchSignalNotificationRule" request And request contains "id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400, "version": 1}, "id": "aaa-bbb-ccc", "type": "notification_rules"}} + And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400, "version": 1}, "id": "aaa-bbb-ccc", "type": "notification_rules"}} When the request is sent Then the response status is 422 The server cannot process the request because it contains invalid data. @@ -2504,7 +2504,7 @@ Feature: Security Monitoring Scenario: Patch a vulnerability-based notification rule returns "The server cannot process the request because it contains invalid data." response Given new "PatchVulnerabilityNotificationRule" request And request contains "id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400, "version": 1}, "id": "aaa-bbb-ccc", "type": "notification_rules"}} + And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400, "version": 1}, "id": "aaa-bbb-ccc", "type": "notification_rules"}} When the request is sent Then the response status is 422 The server cannot process the request because it contains invalid data. @@ -2611,6 +2611,20 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-siem + Scenario: Test a notification rule returns "Bad Request" response + Given new "SendSecurityMonitoringNotificationPreview" request + And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "routing": {"mode": "manual"}, "selectors": {"query": "(source:production_service OR env:prod)", "rule_types": ["misconfiguration", "attack_path"], "severities": ["critical"], "trigger_source": "security_findings"}, "targets": ["@john.doe@email.com"], "time_aggregation": 86400}, "type": "notification_rules"}} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/k9-cloud-siem + Scenario: Test a notification rule returns "OK" response + Given new "SendSecurityMonitoringNotificationPreview" request + And body with value {"data": {"attributes": {"enabled": true, "name": "Rule 1", "selectors": {"query": "env:prod", "rule_types": ["log_detection"], "severities": ["critical"], "trigger_source": "security_signals"}, "targets": ["@john.doe@email.com"]}, "type": "notification_rules"}} + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/k9-cloud-siem Scenario: Test a rule returns "Bad Request" response Given new "TestSecurityMonitoringRule" request diff --git a/features/v2/undo.json b/features/v2/undo.json index c0243828f259..ff311e33efab 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -7038,6 +7038,12 @@ "type": "safe" } }, + "SendSecurityMonitoringNotificationPreview": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListSecurityFilters": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 7216ee3ec4dd..47c97b3c84f3 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -4655,7 +4655,15 @@ def overrides "v2.notification_channel_type" => "NotificationChannelType", "v2.notification_rule" => "NotificationRule", "v2.notification_rule_attributes" => "NotificationRuleAttributes", + "v2.notification_rule_preview_notification_status" => "NotificationRulePreviewNotificationStatus", + "v2.notification_rule_preview_response" => "NotificationRulePreviewResponse", + "v2.notification_rule_preview_response_attributes" => "NotificationRulePreviewResponseAttributes", + "v2.notification_rule_preview_response_data" => "NotificationRulePreviewResponseData", + "v2.notification_rule_preview_response_type" => "NotificationRulePreviewResponseType", + "v2.notification_rule_preview_result" => "NotificationRulePreviewResult", "v2.notification_rule_response" => "NotificationRuleResponse", + "v2.notification_rule_routing" => "NotificationRuleRouting", + "v2.notification_rule_routing_mode" => "NotificationRuleRoutingMode", "v2.notification_rules_list_response" => "NotificationRulesListResponse", "v2.notification_rules_type" => "NotificationRulesType", "v2.notion_api_key" => "NotionAPIKey", diff --git a/lib/datadog_api_client/v2/api/security_monitoring_api.rb b/lib/datadog_api_client/v2/api/security_monitoring_api.rb index 765c57639dc6..94b3626f3971 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -8746,6 +8746,73 @@ def search_security_monitoring_signals_with_pagination(opts = {}) end end + # Test a notification rule. + # + # @see #send_security_monitoring_notification_preview_with_http_info + def send_security_monitoring_notification_preview(body, opts = {}) + data, _status_code, _headers = send_security_monitoring_notification_preview_with_http_info(body, opts) + data + end + + # Test a notification rule. + # + # Send a notification preview to test that a notification rule's targets are properly configured. + # + # @param body [CreateNotificationRuleParameters] + # @param opts [Hash] the optional parameters + # @return [Array<(NotificationRulePreviewResponse, Integer, Hash)>] NotificationRulePreviewResponse data, response status code and response headers + def send_security_monitoring_notification_preview_with_http_info(body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.send_security_monitoring_notification_preview ...' + 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 SecurityMonitoringAPI.send_security_monitoring_notification_preview" + end + # resource path + local_var_path = '/api/v2/security_monitoring/configuration/notification_rules/send_notification_preview' + + # 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] || 'NotificationRulePreviewResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :send_security_monitoring_notification_preview, + :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: SecurityMonitoringAPI#send_security_monitoring_notification_preview\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Test an existing rule. # # @see #test_existing_security_monitoring_rule_with_http_info diff --git a/lib/datadog_api_client/v2/models/create_notification_rule_parameters_data_attributes.rb b/lib/datadog_api_client/v2/models/create_notification_rule_parameters_data_attributes.rb index 2c532b40b073..87495be7cf29 100644 --- a/lib/datadog_api_client/v2/models/create_notification_rule_parameters_data_attributes.rb +++ b/lib/datadog_api_client/v2/models/create_notification_rule_parameters_data_attributes.rb @@ -27,6 +27,9 @@ class CreateNotificationRuleParametersDataAttributes # Name of the notification rule. attr_reader :name + # Routing configuration for the notification rule. + attr_accessor :routing + # Selectors are used to filter security issues for which notifications should be generated. # Users can specify rule severities, rule types, a query to filter security issues on tags and attributes, and the trigger source. # Only the trigger_source field is required. @@ -52,6 +55,7 @@ def self.attribute_map { :'enabled' => :'enabled', :'name' => :'name', + :'routing' => :'routing', :'selectors' => :'selectors', :'targets' => :'targets', :'time_aggregation' => :'time_aggregation' @@ -64,6 +68,7 @@ def self.openapi_types { :'enabled' => :'Boolean', :'name' => :'String', + :'routing' => :'NotificationRuleRouting', :'selectors' => :'Selectors', :'targets' => :'Array', :'time_aggregation' => :'Integer' @@ -96,6 +101,10 @@ def initialize(attributes = {}) self.name = attributes[:'name'] end + if attributes.key?(:'routing') + self.routing = attributes[:'routing'] + end + if attributes.key?(:'selectors') self.selectors = attributes[:'selectors'] end @@ -179,6 +188,7 @@ def ==(o) self.class == o.class && enabled == o.enabled && name == o.name && + routing == o.routing && selectors == o.selectors && targets == o.targets && time_aggregation == o.time_aggregation && @@ -189,7 +199,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [enabled, name, selectors, targets, time_aggregation, additional_properties].hash + [enabled, name, routing, selectors, targets, time_aggregation, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/notification_rule_preview_notification_status.rb b/lib/datadog_api_client/v2/models/notification_rule_preview_notification_status.rb new file mode 100644 index 000000000000..007dc55d455b --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_preview_notification_status.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 notification status for the given rule type. `SUCCESS` means a matching event was found and the notification was sent successfully. `DEFAULT` means no matching event was found and a default placeholder notification was sent instead. `ERROR` means an error occurred while sending the notification. + class NotificationRulePreviewNotificationStatus + include BaseEnumModel + + SUCCESS = "SUCCESS".freeze + DEFAULT = "DEFAULT".freeze + ERROR = "ERROR".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_preview_response.rb b/lib/datadog_api_client/v2/models/notification_rule_preview_response.rb new file mode 100644 index 000000000000..0812e2844b74 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_preview_response.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 + # Response from the notification preview request. + class NotificationRulePreviewResponse + include BaseGenericModel + + # The notification preview response data. + 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' => :'NotificationRulePreviewResponseData' + } + 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::NotificationRulePreviewResponse` 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/notification_rule_preview_response_attributes.rb b/lib/datadog_api_client/v2/models/notification_rule_preview_response_attributes.rb new file mode 100644 index 000000000000..846e8297b168 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_preview_response_attributes.rb @@ -0,0 +1,125 @@ +=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 notification preview response. + class NotificationRulePreviewResponseAttributes + include BaseGenericModel + + # List of preview results for each rule type matched by the notification rule. + attr_reader :preview_results + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'preview_results' => :'preview_results' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'preview_results' => :'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::NotificationRulePreviewResponseAttributes` 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?(:'preview_results') + if (value = attributes[:'preview_results']).is_a?(Array) + self.preview_results = 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 @preview_results.nil? + true + end + + # Custom attribute writer method with validation + # @param preview_results [Object] Object to be assigned + # @!visibility private + def preview_results=(preview_results) + if preview_results.nil? + fail ArgumentError, 'invalid value for "preview_results", preview_results cannot be nil.' + end + @preview_results = preview_results + 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 && + preview_results == o.preview_results && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [preview_results, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_preview_response_data.rb b/lib/datadog_api_client/v2/models/notification_rule_preview_response_data.rb new file mode 100644 index 000000000000..b68d7e9b1369 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_preview_response_data.rb @@ -0,0 +1,154 @@ +=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 notification preview response data. + class NotificationRulePreviewResponseData + include BaseGenericModel + + # Attributes of the notification preview response. + attr_reader :attributes + + # The ID of the notification preview response. + attr_accessor :id + + # The type of the notification preview response. + 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' => :'NotificationRulePreviewResponseAttributes', + :'id' => :'String', + :'type' => :'NotificationRulePreviewResponseType' + } + 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::NotificationRulePreviewResponseData` 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 @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 && + 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/notification_rule_preview_response_type.rb b/lib/datadog_api_client/v2/models/notification_rule_preview_response_type.rb new file mode 100644 index 000000000000..4e386e466f16 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_preview_response_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 + # The type of the notification preview response. + class NotificationRulePreviewResponseType + include BaseEnumModel + + NOTIFICATION_PREVIEW_RESPONSE = "notification_preview_response".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_preview_result.rb b/lib/datadog_api_client/v2/models/notification_rule_preview_result.rb new file mode 100644 index 000000000000..34f18b9bd4d0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_preview_result.rb @@ -0,0 +1,149 @@ +=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 preview result for a single rule type. + class NotificationRulePreviewResult + include BaseGenericModel + + # The notification status for the given rule type. `SUCCESS` means a matching event was found and the notification was sent successfully. `DEFAULT` means no matching event was found and a default placeholder notification was sent instead. `ERROR` means an error occurred while sending the notification. + attr_reader :notification_status + + # Security rule type which can be used in security rules. + # Signal-based notification rules can filter signals based on rule types application_security, log_detection, + # workload_security, signal_correlation, cloud_configuration and infrastructure_configuration. + # Vulnerability-based notification rules can filter vulnerabilities based on rule types application_code_vulnerability, + # application_library_vulnerability, attack_path, container_image_vulnerability, identity_risk, misconfiguration, + # api_security, host_vulnerability, iac_misconfiguration, sast_vulnerability and secret_vulnerability. + attr_reader :rule_type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'notification_status' => :'notification_status', + :'rule_type' => :'rule_type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'notification_status' => :'NotificationRulePreviewNotificationStatus', + :'rule_type' => :'RuleTypesItems' + } + 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::NotificationRulePreviewResult` 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?(:'notification_status') + self.notification_status = attributes[:'notification_status'] + end + + if attributes.key?(:'rule_type') + self.rule_type = attributes[:'rule_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 @notification_status.nil? + return false if @rule_type.nil? + true + end + + # Custom attribute writer method with validation + # @param notification_status [Object] Object to be assigned + # @!visibility private + def notification_status=(notification_status) + if notification_status.nil? + fail ArgumentError, 'invalid value for "notification_status", notification_status cannot be nil.' + end + @notification_status = notification_status + end + + # Custom attribute writer method with validation + # @param rule_type [Object] Object to be assigned + # @!visibility private + def rule_type=(rule_type) + if rule_type.nil? + fail ArgumentError, 'invalid value for "rule_type", rule_type cannot be nil.' + end + @rule_type = rule_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 && + notification_status == o.notification_status && + rule_type == o.rule_type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [notification_status, rule_type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_routing.rb b/lib/datadog_api_client/v2/models/notification_rule_routing.rb new file mode 100644 index 000000000000..f45ca96bf37a --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_routing.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 + # Routing configuration for the notification rule. + class NotificationRuleRouting + include BaseGenericModel + + # The routing mode for the notification rule. `manual` sends notifications to the configured targets. + attr_reader :mode + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'mode' => :'mode' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'mode' => :'NotificationRuleRoutingMode' + } + 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::NotificationRuleRouting` 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?(:'mode') + self.mode = attributes[:'mode'] + 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 @mode.nil? + true + end + + # Custom attribute writer method with validation + # @param mode [Object] Object to be assigned + # @!visibility private + def mode=(mode) + if mode.nil? + fail ArgumentError, 'invalid value for "mode", mode cannot be nil.' + end + @mode = mode + 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 && + mode == o.mode && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [mode, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/notification_rule_routing_mode.rb b/lib/datadog_api_client/v2/models/notification_rule_routing_mode.rb new file mode 100644 index 000000000000..bb4d3a3d1bb6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/notification_rule_routing_mode.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 + # The routing mode for the notification rule. `manual` sends notifications to the configured targets. + class NotificationRuleRoutingMode + include BaseEnumModel + + MANUAL = "manual".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/patch_notification_rule_parameters_data_attributes.rb b/lib/datadog_api_client/v2/models/patch_notification_rule_parameters_data_attributes.rb index 52208cdc5d69..32b16f959dac 100644 --- a/lib/datadog_api_client/v2/models/patch_notification_rule_parameters_data_attributes.rb +++ b/lib/datadog_api_client/v2/models/patch_notification_rule_parameters_data_attributes.rb @@ -27,6 +27,9 @@ class PatchNotificationRuleParametersDataAttributes # Name of the notification rule. attr_accessor :name + # Routing configuration for the notification rule. + attr_accessor :routing + # Selectors are used to filter security issues for which notifications should be generated. # Users can specify rule severities, rule types, a query to filter security issues on tags and attributes, and the trigger source. # Only the trigger_source field is required. @@ -55,6 +58,7 @@ def self.attribute_map { :'enabled' => :'enabled', :'name' => :'name', + :'routing' => :'routing', :'selectors' => :'selectors', :'targets' => :'targets', :'time_aggregation' => :'time_aggregation', @@ -68,6 +72,7 @@ def self.openapi_types { :'enabled' => :'Boolean', :'name' => :'String', + :'routing' => :'NotificationRuleRouting', :'selectors' => :'Selectors', :'targets' => :'Array', :'time_aggregation' => :'Integer', @@ -101,6 +106,10 @@ def initialize(attributes = {}) self.name = attributes[:'name'] end + if attributes.key?(:'routing') + self.routing = attributes[:'routing'] + end + if attributes.key?(:'selectors') self.selectors = attributes[:'selectors'] end @@ -148,6 +157,7 @@ def ==(o) self.class == o.class && enabled == o.enabled && name == o.name && + routing == o.routing && selectors == o.selectors && targets == o.targets && time_aggregation == o.time_aggregation && @@ -159,7 +169,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [enabled, name, selectors, targets, time_aggregation, version, additional_properties].hash + [enabled, name, routing, selectors, targets, time_aggregation, version, additional_properties].hash end end end From d13e137fd6e5ff9ca37364521cf53d7047f1e632 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Thu, 11 Jun 2026 08:49:32 +0000 Subject: [PATCH 3/3] Regenerate client from commit 9ebecac of spec repo (#3461) Co-authored-by: ci.datadog-api-spec --- .generator/schemas/v2/openapi.yaml | 111 +++++++++++++++- .../GetSingleEntityContext.rb | 8 ++ features/scenarios_model_mapping.rb | 6 + features/v2/security_monitoring.feature | 24 ++++ features/v2/undo.json | 6 + lib/datadog_api_client/configuration.rb | 1 + lib/datadog_api_client/inflector.rb | 1 + .../v2/api/security_monitoring_api.rb | 80 ++++++++++++ .../models/single_entity_context_response.rb | 123 ++++++++++++++++++ 9 files changed, 355 insertions(+), 5 deletions(-) create mode 100644 examples/v2/security-monitoring/GetSingleEntityContext.rb create mode 100644 lib/datadog_api_client/v2/models/single_entity_context_response.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 3f8e27ef5d1e..fd5ed0088f50 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -31464,9 +31464,10 @@ components: additionalProperties: {} description: The set of attributes recorded for the entity at this revision. The keys depend on the kind of entity. example: + accounts: + - linked-account-123 display_name: Test User - emails: - - user@example.com + email: user@example.com principal_id: user@example.com type: object EntityData: @@ -88286,6 +88287,14 @@ components: type: string x-enum-varnames: - AGGREGATED_DNS + SingleEntityContextResponse: + description: Response from the single entity context endpoint, containing the matching entity. + properties: + data: + $ref: "#/components/schemas/EntityContextEntity" + required: + - data + type: object SlackIntegrationMetadata: description: Incident integration metadata for the Slack integration. properties: @@ -166474,9 +166483,10 @@ paths: - attributes: revisions: - attributes: + accounts: + - linked-account-123 display_name: Test User - emails: - - user@example.com + email: user@example.com principal_id: user@example.com first_seen_at: "2026-04-01T00:00:00Z" last_seen_at: "2026-05-01T00:00:00Z" @@ -166507,7 +166517,98 @@ paths: permissions: - siem_entities_read x-unstable: |- - **Note**: This endpoint is in preview and is subject to change. + **Note**: This endpoint is in Preview and is subject to change. + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/security_monitoring/entity_context/{id}: + get: + description: |- + Get a single entity from the Cloud SIEM entity context store by its identifier, returning the historical + revisions of the entity in the requested time range. The endpoint can either return revisions across an + interval (`from` / `to`) or the snapshot of the entity at a single point in time (`as_of`); the two modes + are mutually exclusive. + operationId: GetSingleEntityContext + parameters: + - description: The unique identifier of the entity to retrieve. + in: path + name: id + required: true + schema: + example: user@example.com + type: string + - description: |- + The start of the time range to query, as an RFC3339 timestamp or a relative time (for example, `now-7d`). + Defaults to `now-7d`. Ignored when `as_of` is set. + in: query + name: from + required: false + schema: + default: now-7d + example: now-7d + type: string + - description: |- + The end of the time range to query, as an RFC3339 timestamp or a relative time (for example, `now`). + Defaults to `now`. Ignored when `as_of` is set. + in: query + name: to + required: false + schema: + default: now + example: now + type: string + - description: |- + A point in time at which to query the entity revisions, as an RFC3339 timestamp, a Unix timestamp + (in seconds), or a relative time (for example, `now-1d`). When set, `from` and `to` are ignored. + Cannot be combined with custom `from` / `to` values. + example: now-1d + in: query + name: as_of + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + revisions: + - attributes: + accounts: + - linked-account-123 + display_name: Test User + email: user@example.com + principal_id: user@example.com + first_seen_at: "2026-04-01T00:00:00Z" + last_seen_at: "2026-05-01T00:00:00Z" + id: user@example.com + type: siem_entity_identity + schema: + $ref: "#/components/schemas/SingleEntityContextResponse" + description: OK + "400": + $ref: "#/components/responses/BadRequestResponse" + "403": + $ref: "#/components/responses/NotAuthorizedResponse" + "404": + $ref: "#/components/responses/NotFoundResponse" + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - siem_entities_read + summary: Get a single entity context + tags: ["Security Monitoring"] + x-permission: + operator: OR + permissions: + - siem_entities_read + x-unstable: |- + **Note**: This endpoint is in Preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). /api/v2/security_monitoring/rules: get: diff --git a/examples/v2/security-monitoring/GetSingleEntityContext.rb b/examples/v2/security-monitoring/GetSingleEntityContext.rb new file mode 100644 index 000000000000..5b388a088513 --- /dev/null +++ b/examples/v2/security-monitoring/GetSingleEntityContext.rb @@ -0,0 +1,8 @@ +# Get a single entity context returns "OK" response + +require "datadog_api_client" +DatadogAPIClient.configure do |config| + config.unstable_operations["v2.get_single_entity_context".to_sym] = true +end +api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new +p api_instance.get_single_entity_context("user@example.com") diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 626226b236e0..4302b7a08ef5 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2306,6 +2306,12 @@ "limit" => "Integer", "page_token" => "String", }, + "v2.GetSingleEntityContext" => { + "id" => "String", + "from" => "String", + "to" => "String", + "as_of" => "String", + }, "v2.ListSecurityMonitoringRules" => { "page_size" => "Integer", "page_number" => "Integer", diff --git a/features/v2/security_monitoring.feature b/features/v2/security_monitoring.feature index 7e93f0077ade..eb583c92cd36 100644 --- a/features/v2/security_monitoring.feature +++ b/features/v2/security_monitoring.feature @@ -1608,6 +1608,30 @@ Feature: Security Monitoring When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/k9-cloud-siem + Scenario: Get a single entity context returns "Bad Request" response + Given operation "GetSingleEntityContext" enabled + And new "GetSingleEntityContext" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/k9-cloud-siem + Scenario: Get a single entity context returns "Not Found" response + Given operation "GetSingleEntityContext" enabled + And new "GetSingleEntityContext" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/k9-cloud-siem + Scenario: Get a single entity context returns "OK" response + Given operation "GetSingleEntityContext" enabled + And new "GetSingleEntityContext" request + And request contains "id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip-validation @team:DataDog/k9-cloud-siem Scenario: Get a suppression rule returns "Not Found" response Given new "GetSecurityMonitoringSuppression" request diff --git a/features/v2/undo.json b/features/v2/undo.json index ff311e33efab..2de79b4feb4e 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -7227,6 +7227,12 @@ "type": "safe" } }, + "GetSingleEntityContext": { + "tag": "Security Monitoring", + "undo": { + "type": "safe" + } + }, "ListSecurityMonitoringRules": { "tag": "Security Monitoring", "undo": { diff --git a/lib/datadog_api_client/configuration.rb b/lib/datadog_api_client/configuration.rb index fefe797663df..e72b5758ecad 100644 --- a/lib/datadog_api_client/configuration.rb +++ b/lib/datadog_api_client/configuration.rb @@ -360,6 +360,7 @@ def initialize "v2.get_security_monitoring_histsignals_by_job_id": false, "v2.get_security_monitoring_integration_config": false, "v2.get_signal_entities": false, + "v2.get_single_entity_context": false, "v2.get_static_analysis_default_rulesets": false, "v2.get_static_analysis_node_types": false, "v2.get_static_analysis_ruleset": false, diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 47c97b3c84f3..0f0830cc8eb9 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -6527,6 +6527,7 @@ def overrides "v2.single_aggregated_dns_response_data_attributes_group_by_items" => "SingleAggregatedDnsResponseDataAttributesGroupByItems", "v2.single_aggregated_dns_response_data_attributes_metrics_items" => "SingleAggregatedDnsResponseDataAttributesMetricsItems", "v2.single_aggregated_dns_response_data_type" => "SingleAggregatedDnsResponseDataType", + "v2.single_entity_context_response" => "SingleEntityContextResponse", "v2.slack_integration_metadata" => "SlackIntegrationMetadata", "v2.slack_integration_metadata_channel_item" => "SlackIntegrationMetadataChannelItem", "v2.slack_trigger_wrapper" => "SlackTriggerWrapper", diff --git a/lib/datadog_api_client/v2/api/security_monitoring_api.rb b/lib/datadog_api_client/v2/api/security_monitoring_api.rb index 94b3626f3971..aa1c85a6039a 100644 --- a/lib/datadog_api_client/v2/api/security_monitoring_api.rb +++ b/lib/datadog_api_client/v2/api/security_monitoring_api.rb @@ -5494,6 +5494,86 @@ def get_signal_notification_rules_with_http_info(opts = {}) return data, status_code, headers end + # Get a single entity context. + # + # @see #get_single_entity_context_with_http_info + def get_single_entity_context(id, opts = {}) + data, _status_code, _headers = get_single_entity_context_with_http_info(id, opts) + data + end + + # Get a single entity context. + # + # Get a single entity from the Cloud SIEM entity context store by its identifier, returning the historical + # revisions of the entity in the requested time range. The endpoint can either return revisions across an + # interval (`from` / `to`) or the snapshot of the entity at a single point in time (`as_of`); the two modes + # are mutually exclusive. + # + # @param id [String] The unique identifier of the entity to retrieve. + # @param opts [Hash] the optional parameters + # @option opts [String] :from The start of the time range to query, as an RFC3339 timestamp or a relative time (for example, `now-7d`). Defaults to `now-7d`. Ignored when `as_of` is set. + # @option opts [String] :to The end of the time range to query, as an RFC3339 timestamp or a relative time (for example, `now`). Defaults to `now`. Ignored when `as_of` is set. + # @option opts [String] :as_of A point in time at which to query the entity revisions, as an RFC3339 timestamp, a Unix timestamp (in seconds), or a relative time (for example, `now-1d`). When set, `from` and `to` are ignored. Cannot be combined with custom `from` / `to` values. + # @return [Array<(SingleEntityContextResponse, Integer, Hash)>] SingleEntityContextResponse data, response status code and response headers + def get_single_entity_context_with_http_info(id, opts = {}) + unstable_enabled = @api_client.config.unstable_operations["v2.get_single_entity_context".to_sym] + if unstable_enabled + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_single_entity_context") + else + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_single_entity_context")) + end + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: SecurityMonitoringAPI.get_single_entity_context ...' + end + # verify the required parameter 'id' is set + if @api_client.config.client_side_validation && id.nil? + fail ArgumentError, "Missing the required parameter 'id' when calling SecurityMonitoringAPI.get_single_entity_context" + end + # resource path + local_var_path = '/api/v2/security_monitoring/entity_context/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil? + query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil? + query_params[:'as_of'] = opts[:'as_of'] if !opts[:'as_of'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'SingleEntityContextResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] + + new_options = opts.merge( + :operation => :get_single_entity_context, + :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::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: SecurityMonitoringAPI#get_single_entity_context\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Get default rulesets for a language. # # @see #get_static_analysis_default_rulesets_with_http_info diff --git a/lib/datadog_api_client/v2/models/single_entity_context_response.rb b/lib/datadog_api_client/v2/models/single_entity_context_response.rb new file mode 100644 index 000000000000..9d3c031cbbc4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/single_entity_context_response.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 + # Response from the single entity context endpoint, containing the matching entity. + class SingleEntityContextResponse + include BaseGenericModel + + # A single entity returned by the entity context endpoint. + 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' => :'EntityContextEntity' + } + 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::SingleEntityContextResponse` 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