Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
444 changes: 444 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions examples/v2/report-schedules/ListDatasetReportSchedules.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# List dataset report schedules returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new
p api_instance.list_dataset_report_schedules("dataset_id")
27 changes: 27 additions & 0 deletions examples/v2/report-schedules/PrintReport.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Print a report returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new

body = DatadogAPIClient::V2::PrintReportRequest.new({
data: DatadogAPIClient::V2::PrintReportRequestData.new({
attributes: DatadogAPIClient::V2::PrintReportRequestAttributes.new({
from_ts: 1780318800000,
resource_id: "abc-def-ghi",
resource_type: DatadogAPIClient::V2::ReportScheduleResourceType::DASHBOARD,
template_variables: [
DatadogAPIClient::V2::ReportScheduleTemplateVariable.new({
name: "env",
values: [
"prod",
],
}),
],
timeframe: "1w",
timezone: "America/New_York",
to_ts: 1780923600000,
}),
type: DatadogAPIClient::V2::PrintReportType::REPORT,
}),
})
p api_instance.print_report(body)
6 changes: 6 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4966,6 +4966,12 @@
"snapshot_id" => "String",
"body" => "SnapshotUpdateRequest",
},
"v2.ListDatasetReportSchedules" => {
"dataset_id" => "String",
},
"v2.PrintReport" => {
"body" => "PrintReportRequest",
},
"v2.CreateReportSchedule" => {
"body" => "ReportScheduleCreateRequest",
},
Expand Down
49 changes: 49 additions & 0 deletions features/v2/report_schedules.feature
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,27 @@ Feature: Report Schedules
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: List dataset report schedules returns "Bad Request" response
Given new "ListDatasetReportSchedules" request
And request contains "dataset_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: List dataset report schedules returns "Not Found" response
Given new "ListDatasetReportSchedules" request
And request contains "dataset_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: List dataset report schedules returns "OK" response
Given new "ListDatasetReportSchedules" request
And request contains "dataset_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
Expand All @@ -117,6 +138,34 @@ Feature: Report Schedules
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: Print a report returns "Bad Request" response
Given new "PrintReport" request
And body with value {"data": {"attributes": {"from_ts": 1780318800000, "resource_id": "abc-def-ghi", "resource_type": "dashboard", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "to_ts": 1780923600000}, "type": "report"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: Print a report returns "Not Found" response
Given new "PrintReport" request
And body with value {"data": {"attributes": {"from_ts": 1780318800000, "resource_id": "abc-def-ghi", "resource_type": "dashboard", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "to_ts": 1780923600000}, "type": "report"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: Print a report returns "OK" response
Given new "PrintReport" request
And body with value {"data": {"attributes": {"from_ts": 1780318800000, "resource_id": "abc-def-ghi", "resource_type": "dashboard", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "to_ts": 1780923600000}, "type": "report"}}
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: Print a report returns "Unprocessable Entity" response
Given new "PrintReport" request
And body with value {"data": {"attributes": {"from_ts": 1780318800000, "resource_id": "abc-def-ghi", "resource_type": "dashboard", "template_variables": [{"name": "env", "values": ["prod"]}], "timeframe": "1w", "timezone": "America/New_York", "to_ts": 1780923600000}, "type": "report"}}
When the request is sent
Then the response status is 422 Unprocessable Entity

@generated @skip @team:DataDog/reporting-and-sharing
Scenario: Toggle a report schedule returns "Bad Request" response
Given new "ToggleReportSchedule" request
Expand Down
12 changes: 12 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -6458,6 +6458,18 @@
"type": "idempotent"
}
},
"ListDatasetReportSchedules": {
"tag": "Report Schedules",
"undo": {
"type": "safe"
}
},
"PrintReport": {
"tag": "Report Schedules",
"undo": {
"type": "unsafe"
}
},
"CreateReportSchedule": {
"tag": "Report Schedules",
"undo": {
Expand Down
11 changes: 11 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2784,6 +2784,10 @@ def overrides
"v2.dataset_attributes_request" => "DatasetAttributesRequest",
"v2.dataset_attributes_response" => "DatasetAttributesResponse",
"v2.dataset_create_request" => "DatasetCreateRequest",
"v2.dataset_report_schedule_list_response" => "DatasetReportScheduleListResponse",
"v2.dataset_report_schedule_resource_type" => "DatasetReportScheduleResourceType",
"v2.dataset_report_schedule_response_attributes" => "DatasetReportScheduleResponseAttributes",
"v2.dataset_report_schedule_response_data" => "DatasetReportScheduleResponseData",
"v2.dataset_request" => "DatasetRequest",
"v2.dataset_response" => "DatasetResponse",
"v2.dataset_response_multi" => "DatasetResponseMulti",
Expand Down Expand Up @@ -5677,6 +5681,13 @@ def overrides
"v2.powerpacks_response_meta_pagination" => "PowerpacksResponseMetaPagination",
"v2.powerpack_template_variable" => "PowerpackTemplateVariable",
"v2.preview_entity_response_data" => "PreviewEntityResponseData",
"v2.print_report_request" => "PrintReportRequest",
"v2.print_report_request_attributes" => "PrintReportRequestAttributes",
"v2.print_report_request_data" => "PrintReportRequestData",
"v2.print_report_response" => "PrintReportResponse",
"v2.print_report_response_attributes" => "PrintReportResponseAttributes",
"v2.print_report_response_data" => "PrintReportResponseData",
"v2.print_report_type" => "PrintReportType",
"v2.process_data_source" => "ProcessDataSource",
"v2.process_scalar_query" => "ProcessScalarQuery",
"v2.process_summaries_meta" => "ProcessSummariesMeta",
Expand Down
136 changes: 136 additions & 0 deletions lib/datadog_api_client/v2/api/report_schedules_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,73 @@ def get_report_schedules_for_resource_with_http_info(resource_type, resource_id,
return data, status_code, headers
end

# List dataset report schedules.
#
# @see #list_dataset_report_schedules_with_http_info
def list_dataset_report_schedules(dataset_id, opts = {})
data, _status_code, _headers = list_dataset_report_schedules_with_http_info(dataset_id, opts)
data
end

# List dataset report schedules.
#
# Retrieve all report schedules for a given published dataset.
# Returns report schedules belonging to the authenticated user's organization that target the specified dataset.
# Requires the `generate_log_reports` or `manage_log_reports` permission.
#
# @param dataset_id [String] The identifier of the published dataset to retrieve report schedules for.
# @param opts [Hash] the optional parameters
# @return [Array<(DatasetReportScheduleListResponse, Integer, Hash)>] DatasetReportScheduleListResponse data, response status code and response headers
def list_dataset_report_schedules_with_http_info(dataset_id, opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ReportSchedulesAPI.list_dataset_report_schedules ...'
end
# verify the required parameter 'dataset_id' is set
if @api_client.config.client_side_validation && dataset_id.nil?
fail ArgumentError, "Missing the required parameter 'dataset_id' when calling ReportSchedulesAPI.list_dataset_report_schedules"
end
# resource path
local_var_path = '/api/v2/reporting/dataset/{dataset_id}/schedules'.sub('{dataset_id}', CGI.escape(dataset_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] || 'DatasetReportScheduleListResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

new_options = opts.merge(
:operation => :list_dataset_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_dataset_report_schedules\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
Expand Down Expand Up @@ -469,6 +536,75 @@ def patch_report_schedule_with_http_info(schedule_uuid, body, opts = {})
return data, status_code, headers
end

# Print a report.
#
# @see #print_report_with_http_info
def print_report(body, opts = {})
data, _status_code, _headers = print_report_with_http_info(body, opts)
data
end

# Print a report.
#
# Initiate a one-off, print-only report for a dashboard or integration dashboard.
# The report is rendered as a PDF and made available for download through the URL returned in the response.
# Requires a reporting permission appropriate to the targeted resource type.
#
# @param body [PrintReportRequest]
# @param opts [Hash] the optional parameters
# @return [Array<(PrintReportResponse, Integer, Hash)>] PrintReportResponse data, response status code and response headers
def print_report_with_http_info(body, opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: ReportSchedulesAPI.print_report ...'
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.print_report"
end
# resource path
local_var_path = '/api/v2/reporting/print'

# 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] || 'PrintReportResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

new_options = opts.merge(
:operation => :print_report,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: ReportSchedulesAPI#print_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Toggle a report schedule.
#
# @see #toggle_report_schedule_with_http_info
Expand Down
Loading
Loading