diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 99b25f0ac87f..c7f7459aedd0 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -77158,7 +77158,7 @@ components: type: array timeframe: description: The relative timeframe of data to include in the report. - example: "calendar_month" + example: "1w" type: string timezone: description: The IANA time zone identifier the recurrence rule is evaluated in. @@ -77210,6 +77210,269 @@ components: description: A related resource included with a report schedule. oneOf: - $ref: "#/components/schemas/ReportScheduleAuthor" + - $ref: "#/components/schemas/ReportScheduleResource" + ReportScheduleIncludedResourceType: + description: JSON:API resource type for an included report resource. + enum: + - resource + example: resource + type: string + x-enum-varnames: + - RESOURCE + ReportScheduleIndexTemplateVariable: + description: Template variable metadata from a dashboard index. + properties: + available_values: + description: Available values for the template variable. + example: + - prod + - staging + items: + type: string + nullable: true + type: array + defaults: + description: Default values for the template variable. + example: + - prod + items: + type: string + nullable: true + type: array + name: + description: The template variable name. + example: env + nullable: true + type: string + prefix: + description: The tag prefix for the template variable, when available. + example: env + nullable: true + type: string + type: object + ReportScheduleListResourceRelationship: + description: Relationship to the report target resource. + properties: + data: + $ref: "#/components/schemas/ReportScheduleListResourceRelationshipData" + required: + - data + type: object + ReportScheduleListResourceRelationshipData: + description: Relationship data for the report target resource. + properties: + id: + description: The resource identifier. + example: "abc-def-ghi" + type: string + type: + $ref: "#/components/schemas/ReportScheduleIncludedResourceType" + required: + - id + - type + type: object + ReportScheduleListResponse: + description: Response containing a list of report schedules. + properties: + data: + description: The list of report schedules. + items: + $ref: "#/components/schemas/ReportScheduleListResponseData" + type: array + included: + description: Related resources included with the report schedules, such as authors and rendered resources. + items: + $ref: "#/components/schemas/ReportScheduleIncludedResource" + type: array + links: + $ref: "#/components/schemas/ReportScheduleListResponseLinks" + meta: + $ref: "#/components/schemas/ReportScheduleListResponseMeta" + required: + - data + type: object + ReportScheduleListResponseAttributes: + description: The configuration and derived state of a report schedule in a list response. + properties: + delivery_format: + $ref: "#/components/schemas/ReportScheduleResponseAttributesDeliveryFormat" + description: + description: The description of the report. + example: "Weekly summary of infrastructure health." + type: string + next_recurrence: + description: The Unix timestamp, in milliseconds, of the next scheduled delivery, or `null` if none is scheduled. + example: 1780923600000 + format: int64 + nullable: true + type: integer + recipients: + description: The recipients of the report (email addresses, Slack channel references, or Microsoft Teams channel references). + example: + - "user@example.com" + - "slack:T01234567.C01234567.alerts" + - "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2" + items: + description: A single recipient (email address, Slack channel reference, or Microsoft Teams channel reference). + type: string + type: array + resource_id: + description: The identifier of the resource rendered in the report. + example: "abc-def-ghi" + type: string + resource_type: + $ref: "#/components/schemas/ReportScheduleResourceType" + rrule: + description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + example: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + type: string + status: + $ref: "#/components/schemas/ReportScheduleStatus" + template_variables: + description: The dashboard template variables applied when rendering the report. + items: + $ref: "#/components/schemas/ReportScheduleTemplateVariable" + type: array + timeframe: + description: The relative timeframe of data included in the report, or `null` if not set. + example: "1w" + nullable: true + type: string + timezone: + description: The IANA time zone identifier the recurrence rule is evaluated in. + example: "America/New_York" + type: string + title: + description: The title of the report. + example: "Weekly Infrastructure Report" + type: string + required: + - status + - resource_id + - resource_type + - recipients + - rrule + - timezone + - template_variables + - title + - description + - timeframe + - next_recurrence + type: object + ReportScheduleListResponseData: + description: The JSON:API data object representing a report schedule in a list response. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleListResponseAttributes" + id: + description: The unique identifier of the report schedule. + example: "11111111-2222-3333-4444-555555555555" + type: string + relationships: + $ref: "#/components/schemas/ReportScheduleListResponseRelationships" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - id + - type + - attributes + - relationships + type: object + ReportScheduleListResponseLinks: + description: Pagination links for navigating a report schedule list response. + properties: + first: + description: Link to the first page. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=0&page[limit]=25" + nullable: true + type: string + last: + description: Link to the last page, or `null` if it is unavailable. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=0&page[limit]=25" + nullable: true + type: string + next: + description: Link to the next page, or `null` if it is unavailable. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=25&page[limit]=25" + nullable: true + type: string + prev: + description: Link to the previous page, or `null` if it is unavailable. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=0&page[limit]=25" + nullable: true + type: string + self: + description: Link to the current page. + example: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[limit]=25" + nullable: true + type: string + type: object + ReportScheduleListResponseMeta: + description: Metadata for a paginated report schedule list response. + properties: + pagination: + $ref: "#/components/schemas/ReportScheduleListResponsePagination" + type: object + ReportScheduleListResponsePagination: + description: Offset and limit pagination metadata for a report schedule list response. + properties: + first_offset: + description: The first offset. + example: 0 + format: int64 + type: integer + last_offset: + description: The last offset when the total count is known, or `null` if it is unavailable. + example: 0 + format: int64 + nullable: true + type: integer + limit: + description: The maximum number of schedules returned. + example: 25 + format: int64 + type: integer + next_offset: + description: The next offset. + example: 25 + format: int64 + type: integer + offset: + description: The current offset. + example: 0 + format: int64 + type: integer + prev_offset: + description: The previous offset. + example: 0 + format: int64 + type: integer + total: + description: The total number of matching schedules. + example: 1 + format: int64 + type: integer + type: + $ref: "#/components/schemas/ReportScheduleListResponsePaginationType" + type: object + ReportScheduleListResponsePaginationType: + description: The pagination type. + enum: + - offset_limit + example: offset_limit + type: string + x-enum-varnames: + - OFFSET_LIMIT + ReportScheduleListResponseRelationships: + description: Relationships for a report schedule in a list response. + properties: + author: + $ref: "#/components/schemas/ReportScheduleAuthorRelationship" + resource: + $ref: "#/components/schemas/ReportScheduleListResourceRelationship" + required: + - author + type: object ReportSchedulePatchRequest: description: Request body for updating a report schedule. properties: @@ -77259,7 +77522,7 @@ components: type: array timeframe: description: The relative timeframe of data to include in the report. - example: "calendar_month" + example: "1w" type: string timezone: description: The IANA time zone identifier the recurrence rule is evaluated in. @@ -77291,6 +77554,41 @@ components: - type - attributes type: object + ReportScheduleResource: + description: A report target resource included as a related JSON:API resource. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleResourceAttributes" + id: + description: The resource identifier. + example: "abc-def-ghi" + type: string + type: + $ref: "#/components/schemas/ReportScheduleIncludedResourceType" + required: + - type + - id + - attributes + type: object + ReportScheduleResourceAttributes: + description: Attributes of an included report target resource. + properties: + resource_type: + $ref: "#/components/schemas/ReportScheduleResourceType" + template_variables: + description: Template variable metadata from the dashboard resource, when available. + items: + $ref: "#/components/schemas/ReportScheduleIndexTemplateVariable" + nullable: true + type: array + title: + description: The title of the dashboard or integration dashboard resource, when available. + example: "Infrastructure Overview" + nullable: true + type: string + required: + - resource_type + type: object ReportScheduleResourceType: description: The type of dashboard resource the report schedule targets. enum: @@ -77347,7 +77645,7 @@ components: $ref: "#/components/schemas/ReportScheduleResourceType" rrule: description: The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. - example: "FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + example: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" type: string status: $ref: "#/components/schemas/ReportScheduleStatus" @@ -77457,6 +77755,33 @@ components: - name - values type: object + ReportScheduleToggleRequest: + description: Request body for toggling a report schedule. + properties: + data: + $ref: "#/components/schemas/ReportScheduleToggleRequestData" + required: + - data + type: object + ReportScheduleToggleRequestAttributes: + description: The status to set on the report schedule. + properties: + status: + $ref: "#/components/schemas/ReportScheduleStatus" + required: + - status + type: object + ReportScheduleToggleRequestData: + description: The JSON:API data object for a report schedule toggle request. + properties: + attributes: + $ref: "#/components/schemas/ReportScheduleToggleRequestAttributes" + type: + $ref: "#/components/schemas/ReportScheduleType" + required: + - type + - attributes + type: object ReportScheduleType: description: JSON:API resource type for report schedules. enum: @@ -163437,7 +163762,384 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/reporting/schedule/list: + get: + description: |- + List dashboard and integration dashboard report schedules for the organization. + The response is paginated and can be filtered by title, author UUID, or recipients. + Requires the `generate_dashboard_reports` permission. + operationId: ListReportSchedules + parameters: + - description: The maximum number of schedules to return. The maximum value is 50. + example: 25 + in: query + name: page[limit] + required: false + schema: + default: 25 + format: int64 + maximum: 50 + minimum: 1 + type: integer + - description: The offset from which to start returning schedules. + example: 0 + in: query + name: page[offset] + required: false + schema: + default: 0 + format: int64 + minimum: 0 + type: integer + - description: Filter schedules by report title. + example: "Weekly" + in: query + name: filter[title] + required: false + schema: + type: string + - description: Filter schedules by author UUID. + example: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + in: query + name: filter[author_uuid] + required: false + schema: + format: uuid + type: string + - description: Filter schedules by a comma-separated list of recipients. + example: "user@example.com,team@example.com" + in: query + name: filter[recipients] + required: false + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + relationships: + author: + data: + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + resource: + data: + id: "abc-def-ghi" + type: resource + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + - attributes: + resource_type: dashboard + template_variables: + - available_values: + - "prod" + - "staging" + defaults: + - "prod" + name: "env" + prefix: "env" + title: "Infrastructure Overview" + id: "abc-def-ghi" + type: resource + links: + first: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=0&page[limit]=25" + last: + next: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[offset]=25&page[limit]=25" + prev: + self: "https://api.datadoghq.com/api/v2/reporting/schedule/list?page[limit]=25" + meta: + pagination: + first_offset: 0 + last_offset: 0 + limit: 25 + next_offset: 25 + offset: 0 + prev_offset: 0 + total: 1 + type: offset_limit + schema: + $ref: "#/components/schemas/ReportScheduleListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: List report schedules + tags: + - Report Schedules + /api/v2/reporting/schedule/{resource_type}/{resource_id}: + get: + description: |- + Get all report schedules that target a dashboard or integration dashboard resource. + Requires a reporting read permission appropriate to the targeted resource type. + operationId: GetReportSchedulesForResource + parameters: + - description: The type of resource to fetch report schedules for. + example: dashboard + in: path + name: resource_type + required: true + schema: + $ref: "#/components/schemas/ReportScheduleResourceType" + - description: The identifier of the resource to fetch report schedules for. + example: "abc-def-ghi" + in: path + name: resource_id + required: true + schema: + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleListResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get report schedules for a resource + tags: + - Report Schedules /api/v2/reporting/schedule/{schedule_uuid}: + delete: + description: |- + Delete a report schedule by its unique identifier. The response returns the deleted schedule. + Requires a reporting write permission appropriate to the targeted resource type and schedule ownership. + operationId: DeleteReportSchedule + parameters: + - description: The unique identifier of the report schedule to delete. + example: "11111111-2222-3333-4444-555555555555" + in: path + name: schedule_uuid + required: true + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: inactive + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Delete a report schedule + tags: + - Report Schedules + get: + description: |- + Get a report schedule by its unique identifier. + Requires a reporting read permission appropriate to the targeted resource type. + operationId: GetReportSchedule + parameters: + - description: The unique identifier of the report schedule to fetch. + example: "11111111-2222-3333-4444-555555555555" + in: path + name: schedule_uuid + required: true + schema: + format: uuid + type: string + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: active + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Get a report schedule + tags: + - Report Schedules patch: description: |- Update an existing scheduled report by its identifier. The editable attributes @@ -163551,6 +164253,95 @@ paths: x-unstable: |- **Note**: This endpoint is in preview and is subject to change. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/). + /api/v2/reporting/schedule/{schedule_uuid}/toggle: + patch: + description: |- + Activate or pause a report schedule by setting its status to `active` or `inactive`. + Requires a reporting write permission appropriate to the targeted resource type and schedule ownership. + operationId: ToggleReportSchedule + parameters: + - description: The unique identifier of the report schedule to toggle. + example: "11111111-2222-3333-4444-555555555555" + in: path + name: schedule_uuid + required: true + schema: + format: uuid + type: string + requestBody: + content: + application/json: + examples: + default: + value: + data: + attributes: + status: inactive + type: schedule + schema: + $ref: "#/components/schemas/ReportScheduleToggleRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + attributes: + delivery_format: pdf + description: "Weekly summary of infrastructure health." + next_recurrence: 1780923600000 + recipients: + - "user@example.com" + resource_id: "abc-def-ghi" + resource_type: dashboard + rrule: "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0" + status: inactive + tab_id: "66666666-7777-8888-9999-000000000000" + template_variables: + - name: "env" + values: + - "prod" + timeframe: "1w" + timezone: "America/New_York" + title: "Weekly Infrastructure Report" + id: "11111111-2222-3333-4444-555555555555" + type: schedule + included: + - attributes: + email: "user@example.com" + name: "Example User" + id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee" + type: users + schema: + $ref: "#/components/schemas/ReportScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/JSONAPIErrorResponse" + description: Not Found + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + summary: Toggle a report schedule + tags: + - Report Schedules + x-codegen-request-body-name: body /api/v2/restriction_policy/{resource_id}: delete: description: Deletes the restriction policy associated with a specified resource. diff --git a/examples/v2/report-schedules/CreateReportSchedule.rb b/examples/v2/report-schedules/CreateReportSchedule.rb index 9e142a0ac17a..9fa645c6461b 100644 --- a/examples/v2/report-schedules/CreateReportSchedule.rb +++ b/examples/v2/report-schedules/CreateReportSchedule.rb @@ -28,7 +28,7 @@ ], }), ], - timeframe: "calendar_month", + timeframe: "1w", timezone: "America/New_York", title: "Weekly Infrastructure Report", }), diff --git a/examples/v2/report-schedules/DeleteReportSchedule.rb b/examples/v2/report-schedules/DeleteReportSchedule.rb new file mode 100644 index 000000000000..e9b15a76f1fd --- /dev/null +++ b/examples/v2/report-schedules/DeleteReportSchedule.rb @@ -0,0 +1,5 @@ +# Delete a report schedule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new +p api_instance.delete_report_schedule("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d") diff --git a/examples/v2/report-schedules/GetReportSchedule.rb b/examples/v2/report-schedules/GetReportSchedule.rb new file mode 100644 index 000000000000..00202876c4fd --- /dev/null +++ b/examples/v2/report-schedules/GetReportSchedule.rb @@ -0,0 +1,5 @@ +# Get a report schedule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new +p api_instance.get_report_schedule("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d") diff --git a/examples/v2/report-schedules/GetReportSchedulesForResource.rb b/examples/v2/report-schedules/GetReportSchedulesForResource.rb new file mode 100644 index 000000000000..df3bf899e198 --- /dev/null +++ b/examples/v2/report-schedules/GetReportSchedulesForResource.rb @@ -0,0 +1,5 @@ +# Get report schedules for a resource returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new +p api_instance.get_report_schedules_for_resource(ReportScheduleResourceType::DASHBOARD, "resource_id") diff --git a/examples/v2/report-schedules/ListReportSchedules.rb b/examples/v2/report-schedules/ListReportSchedules.rb new file mode 100644 index 000000000000..e7277f365961 --- /dev/null +++ b/examples/v2/report-schedules/ListReportSchedules.rb @@ -0,0 +1,5 @@ +# List report schedules returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new +p api_instance.list_report_schedules() diff --git a/examples/v2/report-schedules/PatchReportSchedule.rb b/examples/v2/report-schedules/PatchReportSchedule.rb index 93e9d34a94e4..31fc99214f46 100644 --- a/examples/v2/report-schedules/PatchReportSchedule.rb +++ b/examples/v2/report-schedules/PatchReportSchedule.rb @@ -26,7 +26,7 @@ ], }), ], - timeframe: "calendar_month", + timeframe: "1w", timezone: "America/New_York", title: "Weekly Infrastructure Report", }), diff --git a/examples/v2/report-schedules/ToggleReportSchedule.rb b/examples/v2/report-schedules/ToggleReportSchedule.rb new file mode 100644 index 000000000000..5be1242e590a --- /dev/null +++ b/examples/v2/report-schedules/ToggleReportSchedule.rb @@ -0,0 +1,14 @@ +# Toggle a report schedule returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new + +body = DatadogAPIClient::V2::ReportScheduleToggleRequest.new({ + data: DatadogAPIClient::V2::ReportScheduleToggleRequestData.new({ + attributes: DatadogAPIClient::V2::ReportScheduleToggleRequestAttributes.new({ + status: DatadogAPIClient::V2::ReportScheduleStatus::ACTIVE, + }), + type: DatadogAPIClient::V2::ReportScheduleType::SCHEDULE, + }), +}) +p api_instance.toggle_report_schedule("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 8d27a626e6cf..ed2d45bb8c3a 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -4860,10 +4860,31 @@ "v2.CreateReportSchedule" => { "body" => "ReportScheduleCreateRequest", }, + "v2.ListReportSchedules" => { + "page_limit" => "Integer", + "page_offset" => "Integer", + "filter_title" => "String", + "filter_author_uuid" => "UUID", + "filter_recipients" => "String", + }, + "v2.GetReportSchedulesForResource" => { + "resource_type" => "ReportScheduleResourceType", + "resource_id" => "String", + }, + "v2.DeleteReportSchedule" => { + "schedule_uuid" => "UUID", + }, + "v2.GetReportSchedule" => { + "schedule_uuid" => "UUID", + }, "v2.PatchReportSchedule" => { "schedule_uuid" => "UUID", "body" => "ReportSchedulePatchRequest", }, + "v2.ToggleReportSchedule" => { + "schedule_uuid" => "UUID", + "body" => "ReportScheduleToggleRequest", + }, "v2.DeleteRestrictionPolicy" => { "resource_id" => "String", }, diff --git a/features/v2/report_schedules.feature b/features/v2/report_schedules.feature index 7d2ffafbc65b..aa62a5e35063 100644 --- a/features/v2/report_schedules.feature +++ b/features/v2/report_schedules.feature @@ -13,7 +13,7 @@ Feature: Report Schedules Scenario: Create a report schedule returns "Bad Request" response Given operation "CreateReportSchedule" enabled And new "CreateReportSchedule" request - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 400 Bad Request @@ -21,7 +21,7 @@ Feature: Report Schedules Scenario: Create a report schedule returns "CREATED" response Given operation "CreateReportSchedule" enabled And new "CreateReportSchedule" request - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 201 CREATED @@ -29,16 +29,124 @@ Feature: Report Schedules Scenario: Create a report schedule returns "Not Found" response Given operation "CreateReportSchedule" enabled And new "CreateReportSchedule" request - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "resource_id": "abc-def-ghi", "resource_type": "dashboard", "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 404 Not Found + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a report schedule returns "Bad Request" response + Given new "DeleteReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a report schedule returns "Not Found" response + Given new "DeleteReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Delete a report schedule returns "OK" response + Given new "DeleteReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a report schedule returns "Bad Request" response + Given new "GetReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a report schedule returns "Not Found" response + Given new "GetReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get a report schedule returns "OK" response + Given new "GetReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get report schedules for a resource returns "Bad Request" response + Given new "GetReportSchedulesForResource" request + And request contains "resource_type" parameter from "REPLACE.ME" + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get report schedules for a resource returns "Not Found" response + Given new "GetReportSchedulesForResource" request + And request contains "resource_type" parameter from "REPLACE.ME" + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Get report schedules for a resource returns "OK" response + Given new "GetReportSchedulesForResource" request + And request contains "resource_type" parameter from "REPLACE.ME" + And request contains "resource_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: List report schedules returns "Bad Request" response + Given new "ListReportSchedules" request + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: List report schedules returns "Not Found" response + Given new "ListReportSchedules" request + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: List report schedules returns "OK" response + Given new "ListReportSchedules" request + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Toggle a report schedule returns "Bad Request" response + Given new "ToggleReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"status": "active"}, "type": "schedule"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Toggle a report schedule returns "Not Found" response + Given new "ToggleReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"status": "active"}, "type": "schedule"}} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/reporting-and-sharing + Scenario: Toggle a report schedule returns "OK" response + Given new "ToggleReportSchedule" request + And request contains "schedule_uuid" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"status": "active"}, "type": "schedule"}} + When the request is sent + Then the response status is 200 OK + @generated @skip @team:DataDog/reporting-and-sharing Scenario: Update a report schedule returns "Bad Request" response Given operation "PatchReportSchedule" enabled And new "PatchReportSchedule" request And request contains "schedule_uuid" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 400 Bad Request @@ -47,7 +155,7 @@ Feature: Report Schedules Given operation "PatchReportSchedule" enabled And new "PatchReportSchedule" request And request contains "schedule_uuid" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 404 Not Found @@ -56,6 +164,6 @@ Feature: Report Schedules Given operation "PatchReportSchedule" enabled And new "PatchReportSchedule" request And request contains "schedule_uuid" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "calendar_month", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} + And body with value {"data": {"attributes": {"delivery_format": "pdf", "description": "Updated weekly summary of infrastructure health.", "recipients": ["user@example.com", "slack:T01234567.C01234567.alerts", "teams:11111111-1111-1111-1111-111111111111|22222222-2222-2222-2222-222222222222|19:exampleChannelId@thread.tacv2"], "rrule": "DTSTART;TZID=America/New_York:20260601T090000\nRRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0", "tab_id": "66666666-7777-8888-9999-000000000000", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "title": "Weekly Infrastructure Report"}, "type": "schedule"}} When the request is sent Then the response status is 200 OK diff --git a/features/v2/undo.json b/features/v2/undo.json index a5c43f6c0f2c..6c6beff0419f 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -6348,9 +6348,40 @@ "CreateReportSchedule": { "tag": "Report Schedules", "undo": { + "operationId": "DeleteReportSchedule", + "parameters": [ + { + "name": "schedule_uuid", + "source": "data.id" + } + ], "type": "unsafe" } }, + "ListReportSchedules": { + "tag": "Report Schedules", + "undo": { + "type": "safe" + } + }, + "GetReportSchedulesForResource": { + "tag": "Report Schedules", + "undo": { + "type": "safe" + } + }, + "DeleteReportSchedule": { + "tag": "Report Schedules", + "undo": { + "type": "idempotent" + } + }, + "GetReportSchedule": { + "tag": "Report Schedules", + "undo": { + "type": "safe" + } + }, "PatchReportSchedule": { "tag": "Report Schedules", "undo": { @@ -6358,6 +6389,13 @@ "type": "idempotent" } }, + "ToggleReportSchedule": { + "tag": "Report Schedules", + "undo": { + "operationId": "ToggleReportSchedule", + "type": "idempotent" + } + }, "DeleteRestrictionPolicy": { "tag": "Restriction Policies", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 1912c3a1f419..56e0a2556383 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -5750,9 +5750,23 @@ def overrides "v2.report_schedule_create_request_data" => "ReportScheduleCreateRequestData", "v2.report_schedule_delivery_format" => "ReportScheduleDeliveryFormat", "v2.report_schedule_included_resource" => "ReportScheduleIncludedResource", + "v2.report_schedule_included_resource_type" => "ReportScheduleIncludedResourceType", + "v2.report_schedule_index_template_variable" => "ReportScheduleIndexTemplateVariable", + "v2.report_schedule_list_resource_relationship" => "ReportScheduleListResourceRelationship", + "v2.report_schedule_list_resource_relationship_data" => "ReportScheduleListResourceRelationshipData", + "v2.report_schedule_list_response" => "ReportScheduleListResponse", + "v2.report_schedule_list_response_attributes" => "ReportScheduleListResponseAttributes", + "v2.report_schedule_list_response_data" => "ReportScheduleListResponseData", + "v2.report_schedule_list_response_links" => "ReportScheduleListResponseLinks", + "v2.report_schedule_list_response_meta" => "ReportScheduleListResponseMeta", + "v2.report_schedule_list_response_pagination" => "ReportScheduleListResponsePagination", + "v2.report_schedule_list_response_pagination_type" => "ReportScheduleListResponsePaginationType", + "v2.report_schedule_list_response_relationships" => "ReportScheduleListResponseRelationships", "v2.report_schedule_patch_request" => "ReportSchedulePatchRequest", "v2.report_schedule_patch_request_attributes" => "ReportSchedulePatchRequestAttributes", "v2.report_schedule_patch_request_data" => "ReportSchedulePatchRequestData", + "v2.report_schedule_resource" => "ReportScheduleResource", + "v2.report_schedule_resource_attributes" => "ReportScheduleResourceAttributes", "v2.report_schedule_resource_type" => "ReportScheduleResourceType", "v2.report_schedule_response" => "ReportScheduleResponse", "v2.report_schedule_response_attributes" => "ReportScheduleResponseAttributes", @@ -5761,6 +5775,9 @@ def overrides "v2.report_schedule_response_relationships" => "ReportScheduleResponseRelationships", "v2.report_schedule_status" => "ReportScheduleStatus", "v2.report_schedule_template_variable" => "ReportScheduleTemplateVariable", + "v2.report_schedule_toggle_request" => "ReportScheduleToggleRequest", + "v2.report_schedule_toggle_request_attributes" => "ReportScheduleToggleRequestAttributes", + "v2.report_schedule_toggle_request_data" => "ReportScheduleToggleRequestData", "v2.report_schedule_type" => "ReportScheduleType", "v2.resolve_vulnerable_symbols_request" => "ResolveVulnerableSymbolsRequest", "v2.resolve_vulnerable_symbols_request_data" => "ResolveVulnerableSymbolsRequestData", diff --git a/lib/datadog_api_client/v2/api/report_schedules_api.rb b/lib/datadog_api_client/v2/api/report_schedules_api.rb index 1fd9598abd54..64a4e4168103 100644 --- a/lib/datadog_api_client/v2/api/report_schedules_api.rb +++ b/lib/datadog_api_client/v2/api/report_schedules_api.rb @@ -99,6 +99,295 @@ def create_report_schedule_with_http_info(body, opts = {}) return data, status_code, headers end + # Delete a report schedule. + # + # @see #delete_report_schedule_with_http_info + def delete_report_schedule(schedule_uuid, opts = {}) + data, _status_code, _headers = delete_report_schedule_with_http_info(schedule_uuid, opts) + data + end + + # Delete a report schedule. + # + # Delete a report schedule by its unique identifier. The response returns the deleted schedule. + # Requires a reporting write permission appropriate to the targeted resource type and schedule ownership. + # + # @param schedule_uuid [UUID] The unique identifier of the report schedule to delete. + # @param opts [Hash] the optional parameters + # @return [Array<(ReportScheduleResponse, Integer, Hash)>] ReportScheduleResponse data, response status code and response headers + def delete_report_schedule_with_http_info(schedule_uuid, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReportSchedulesAPI.delete_report_schedule ...' + end + # verify the required parameter 'schedule_uuid' is set + if @api_client.config.client_side_validation && schedule_uuid.nil? + fail ArgumentError, "Missing the required parameter 'schedule_uuid' when calling ReportSchedulesAPI.delete_report_schedule" + end + # resource path + local_var_path = '/api/v2/reporting/schedule/{schedule_uuid}'.sub('{schedule_uuid}', CGI.escape(schedule_uuid.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ReportScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :delete_report_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Delete, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReportSchedulesAPI#delete_report_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get a report schedule. + # + # @see #get_report_schedule_with_http_info + def get_report_schedule(schedule_uuid, opts = {}) + data, _status_code, _headers = get_report_schedule_with_http_info(schedule_uuid, opts) + data + end + + # Get a report schedule. + # + # Get a report schedule by its unique identifier. + # Requires a reporting read permission appropriate to the targeted resource type. + # + # @param schedule_uuid [UUID] The unique identifier of the report schedule to fetch. + # @param opts [Hash] the optional parameters + # @return [Array<(ReportScheduleResponse, Integer, Hash)>] ReportScheduleResponse data, response status code and response headers + def get_report_schedule_with_http_info(schedule_uuid, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReportSchedulesAPI.get_report_schedule ...' + end + # verify the required parameter 'schedule_uuid' is set + if @api_client.config.client_side_validation && schedule_uuid.nil? + fail ArgumentError, "Missing the required parameter 'schedule_uuid' when calling ReportSchedulesAPI.get_report_schedule" + end + # resource path + local_var_path = '/api/v2/reporting/schedule/{schedule_uuid}'.sub('{schedule_uuid}', CGI.escape(schedule_uuid.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ReportScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_report_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReportSchedulesAPI#get_report_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Get report schedules for a resource. + # + # @see #get_report_schedules_for_resource_with_http_info + def get_report_schedules_for_resource(resource_type, resource_id, opts = {}) + data, _status_code, _headers = get_report_schedules_for_resource_with_http_info(resource_type, resource_id, opts) + data + end + + # Get report schedules for a resource. + # + # Get all report schedules that target a dashboard or integration dashboard resource. + # Requires a reporting read permission appropriate to the targeted resource type. + # + # @param resource_type [ReportScheduleResourceType] The type of resource to fetch report schedules for. + # @param resource_id [String] The identifier of the resource to fetch report schedules for. + # @param opts [Hash] the optional parameters + # @return [Array<(ReportScheduleListResponse, Integer, Hash)>] ReportScheduleListResponse data, response status code and response headers + def get_report_schedules_for_resource_with_http_info(resource_type, resource_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReportSchedulesAPI.get_report_schedules_for_resource ...' + end + # verify the required parameter 'resource_type' is set + if @api_client.config.client_side_validation && resource_type.nil? + fail ArgumentError, "Missing the required parameter 'resource_type' when calling ReportSchedulesAPI.get_report_schedules_for_resource" + end + # verify enum value + allowable_values = ['dashboard', 'integration_dashboard'] + if @api_client.config.client_side_validation && !allowable_values.include?(resource_type) + fail ArgumentError, "invalid value for \"resource_type\", must be one of #{allowable_values}" + end + # verify the required parameter 'resource_id' is set + if @api_client.config.client_side_validation && resource_id.nil? + fail ArgumentError, "Missing the required parameter 'resource_id' when calling ReportSchedulesAPI.get_report_schedules_for_resource" + end + # resource path + local_var_path = '/api/v2/reporting/schedule/{resource_type}/{resource_id}'.sub('{resource_type}', CGI.escape(resource_type.to_s).gsub('%2F', '/')).sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ReportScheduleListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :get_report_schedules_for_resource, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReportSchedulesAPI#get_report_schedules_for_resource\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # List report schedules. + # + # @see #list_report_schedules_with_http_info + def list_report_schedules(opts = {}) + data, _status_code, _headers = list_report_schedules_with_http_info(opts) + data + end + + # List report schedules. + # + # List dashboard and integration dashboard report schedules for the organization. + # The response is paginated and can be filtered by title, author UUID, or recipients. + # Requires the `generate_dashboard_reports` permission. + # + # @param opts [Hash] the optional parameters + # @option opts [Integer] :page_limit The maximum number of schedules to return. The maximum value is 50. + # @option opts [Integer] :page_offset The offset from which to start returning schedules. + # @option opts [String] :filter_title Filter schedules by report title. + # @option opts [UUID] :filter_author_uuid Filter schedules by author UUID. + # @option opts [String] :filter_recipients Filter schedules by a comma-separated list of recipients. + # @return [Array<(ReportScheduleListResponse, Integer, Hash)>] ReportScheduleListResponse data, response status code and response headers + def list_report_schedules_with_http_info(opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReportSchedulesAPI.list_report_schedules ...' + end + if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 50 + fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling ReportSchedulesAPI.list_report_schedules, must be smaller than or equal to 50.' + end + if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] < 1 + fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling ReportSchedulesAPI.list_report_schedules, must be greater than or equal to 1.' + end + if @api_client.config.client_side_validation && !opts[:'page_offset'].nil? && opts[:'page_offset'] < 0 + fail ArgumentError, 'invalid value for "opts[:"page_offset"]" when calling ReportSchedulesAPI.list_report_schedules, must be greater than or equal to 0.' + end + # resource path + local_var_path = '/api/v2/reporting/schedule/list' + + # query parameters + query_params = opts[:query_params] || {} + query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil? + query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil? + query_params[:'filter[title]'] = opts[:'filter_title'] if !opts[:'filter_title'].nil? + query_params[:'filter[author_uuid]'] = opts[:'filter_author_uuid'] if !opts[:'filter_author_uuid'].nil? + query_params[:'filter[recipients]'] = opts[:'filter_recipients'] if !opts[:'filter_recipients'].nil? + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'ReportScheduleListResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :list_report_schedules, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReportSchedulesAPI#list_report_schedules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a report schedule. # # @see #patch_report_schedule_with_http_info @@ -179,5 +468,78 @@ def patch_report_schedule_with_http_info(schedule_uuid, body, opts = {}) end return data, status_code, headers end + + # Toggle a report schedule. + # + # @see #toggle_report_schedule_with_http_info + def toggle_report_schedule(schedule_uuid, body, opts = {}) + data, _status_code, _headers = toggle_report_schedule_with_http_info(schedule_uuid, body, opts) + data + end + + # Toggle a report schedule. + # + # Activate or pause a report schedule by setting its status to `active` or `inactive`. + # Requires a reporting write permission appropriate to the targeted resource type and schedule ownership. + # + # @param schedule_uuid [UUID] The unique identifier of the report schedule to toggle. + # @param body [ReportScheduleToggleRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(ReportScheduleResponse, Integer, Hash)>] ReportScheduleResponse data, response status code and response headers + def toggle_report_schedule_with_http_info(schedule_uuid, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ReportSchedulesAPI.toggle_report_schedule ...' + end + # verify the required parameter 'schedule_uuid' is set + if @api_client.config.client_side_validation && schedule_uuid.nil? + fail ArgumentError, "Missing the required parameter 'schedule_uuid' when calling ReportSchedulesAPI.toggle_report_schedule" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling ReportSchedulesAPI.toggle_report_schedule" + end + # resource path + local_var_path = '/api/v2/reporting/schedule/{schedule_uuid}/toggle'.sub('{schedule_uuid}', CGI.escape(schedule_uuid.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ReportScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :toggle_report_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ReportSchedulesAPI#toggle_report_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end end end diff --git a/lib/datadog_api_client/v2/models/report_schedule_included_resource.rb b/lib/datadog_api_client/v2/models/report_schedule_included_resource.rb index ade3a9f469a0..c7135a8d461d 100644 --- a/lib/datadog_api_client/v2/models/report_schedule_included_resource.rb +++ b/lib/datadog_api_client/v2/models/report_schedule_included_resource.rb @@ -26,7 +26,8 @@ class << self # List of class defined in oneOf (OpenAPI v3) def openapi_one_of [ - :'ReportScheduleAuthor' + :'ReportScheduleAuthor', + :'ReportScheduleResource' ] end # Builds the object diff --git a/lib/datadog_api_client/v2/models/report_schedule_included_resource_type.rb b/lib/datadog_api_client/v2/models/report_schedule_included_resource_type.rb new file mode 100644 index 000000000000..2390acc1f26b --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_included_resource_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # JSON:API resource type for an included report resource. + class ReportScheduleIncludedResourceType + include BaseEnumModel + + RESOURCE = "resource".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_index_template_variable.rb b/lib/datadog_api_client/v2/models/report_schedule_index_template_variable.rb new file mode 100644 index 000000000000..80d6586d98b7 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_index_template_variable.rb @@ -0,0 +1,150 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Template variable metadata from a dashboard index. + class ReportScheduleIndexTemplateVariable + include BaseGenericModel + + # Available values for the template variable. + attr_accessor :available_values + + # Default values for the template variable. + attr_accessor :defaults + + # The template variable name. + attr_accessor :name + + # The tag prefix for the template variable, when available. + attr_accessor :prefix + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'available_values' => :'available_values', + :'defaults' => :'defaults', + :'name' => :'name', + :'prefix' => :'prefix' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'available_values' => :'Array', + :'defaults' => :'Array', + :'name' => :'String', + :'prefix' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'available_values', + :'defaults', + :'name', + :'prefix', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleIndexTemplateVariable` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'available_values') + if (value = attributes[:'available_values']).is_a?(Array) + self.available_values = value + end + end + + if attributes.key?(:'defaults') + if (value = attributes[:'defaults']).is_a?(Array) + self.defaults = value + end + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'prefix') + self.prefix = attributes[:'prefix'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + available_values == o.available_values && + defaults == o.defaults && + name == o.name && + prefix == o.prefix && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [available_values, defaults, name, prefix, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_resource_relationship.rb b/lib/datadog_api_client/v2/models/report_schedule_list_resource_relationship.rb new file mode 100644 index 000000000000..105b5e20ae5c --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_resource_relationship.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationship to the report target resource. + class ReportScheduleListResourceRelationship + include BaseGenericModel + + # Relationship data for the report target resource. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ReportScheduleListResourceRelationshipData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleListResourceRelationship` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_resource_relationship_data.rb b/lib/datadog_api_client/v2/models/report_schedule_list_resource_relationship_data.rb new file mode 100644 index 000000000000..9a2404be87ad --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_resource_relationship_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationship data for the report target resource. + class ReportScheduleListResourceRelationshipData + include BaseGenericModel + + # The resource identifier. + attr_reader :id + + # JSON:API resource type for an included report resource. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'id' => :'String', + :'type' => :'ReportScheduleIncludedResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleListResourceRelationshipData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_response.rb b/lib/datadog_api_client/v2/models/report_schedule_list_response.rb new file mode 100644 index 000000000000..f3e5b3a35fc6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_response.rb @@ -0,0 +1,157 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of report schedules. + class ReportScheduleListResponse + include BaseGenericModel + + # The list of report schedules. + attr_reader :data + + # Related resources included with the report schedules, such as authors and rendered resources. + attr_accessor :included + + # Pagination links for navigating a report schedule list response. + attr_accessor :links + + # Metadata for a paginated report schedule list response. + attr_accessor :meta + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data', + :'included' => :'included', + :'links' => :'links', + :'meta' => :'meta' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array', + :'included' => :'Array', + :'links' => :'ReportScheduleListResponseLinks', + :'meta' => :'ReportScheduleListResponseMeta' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleListResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + + if attributes.key?(:'included') + if (value = attributes[:'included']).is_a?(Array) + self.included = value + end + end + + if attributes.key?(:'links') + self.links = attributes[:'links'] + end + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + included == o.included && + links == o.links && + meta == o.meta && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, included, links, meta, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_response_attributes.rb b/lib/datadog_api_client/v2/models/report_schedule_list_response_attributes.rb new file mode 100644 index 000000000000..b0a993963d49 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_response_attributes.rb @@ -0,0 +1,335 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The configuration and derived state of a report schedule in a list response. + class ReportScheduleListResponseAttributes + include BaseGenericModel + + # The delivery format for dashboard report schedules, or `null` if not set. + attr_accessor :delivery_format + + # The description of the report. + attr_reader :description + + # The Unix timestamp, in milliseconds, of the next scheduled delivery, or `null` if none is scheduled. + attr_accessor :next_recurrence + + # The recipients of the report (email addresses, Slack channel references, or Microsoft Teams channel references). + attr_reader :recipients + + # The identifier of the resource rendered in the report. + attr_reader :resource_id + + # The type of dashboard resource the report schedule targets. + attr_reader :resource_type + + # The recurrence rule for the schedule, expressed as an iCalendar `RRULE` string. + attr_reader :rrule + + # Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + attr_reader :status + + # The dashboard template variables applied when rendering the report. + attr_reader :template_variables + + # The relative timeframe of data included in the report, or `null` if not set. + attr_accessor :timeframe + + # The IANA time zone identifier the recurrence rule is evaluated in. + attr_reader :timezone + + # The title of the report. + attr_reader :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'delivery_format' => :'delivery_format', + :'description' => :'description', + :'next_recurrence' => :'next_recurrence', + :'recipients' => :'recipients', + :'resource_id' => :'resource_id', + :'resource_type' => :'resource_type', + :'rrule' => :'rrule', + :'status' => :'status', + :'template_variables' => :'template_variables', + :'timeframe' => :'timeframe', + :'timezone' => :'timezone', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'delivery_format' => :'ReportScheduleResponseAttributesDeliveryFormat', + :'description' => :'String', + :'next_recurrence' => :'Integer', + :'recipients' => :'Array', + :'resource_id' => :'String', + :'resource_type' => :'ReportScheduleResourceType', + :'rrule' => :'String', + :'status' => :'ReportScheduleStatus', + :'template_variables' => :'Array', + :'timeframe' => :'String', + :'timezone' => :'String', + :'title' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'delivery_format', + :'next_recurrence', + :'timeframe', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleListResponseAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'delivery_format') + self.delivery_format = attributes[:'delivery_format'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'next_recurrence') + self.next_recurrence = attributes[:'next_recurrence'] + end + + if attributes.key?(:'recipients') + if (value = attributes[:'recipients']).is_a?(Array) + self.recipients = value + end + end + + if attributes.key?(:'resource_id') + self.resource_id = attributes[:'resource_id'] + end + + if attributes.key?(:'resource_type') + self.resource_type = attributes[:'resource_type'] + end + + if attributes.key?(:'rrule') + self.rrule = attributes[:'rrule'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + + if attributes.key?(:'template_variables') + if (value = attributes[:'template_variables']).is_a?(Array) + self.template_variables = value + end + end + + if attributes.key?(:'timeframe') + self.timeframe = attributes[:'timeframe'] + end + + if attributes.key?(:'timezone') + self.timezone = attributes[:'timezone'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @description.nil? + return false if @recipients.nil? + return false if @resource_id.nil? + return false if @resource_type.nil? + return false if @rrule.nil? + return false if @status.nil? + return false if @template_variables.nil? + return false if @timezone.nil? + return false if @title.nil? + true + end + + # Custom attribute writer method with validation + # @param description [Object] Object to be assigned + # @!visibility private + def description=(description) + if description.nil? + fail ArgumentError, 'invalid value for "description", description cannot be nil.' + end + @description = description + end + + # Custom attribute writer method with validation + # @param recipients [Object] Object to be assigned + # @!visibility private + def recipients=(recipients) + if recipients.nil? + fail ArgumentError, 'invalid value for "recipients", recipients cannot be nil.' + end + @recipients = recipients + end + + # Custom attribute writer method with validation + # @param resource_id [Object] Object to be assigned + # @!visibility private + def resource_id=(resource_id) + if resource_id.nil? + fail ArgumentError, 'invalid value for "resource_id", resource_id cannot be nil.' + end + @resource_id = resource_id + end + + # Custom attribute writer method with validation + # @param resource_type [Object] Object to be assigned + # @!visibility private + def resource_type=(resource_type) + if resource_type.nil? + fail ArgumentError, 'invalid value for "resource_type", resource_type cannot be nil.' + end + @resource_type = resource_type + end + + # Custom attribute writer method with validation + # @param rrule [Object] Object to be assigned + # @!visibility private + def rrule=(rrule) + if rrule.nil? + fail ArgumentError, 'invalid value for "rrule", rrule cannot be nil.' + end + @rrule = rrule + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Custom attribute writer method with validation + # @param template_variables [Object] Object to be assigned + # @!visibility private + def template_variables=(template_variables) + if template_variables.nil? + fail ArgumentError, 'invalid value for "template_variables", template_variables cannot be nil.' + end + @template_variables = template_variables + end + + # Custom attribute writer method with validation + # @param timezone [Object] Object to be assigned + # @!visibility private + def timezone=(timezone) + if timezone.nil? + fail ArgumentError, 'invalid value for "timezone", timezone cannot be nil.' + end + @timezone = timezone + end + + # Custom attribute writer method with validation + # @param title [Object] Object to be assigned + # @!visibility private + def title=(title) + if title.nil? + fail ArgumentError, 'invalid value for "title", title cannot be nil.' + end + @title = title + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + delivery_format == o.delivery_format && + description == o.description && + next_recurrence == o.next_recurrence && + recipients == o.recipients && + resource_id == o.resource_id && + resource_type == o.resource_type && + rrule == o.rrule && + status == o.status && + template_variables == o.template_variables && + timeframe == o.timeframe && + timezone == o.timezone && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [delivery_format, description, next_recurrence, recipients, resource_id, resource_type, rrule, status, template_variables, timeframe, timezone, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_response_data.rb b/lib/datadog_api_client/v2/models/report_schedule_list_response_data.rb new file mode 100644 index 000000000000..ad7736b8dcd2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_response_data.rb @@ -0,0 +1,186 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API data object representing a report schedule in a list response. + class ReportScheduleListResponseData + include BaseGenericModel + + # The configuration and derived state of a report schedule in a list response. + attr_reader :attributes + + # The unique identifier of the report schedule. + attr_reader :id + + # Relationships for a report schedule in a list response. + attr_reader :relationships + + # JSON:API resource type for report schedules. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'relationships' => :'relationships', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ReportScheduleListResponseAttributes', + :'id' => :'String', + :'relationships' => :'ReportScheduleListResponseRelationships', + :'type' => :'ReportScheduleType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleListResponseData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'relationships') + self.relationships = attributes[:'relationships'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @relationships.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param relationships [Object] Object to be assigned + # @!visibility private + def relationships=(relationships) + if relationships.nil? + fail ArgumentError, 'invalid value for "relationships", relationships cannot be nil.' + end + @relationships = relationships + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + relationships == o.relationships && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, relationships, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_response_links.rb b/lib/datadog_api_client/v2/models/report_schedule_list_response_links.rb new file mode 100644 index 000000000000..1c1523417a96 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_response_links.rb @@ -0,0 +1,157 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Pagination links for navigating a report schedule list response. + class ReportScheduleListResponseLinks + include BaseGenericModel + + # Link to the first page. + attr_accessor :first + + # Link to the last page, or `null` if it is unavailable. + attr_accessor :last + + # Link to the next page, or `null` if it is unavailable. + attr_accessor :_next + + # Link to the previous page, or `null` if it is unavailable. + attr_accessor :prev + + # Link to the current page. + attr_accessor :_self + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'first' => :'first', + :'last' => :'last', + :'_next' => :'next', + :'prev' => :'prev', + :'_self' => :'self' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'first' => :'String', + :'last' => :'String', + :'_next' => :'String', + :'prev' => :'String', + :'_self' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'first', + :'last', + :'_next', + :'prev', + :'_self', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleListResponseLinks` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'first') + self.first = attributes[:'first'] + end + + if attributes.key?(:'last') + self.last = attributes[:'last'] + end + + if attributes.key?(:'_next') + self._next = attributes[:'_next'] + end + + if attributes.key?(:'prev') + self.prev = attributes[:'prev'] + end + + if attributes.key?(:'_self') + self._self = attributes[:'_self'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first == o.first && + last == o.last && + _next == o._next && + prev == o.prev && + _self == o._self && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [first, last, _next, prev, _self, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_response_meta.rb b/lib/datadog_api_client/v2/models/report_schedule_list_response_meta.rb new file mode 100644 index 000000000000..8818e801cac8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_response_meta.rb @@ -0,0 +1,105 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Metadata for a paginated report schedule list response. + class ReportScheduleListResponseMeta + include BaseGenericModel + + # Offset and limit pagination metadata for a report schedule list response. + attr_accessor :pagination + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'pagination' => :'pagination' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'pagination' => :'ReportScheduleListResponsePagination' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleListResponseMeta` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'pagination') + self.pagination = attributes[:'pagination'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + pagination == o.pagination && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [pagination, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_response_pagination.rb b/lib/datadog_api_client/v2/models/report_schedule_list_response_pagination.rb new file mode 100644 index 000000000000..c0f51d08790a --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_response_pagination.rb @@ -0,0 +1,183 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Offset and limit pagination metadata for a report schedule list response. + class ReportScheduleListResponsePagination + include BaseGenericModel + + # The first offset. + attr_accessor :first_offset + + # The last offset when the total count is known, or `null` if it is unavailable. + attr_accessor :last_offset + + # The maximum number of schedules returned. + attr_accessor :limit + + # The next offset. + attr_accessor :next_offset + + # The current offset. + attr_accessor :offset + + # The previous offset. + attr_accessor :prev_offset + + # The total number of matching schedules. + attr_accessor :total + + # The pagination type. + attr_accessor :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'first_offset' => :'first_offset', + :'last_offset' => :'last_offset', + :'limit' => :'limit', + :'next_offset' => :'next_offset', + :'offset' => :'offset', + :'prev_offset' => :'prev_offset', + :'total' => :'total', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'first_offset' => :'Integer', + :'last_offset' => :'Integer', + :'limit' => :'Integer', + :'next_offset' => :'Integer', + :'offset' => :'Integer', + :'prev_offset' => :'Integer', + :'total' => :'Integer', + :'type' => :'ReportScheduleListResponsePaginationType' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'last_offset', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleListResponsePagination` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'first_offset') + self.first_offset = attributes[:'first_offset'] + end + + if attributes.key?(:'last_offset') + self.last_offset = attributes[:'last_offset'] + end + + if attributes.key?(:'limit') + self.limit = attributes[:'limit'] + end + + if attributes.key?(:'next_offset') + self.next_offset = attributes[:'next_offset'] + end + + if attributes.key?(:'offset') + self.offset = attributes[:'offset'] + end + + if attributes.key?(:'prev_offset') + self.prev_offset = attributes[:'prev_offset'] + end + + if attributes.key?(:'total') + self.total = attributes[:'total'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + first_offset == o.first_offset && + last_offset == o.last_offset && + limit == o.limit && + next_offset == o.next_offset && + offset == o.offset && + prev_offset == o.prev_offset && + total == o.total && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [first_offset, last_offset, limit, next_offset, offset, prev_offset, total, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_response_pagination_type.rb b/lib/datadog_api_client/v2/models/report_schedule_list_response_pagination_type.rb new file mode 100644 index 000000000000..e7408b5082c0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_response_pagination_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The pagination type. + class ReportScheduleListResponsePaginationType + include BaseEnumModel + + OFFSET_LIMIT = "offset_limit".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_list_response_relationships.rb b/lib/datadog_api_client/v2/models/report_schedule_list_response_relationships.rb new file mode 100644 index 000000000000..10ae532c1d74 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_list_response_relationships.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Relationships for a report schedule in a list response. + class ReportScheduleListResponseRelationships + include BaseGenericModel + + # Relationship to the author of the report schedule. + attr_reader :author + + # Relationship to the report target resource. + attr_accessor :resource + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'author' => :'author', + :'resource' => :'resource' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'author' => :'ReportScheduleAuthorRelationship', + :'resource' => :'ReportScheduleListResourceRelationship' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleListResponseRelationships` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'author') + self.author = attributes[:'author'] + end + + if attributes.key?(:'resource') + self.resource = attributes[:'resource'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @author.nil? + true + end + + # Custom attribute writer method with validation + # @param author [Object] Object to be assigned + # @!visibility private + def author=(author) + if author.nil? + fail ArgumentError, 'invalid value for "author", author cannot be nil.' + end + @author = author + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + author == o.author && + resource == o.resource && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [author, resource, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_resource.rb b/lib/datadog_api_client/v2/models/report_schedule_resource.rb new file mode 100644 index 000000000000..f51f551c7228 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_resource.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # A report target resource included as a related JSON:API resource. + class ReportScheduleResource + include BaseGenericModel + + # Attributes of an included report target resource. + attr_reader :attributes + + # The resource identifier. + attr_reader :id + + # JSON:API resource type for an included report resource. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ReportScheduleResourceAttributes', + :'id' => :'String', + :'type' => :'ReportScheduleIncludedResourceType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleResource` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_resource_attributes.rb b/lib/datadog_api_client/v2/models/report_schedule_resource_attributes.rb new file mode 100644 index 000000000000..f13276b623c0 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_resource_attributes.rb @@ -0,0 +1,154 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Attributes of an included report target resource. + class ReportScheduleResourceAttributes + include BaseGenericModel + + # The type of dashboard resource the report schedule targets. + attr_reader :resource_type + + # Template variable metadata from the dashboard resource, when available. + attr_accessor :template_variables + + # The title of the dashboard or integration dashboard resource, when available. + attr_accessor :title + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'resource_type' => :'resource_type', + :'template_variables' => :'template_variables', + :'title' => :'title' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'resource_type' => :'ReportScheduleResourceType', + :'template_variables' => :'Array', + :'title' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'template_variables', + :'title', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleResourceAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'resource_type') + self.resource_type = attributes[:'resource_type'] + end + + if attributes.key?(:'template_variables') + if (value = attributes[:'template_variables']).is_a?(Array) + self.template_variables = value + end + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @resource_type.nil? + true + end + + # Custom attribute writer method with validation + # @param resource_type [Object] Object to be assigned + # @!visibility private + def resource_type=(resource_type) + if resource_type.nil? + fail ArgumentError, 'invalid value for "resource_type", resource_type cannot be nil.' + end + @resource_type = resource_type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + resource_type == o.resource_type && + template_variables == o.template_variables && + title == o.title && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [resource_type, template_variables, title, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_toggle_request.rb b/lib/datadog_api_client/v2/models/report_schedule_toggle_request.rb new file mode 100644 index 000000000000..a987ab4088d6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_toggle_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request body for toggling a report schedule. + class ReportScheduleToggleRequest + include BaseGenericModel + + # The JSON:API data object for a report schedule toggle request. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'ReportScheduleToggleRequestData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleToggleRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_toggle_request_attributes.rb b/lib/datadog_api_client/v2/models/report_schedule_toggle_request_attributes.rb new file mode 100644 index 000000000000..3ba6955827b9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_toggle_request_attributes.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The status to set on the report schedule. + class ReportScheduleToggleRequestAttributes + include BaseGenericModel + + # Whether the schedule is currently delivering reports (`active`) or paused (`inactive`). + attr_reader :status + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'status' => :'status' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'status' => :'ReportScheduleStatus' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleToggleRequestAttributes` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @status.nil? + true + end + + # Custom attribute writer method with validation + # @param status [Object] Object to be assigned + # @!visibility private + def status=(status) + if status.nil? + fail ArgumentError, 'invalid value for "status", status cannot be nil.' + end + @status = status + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + status == o.status && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [status, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/report_schedule_toggle_request_data.rb b/lib/datadog_api_client/v2/models/report_schedule_toggle_request_data.rb new file mode 100644 index 000000000000..7a9a5a22e8d4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/report_schedule_toggle_request_data.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The JSON:API data object for a report schedule toggle request. + class ReportScheduleToggleRequestData + include BaseGenericModel + + # The status to set on the report schedule. + attr_reader :attributes + + # JSON:API resource type for report schedules. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'ReportScheduleToggleRequestAttributes', + :'type' => :'ReportScheduleType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ReportScheduleToggleRequestData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end