From 9f25c66b62d5359059f49dc2c08f17d909b84a4e Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 5 Jun 2026 08:03:32 +0000 Subject: [PATCH] Regenerate client from commit c591f36 of spec repo --- .generator/schemas/v2/openapi.yaml | 594 ++++++++++++++++++ .../CreateReportSchedule.java | 64 ++ .../report-schedules/PatchReportSchedule.java | 64 ++ .../api/client/v2/api/ReportSchedulesApi.java | 347 ++++++++++ .../client/v2/model/ReportScheduleAuthor.java | 209 ++++++ .../model/ReportScheduleAuthorAttributes.java | 181 ++++++ .../v2/model/ReportScheduleAuthorType.java | 55 ++ .../v2/model/ReportScheduleCreateRequest.java | 147 +++++ ...ReportScheduleCreateRequestAttributes.java | 471 ++++++++++++++ .../ReportScheduleCreateRequestData.java | 184 ++++++ .../model/ReportScheduleDeliveryFormat.java | 62 ++ .../model/ReportScheduleIncludedResource.java | 218 +++++++ .../v2/model/ReportSchedulePatchRequest.java | 147 +++++ .../ReportSchedulePatchRequestAttributes.java | 410 ++++++++++++ .../model/ReportSchedulePatchRequestData.java | 185 ++++++ .../v2/model/ReportScheduleResourceType.java | 59 ++ .../v2/model/ReportScheduleResponse.java | 188 ++++++ .../ReportScheduleResponseAttributes.java | 559 ++++++++++++++++ ...eduleResponseAttributesDeliveryFormat.java | 67 ++ .../v2/model/ReportScheduleResponseData.java | 210 +++++++ .../client/v2/model/ReportScheduleStatus.java | 59 ++ .../model/ReportScheduleTemplateVariable.java | 182 ++++++ .../client/v2/model/ReportScheduleType.java | 53 ++ .../client/v2/api/report_schedules.feature | 55 ++ .../com/datadog/api/client/v2/api/undo.json | 13 + 25 files changed, 4783 insertions(+) create mode 100644 examples/v2/report-schedules/CreateReportSchedule.java create mode 100644 examples/v2/report-schedules/PatchReportSchedule.java create mode 100644 src/main/java/com/datadog/api/client/v2/api/ReportSchedulesApi.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthor.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthorAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthorType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleDeliveryFormat.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleIncludedResource.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequestAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequestData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleResourceType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseAttributes.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseAttributesDeliveryFormat.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleStatus.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleTemplateVariable.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ReportScheduleType.java create mode 100644 src/test/resources/com/datadog/api/client/v2/api/report_schedules.feature diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 74b9de40104..938cc42c80a 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -71719,6 +71719,390 @@ components: type: string x-enum-varnames: - RULESET + ReportScheduleAuthor: + description: A user included as a related JSON:API resource. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleAuthorAttributes" + id: + description: The user UUID. + example: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: string + type: + $ref: "#/components/schemas/ReportScheduleAuthorType" + required: + - type + - id + - attributes + type: object + ReportScheduleAuthorAttributes: + description: Attributes of the report author. + properties: + email: + description: The email address of the report author, or `null` if unavailable. + example: "user@example.com" + nullable: true + type: string + name: + description: The display name of the report author, or `null` if unavailable. + example: "Example User" + nullable: true + type: string + required: + - name + - email + type: object + ReportScheduleAuthorType: + description: JSON:API resource type for the included report author. + enum: + - users + example: users + type: string + x-enum-varnames: + - USERS + ReportScheduleCreateRequest: + description: Request body for creating a report schedule. + properties: + data: + $ref: "#/components/schemas/ReportScheduleCreateRequestData" + required: + - data + type: object + ReportScheduleCreateRequestAttributes: + description: The configuration of the report schedule to create. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleDeliveryFormat" + description: + description: A description of the report, up to 4096 characters. + example: "Weekly summary of infrastructure health." + type: string + recipients: + description: |- + The recipients of the report. Each entry is an email address, a Slack channel + reference in the form `slack:{team_id}.{channel_id}.{channel_name}`, or a Microsoft + Teams channel reference in the form `teams:{tenant_id}|{team_id}|{channel_id}`. + example: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + items: + description: A single recipient (email address, Slack channel reference, or Microsoft Teams channel reference). + type: string + type: array + resource_id: + description: The identifier of the dashboard or integration dashboard to render in the report. + example: "abc-def-ghi" + type: string + resource_type: + $ref: "#/components/schemas/ReportScheduleResourceType" + rrule: + description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + example: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + type: string + tab_id: + description: The identifier of the dashboard tab to render, when the dashboard has tabs. + example: "66666666-7777-8888-9999-000000000000" + type: string + template_variables: + description: The dashboard template variables applied when rendering the report. + items: + $ref: "#/components/schemas/ReportScheduleTemplateVariable" + type: array + timeframe: + description: The relative timeframe of data to include in the report (for example, `1w`). + example: "1w" + type: string + timezone: + description: The IANA time zone identifier the recurrence rule is evaluated in. + example: "America/New_York" + type: string + title: + description: The title of the report, between 1 and 78 characters. + example: "Weekly Infrastructure Report" + type: string + required: + - resource_id + - resource_type + - recipients + - rrule + - timezone + - template_variables + - title + - description + type: object + ReportScheduleCreateRequestData: + description: The JSON:API data object for a report schedule creation request. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleCreateRequestAttributes" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - type + - attributes + type: object + ReportScheduleDeliveryFormat: + description: |- + How a PDF-export report is delivered. `pdf` attaches a PDF file, `png` embeds + an inline PNG image, and `pdf_and_png` delivers both. + enum: + - pdf + - png + - pdf_and_png + example: pdf + type: string + x-enum-varnames: + - PDF + - PNG + - PDF_AND_PNG + ReportScheduleIncludedResource: + description: A related resource included with a report schedule. + oneOf: + - $ref: "#/components/schemas/ReportScheduleAuthor" + ReportSchedulePatchRequest: + description: Request body for updating a report schedule. + properties: + data: + $ref: "#/components/schemas/ReportSchedulePatchRequestData" + required: + - data + type: object + ReportSchedulePatchRequestAttributes: + description: |- + The updated configuration of the report schedule. These values replace the existing + ones; the targeted resource (`resource_id` and `resource_type`) cannot be changed. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleDeliveryFormat" + description: + description: A description of the report, up to 4096 characters. + example: "Updated weekly summary of infrastructure health." + maxLength: 4096 + type: string + recipients: + description: |- + The recipients of the report. Each entry is an email address, a Slack channel + reference in the form `slack:{team_id}.{channel_id}.{channel_name}`, or a Microsoft + Teams channel reference in the form `teams:{tenant_id}|{team_id}|{channel_id}`. + example: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + items: + description: A single recipient (email address, Slack channel reference, or Microsoft Teams channel reference). + type: string + type: array + rrule: + description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + example: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + type: string + tab_id: + description: The identifier of the dashboard tab to render, when the dashboard has tabs. + example: "66666666-7777-8888-9999-000000000000" + format: uuid + type: string + template_variables: + description: The dashboard template variables applied when rendering the report. + items: + $ref: "#/components/schemas/ReportScheduleTemplateVariable" + type: array + timeframe: + description: The relative timeframe of data to include in the report (for example, `1w`). + example: "1w" + type: string + timezone: + description: The IANA time zone identifier the recurrence rule is evaluated in. + example: "America/New_York" + type: string + title: + description: The title of the report, between 1 and 78 characters. + example: "Weekly Infrastructure Report" + maxLength: 78 + minLength: 1 + type: string + required: + - recipients + - rrule + - timezone + - template_variables + - title + - description + type: object + ReportSchedulePatchRequestData: + description: The JSON:API data object for a report schedule update request. + properties: + attributes: + $ref: "#/components/schemas/ReportSchedulePatchRequestAttributes" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - type + - attributes + type: object + ReportScheduleResourceType: + description: The type of dashboard resource the report schedule targets. + enum: + - dashboard + - integration_dashboard + example: dashboard + type: string + x-enum-varnames: + - DASHBOARD + - INTEGRATION_DASHBOARD + ReportScheduleResponse: + description: Response containing a single report schedule. + properties: + data: + $ref: "#/components/schemas/ReportScheduleResponseData" + included: + description: Related resources included with the report schedule, such as the author. + items: + $ref: "#/components/schemas/ReportScheduleIncludedResource" + type: array + required: + - data + type: object + ReportScheduleResponseAttributes: + description: The configuration and derived state of a report schedule. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleResponseAttributesDeliveryFormat" + description: + description: The description of the report. + example: "Weekly summary of infrastructure health." + type: string + next_recurrence: + description: The Unix timestamp, in milliseconds, of the next scheduled delivery, or `null` if none is scheduled. + example: 1780923600000 + format: int64 + nullable: true + type: integer + recipients: + description: The recipients of the report (email addresses, Slack channel references, or Microsoft Teams channel references). + example: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + items: + description: A single recipient (email address, Slack channel reference, or Microsoft Teams channel reference). + type: string + type: array + resource_id: + description: The identifier of the resource rendered in the report. + example: "abc-def-ghi" + type: string + resource_type: + $ref: "#/components/schemas/ReportScheduleResourceType" + rrule: + description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + example: "FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + type: string + status: + $ref: "#/components/schemas/ReportScheduleStatus" + tab_id: + description: The identifier of the dashboard tab rendered in the report, or `null` if not set. + example: "66666666-7777-8888-9999-000000000000" + nullable: true + type: string + template_variables: + description: The dashboard template variables applied when rendering the report. + items: + $ref: "#/components/schemas/ReportScheduleTemplateVariable" + type: array + timeframe: + description: The relative timeframe of data included in the report, or `null` if not set. + example: "1w" + nullable: true + type: string + timezone: + description: The IANA time zone identifier the recurrence rule is evaluated in. + example: "America/New_York" + type: string + title: + description: The title of the report. + example: "Weekly Infrastructure Report" + type: string + required: + - status + - resource_id + - resource_type + - recipients + - rrule + - timezone + - template_variables + - title + - description + - timeframe + - next_recurrence + - tab_id + type: object + ReportScheduleResponseAttributesDeliveryFormat: + description: The delivery format for dashboard report schedules, or `null` if not set. + enum: + - pdf + - png + - pdf_and_png + example: pdf + nullable: true + type: string + x-enum-varnames: + - PDF + - PNG + - PDF_AND_PNG + ReportScheduleResponseData: + description: The JSON:API data object representing a report schedule. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleResponseAttributes" + id: + description: The unique identifier of the report schedule. + example: "11111111-2222-3333-4444-555555555555" + type: string + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - id + - type + - attributes + type: object + ReportScheduleStatus: + description: Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + enum: + - active + - inactive + example: active + type: string + x-enum-varnames: + - ACTIVE + - INACTIVE + ReportScheduleTemplateVariable: + description: A dashboard template variable applied when rendering the report. + properties: + name: + description: The name of the template variable. + example: env + type: string + values: + description: The selected values for the template variable. + example: + - "prod" + items: + description: A single selected template variable value. + type: string + type: array + required: + - name + - values + type: object + ReportScheduleType: + description: JSON:API resource type for report schedules. + enum: + - schedule + example: schedule + type: string + x-enum-varnames: + - SCHEDULE ResolveVulnerableSymbolsRequest: description: The top-level request object for resolving vulnerable symbols in a set of packages. properties: @@ -151378,6 +151762,211 @@ paths: summary: Update replay heatmap snapshot tags: - Rum Replay Heatmaps + /api/v2/reporting/schedule: + post: + description: |- + Create a new scheduled report. A schedule renders a dashboard or integration dashboard + on a recurring cadence and delivers it to the configured recipients over email, Slack, + or Microsoft Teams. + Requires the `generate_dashboard_reports` permission. + operationId: CreateReportSchedule + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + recipients: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + type: schedule + schema: + $ref: "#/components/schemas/ReportScheduleCreateRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + description: CREATED + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Create a report schedule + tags: + - Report Schedules + x-codegen-request-body-name: body + /api/v2/reporting/schedule/{schedule_uuid}: + patch: + description: |- + Update an existing scheduled report by its identifier. The editable attributes + are replaced with the supplied values; the targeted resource (`resource_id` and + `resource_type`) cannot be changed after creation. + Requires the `generate_dashboard_reports` permission and schedule ownership. + operationId: PatchReportSchedule + parameters: + - description: The unique identifier of the report schedule to update. + example: "11111111-2222-3333-4444-555555555555" + in: path + name: schedule_uuid + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Updated weekly summary of infrastructure health." + recipients: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + type: schedule + schema: + $ref: "#/components/schemas/ReportSchedulePatchRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Updated weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Update a report schedule + tags: + - Report Schedules + x-codegen-request-body-name: body /api/v2/restriction_policy/{resource_id}: delete: description: Deletes the restriction policy associated with a specified resource. @@ -179332,6 +179921,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.java b/examples/v2/report-schedules/CreateReportSchedule.java new file mode 100644 index 00000000000..0920f558cba --- /dev/null +++ b/examples/v2/report-schedules/CreateReportSchedule.java @@ -0,0 +1,64 @@ +// Create a report schedule returns "CREATED" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ReportSchedulesApi; +import com.datadog.api.client.v2.model.ReportScheduleCreateRequest; +import com.datadog.api.client.v2.model.ReportScheduleCreateRequestAttributes; +import com.datadog.api.client.v2.model.ReportScheduleCreateRequestData; +import com.datadog.api.client.v2.model.ReportScheduleDeliveryFormat; +import com.datadog.api.client.v2.model.ReportScheduleResourceType; +import com.datadog.api.client.v2.model.ReportScheduleResponse; +import com.datadog.api.client.v2.model.ReportScheduleTemplateVariable; +import com.datadog.api.client.v2.model.ReportScheduleType; +import java.util.Arrays; +import java.util.Collections; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ReportSchedulesApi apiInstance = new ReportSchedulesApi(defaultClient); + + ReportScheduleCreateRequest body = + new ReportScheduleCreateRequest() + .data( + new ReportScheduleCreateRequestData() + .attributes( + new ReportScheduleCreateRequestAttributes() + .deliveryFormat(ReportScheduleDeliveryFormat.PDF) + .description("Weekly summary of infrastructure health.") + .recipients( + Arrays.asList( + "user@example.com", + "slack:T01234567.C01234567.alerts", + "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2")) + .resourceId("abc-def-ghi") + .resourceType(ReportScheduleResourceType.DASHBOARD) + .rrule( + """ +DTSTART;TZID=America/New_York:20260601T090000 +RRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0 +""") + .tabId("66666666-7777-8888-9999-000000000000") + .templateVariables( + Collections.singletonList( + new ReportScheduleTemplateVariable() + .name("env") + .values(Collections.singletonList("prod")))) + .timeframe("1w") + .timezone("America/New_York") + .title("Weekly Infrastructure Report")) + .type(ReportScheduleType.SCHEDULE)); + + try { + ReportScheduleResponse result = apiInstance.createReportSchedule(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReportSchedulesApi#createReportSchedule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/report-schedules/PatchReportSchedule.java b/examples/v2/report-schedules/PatchReportSchedule.java new file mode 100644 index 00000000000..b4b78204945 --- /dev/null +++ b/examples/v2/report-schedules/PatchReportSchedule.java @@ -0,0 +1,64 @@ +// Update a report schedule returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.ReportSchedulesApi; +import com.datadog.api.client.v2.model.ReportScheduleDeliveryFormat; +import com.datadog.api.client.v2.model.ReportSchedulePatchRequest; +import com.datadog.api.client.v2.model.ReportSchedulePatchRequestAttributes; +import com.datadog.api.client.v2.model.ReportSchedulePatchRequestData; +import com.datadog.api.client.v2.model.ReportScheduleResponse; +import com.datadog.api.client.v2.model.ReportScheduleTemplateVariable; +import com.datadog.api.client.v2.model.ReportScheduleType; +import java.util.Arrays; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + ReportSchedulesApi apiInstance = new ReportSchedulesApi(defaultClient); + + ReportSchedulePatchRequest body = + new ReportSchedulePatchRequest() + .data( + new ReportSchedulePatchRequestData() + .attributes( + new ReportSchedulePatchRequestAttributes() + .deliveryFormat(ReportScheduleDeliveryFormat.PDF) + .description("Updated weekly summary of infrastructure health.") + .recipients( + Arrays.asList( + "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 +RRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0 +""") + .tabId(UUID.fromString("66666666-7777-8888-9999-000000000000")) + .templateVariables( + Collections.singletonList( + new ReportScheduleTemplateVariable() + .name("env") + .values(Collections.singletonList("prod")))) + .timeframe("1w") + .timezone("America/New_York") + .title("Weekly Infrastructure Report")) + .type(ReportScheduleType.SCHEDULE)); + + try { + ReportScheduleResponse result = + apiInstance.patchReportSchedule( + UUID.fromString("11111111-2222-3333-4444-555555555555"), body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling ReportSchedulesApi#patchReportSchedule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/ReportSchedulesApi.java b/src/main/java/com/datadog/api/client/v2/api/ReportSchedulesApi.java new file mode 100644 index 00000000000..64e4068a138 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/api/ReportSchedulesApi.java @@ -0,0 +1,347 @@ +package com.datadog.api.client.v2.api; + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.ApiResponse; +import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.ReportScheduleCreateRequest; +import com.datadog.api.client.v2.model.ReportSchedulePatchRequest; +import com.datadog.api.client.v2.model.ReportScheduleResponse; +import jakarta.ws.rs.client.Invocation; +import jakarta.ws.rs.core.GenericType; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportSchedulesApi { + private ApiClient apiClient; + + public ReportSchedulesApi() { + this(ApiClient.getDefaultApiClient()); + } + + public ReportSchedulesApi(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Get the API client. + * + * @return API client + */ + public ApiClient getApiClient() { + return apiClient; + } + + /** + * Set the API client. + * + * @param apiClient an instance of API client + */ + public void setApiClient(ApiClient apiClient) { + this.apiClient = apiClient; + } + + /** + * Create a report schedule. + * + *

See {@link #createReportScheduleWithHttpInfo}. + * + * @param body (required) + * @return ReportScheduleResponse + * @throws ApiException if fails to make API call + */ + public ReportScheduleResponse createReportSchedule(ReportScheduleCreateRequest body) + throws ApiException { + return createReportScheduleWithHttpInfo(body).getData(); + } + + /** + * Create a report schedule. + * + *

See {@link #createReportScheduleWithHttpInfoAsync}. + * + * @param body (required) + * @return CompletableFuture<ReportScheduleResponse> + */ + public CompletableFuture createReportScheduleAsync( + ReportScheduleCreateRequest body) { + return createReportScheduleWithHttpInfoAsync(body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 (required) + * @return ApiResponse<ReportScheduleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 CREATED -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse createReportScheduleWithHttpInfo( + ReportScheduleCreateRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling createReportSchedule"); + } + // create path and map variables + String localVarPath = "/api/v2/reporting/schedule"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ReportSchedulesApi.createReportSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create a report schedule. + * + *

See {@link #createReportScheduleWithHttpInfo}. + * + * @param body (required) + * @return CompletableFuture<ApiResponse<ReportScheduleResponse>> + */ + public CompletableFuture> + createReportScheduleWithHttpInfoAsync(ReportScheduleCreateRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling createReportSchedule")); + return result; + } + // create path and map variables + String localVarPath = "/api/v2/reporting/schedule"; + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ReportSchedulesApi.createReportSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a report schedule. + * + *

See {@link #patchReportScheduleWithHttpInfo}. + * + * @param scheduleUuid The unique identifier of the report schedule to update. (required) + * @param body (required) + * @return ReportScheduleResponse + * @throws ApiException if fails to make API call + */ + public ReportScheduleResponse patchReportSchedule( + UUID scheduleUuid, ReportSchedulePatchRequest body) throws ApiException { + return patchReportScheduleWithHttpInfo(scheduleUuid, body).getData(); + } + + /** + * Update a report schedule. + * + *

See {@link #patchReportScheduleWithHttpInfoAsync}. + * + * @param scheduleUuid The unique identifier of the report schedule to update. (required) + * @param body (required) + * @return CompletableFuture<ReportScheduleResponse> + */ + public CompletableFuture patchReportScheduleAsync( + UUID scheduleUuid, ReportSchedulePatchRequest body) { + return patchReportScheduleWithHttpInfoAsync(scheduleUuid, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 scheduleUuid The unique identifier of the report schedule to update. (required) + * @param body (required) + * @return ApiResponse<ReportScheduleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse patchReportScheduleWithHttpInfo( + UUID scheduleUuid, ReportSchedulePatchRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'scheduleUuid' is set + if (scheduleUuid == null) { + throw new ApiException( + 400, "Missing the required parameter 'scheduleUuid' when calling patchReportSchedule"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, "Missing the required parameter 'body' when calling patchReportSchedule"); + } + // create path and map variables + String localVarPath = + "/api/v2/reporting/schedule/{schedule_uuid}" + .replaceAll( + "\\{" + "schedule_uuid" + "\\}", apiClient.escapeString(scheduleUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.ReportSchedulesApi.patchReportSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update a report schedule. + * + *

See {@link #patchReportScheduleWithHttpInfo}. + * + * @param scheduleUuid The unique identifier of the report schedule to update. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<ReportScheduleResponse>> + */ + public CompletableFuture> + patchReportScheduleWithHttpInfoAsync(UUID scheduleUuid, ReportSchedulePatchRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'scheduleUuid' is set + if (scheduleUuid == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'scheduleUuid' when calling patchReportSchedule")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, "Missing the required parameter 'body' when calling patchReportSchedule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/reporting/schedule/{schedule_uuid}" + .replaceAll( + "\\{" + "schedule_uuid" + "\\}", apiClient.escapeString(scheduleUuid.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.ReportSchedulesApi.patchReportSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PATCH", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthor.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthor.java new file mode 100644 index 00000000000..8214b5bc771 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthor.java @@ -0,0 +1,209 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** A user included as a related JSON:API resource. */ +@JsonPropertyOrder({ + ReportScheduleAuthor.JSON_PROPERTY_ATTRIBUTES, + ReportScheduleAuthor.JSON_PROPERTY_ID, + ReportScheduleAuthor.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportScheduleAuthor { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ReportScheduleAuthorAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ReportScheduleAuthorType type; + + public ReportScheduleAuthor() {} + + @JsonCreator + public ReportScheduleAuthor( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ReportScheduleAuthorAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ReportScheduleAuthorType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ReportScheduleAuthor attributes(ReportScheduleAuthorAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Attributes of the report author. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleAuthorAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ReportScheduleAuthorAttributes attributes) { + this.attributes = attributes; + } + + public ReportScheduleAuthor id(String id) { + this.id = id; + return this; + } + + /** + * The user UUID. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ReportScheduleAuthor type(ReportScheduleAuthorType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API resource type for the included report author. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleAuthorType getType() { + return type; + } + + public void setType(ReportScheduleAuthorType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportScheduleAuthor + */ + @JsonAnySetter + public ReportScheduleAuthor putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportScheduleAuthor object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportScheduleAuthor reportScheduleAuthor = (ReportScheduleAuthor) o; + return Objects.equals(this.attributes, reportScheduleAuthor.attributes) + && Objects.equals(this.id, reportScheduleAuthor.id) + && Objects.equals(this.type, reportScheduleAuthor.type) + && Objects.equals(this.additionalProperties, reportScheduleAuthor.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportScheduleAuthor {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthorAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthorAttributes.java new file mode 100644 index 00000000000..6bf698f3d63 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthorAttributes.java @@ -0,0 +1,181 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Attributes of the report author. */ +@JsonPropertyOrder({ + ReportScheduleAuthorAttributes.JSON_PROPERTY_EMAIL, + ReportScheduleAuthorAttributes.JSON_PROPERTY_NAME +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportScheduleAuthorAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EMAIL = "email"; + private String email; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public ReportScheduleAuthorAttributes() {} + + @JsonCreator + public ReportScheduleAuthorAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_EMAIL) String email, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name) { + this.email = email; + if (email != null) {} + this.name = name; + if (name != null) {} + } + + public ReportScheduleAuthorAttributes email(String email) { + this.email = email; + if (email != null) {} + return this; + } + + /** + * The email address of the report author, or null if unavailable. + * + * @return email + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EMAIL) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public ReportScheduleAuthorAttributes name(String name) { + this.name = name; + if (name != null) {} + return this; + } + + /** + * The display name of the report author, or null if unavailable. + * + * @return name + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportScheduleAuthorAttributes + */ + @JsonAnySetter + public ReportScheduleAuthorAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportScheduleAuthorAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportScheduleAuthorAttributes reportScheduleAuthorAttributes = + (ReportScheduleAuthorAttributes) o; + return Objects.equals(this.email, reportScheduleAuthorAttributes.email) + && Objects.equals(this.name, reportScheduleAuthorAttributes.name) + && Objects.equals( + this.additionalProperties, reportScheduleAuthorAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(email, name, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportScheduleAuthorAttributes {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthorType.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthorType.java new file mode 100644 index 00000000000..8ee5b985b06 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleAuthorType.java @@ -0,0 +1,55 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** JSON:API resource type for the included report author. */ +@JsonSerialize(using = ReportScheduleAuthorType.ReportScheduleAuthorTypeSerializer.class) +public class ReportScheduleAuthorType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("users")); + + public static final ReportScheduleAuthorType USERS = new ReportScheduleAuthorType("users"); + + ReportScheduleAuthorType(String value) { + super(value, allowedValues); + } + + public static class ReportScheduleAuthorTypeSerializer + extends StdSerializer { + public ReportScheduleAuthorTypeSerializer(Class t) { + super(t); + } + + public ReportScheduleAuthorTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ReportScheduleAuthorType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ReportScheduleAuthorType fromValue(String value) { + return new ReportScheduleAuthorType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequest.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequest.java new file mode 100644 index 00000000000..4ecf483028d --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequest.java @@ -0,0 +1,147 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request body for creating a report schedule. */ +@JsonPropertyOrder({ReportScheduleCreateRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportScheduleCreateRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ReportScheduleCreateRequestData data; + + public ReportScheduleCreateRequest() {} + + @JsonCreator + public ReportScheduleCreateRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + ReportScheduleCreateRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public ReportScheduleCreateRequest data(ReportScheduleCreateRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The JSON:API data object for a report schedule creation request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleCreateRequestData getData() { + return data; + } + + public void setData(ReportScheduleCreateRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportScheduleCreateRequest + */ + @JsonAnySetter + public ReportScheduleCreateRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportScheduleCreateRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportScheduleCreateRequest reportScheduleCreateRequest = (ReportScheduleCreateRequest) o; + return Objects.equals(this.data, reportScheduleCreateRequest.data) + && Objects.equals( + this.additionalProperties, reportScheduleCreateRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportScheduleCreateRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequestAttributes.java new file mode 100644 index 00000000000..b0f8eb84e8f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequestAttributes.java @@ -0,0 +1,471 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** The configuration of the report schedule to create. */ +@JsonPropertyOrder({ + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_DELIVERY_FORMAT, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_DESCRIPTION, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_RECIPIENTS, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_RESOURCE_ID, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_RESOURCE_TYPE, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_RRULE, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_TAB_ID, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_TEMPLATE_VARIABLES, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_TIMEFRAME, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_TIMEZONE, + ReportScheduleCreateRequestAttributes.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportScheduleCreateRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DELIVERY_FORMAT = "delivery_format"; + private ReportScheduleDeliveryFormat deliveryFormat; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_RECIPIENTS = "recipients"; + private List recipients = new ArrayList<>(); + + public static final String JSON_PROPERTY_RESOURCE_ID = "resource_id"; + private String resourceId; + + public static final String JSON_PROPERTY_RESOURCE_TYPE = "resource_type"; + private ReportScheduleResourceType resourceType; + + public static final String JSON_PROPERTY_RRULE = "rrule"; + private String rrule; + + public static final String JSON_PROPERTY_TAB_ID = "tab_id"; + private String tabId; + + public static final String JSON_PROPERTY_TEMPLATE_VARIABLES = "template_variables"; + private List templateVariables = new ArrayList<>(); + + public static final String JSON_PROPERTY_TIMEFRAME = "timeframe"; + private String timeframe; + + public static final String JSON_PROPERTY_TIMEZONE = "timezone"; + private String timezone; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public ReportScheduleCreateRequestAttributes() {} + + @JsonCreator + public ReportScheduleCreateRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_RECIPIENTS) List recipients, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_ID) String resourceId, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_TYPE) + ReportScheduleResourceType resourceType, + @JsonProperty(required = true, value = JSON_PROPERTY_RRULE) String rrule, + @JsonProperty(required = true, value = JSON_PROPERTY_TEMPLATE_VARIABLES) + List templateVariables, + @JsonProperty(required = true, value = JSON_PROPERTY_TIMEZONE) String timezone, + @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title) { + this.description = description; + this.recipients = recipients; + this.resourceId = resourceId; + this.resourceType = resourceType; + this.unparsed |= !resourceType.isValid(); + this.rrule = rrule; + this.templateVariables = templateVariables; + this.timezone = timezone; + this.title = title; + } + + public ReportScheduleCreateRequestAttributes deliveryFormat( + ReportScheduleDeliveryFormat deliveryFormat) { + this.deliveryFormat = deliveryFormat; + this.unparsed |= !deliveryFormat.isValid(); + return this; + } + + /** + * How a PDF-export report is delivered. pdf attaches a PDF file, png + * embeds an inline PNG image, and pdf_and_png delivers both. + * + * @return deliveryFormat + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELIVERY_FORMAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ReportScheduleDeliveryFormat getDeliveryFormat() { + return deliveryFormat; + } + + public void setDeliveryFormat(ReportScheduleDeliveryFormat deliveryFormat) { + if (!deliveryFormat.isValid()) { + this.unparsed = true; + } + this.deliveryFormat = deliveryFormat; + } + + public ReportScheduleCreateRequestAttributes description(String description) { + this.description = description; + return this; + } + + /** + * A description of the report, up to 4096 characters. + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ReportScheduleCreateRequestAttributes recipients(List recipients) { + this.recipients = recipients; + return this; + } + + public ReportScheduleCreateRequestAttributes addRecipientsItem(String recipientsItem) { + this.recipients.add(recipientsItem); + return this; + } + + /** + * 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}. + * + * @return recipients + */ + @JsonProperty(JSON_PROPERTY_RECIPIENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRecipients() { + return recipients; + } + + public void setRecipients(List recipients) { + this.recipients = recipients; + } + + public ReportScheduleCreateRequestAttributes resourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * The identifier of the dashboard or integration dashboard to render in the report. + * + * @return resourceId + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public ReportScheduleCreateRequestAttributes resourceType( + ReportScheduleResourceType resourceType) { + this.resourceType = resourceType; + this.unparsed |= !resourceType.isValid(); + return this; + } + + /** + * The type of dashboard resource the report schedule targets. + * + * @return resourceType + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleResourceType getResourceType() { + return resourceType; + } + + public void setResourceType(ReportScheduleResourceType resourceType) { + if (!resourceType.isValid()) { + this.unparsed = true; + } + this.resourceType = resourceType; + } + + public ReportScheduleCreateRequestAttributes rrule(String rrule) { + this.rrule = rrule; + return this; + } + + /** + * The recurrence rule for the schedule, expressed as an iCalendar RRULE string. + * + * @return rrule + */ + @JsonProperty(JSON_PROPERTY_RRULE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRrule() { + return rrule; + } + + public void setRrule(String rrule) { + this.rrule = rrule; + } + + public ReportScheduleCreateRequestAttributes tabId(String tabId) { + this.tabId = tabId; + return this; + } + + /** + * The identifier of the dashboard tab to render, when the dashboard has tabs. + * + * @return tabId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAB_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTabId() { + return tabId; + } + + public void setTabId(String tabId) { + this.tabId = tabId; + } + + public ReportScheduleCreateRequestAttributes templateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + for (ReportScheduleTemplateVariable item : templateVariables) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ReportScheduleCreateRequestAttributes addTemplateVariablesItem( + ReportScheduleTemplateVariable templateVariablesItem) { + this.templateVariables.add(templateVariablesItem); + this.unparsed |= templateVariablesItem.unparsed; + return this; + } + + /** + * The dashboard template variables applied when rendering the report. + * + * @return templateVariables + */ + @JsonProperty(JSON_PROPERTY_TEMPLATE_VARIABLES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTemplateVariables() { + return templateVariables; + } + + public void setTemplateVariables(List templateVariables) { + this.templateVariables = templateVariables; + } + + public ReportScheduleCreateRequestAttributes timeframe(String timeframe) { + this.timeframe = timeframe; + return this; + } + + /** + * The relative timeframe of data to include in the report (for example, 1w). + * + * @return timeframe + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMEFRAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTimeframe() { + return timeframe; + } + + public void setTimeframe(String timeframe) { + this.timeframe = timeframe; + } + + public ReportScheduleCreateRequestAttributes timezone(String timezone) { + this.timezone = timezone; + return this; + } + + /** + * The IANA time zone identifier the recurrence rule is evaluated in. + * + * @return timezone + */ + @JsonProperty(JSON_PROPERTY_TIMEZONE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTimezone() { + return timezone; + } + + public void setTimezone(String timezone) { + this.timezone = timezone; + } + + public ReportScheduleCreateRequestAttributes title(String title) { + this.title = title; + return this; + } + + /** + * The title of the report, between 1 and 78 characters. + * + * @return title + */ + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportScheduleCreateRequestAttributes + */ + @JsonAnySetter + public ReportScheduleCreateRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportScheduleCreateRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportScheduleCreateRequestAttributes reportScheduleCreateRequestAttributes = + (ReportScheduleCreateRequestAttributes) o; + return Objects.equals(this.deliveryFormat, reportScheduleCreateRequestAttributes.deliveryFormat) + && Objects.equals(this.description, reportScheduleCreateRequestAttributes.description) + && Objects.equals(this.recipients, reportScheduleCreateRequestAttributes.recipients) + && Objects.equals(this.resourceId, reportScheduleCreateRequestAttributes.resourceId) + && Objects.equals(this.resourceType, reportScheduleCreateRequestAttributes.resourceType) + && Objects.equals(this.rrule, reportScheduleCreateRequestAttributes.rrule) + && Objects.equals(this.tabId, reportScheduleCreateRequestAttributes.tabId) + && Objects.equals( + this.templateVariables, reportScheduleCreateRequestAttributes.templateVariables) + && Objects.equals(this.timeframe, reportScheduleCreateRequestAttributes.timeframe) + && Objects.equals(this.timezone, reportScheduleCreateRequestAttributes.timezone) + && Objects.equals(this.title, reportScheduleCreateRequestAttributes.title) + && Objects.equals( + this.additionalProperties, reportScheduleCreateRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + deliveryFormat, + description, + recipients, + resourceId, + resourceType, + rrule, + tabId, + templateVariables, + timeframe, + timezone, + title, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportScheduleCreateRequestAttributes {\n"); + sb.append(" deliveryFormat: ").append(toIndentedString(deliveryFormat)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" recipients: ").append(toIndentedString(recipients)).append("\n"); + sb.append(" resourceId: ").append(toIndentedString(resourceId)).append("\n"); + sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); + sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n"); + sb.append(" tabId: ").append(toIndentedString(tabId)).append("\n"); + sb.append(" templateVariables: ").append(toIndentedString(templateVariables)).append("\n"); + sb.append(" timeframe: ").append(toIndentedString(timeframe)).append("\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequestData.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequestData.java new file mode 100644 index 00000000000..0331af455a2 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleCreateRequestData.java @@ -0,0 +1,184 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The JSON:API data object for a report schedule creation request. */ +@JsonPropertyOrder({ + ReportScheduleCreateRequestData.JSON_PROPERTY_ATTRIBUTES, + ReportScheduleCreateRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportScheduleCreateRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ReportScheduleCreateRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ReportScheduleType type; + + public ReportScheduleCreateRequestData() {} + + @JsonCreator + public ReportScheduleCreateRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ReportScheduleCreateRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ReportScheduleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ReportScheduleCreateRequestData attributes( + ReportScheduleCreateRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The configuration of the report schedule to create. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleCreateRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ReportScheduleCreateRequestAttributes attributes) { + this.attributes = attributes; + } + + public ReportScheduleCreateRequestData type(ReportScheduleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API resource type for report schedules. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleType getType() { + return type; + } + + public void setType(ReportScheduleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportScheduleCreateRequestData + */ + @JsonAnySetter + public ReportScheduleCreateRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportScheduleCreateRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportScheduleCreateRequestData reportScheduleCreateRequestData = + (ReportScheduleCreateRequestData) o; + return Objects.equals(this.attributes, reportScheduleCreateRequestData.attributes) + && Objects.equals(this.type, reportScheduleCreateRequestData.type) + && Objects.equals( + this.additionalProperties, reportScheduleCreateRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportScheduleCreateRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleDeliveryFormat.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleDeliveryFormat.java new file mode 100644 index 00000000000..67177e49314 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleDeliveryFormat.java @@ -0,0 +1,62 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * How a PDF-export report is delivered. pdf attaches a PDF file, png + * embeds an inline PNG image, and pdf_and_png delivers both. + */ +@JsonSerialize(using = ReportScheduleDeliveryFormat.ReportScheduleDeliveryFormatSerializer.class) +public class ReportScheduleDeliveryFormat extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pdf", "png", "pdf_and_png")); + + public static final ReportScheduleDeliveryFormat PDF = new ReportScheduleDeliveryFormat("pdf"); + public static final ReportScheduleDeliveryFormat PNG = new ReportScheduleDeliveryFormat("png"); + public static final ReportScheduleDeliveryFormat PDF_AND_PNG = + new ReportScheduleDeliveryFormat("pdf_and_png"); + + ReportScheduleDeliveryFormat(String value) { + super(value, allowedValues); + } + + public static class ReportScheduleDeliveryFormatSerializer + extends StdSerializer { + public ReportScheduleDeliveryFormatSerializer(Class t) { + super(t); + } + + public ReportScheduleDeliveryFormatSerializer() { + this(null); + } + + @Override + public void serialize( + ReportScheduleDeliveryFormat value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ReportScheduleDeliveryFormat fromValue(String value) { + return new ReportScheduleDeliveryFormat(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleIncludedResource.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleIncludedResource.java new file mode 100644 index 00000000000..aa0de0fcb67 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleIncludedResource.java @@ -0,0 +1,218 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.AbstractOpenApiSchema; +import com.datadog.api.client.JSON; +import com.datadog.api.client.UnparsedObject; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import jakarta.ws.rs.core.GenericType; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +@JsonDeserialize( + using = ReportScheduleIncludedResource.ReportScheduleIncludedResourceDeserializer.class) +@JsonSerialize( + using = ReportScheduleIncludedResource.ReportScheduleIncludedResourceSerializer.class) +public class ReportScheduleIncludedResource extends AbstractOpenApiSchema { + private static final Logger log = + Logger.getLogger(ReportScheduleIncludedResource.class.getName()); + + @JsonIgnore public boolean unparsed = false; + + public static class ReportScheduleIncludedResourceSerializer + extends StdSerializer { + public ReportScheduleIncludedResourceSerializer(Class t) { + super(t); + } + + public ReportScheduleIncludedResourceSerializer() { + this(null); + } + + @Override + public void serialize( + ReportScheduleIncludedResource value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.getActualInstance()); + } + } + + public static class ReportScheduleIncludedResourceDeserializer + extends StdDeserializer { + public ReportScheduleIncludedResourceDeserializer() { + this(ReportScheduleIncludedResource.class); + } + + public ReportScheduleIncludedResourceDeserializer(Class vc) { + super(vc); + } + + @Override + public ReportScheduleIncludedResource deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException, JsonProcessingException { + JsonNode tree = jp.readValueAsTree(); + Object deserialized = null; + Object tmp = null; + boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS); + int match = 0; + JsonToken token = tree.traverse(jp.getCodec()).nextToken(); + // deserialize ReportScheduleAuthor + try { + boolean attemptParsing = true; + // ensure that we respect type coercion as set on the client ObjectMapper + if (ReportScheduleAuthor.class.equals(Integer.class) + || ReportScheduleAuthor.class.equals(Long.class) + || ReportScheduleAuthor.class.equals(Float.class) + || ReportScheduleAuthor.class.equals(Double.class) + || ReportScheduleAuthor.class.equals(Boolean.class) + || ReportScheduleAuthor.class.equals(String.class)) { + attemptParsing = typeCoercion; + if (!attemptParsing) { + attemptParsing |= + ((ReportScheduleAuthor.class.equals(Integer.class) + || ReportScheduleAuthor.class.equals(Long.class)) + && token == JsonToken.VALUE_NUMBER_INT); + attemptParsing |= + ((ReportScheduleAuthor.class.equals(Float.class) + || ReportScheduleAuthor.class.equals(Double.class)) + && (token == JsonToken.VALUE_NUMBER_FLOAT + || token == JsonToken.VALUE_NUMBER_INT)); + attemptParsing |= + (ReportScheduleAuthor.class.equals(Boolean.class) + && (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE)); + attemptParsing |= + (ReportScheduleAuthor.class.equals(String.class) + && token == JsonToken.VALUE_STRING); + } + } + if (attemptParsing) { + tmp = tree.traverse(jp.getCodec()).readValueAs(ReportScheduleAuthor.class); + // TODO: there is no validation against JSON schema constraints + // (min, max, enum, pattern...), this does not perform a strict JSON + // validation, which means the 'match' count may be higher than it should be. + if (!((ReportScheduleAuthor) tmp).unparsed) { + deserialized = tmp; + match++; + } + log.log(Level.FINER, "Input data matches schema 'ReportScheduleAuthor'"); + } + } catch (Exception e) { + // deserialization failed, continue + log.log(Level.FINER, "Input data does not match schema 'ReportScheduleAuthor'", e); + } + + ReportScheduleIncludedResource ret = new ReportScheduleIncludedResource(); + if (match == 1) { + ret.setActualInstance(deserialized); + } else { + Map res = + new ObjectMapper() + .readValue( + tree.traverse(jp.getCodec()).readValueAsTree().toString(), + new TypeReference>() {}); + ret.setActualInstance(new UnparsedObject(res)); + } + return ret; + } + + /** Handle deserialization of the 'null' value. */ + @Override + public ReportScheduleIncludedResource getNullValue(DeserializationContext ctxt) + throws JsonMappingException { + throw new JsonMappingException( + ctxt.getParser(), "ReportScheduleIncludedResource cannot be null"); + } + } + + // store a list of schema names defined in oneOf + public static final Map schemas = new HashMap(); + + public ReportScheduleIncludedResource() { + super("oneOf", Boolean.FALSE); + } + + public ReportScheduleIncludedResource(ReportScheduleAuthor o) { + super("oneOf", Boolean.FALSE); + setActualInstance(o); + } + + static { + schemas.put("ReportScheduleAuthor", new GenericType() {}); + JSON.registerDescendants( + ReportScheduleIncludedResource.class, Collections.unmodifiableMap(schemas)); + } + + @Override + public Map getSchemas() { + return ReportScheduleIncludedResource.schemas; + } + + /** + * Set the instance that matches the oneOf child schema, check the instance parameter is valid + * against the oneOf child schemas: ReportScheduleAuthor + * + *

It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a + * composed schema (allOf, anyOf, oneOf). + */ + @Override + public void setActualInstance(Object instance) { + if (JSON.isInstanceOf(ReportScheduleAuthor.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + + if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet>())) { + super.setActualInstance(instance); + return; + } + throw new RuntimeException("Invalid instance type. Must be ReportScheduleAuthor"); + } + + /** + * Get the actual instance, which can be the following: ReportScheduleAuthor + * + * @return The actual instance (ReportScheduleAuthor) + */ + @Override + public Object getActualInstance() { + return super.getActualInstance(); + } + + /** + * Get the actual instance of `ReportScheduleAuthor`. If the actual instance is not + * `ReportScheduleAuthor`, the ClassCastException will be thrown. + * + * @return The actual instance of `ReportScheduleAuthor` + * @throws ClassCastException if the instance is not `ReportScheduleAuthor` + */ + public ReportScheduleAuthor getReportScheduleAuthor() throws ClassCastException { + return (ReportScheduleAuthor) super.getActualInstance(); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequest.java b/src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequest.java new file mode 100644 index 00000000000..0cb307d1a89 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequest.java @@ -0,0 +1,147 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request body for updating a report schedule. */ +@JsonPropertyOrder({ReportSchedulePatchRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportSchedulePatchRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ReportSchedulePatchRequestData data; + + public ReportSchedulePatchRequest() {} + + @JsonCreator + public ReportSchedulePatchRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + ReportSchedulePatchRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public ReportSchedulePatchRequest data(ReportSchedulePatchRequestData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The JSON:API data object for a report schedule update request. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportSchedulePatchRequestData getData() { + return data; + } + + public void setData(ReportSchedulePatchRequestData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportSchedulePatchRequest + */ + @JsonAnySetter + public ReportSchedulePatchRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportSchedulePatchRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportSchedulePatchRequest reportSchedulePatchRequest = (ReportSchedulePatchRequest) o; + return Objects.equals(this.data, reportSchedulePatchRequest.data) + && Objects.equals( + this.additionalProperties, reportSchedulePatchRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportSchedulePatchRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequestAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequestAttributes.java new file mode 100644 index 00000000000..fc266e44ffb --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequestAttributes.java @@ -0,0 +1,410 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** + * The updated configuration of the report schedule. These values replace the existing ones; the + * targeted resource (resource_id and resource_type) cannot be changed. + */ +@JsonPropertyOrder({ + ReportSchedulePatchRequestAttributes.JSON_PROPERTY_DELIVERY_FORMAT, + ReportSchedulePatchRequestAttributes.JSON_PROPERTY_DESCRIPTION, + ReportSchedulePatchRequestAttributes.JSON_PROPERTY_RECIPIENTS, + ReportSchedulePatchRequestAttributes.JSON_PROPERTY_RRULE, + ReportSchedulePatchRequestAttributes.JSON_PROPERTY_TAB_ID, + ReportSchedulePatchRequestAttributes.JSON_PROPERTY_TEMPLATE_VARIABLES, + ReportSchedulePatchRequestAttributes.JSON_PROPERTY_TIMEFRAME, + ReportSchedulePatchRequestAttributes.JSON_PROPERTY_TIMEZONE, + ReportSchedulePatchRequestAttributes.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportSchedulePatchRequestAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DELIVERY_FORMAT = "delivery_format"; + private ReportScheduleDeliveryFormat deliveryFormat; + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_RECIPIENTS = "recipients"; + private List recipients = new ArrayList<>(); + + public static final String JSON_PROPERTY_RRULE = "rrule"; + private String rrule; + + public static final String JSON_PROPERTY_TAB_ID = "tab_id"; + private UUID tabId; + + public static final String JSON_PROPERTY_TEMPLATE_VARIABLES = "template_variables"; + private List templateVariables = new ArrayList<>(); + + public static final String JSON_PROPERTY_TIMEFRAME = "timeframe"; + private String timeframe; + + public static final String JSON_PROPERTY_TIMEZONE = "timezone"; + private String timezone; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public ReportSchedulePatchRequestAttributes() {} + + @JsonCreator + public ReportSchedulePatchRequestAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_RECIPIENTS) List recipients, + @JsonProperty(required = true, value = JSON_PROPERTY_RRULE) String rrule, + @JsonProperty(required = true, value = JSON_PROPERTY_TEMPLATE_VARIABLES) + List templateVariables, + @JsonProperty(required = true, value = JSON_PROPERTY_TIMEZONE) String timezone, + @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title) { + this.description = description; + this.recipients = recipients; + this.rrule = rrule; + this.templateVariables = templateVariables; + this.timezone = timezone; + this.title = title; + } + + public ReportSchedulePatchRequestAttributes deliveryFormat( + ReportScheduleDeliveryFormat deliveryFormat) { + this.deliveryFormat = deliveryFormat; + this.unparsed |= !deliveryFormat.isValid(); + return this; + } + + /** + * How a PDF-export report is delivered. pdf attaches a PDF file, png + * embeds an inline PNG image, and pdf_and_png delivers both. + * + * @return deliveryFormat + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_DELIVERY_FORMAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ReportScheduleDeliveryFormat getDeliveryFormat() { + return deliveryFormat; + } + + public void setDeliveryFormat(ReportScheduleDeliveryFormat deliveryFormat) { + if (!deliveryFormat.isValid()) { + this.unparsed = true; + } + this.deliveryFormat = deliveryFormat; + } + + public ReportSchedulePatchRequestAttributes description(String description) { + this.description = description; + return this; + } + + /** + * A description of the report, up to 4096 characters. + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ReportSchedulePatchRequestAttributes recipients(List recipients) { + this.recipients = recipients; + return this; + } + + public ReportSchedulePatchRequestAttributes addRecipientsItem(String recipientsItem) { + this.recipients.add(recipientsItem); + return this; + } + + /** + * 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}. + * + * @return recipients + */ + @JsonProperty(JSON_PROPERTY_RECIPIENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRecipients() { + return recipients; + } + + public void setRecipients(List recipients) { + this.recipients = recipients; + } + + public ReportSchedulePatchRequestAttributes rrule(String rrule) { + this.rrule = rrule; + return this; + } + + /** + * The recurrence rule for the schedule, expressed as an iCalendar RRULE string. + * + * @return rrule + */ + @JsonProperty(JSON_PROPERTY_RRULE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRrule() { + return rrule; + } + + public void setRrule(String rrule) { + this.rrule = rrule; + } + + public ReportSchedulePatchRequestAttributes tabId(UUID tabId) { + this.tabId = tabId; + return this; + } + + /** + * The identifier of the dashboard tab to render, when the dashboard has tabs. + * + * @return tabId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAB_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getTabId() { + return tabId; + } + + public void setTabId(UUID tabId) { + this.tabId = tabId; + } + + public ReportSchedulePatchRequestAttributes templateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + for (ReportScheduleTemplateVariable item : templateVariables) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ReportSchedulePatchRequestAttributes addTemplateVariablesItem( + ReportScheduleTemplateVariable templateVariablesItem) { + this.templateVariables.add(templateVariablesItem); + this.unparsed |= templateVariablesItem.unparsed; + return this; + } + + /** + * The dashboard template variables applied when rendering the report. + * + * @return templateVariables + */ + @JsonProperty(JSON_PROPERTY_TEMPLATE_VARIABLES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTemplateVariables() { + return templateVariables; + } + + public void setTemplateVariables(List templateVariables) { + this.templateVariables = templateVariables; + } + + public ReportSchedulePatchRequestAttributes timeframe(String timeframe) { + this.timeframe = timeframe; + return this; + } + + /** + * The relative timeframe of data to include in the report (for example, 1w). + * + * @return timeframe + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMEFRAME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getTimeframe() { + return timeframe; + } + + public void setTimeframe(String timeframe) { + this.timeframe = timeframe; + } + + public ReportSchedulePatchRequestAttributes timezone(String timezone) { + this.timezone = timezone; + return this; + } + + /** + * The IANA time zone identifier the recurrence rule is evaluated in. + * + * @return timezone + */ + @JsonProperty(JSON_PROPERTY_TIMEZONE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTimezone() { + return timezone; + } + + public void setTimezone(String timezone) { + this.timezone = timezone; + } + + public ReportSchedulePatchRequestAttributes title(String title) { + this.title = title; + return this; + } + + /** + * The title of the report, between 1 and 78 characters. + * + * @return title + */ + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportSchedulePatchRequestAttributes + */ + @JsonAnySetter + public ReportSchedulePatchRequestAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportSchedulePatchRequestAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportSchedulePatchRequestAttributes reportSchedulePatchRequestAttributes = + (ReportSchedulePatchRequestAttributes) o; + return Objects.equals(this.deliveryFormat, reportSchedulePatchRequestAttributes.deliveryFormat) + && Objects.equals(this.description, reportSchedulePatchRequestAttributes.description) + && Objects.equals(this.recipients, reportSchedulePatchRequestAttributes.recipients) + && Objects.equals(this.rrule, reportSchedulePatchRequestAttributes.rrule) + && Objects.equals(this.tabId, reportSchedulePatchRequestAttributes.tabId) + && Objects.equals( + this.templateVariables, reportSchedulePatchRequestAttributes.templateVariables) + && Objects.equals(this.timeframe, reportSchedulePatchRequestAttributes.timeframe) + && Objects.equals(this.timezone, reportSchedulePatchRequestAttributes.timezone) + && Objects.equals(this.title, reportSchedulePatchRequestAttributes.title) + && Objects.equals( + this.additionalProperties, reportSchedulePatchRequestAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + deliveryFormat, + description, + recipients, + rrule, + tabId, + templateVariables, + timeframe, + timezone, + title, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportSchedulePatchRequestAttributes {\n"); + sb.append(" deliveryFormat: ").append(toIndentedString(deliveryFormat)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" recipients: ").append(toIndentedString(recipients)).append("\n"); + sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n"); + sb.append(" tabId: ").append(toIndentedString(tabId)).append("\n"); + sb.append(" templateVariables: ").append(toIndentedString(templateVariables)).append("\n"); + sb.append(" timeframe: ").append(toIndentedString(timeframe)).append("\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequestData.java b/src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequestData.java new file mode 100644 index 00000000000..88aa77fb0ed --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportSchedulePatchRequestData.java @@ -0,0 +1,185 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The JSON:API data object for a report schedule update request. */ +@JsonPropertyOrder({ + ReportSchedulePatchRequestData.JSON_PROPERTY_ATTRIBUTES, + ReportSchedulePatchRequestData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportSchedulePatchRequestData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ReportSchedulePatchRequestAttributes attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ReportScheduleType type; + + public ReportSchedulePatchRequestData() {} + + @JsonCreator + public ReportSchedulePatchRequestData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ReportSchedulePatchRequestAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ReportScheduleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ReportSchedulePatchRequestData attributes( + ReportSchedulePatchRequestAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The updated configuration of the report schedule. These values replace the existing ones; the + * targeted resource (resource_id and resource_type) cannot be changed. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportSchedulePatchRequestAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ReportSchedulePatchRequestAttributes attributes) { + this.attributes = attributes; + } + + public ReportSchedulePatchRequestData type(ReportScheduleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API resource type for report schedules. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleType getType() { + return type; + } + + public void setType(ReportScheduleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportSchedulePatchRequestData + */ + @JsonAnySetter + public ReportSchedulePatchRequestData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportSchedulePatchRequestData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportSchedulePatchRequestData reportSchedulePatchRequestData = + (ReportSchedulePatchRequestData) o; + return Objects.equals(this.attributes, reportSchedulePatchRequestData.attributes) + && Objects.equals(this.type, reportSchedulePatchRequestData.type) + && Objects.equals( + this.additionalProperties, reportSchedulePatchRequestData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportSchedulePatchRequestData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResourceType.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResourceType.java new file mode 100644 index 00000000000..2a31918bae7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResourceType.java @@ -0,0 +1,59 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of dashboard resource the report schedule targets. */ +@JsonSerialize(using = ReportScheduleResourceType.ReportScheduleResourceTypeSerializer.class) +public class ReportScheduleResourceType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("dashboard", "integration_dashboard")); + + public static final ReportScheduleResourceType DASHBOARD = + new ReportScheduleResourceType("dashboard"); + public static final ReportScheduleResourceType INTEGRATION_DASHBOARD = + new ReportScheduleResourceType("integration_dashboard"); + + ReportScheduleResourceType(String value) { + super(value, allowedValues); + } + + public static class ReportScheduleResourceTypeSerializer + extends StdSerializer { + public ReportScheduleResourceTypeSerializer(Class t) { + super(t); + } + + public ReportScheduleResourceTypeSerializer() { + this(null); + } + + @Override + public void serialize( + ReportScheduleResourceType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ReportScheduleResourceType fromValue(String value) { + return new ReportScheduleResourceType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponse.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponse.java new file mode 100644 index 00000000000..ce64b1d3b71 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponse.java @@ -0,0 +1,188 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing a single report schedule. */ +@JsonPropertyOrder({ + ReportScheduleResponse.JSON_PROPERTY_DATA, + ReportScheduleResponse.JSON_PROPERTY_INCLUDED +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportScheduleResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private ReportScheduleResponseData data; + + public static final String JSON_PROPERTY_INCLUDED = "included"; + private List included = null; + + public ReportScheduleResponse() {} + + @JsonCreator + public ReportScheduleResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) ReportScheduleResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public ReportScheduleResponse data(ReportScheduleResponseData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * The JSON:API data object representing a report schedule. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleResponseData getData() { + return data; + } + + public void setData(ReportScheduleResponseData data) { + this.data = data; + } + + public ReportScheduleResponse included(List included) { + this.included = included; + for (ReportScheduleIncludedResource item : included) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ReportScheduleResponse addIncludedItem(ReportScheduleIncludedResource includedItem) { + if (this.included == null) { + this.included = new ArrayList<>(); + } + this.included.add(includedItem); + this.unparsed |= includedItem.unparsed; + return this; + } + + /** + * Related resources included with the report schedule, such as the author. + * + * @return included + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_INCLUDED) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getIncluded() { + return included; + } + + public void setIncluded(List included) { + this.included = included; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportScheduleResponse + */ + @JsonAnySetter + public ReportScheduleResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportScheduleResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportScheduleResponse reportScheduleResponse = (ReportScheduleResponse) o; + return Objects.equals(this.data, reportScheduleResponse.data) + && Objects.equals(this.included, reportScheduleResponse.included) + && Objects.equals(this.additionalProperties, reportScheduleResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, included, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportScheduleResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" included: ").append(toIndentedString(included)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseAttributes.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseAttributes.java new file mode 100644 index 00000000000..bed20d70f60 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseAttributes.java @@ -0,0 +1,559 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** The configuration and derived state of a report schedule. */ +@JsonPropertyOrder({ + ReportScheduleResponseAttributes.JSON_PROPERTY_DELIVERY_FORMAT, + ReportScheduleResponseAttributes.JSON_PROPERTY_DESCRIPTION, + ReportScheduleResponseAttributes.JSON_PROPERTY_NEXT_RECURRENCE, + ReportScheduleResponseAttributes.JSON_PROPERTY_RECIPIENTS, + ReportScheduleResponseAttributes.JSON_PROPERTY_RESOURCE_ID, + ReportScheduleResponseAttributes.JSON_PROPERTY_RESOURCE_TYPE, + ReportScheduleResponseAttributes.JSON_PROPERTY_RRULE, + ReportScheduleResponseAttributes.JSON_PROPERTY_STATUS, + ReportScheduleResponseAttributes.JSON_PROPERTY_TAB_ID, + ReportScheduleResponseAttributes.JSON_PROPERTY_TEMPLATE_VARIABLES, + ReportScheduleResponseAttributes.JSON_PROPERTY_TIMEFRAME, + ReportScheduleResponseAttributes.JSON_PROPERTY_TIMEZONE, + ReportScheduleResponseAttributes.JSON_PROPERTY_TITLE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportScheduleResponseAttributes { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DELIVERY_FORMAT = "delivery_format"; + private JsonNullable deliveryFormat = + JsonNullable.undefined(); + + public static final String JSON_PROPERTY_DESCRIPTION = "description"; + private String description; + + public static final String JSON_PROPERTY_NEXT_RECURRENCE = "next_recurrence"; + private Long nextRecurrence; + + public static final String JSON_PROPERTY_RECIPIENTS = "recipients"; + private List recipients = new ArrayList<>(); + + public static final String JSON_PROPERTY_RESOURCE_ID = "resource_id"; + private String resourceId; + + public static final String JSON_PROPERTY_RESOURCE_TYPE = "resource_type"; + private ReportScheduleResourceType resourceType; + + public static final String JSON_PROPERTY_RRULE = "rrule"; + private String rrule; + + public static final String JSON_PROPERTY_STATUS = "status"; + private ReportScheduleStatus status; + + public static final String JSON_PROPERTY_TAB_ID = "tab_id"; + private String tabId; + + public static final String JSON_PROPERTY_TEMPLATE_VARIABLES = "template_variables"; + private List templateVariables = new ArrayList<>(); + + public static final String JSON_PROPERTY_TIMEFRAME = "timeframe"; + private String timeframe; + + public static final String JSON_PROPERTY_TIMEZONE = "timezone"; + private String timezone; + + public static final String JSON_PROPERTY_TITLE = "title"; + private String title; + + public ReportScheduleResponseAttributes() {} + + @JsonCreator + public ReportScheduleResponseAttributes( + @JsonProperty(required = true, value = JSON_PROPERTY_DESCRIPTION) String description, + @JsonProperty(required = true, value = JSON_PROPERTY_NEXT_RECURRENCE) Long nextRecurrence, + @JsonProperty(required = true, value = JSON_PROPERTY_RECIPIENTS) List recipients, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_ID) String resourceId, + @JsonProperty(required = true, value = JSON_PROPERTY_RESOURCE_TYPE) + ReportScheduleResourceType resourceType, + @JsonProperty(required = true, value = JSON_PROPERTY_RRULE) String rrule, + @JsonProperty(required = true, value = JSON_PROPERTY_STATUS) ReportScheduleStatus status, + @JsonProperty(required = true, value = JSON_PROPERTY_TAB_ID) String tabId, + @JsonProperty(required = true, value = JSON_PROPERTY_TEMPLATE_VARIABLES) + List templateVariables, + @JsonProperty(required = true, value = JSON_PROPERTY_TIMEFRAME) String timeframe, + @JsonProperty(required = true, value = JSON_PROPERTY_TIMEZONE) String timezone, + @JsonProperty(required = true, value = JSON_PROPERTY_TITLE) String title) { + this.description = description; + this.nextRecurrence = nextRecurrence; + if (nextRecurrence != null) {} + this.recipients = recipients; + this.resourceId = resourceId; + this.resourceType = resourceType; + this.unparsed |= !resourceType.isValid(); + this.rrule = rrule; + this.status = status; + this.unparsed |= !status.isValid(); + this.tabId = tabId; + if (tabId != null) {} + this.templateVariables = templateVariables; + this.timeframe = timeframe; + if (timeframe != null) {} + this.timezone = timezone; + this.title = title; + } + + public ReportScheduleResponseAttributes deliveryFormat( + ReportScheduleResponseAttributesDeliveryFormat deliveryFormat) { + this.deliveryFormat = + JsonNullable.of(deliveryFormat); + return this; + } + + /** + * The delivery format for dashboard report schedules, or null if not set. + * + * @return deliveryFormat + */ + @jakarta.annotation.Nullable + @JsonIgnore + public ReportScheduleResponseAttributesDeliveryFormat getDeliveryFormat() { + return deliveryFormat.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_DELIVERY_FORMAT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable + getDeliveryFormat_JsonNullable() { + return deliveryFormat; + } + + @JsonProperty(JSON_PROPERTY_DELIVERY_FORMAT) + public void setDeliveryFormat_JsonNullable( + JsonNullable deliveryFormat) { + this.deliveryFormat = deliveryFormat; + } + + public void setDeliveryFormat(ReportScheduleResponseAttributesDeliveryFormat deliveryFormat) { + if (!deliveryFormat.isValid()) { + this.unparsed = true; + } + this.deliveryFormat = + JsonNullable.of(deliveryFormat); + } + + public ReportScheduleResponseAttributes description(String description) { + this.description = description; + return this; + } + + /** + * The description of the report. + * + * @return description + */ + @JsonProperty(JSON_PROPERTY_DESCRIPTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public ReportScheduleResponseAttributes nextRecurrence(Long nextRecurrence) { + this.nextRecurrence = nextRecurrence; + if (nextRecurrence != null) {} + return this; + } + + /** + * The Unix timestamp, in milliseconds, of the next scheduled delivery, or null if + * none is scheduled. + * + * @return nextRecurrence + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_NEXT_RECURRENCE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getNextRecurrence() { + return nextRecurrence; + } + + public void setNextRecurrence(Long nextRecurrence) { + this.nextRecurrence = nextRecurrence; + } + + public ReportScheduleResponseAttributes recipients(List recipients) { + this.recipients = recipients; + return this; + } + + public ReportScheduleResponseAttributes addRecipientsItem(String recipientsItem) { + this.recipients.add(recipientsItem); + return this; + } + + /** + * The recipients of the report (email addresses, Slack channel references, or Microsoft Teams + * channel references). + * + * @return recipients + */ + @JsonProperty(JSON_PROPERTY_RECIPIENTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRecipients() { + return recipients; + } + + public void setRecipients(List recipients) { + this.recipients = recipients; + } + + public ReportScheduleResponseAttributes resourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * The identifier of the resource rendered in the report. + * + * @return resourceId + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public ReportScheduleResponseAttributes resourceType(ReportScheduleResourceType resourceType) { + this.resourceType = resourceType; + this.unparsed |= !resourceType.isValid(); + return this; + } + + /** + * The type of dashboard resource the report schedule targets. + * + * @return resourceType + */ + @JsonProperty(JSON_PROPERTY_RESOURCE_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleResourceType getResourceType() { + return resourceType; + } + + public void setResourceType(ReportScheduleResourceType resourceType) { + if (!resourceType.isValid()) { + this.unparsed = true; + } + this.resourceType = resourceType; + } + + public ReportScheduleResponseAttributes rrule(String rrule) { + this.rrule = rrule; + return this; + } + + /** + * The recurrence rule for the schedule, expressed as an iCalendar RRULE string. + * + * @return rrule + */ + @JsonProperty(JSON_PROPERTY_RRULE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getRrule() { + return rrule; + } + + public void setRrule(String rrule) { + this.rrule = rrule; + } + + public ReportScheduleResponseAttributes status(ReportScheduleStatus status) { + this.status = status; + this.unparsed |= !status.isValid(); + return this; + } + + /** + * Whether the schedule is currently delivering reports (active) or paused ( + * inactive). + * + * @return status + */ + @JsonProperty(JSON_PROPERTY_STATUS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleStatus getStatus() { + return status; + } + + public void setStatus(ReportScheduleStatus status) { + if (!status.isValid()) { + this.unparsed = true; + } + this.status = status; + } + + public ReportScheduleResponseAttributes tabId(String tabId) { + this.tabId = tabId; + if (tabId != null) {} + return this; + } + + /** + * The identifier of the dashboard tab rendered in the report, or null if not set. + * + * @return tabId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAB_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTabId() { + return tabId; + } + + public void setTabId(String tabId) { + this.tabId = tabId; + } + + public ReportScheduleResponseAttributes templateVariables( + List templateVariables) { + this.templateVariables = templateVariables; + for (ReportScheduleTemplateVariable item : templateVariables) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ReportScheduleResponseAttributes addTemplateVariablesItem( + ReportScheduleTemplateVariable templateVariablesItem) { + this.templateVariables.add(templateVariablesItem); + this.unparsed |= templateVariablesItem.unparsed; + return this; + } + + /** + * The dashboard template variables applied when rendering the report. + * + * @return templateVariables + */ + @JsonProperty(JSON_PROPERTY_TEMPLATE_VARIABLES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTemplateVariables() { + return templateVariables; + } + + public void setTemplateVariables(List templateVariables) { + this.templateVariables = templateVariables; + } + + public ReportScheduleResponseAttributes timeframe(String timeframe) { + this.timeframe = timeframe; + if (timeframe != null) {} + return this; + } + + /** + * The relative timeframe of data included in the report, or null if not set. + * + * @return timeframe + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TIMEFRAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTimeframe() { + return timeframe; + } + + public void setTimeframe(String timeframe) { + this.timeframe = timeframe; + } + + public ReportScheduleResponseAttributes timezone(String timezone) { + this.timezone = timezone; + return this; + } + + /** + * The IANA time zone identifier the recurrence rule is evaluated in. + * + * @return timezone + */ + @JsonProperty(JSON_PROPERTY_TIMEZONE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTimezone() { + return timezone; + } + + public void setTimezone(String timezone) { + this.timezone = timezone; + } + + public ReportScheduleResponseAttributes title(String title) { + this.title = title; + return this; + } + + /** + * The title of the report. + * + * @return title + */ + @JsonProperty(JSON_PROPERTY_TITLE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportScheduleResponseAttributes + */ + @JsonAnySetter + public ReportScheduleResponseAttributes putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportScheduleResponseAttributes object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportScheduleResponseAttributes reportScheduleResponseAttributes = + (ReportScheduleResponseAttributes) o; + return Objects.equals(this.deliveryFormat, reportScheduleResponseAttributes.deliveryFormat) + && Objects.equals(this.description, reportScheduleResponseAttributes.description) + && Objects.equals(this.nextRecurrence, reportScheduleResponseAttributes.nextRecurrence) + && Objects.equals(this.recipients, reportScheduleResponseAttributes.recipients) + && Objects.equals(this.resourceId, reportScheduleResponseAttributes.resourceId) + && Objects.equals(this.resourceType, reportScheduleResponseAttributes.resourceType) + && Objects.equals(this.rrule, reportScheduleResponseAttributes.rrule) + && Objects.equals(this.status, reportScheduleResponseAttributes.status) + && Objects.equals(this.tabId, reportScheduleResponseAttributes.tabId) + && Objects.equals( + this.templateVariables, reportScheduleResponseAttributes.templateVariables) + && Objects.equals(this.timeframe, reportScheduleResponseAttributes.timeframe) + && Objects.equals(this.timezone, reportScheduleResponseAttributes.timezone) + && Objects.equals(this.title, reportScheduleResponseAttributes.title) + && Objects.equals( + this.additionalProperties, reportScheduleResponseAttributes.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + deliveryFormat, + description, + nextRecurrence, + recipients, + resourceId, + resourceType, + rrule, + status, + tabId, + templateVariables, + timeframe, + timezone, + title, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportScheduleResponseAttributes {\n"); + sb.append(" deliveryFormat: ").append(toIndentedString(deliveryFormat)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" nextRecurrence: ").append(toIndentedString(nextRecurrence)).append("\n"); + sb.append(" recipients: ").append(toIndentedString(recipients)).append("\n"); + sb.append(" resourceId: ").append(toIndentedString(resourceId)).append("\n"); + sb.append(" resourceType: ").append(toIndentedString(resourceType)).append("\n"); + sb.append(" rrule: ").append(toIndentedString(rrule)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" tabId: ").append(toIndentedString(tabId)).append("\n"); + sb.append(" templateVariables: ").append(toIndentedString(templateVariables)).append("\n"); + sb.append(" timeframe: ").append(toIndentedString(timeframe)).append("\n"); + sb.append(" timezone: ").append(toIndentedString(timezone)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseAttributesDeliveryFormat.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseAttributesDeliveryFormat.java new file mode 100644 index 00000000000..d0cecc8279f --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseAttributesDeliveryFormat.java @@ -0,0 +1,67 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The delivery format for dashboard report schedules, or null if not set. */ +@JsonSerialize( + using = + ReportScheduleResponseAttributesDeliveryFormat + .ReportScheduleResponseAttributesDeliveryFormatSerializer.class) +public class ReportScheduleResponseAttributesDeliveryFormat extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("pdf", "png", "pdf_and_png")); + + public static final ReportScheduleResponseAttributesDeliveryFormat PDF = + new ReportScheduleResponseAttributesDeliveryFormat("pdf"); + public static final ReportScheduleResponseAttributesDeliveryFormat PNG = + new ReportScheduleResponseAttributesDeliveryFormat("png"); + public static final ReportScheduleResponseAttributesDeliveryFormat PDF_AND_PNG = + new ReportScheduleResponseAttributesDeliveryFormat("pdf_and_png"); + + ReportScheduleResponseAttributesDeliveryFormat(String value) { + super(value, allowedValues); + } + + public static class ReportScheduleResponseAttributesDeliveryFormatSerializer + extends StdSerializer { + public ReportScheduleResponseAttributesDeliveryFormatSerializer( + Class t) { + super(t); + } + + public ReportScheduleResponseAttributesDeliveryFormatSerializer() { + this(null); + } + + @Override + public void serialize( + ReportScheduleResponseAttributesDeliveryFormat value, + JsonGenerator jgen, + SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ReportScheduleResponseAttributesDeliveryFormat fromValue(String value) { + return new ReportScheduleResponseAttributesDeliveryFormat(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseData.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseData.java new file mode 100644 index 00000000000..9e20ce455ca --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleResponseData.java @@ -0,0 +1,210 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** The JSON:API data object representing a report schedule. */ +@JsonPropertyOrder({ + ReportScheduleResponseData.JSON_PROPERTY_ATTRIBUTES, + ReportScheduleResponseData.JSON_PROPERTY_ID, + ReportScheduleResponseData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportScheduleResponseData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private ReportScheduleResponseAttributes attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private String id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private ReportScheduleType type; + + public ReportScheduleResponseData() {} + + @JsonCreator + public ReportScheduleResponseData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + ReportScheduleResponseAttributes attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) String id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) ReportScheduleType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public ReportScheduleResponseData attributes(ReportScheduleResponseAttributes attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * The configuration and derived state of a report schedule. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleResponseAttributes getAttributes() { + return attributes; + } + + public void setAttributes(ReportScheduleResponseAttributes attributes) { + this.attributes = attributes; + } + + public ReportScheduleResponseData id(String id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the report schedule. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public ReportScheduleResponseData type(ReportScheduleType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * JSON:API resource type for report schedules. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ReportScheduleType getType() { + return type; + } + + public void setType(ReportScheduleType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportScheduleResponseData + */ + @JsonAnySetter + public ReportScheduleResponseData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportScheduleResponseData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportScheduleResponseData reportScheduleResponseData = (ReportScheduleResponseData) o; + return Objects.equals(this.attributes, reportScheduleResponseData.attributes) + && Objects.equals(this.id, reportScheduleResponseData.id) + && Objects.equals(this.type, reportScheduleResponseData.type) + && Objects.equals( + this.additionalProperties, reportScheduleResponseData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportScheduleResponseData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleStatus.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleStatus.java new file mode 100644 index 00000000000..327a790a3ac --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleStatus.java @@ -0,0 +1,59 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** + * Whether the schedule is currently delivering reports (active) or paused ( + * inactive). + */ +@JsonSerialize(using = ReportScheduleStatus.ReportScheduleStatusSerializer.class) +public class ReportScheduleStatus extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("active", "inactive")); + + public static final ReportScheduleStatus ACTIVE = new ReportScheduleStatus("active"); + public static final ReportScheduleStatus INACTIVE = new ReportScheduleStatus("inactive"); + + ReportScheduleStatus(String value) { + super(value, allowedValues); + } + + public static class ReportScheduleStatusSerializer extends StdSerializer { + public ReportScheduleStatusSerializer(Class t) { + super(t); + } + + public ReportScheduleStatusSerializer() { + this(null); + } + + @Override + public void serialize( + ReportScheduleStatus value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ReportScheduleStatus fromValue(String value) { + return new ReportScheduleStatus(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleTemplateVariable.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleTemplateVariable.java new file mode 100644 index 00000000000..5876f1caa7a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleTemplateVariable.java @@ -0,0 +1,182 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** A dashboard template variable applied when rendering the report. */ +@JsonPropertyOrder({ + ReportScheduleTemplateVariable.JSON_PROPERTY_NAME, + ReportScheduleTemplateVariable.JSON_PROPERTY_VALUES +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ReportScheduleTemplateVariable { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_VALUES = "values"; + private List values = new ArrayList<>(); + + public ReportScheduleTemplateVariable() {} + + @JsonCreator + public ReportScheduleTemplateVariable( + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUES) List values) { + this.name = name; + this.values = values; + } + + public ReportScheduleTemplateVariable name(String name) { + this.name = name; + return this; + } + + /** + * The name of the template variable. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public ReportScheduleTemplateVariable values(List values) { + this.values = values; + return this; + } + + public ReportScheduleTemplateVariable addValuesItem(String valuesItem) { + this.values.add(valuesItem); + return this; + } + + /** + * The selected values for the template variable. + * + * @return values + */ + @JsonProperty(JSON_PROPERTY_VALUES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValues() { + return values; + } + + public void setValues(List values) { + this.values = values; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ReportScheduleTemplateVariable + */ + @JsonAnySetter + public ReportScheduleTemplateVariable putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ReportScheduleTemplateVariable object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReportScheduleTemplateVariable reportScheduleTemplateVariable = + (ReportScheduleTemplateVariable) o; + return Objects.equals(this.name, reportScheduleTemplateVariable.name) + && Objects.equals(this.values, reportScheduleTemplateVariable.values) + && Objects.equals( + this.additionalProperties, reportScheduleTemplateVariable.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(name, values, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReportScheduleTemplateVariable {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ReportScheduleType.java b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleType.java new file mode 100644 index 00000000000..b4cfc8f217a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ReportScheduleType.java @@ -0,0 +1,53 @@ +/* + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** JSON:API resource type for report schedules. */ +@JsonSerialize(using = ReportScheduleType.ReportScheduleTypeSerializer.class) +public class ReportScheduleType extends ModelEnum { + + private static final Set allowedValues = new HashSet(Arrays.asList("schedule")); + + public static final ReportScheduleType SCHEDULE = new ReportScheduleType("schedule"); + + ReportScheduleType(String value) { + super(value, allowedValues); + } + + public static class ReportScheduleTypeSerializer extends StdSerializer { + public ReportScheduleTypeSerializer(Class t) { + super(t); + } + + public ReportScheduleTypeSerializer() { + this(null); + } + + @Override + public void serialize(ReportScheduleType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ReportScheduleType fromValue(String value) { + return new ReportScheduleType(value); + } +} diff --git a/src/test/resources/com/datadog/api/client/v2/api/report_schedules.feature b/src/test/resources/com/datadog/api/client/v2/api/report_schedules.feature new file mode 100644 index 00000000000..7f77c0ec9f8 --- /dev/null +++ b/src/test/resources/com/datadog/api/client/v2/api/report_schedules.feature @@ -0,0 +1,55 @@ +@endpoint(report-schedules) @endpoint(report-schedules-v2) +Feature: Report Schedules + Create and manage scheduled reports. A scheduled report renders a + dashboard or integration dashboard on a recurring cadence and delivers it + to a set of recipients over email, Slack, or Microsoft Teams. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "ReportSchedules" API + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a report schedule returns "Bad Request" response + Given new "CreateReportSchedule" request + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a report schedule returns "CREATED" response + Given new "CreateReportSchedule" request + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 201 CREATED + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Create a report schedule returns "Not Found" response + Given new "CreateReportSchedule" request + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a report schedule returns "Bad Request" response + Given new "PatchReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a report schedule returns "Not Found" response + Given new "PatchReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Update a report schedule returns "OK" response + Given new "PatchReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + When the request is sent + Then the response status is 200 OK diff --git a/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index bf8c214ecee..595ffa32010 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/undo.json @@ -5919,6 +5919,19 @@ "type": "idempotent" } }, + "CreateReportSchedule": { + "tag": "Report Schedules", + "undo": { + "type": "unsafe" + } + }, + "PatchReportSchedule": { + "tag": "Report Schedules", + "undo": { + "operationId": "PatchReportSchedule", + "type": "idempotent" + } + }, "DeleteRestrictionPolicy": { "tag": "Restriction Policies", "undo": {