diff --git a/.generator/schemas/v1/openapi.yaml b/.generator/schemas/v1/openapi.yaml index d9bb88a10f2..a0b2429945a 100644 --- a/.generator/schemas/v1/openapi.yaml +++ b/.generator/schemas/v1/openapi.yaml @@ -895,6 +895,174 @@ components: items: $ref: '#/components/schemas/AzureAccount' type: array + BarChartWidgetDefinition: + description: The bar chart visualization displays categorical data using vertical + bars, allowing you to compare values across different groups. + properties: + custom_links: + description: List of custom links. + items: + $ref: '#/components/schemas/WidgetCustomLink' + type: array + requests: + description: List of bar chart widget requests. + example: + - q: system.load.1 + items: + $ref: '#/components/schemas/BarChartWidgetRequest' + maxItems: 1 + minItems: 1 + type: array + style: + $ref: '#/components/schemas/BarChartWidgetStyle' + time: + $ref: '#/components/schemas/WidgetTime' + title: + description: Title of your widget. + type: string + title_align: + $ref: '#/components/schemas/WidgetTextAlign' + title_size: + description: Size of the title. + type: string + type: + $ref: '#/components/schemas/BarChartWidgetDefinitionType' + required: + - type + - requests + type: object + BarChartWidgetDefinitionType: + default: bar_chart + description: Type of the bar chart widget. + enum: + - bar_chart + example: bar_chart + type: string + x-enum-varnames: + - BAR_CHART + BarChartWidgetDisplay: + description: Bar chart widget display options. + oneOf: + - $ref: '#/components/schemas/BarChartWidgetStacked' + - $ref: '#/components/schemas/BarChartWidgetFlat' + BarChartWidgetFlat: + description: Bar chart widget flat display. + properties: + type: + $ref: '#/components/schemas/BarChartWidgetFlatType' + required: + - type + type: object + BarChartWidgetFlatType: + default: flat + description: Bar chart widget flat display type. + enum: + - flat + example: flat + type: string + x-enum-varnames: + - FLAT + BarChartWidgetLegend: + description: Bar chart widget stacked legend behavior. + enum: + - automatic + - inline + - none + example: automatic + type: string + x-enum-varnames: + - AUTOMATIC + - INLINE + - NONE + BarChartWidgetRequest: + description: Updated bar chart widget. + properties: + apm_query: + $ref: '#/components/schemas/LogQueryDefinition' + audit_query: + $ref: '#/components/schemas/LogQueryDefinition' + conditional_formats: + description: List of conditional formats. + example: + - comparator: '>=' + palette: blue + value: 1.0 + items: + $ref: '#/components/schemas/WidgetConditionalFormat' + type: array + event_query: + $ref: '#/components/schemas/LogQueryDefinition' + formulas: + description: List of formulas that operate on queries. + items: + $ref: '#/components/schemas/WidgetFormula' + type: array + log_query: + $ref: '#/components/schemas/LogQueryDefinition' + network_query: + $ref: '#/components/schemas/LogQueryDefinition' + process_query: + $ref: '#/components/schemas/ProcessQueryDefinition' + profile_metrics_query: + $ref: '#/components/schemas/LogQueryDefinition' + q: + description: Widget query. + type: string + queries: + description: List of queries that can be returned directly or used in formulas. + items: + $ref: '#/components/schemas/FormulaAndFunctionQueryDefinition' + type: array + response_format: + $ref: '#/components/schemas/FormulaAndFunctionResponseFormat' + rum_query: + $ref: '#/components/schemas/LogQueryDefinition' + security_query: + $ref: '#/components/schemas/LogQueryDefinition' + sort: + $ref: '#/components/schemas/WidgetSortBy' + style: + $ref: '#/components/schemas/WidgetRequestStyle' + type: object + BarChartWidgetScaling: + description: Bar chart widget scaling definition. + enum: + - absolute + - relative + type: string + x-enum-varnames: + - ABSOLUTE + - RELATIVE + BarChartWidgetStacked: + description: Bar chart widget stacked display options. + properties: + legend: + $ref: '#/components/schemas/BarChartWidgetLegend' + type: + $ref: '#/components/schemas/BarChartWidgetStackedType' + required: + - type + type: object + BarChartWidgetStackedType: + default: stacked + description: Bar chart widget stacked display type. + enum: + - stacked + example: stacked + type: string + x-enum-varnames: + - STACKED + BarChartWidgetStyle: + description: Style customization for a bar chart widget. + properties: + display: + $ref: '#/components/schemas/BarChartWidgetDisplay' + palette: + description: Color palette to apply to the widget. + type: string + scaling: + $ref: '#/components/schemas/BarChartWidgetScaling' + type: object CancelDowntimesByScopeRequest: description: Cancel downtimes according to scope. properties: @@ -14338,6 +14506,7 @@ components: SplitGraphSourceWidgetDefinition: description: The original widget we are splitting on. oneOf: + - $ref: '#/components/schemas/BarChartWidgetDefinition' - $ref: '#/components/schemas/ChangeWidgetDefinition' - $ref: '#/components/schemas/GeomapWidgetDefinition' - $ref: '#/components/schemas/QueryValueWidgetDefinition' @@ -24829,6 +24998,7 @@ components: oneOf: - $ref: '#/components/schemas/AlertGraphWidgetDefinition' - $ref: '#/components/schemas/AlertValueWidgetDefinition' + - $ref: '#/components/schemas/BarChartWidgetDefinition' - $ref: '#/components/schemas/ChangeWidgetDefinition' - $ref: '#/components/schemas/CheckStatusWidgetDefinition' - $ref: '#/components/schemas/DistributionWidgetDefinition' diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-bar-chart-widget-with-stacked-type-and-no-legend-specified.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-bar-chart-widget-with-stacked-type-and-no-legend-specified.frozen new file mode 100644 index 00000000000..84e3901971d --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-bar-chart-widget-with-stacked-type-and-no-legend-specified.frozen @@ -0,0 +1 @@ +2025-12-15T21:25:35.069Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-bar-chart-widget-with-stacked-type-and-no-legend-specified.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-bar-chart-widget-with-stacked-type-and-no-legend-specified.yml new file mode 100644 index 00000000000..044c69ca50f --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-a-bar-chart-widget-with-stacked-type-and-no-legend-specified.yml @@ -0,0 +1,45 @@ +http_interactions: +- recorded_at: Mon, 15 Dec 2025 21:25:35 GMT + request: + body: + encoding: UTF-8 + string: '{"description":"","layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_a_bar_chart_widget_with_stacked_type_and_no_legend_specified-1765833935","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"bar_chart"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + encoding: UTF-8 + string: '{"id":"6yv-ayr-nyv","title":"Test-Create_a_new_dashboard_with_a_bar_chart_widget_with_stacked_type_and_no_legend_specified-1765833935","description":"","author_handle":"jessica.sylvester@datadoghq.com","author_name":"Jessica + Sylvester","layout_type":"free","url":"/dashboard/6yv-ayr-nyv/test-createanewdashboardwithabarchartwidgetwithstackedtypeandnolegendspecified-1","template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"bar_chart"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":747608743840054}],"notify_list":[],"created_at":"2025-12-15T21:25:35.211465+00:00","modified_at":"2025-12-15T21:25:35.211465+00:00","restricted_roles":[]}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Mon, 15 Dec 2025 21:25:35 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/6yv-ayr-nyv + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"6yv-ayr-nyv"}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget-sorted-by-group.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget-sorted-by-group.frozen new file mode 100644 index 00000000000..66da6ecb4a7 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget-sorted-by-group.frozen @@ -0,0 +1 @@ +2025-12-15T21:26:29.455Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget-sorted-by-group.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget-sorted-by-group.yml new file mode 100644 index 00000000000..1b9fea2dd93 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget-sorted-by-group.yml @@ -0,0 +1,45 @@ +http_interactions: +- recorded_at: Mon, 15 Dec 2025 21:26:29 GMT + request: + body: + encoding: UTF-8 + string: '{"description":"","layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_bar_chart_widget_sorted_by_group-1765833989","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"bar_chart"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + encoding: UTF-8 + string: '{"id":"d7t-dfe-vuh","title":"Test-Create_a_new_dashboard_with_bar_chart_widget_sorted_by_group-1765833989","description":"","author_handle":"jessica.sylvester@datadoghq.com","author_name":"Jessica + Sylvester","layout_type":"free","url":"/dashboard/d7t-dfe-vuh/test-createanewdashboardwithbarchartwidgetsortedbygroup-1765833989","template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"name":"service","order":"asc","type":"group"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"bar_chart"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":3540992741229512}],"notify_list":[],"created_at":"2025-12-15T21:26:29.666161+00:00","modified_at":"2025-12-15T21:26:29.666161+00:00","restricted_roles":[]}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Mon, 15 Dec 2025 21:26:29 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/d7t-dfe-vuh + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"d7t-dfe-vuh"}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget.frozen b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget.frozen new file mode 100644 index 00000000000..cbf1cd99173 --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget.frozen @@ -0,0 +1 @@ +2025-12-15T21:26:18.139Z \ No newline at end of file diff --git a/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget.yml b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget.yml new file mode 100644 index 00000000000..d7e1be1892d --- /dev/null +++ b/cassettes/features/v1/dashboards/Create-a-new-dashboard-with-bar-chart-widget.yml @@ -0,0 +1,45 @@ +http_interactions: +- recorded_at: Mon, 15 Dec 2025 21:26:18 GMT + request: + body: + encoding: UTF-8 + string: '{"description":"","layout_type":"free","notify_list":[],"template_variables":[],"title":"Test-Create_a_new_dashboard_with_bar_chart_widget-1765833978","widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"bar_chart"},"layout":{"height":15,"width":47,"x":0,"y":0}}]}' + headers: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v1/dashboard + response: + body: + encoding: UTF-8 + string: '{"id":"jnt-fik-esx","title":"Test-Create_a_new_dashboard_with_bar_chart_widget-1765833978","description":"","author_handle":"jessica.sylvester@datadoghq.com","author_name":"Jessica + Sylvester","layout_type":"free","url":"/dashboard/jnt-fik-esx/test-createanewdashboardwithbarchartwidget-1765833978","template_variables":[],"widgets":[{"definition":{"requests":[{"formulas":[{"formula":"query1"}],"queries":[{"aggregator":"avg","data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} + by {service}"}],"response_format":"scalar","sort":{"count":10,"order_by":[{"index":0,"order":"desc","type":"formula"}]}}],"style":{"display":{"legend":"inline","type":"stacked"},"palette":"dog_classic","scaling":"relative"},"time":{},"title":"","title_align":"left","title_size":"16","type":"bar_chart"},"layout":{"height":15,"width":47,"x":0,"y":0},"id":4318878693632821}],"notify_list":[],"created_at":"2025-12-15T21:26:18.283708+00:00","modified_at":"2025-12-15T21:26:18.283708+00:00","restricted_roles":[]}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +- recorded_at: Mon, 15 Dec 2025 21:26:18 GMT + request: + body: null + headers: + Accept: + - application/json + method: DELETE + uri: https://api.datadoghq.com/api/v1/dashboard/jnt-fik-esx + response: + body: + encoding: UTF-8 + string: '{"deleted_dashboard_id":"jnt-fik-esx"}' + headers: + Content-Type: + - application/json + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v1/dashboards/CreateDashboard_1712853070.rb b/examples/v1/dashboards/CreateDashboard_1712853070.rb new file mode 100644 index 00000000000..57c5708d527 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_1712853070.rb @@ -0,0 +1,66 @@ +# Create a new dashboard with bar_chart widget + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard", + description: "", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 47, + height: 15, + }), + definition: DatadogAPIClient::V1::BarChartWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), + style: DatadogAPIClient::V1::BarChartWidgetStyle.new({ + display: DatadogAPIClient::V1::BarChartWidgetStacked.new({ + type: DatadogAPIClient::V1::BarChartWidgetStackedType::STACKED, + legend: DatadogAPIClient::V1::BarChartWidgetLegend::INLINE, + }), + scaling: DatadogAPIClient::V1::BarChartWidgetScaling::RELATIVE, + palette: "dog_classic", + }), + type: DatadogAPIClient::V1::BarChartWidgetDefinitionType::BAR_CHART, + requests: [ + DatadogAPIClient::V1::BarChartWidgetRequest.new({ + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query1", + query: "avg:system.cpu.user{*} by {service}", + aggregator: DatadogAPIClient::V1::FormulaAndFunctionMetricAggregation::AVG, + }), + ], + formulas: [ + DatadogAPIClient::V1::WidgetFormula.new({ + formula: "query1", + }), + ], + sort: DatadogAPIClient::V1::WidgetSortBy.new({ + count: 10, + order_by: [ + DatadogAPIClient::V1::WidgetFormulaSort.new({ + type: DatadogAPIClient::V1::FormulaType::FORMULA, + index: 0, + order: DatadogAPIClient::V1::WidgetSort::DESCENDING, + }), + ], + }), + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, + }), + ], + }), + }), + ], + template_variables: [], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::FREE, + notify_list: [], +}) +p api_instance.create_dashboard(body) diff --git a/examples/v1/dashboards/CreateDashboard_2345541687.rb b/examples/v1/dashboards/CreateDashboard_2345541687.rb new file mode 100644 index 00000000000..a4de6759c04 --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2345541687.rb @@ -0,0 +1,65 @@ +# Create a new dashboard with a bar_chart widget with stacked type and no legend specified + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard", + description: "", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 47, + height: 15, + }), + definition: DatadogAPIClient::V1::BarChartWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), + style: DatadogAPIClient::V1::BarChartWidgetStyle.new({ + display: DatadogAPIClient::V1::BarChartWidgetStacked.new({ + type: DatadogAPIClient::V1::BarChartWidgetStackedType::STACKED, + }), + scaling: DatadogAPIClient::V1::BarChartWidgetScaling::RELATIVE, + palette: "dog_classic", + }), + type: DatadogAPIClient::V1::BarChartWidgetDefinitionType::BAR_CHART, + requests: [ + DatadogAPIClient::V1::BarChartWidgetRequest.new({ + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query1", + query: "avg:system.cpu.user{*} by {service}", + aggregator: DatadogAPIClient::V1::FormulaAndFunctionMetricAggregation::AVG, + }), + ], + formulas: [ + DatadogAPIClient::V1::WidgetFormula.new({ + formula: "query1", + }), + ], + sort: DatadogAPIClient::V1::WidgetSortBy.new({ + count: 10, + order_by: [ + DatadogAPIClient::V1::WidgetGroupSort.new({ + type: DatadogAPIClient::V1::GroupType::GROUP, + name: "service", + order: DatadogAPIClient::V1::WidgetSort::ASCENDING, + }), + ], + }), + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, + }), + ], + }), + }), + ], + template_variables: [], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::FREE, + notify_list: [], +}) +p api_instance.create_dashboard(body) diff --git a/examples/v1/dashboards/CreateDashboard_2617251399.rb b/examples/v1/dashboards/CreateDashboard_2617251399.rb new file mode 100644 index 00000000000..65f4a25e1de --- /dev/null +++ b/examples/v1/dashboards/CreateDashboard_2617251399.rb @@ -0,0 +1,66 @@ +# Create a new dashboard with bar_chart widget sorted by group + +require "datadog_api_client" +api_instance = DatadogAPIClient::V1::DashboardsAPI.new + +body = DatadogAPIClient::V1::Dashboard.new({ + title: "Example-Dashboard", + description: "", + widgets: [ + DatadogAPIClient::V1::Widget.new({ + layout: DatadogAPIClient::V1::WidgetLayout.new({ + x: 0, + y: 0, + width: 47, + height: 15, + }), + definition: DatadogAPIClient::V1::BarChartWidgetDefinition.new({ + title: "", + title_size: "16", + title_align: DatadogAPIClient::V1::WidgetTextAlign::LEFT, + time: DatadogAPIClient::V1::WidgetLegacyLiveSpan.new({}), + style: DatadogAPIClient::V1::BarChartWidgetStyle.new({ + display: DatadogAPIClient::V1::BarChartWidgetStacked.new({ + type: DatadogAPIClient::V1::BarChartWidgetStackedType::STACKED, + legend: DatadogAPIClient::V1::BarChartWidgetLegend::INLINE, + }), + scaling: DatadogAPIClient::V1::BarChartWidgetScaling::RELATIVE, + palette: "dog_classic", + }), + type: DatadogAPIClient::V1::BarChartWidgetDefinitionType::BAR_CHART, + requests: [ + DatadogAPIClient::V1::BarChartWidgetRequest.new({ + queries: [ + DatadogAPIClient::V1::FormulaAndFunctionMetricQueryDefinition.new({ + data_source: DatadogAPIClient::V1::FormulaAndFunctionMetricDataSource::METRICS, + name: "query1", + query: "avg:system.cpu.user{*} by {service}", + aggregator: DatadogAPIClient::V1::FormulaAndFunctionMetricAggregation::AVG, + }), + ], + formulas: [ + DatadogAPIClient::V1::WidgetFormula.new({ + formula: "query1", + }), + ], + sort: DatadogAPIClient::V1::WidgetSortBy.new({ + count: 10, + order_by: [ + DatadogAPIClient::V1::WidgetGroupSort.new({ + type: DatadogAPIClient::V1::GroupType::GROUP, + name: "service", + order: DatadogAPIClient::V1::WidgetSort::ASCENDING, + }), + ], + }), + response_format: DatadogAPIClient::V1::FormulaAndFunctionResponseFormat::SCALAR, + }), + ], + }), + }), + ], + template_variables: [], + layout_type: DatadogAPIClient::V1::DashboardLayoutType::FREE, + notify_list: [], +}) +p api_instance.create_dashboard(body) diff --git a/features/v1/dashboards.feature b/features/v1/dashboards.feature index 588c609cedd..43640d8a82c 100644 --- a/features/v1/dashboards.feature +++ b/features/v1/dashboards.feature @@ -106,6 +106,19 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].profile_metrics_query.compute.facet" is equal to "@prof_core_cpu_cores" And the response "widgets[0].definition.requests[0].profile_metrics_query.compute.aggregation" is equal to "sum" + @skip-terraform-config @skip-typescript @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with a bar_chart widget with stacked type and no legend specified + Given new "CreateDashboard" request + And body with value {"title":"{{ unique }}","description":"","widgets":[{"layout":{"x":0,"y":0,"width":47,"height":15},"definition":{"title":"","title_size":"16","title_align":"left","time":{},"style":{"display": {"type": "stacked"},"scaling": "relative","palette": "dog_classic"},"type":"bar_chart","requests":[{"queries":[{"data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} by {service}","aggregator":"avg"}],"formulas":[{"formula":"query1"}],"sort":{"count":10,"order_by":[{"type":"group","name":"service","order":"asc"}]},"response_format":"scalar"}]}}],"template_variables":[],"layout_type":"free","notify_list":[]} + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "bar_chart" + And the response "widgets[0].definition.requests[0].sort.order_by[0].order" is equal to "asc" + And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "group" + And the response "widgets[0].definition.requests[0].sort.order_by[0].name" is equal to "service" + And the response "widgets[0].definition.style.display.type" is equal to "stacked" + And the response "widgets[0].definition.style.display" does not have field "legend" + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with a change widget using formulas and functions slo query Given there is a valid "slo" in the system @@ -336,6 +349,28 @@ Feature: Dashboards And the response "widgets[0].definition.requests[0].columns[0].width" is equal to "auto" And the response "widgets[0].definition.requests[0].query.data_source" is equal to "apm_issue_stream" + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with bar_chart widget + Given new "CreateDashboard" request + And body from file "dashboards_json_payload/bar_chart_widget.json" + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "bar_chart" + And the response "widgets[0].definition.requests[0].sort.order_by[0].order" is equal to "desc" + And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "formula" + And the response "widgets[0].definition.requests[0].sort.order_by[0].index" is equal to 0 + + @team:DataDog/dashboards-backend + Scenario: Create a new dashboard with bar_chart widget sorted by group + Given new "CreateDashboard" request + And body with value {"title":"{{ unique }}","description":"","widgets":[{"layout":{"x":0,"y":0,"width":47,"height":15},"definition":{"title":"","title_size":"16","title_align":"left","time":{},"style":{"display": {"type": "stacked","legend": "inline"},"scaling": "relative","palette": "dog_classic"},"type":"bar_chart","requests":[{"queries":[{"data_source":"metrics","name":"query1","query":"avg:system.cpu.user{*} by {service}","aggregator":"avg"}],"formulas":[{"formula":"query1"}],"sort":{"count":10,"order_by":[{"type":"group","name":"service","order":"asc"}]},"response_format":"scalar"}]}}],"template_variables":[],"layout_type":"free","notify_list":[]} + When the request is sent + Then the response status is 200 OK + And the response "widgets[0].definition.type" is equal to "bar_chart" + And the response "widgets[0].definition.requests[0].sort.order_by[0].order" is equal to "asc" + And the response "widgets[0].definition.requests[0].sort.order_by[0].type" is equal to "group" + And the response "widgets[0].definition.requests[0].sort.order_by[0].name" is equal to "service" + @team:DataDog/dashboards-backend Scenario: Create a new dashboard with check_status widget Given new "CreateDashboard" request diff --git a/features/v1/dashboards_json_payload/bar_chart_widget.json b/features/v1/dashboards_json_payload/bar_chart_widget.json new file mode 100644 index 00000000000..0fac4d091bf --- /dev/null +++ b/features/v1/dashboards_json_payload/bar_chart_widget.json @@ -0,0 +1,66 @@ +{ + "title":"{{ unique }}", + "description":"", + "widgets":[ + { + "layout":{ + "x":0, + "y":0, + "width":47, + "height":15 + }, + "definition":{ + "title":"", + "title_size":"16", + "title_align":"left", + "time":{ + + }, + "style":{ + "display": { + "type": "stacked", + "legend": "inline" + }, + "scaling": "relative", + "palette": "dog_classic" + }, + "type":"bar_chart", + "requests":[ + { + "queries":[ + { + "data_source":"metrics", + "name":"query1", + "query":"avg:system.cpu.user{*} by {service}", + "aggregator":"avg" + } + ], + "formulas":[ + { + "formula":"query1" + } + ], + "sort": { + "count":10, + "order_by":[ + { + "type":"formula", + "index":0, + "order":"desc" + } + ] + }, + "response_format":"scalar" + } + ] + } + } + ], + "template_variables":[ + + ], + "layout_type":"free", + "notify_list":[ + + ] +} diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 3e6e421122a..ef14025fb7f 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -53,6 +53,17 @@ def overrides "v1.aws_tag_filter_delete_request" => "AWSTagFilterDeleteRequest", "v1.aws_tag_filter_list_response" => "AWSTagFilterListResponse", "v1.azure_account" => "AzureAccount", + "v1.bar_chart_widget_definition" => "BarChartWidgetDefinition", + "v1.bar_chart_widget_definition_type" => "BarChartWidgetDefinitionType", + "v1.bar_chart_widget_display" => "BarChartWidgetDisplay", + "v1.bar_chart_widget_flat" => "BarChartWidgetFlat", + "v1.bar_chart_widget_flat_type" => "BarChartWidgetFlatType", + "v1.bar_chart_widget_legend" => "BarChartWidgetLegend", + "v1.bar_chart_widget_request" => "BarChartWidgetRequest", + "v1.bar_chart_widget_scaling" => "BarChartWidgetScaling", + "v1.bar_chart_widget_stacked" => "BarChartWidgetStacked", + "v1.bar_chart_widget_stacked_type" => "BarChartWidgetStackedType", + "v1.bar_chart_widget_style" => "BarChartWidgetStyle", "v1.cancel_downtimes_by_scope_request" => "CancelDowntimesByScopeRequest", "v1.canceled_downtimes_ids" => "CanceledDowntimesIds", "v1.change_widget_definition" => "ChangeWidgetDefinition", diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_definition.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_definition.rb new file mode 100644 index 00000000000..b95abe53320 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_definition.rb @@ -0,0 +1,216 @@ +=begin +#Datadog API V1 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::V1 + # The bar chart visualization displays categorical data using vertical bars, allowing you to compare values across different groups. + class BarChartWidgetDefinition + include BaseGenericModel + + # List of custom links. + attr_accessor :custom_links + + # List of bar chart widget requests. + attr_reader :requests + + # Style customization for a bar chart widget. + attr_accessor :style + + # Time setting for the widget. + attr_accessor :time + + # Title of your widget. + attr_accessor :title + + # How to align the text on the widget. + attr_accessor :title_align + + # Size of the title. + attr_accessor :title_size + + # Type of the bar chart widget. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'custom_links' => :'custom_links', + :'requests' => :'requests', + :'style' => :'style', + :'time' => :'time', + :'title' => :'title', + :'title_align' => :'title_align', + :'title_size' => :'title_size', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'custom_links' => :'Array', + :'requests' => :'Array', + :'style' => :'BarChartWidgetStyle', + :'time' => :'WidgetTime', + :'title' => :'String', + :'title_align' => :'WidgetTextAlign', + :'title_size' => :'String', + :'type' => :'BarChartWidgetDefinitionType' + } + 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::V1::BarChartWidgetDefinition` 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?(:'custom_links') + if (value = attributes[:'custom_links']).is_a?(Array) + self.custom_links = value + end + end + + if attributes.key?(:'requests') + if (value = attributes[:'requests']).is_a?(Array) + self.requests = value + end + end + + if attributes.key?(:'style') + self.style = attributes[:'style'] + end + + if attributes.key?(:'time') + self.time = attributes[:'time'] + end + + if attributes.key?(:'title') + self.title = attributes[:'title'] + end + + if attributes.key?(:'title_align') + self.title_align = attributes[:'title_align'] + end + + if attributes.key?(:'title_size') + self.title_size = attributes[:'title_size'] + 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 @requests.nil? + return false if @requests.length > 1 + return false if @requests.length < 1 + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param requests [Object] Object to be assigned + # @!visibility private + def requests=(requests) + if requests.nil? + fail ArgumentError, 'invalid value for "requests", requests cannot be nil.' + end + if requests.length > 1 + fail ArgumentError, 'invalid value for "requests", number of items must be less than or equal to 1.' + end + if requests.length < 1 + fail ArgumentError, 'invalid value for "requests", number of items must be greater than or equal to 1.' + end + @requests = requests + 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 && + custom_links == o.custom_links && + requests == o.requests && + style == o.style && + time == o.time && + title == o.title && + title_align == o.title_align && + title_size == o.title_size && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [custom_links, requests, style, time, title, title_align, title_size, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_definition_type.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_definition_type.rb new file mode 100644 index 00000000000..55af8bda882 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_definition_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 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::V1 + # Type of the bar chart widget. + class BarChartWidgetDefinitionType + include BaseEnumModel + + BAR_CHART = "bar_chart".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_display.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_display.rb new file mode 100644 index 00000000000..73cbfd6cd50 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_display.rb @@ -0,0 +1,63 @@ +=begin +#Datadog API V1 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::V1 + # Bar chart widget display options. + module BarChartWidgetDisplay + class << self + include BaseOneOfModel + include BaseOneOfModelNoDiscriminator + + # List of class defined in oneOf (OpenAPI v3) + def openapi_one_of + [ + :'BarChartWidgetStacked', + :'BarChartWidgetFlat' + ] + end + # Builds the object + # @param data [Mixed] Data to be matched against the list of oneOf items + # @return [Object] Returns the model or the data itself + def build(data) + # Go through the list of oneOf items and attempt to identify the appropriate one. + # Note: + # - We do not attempt to check whether exactly one item matches. + # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 }) + # due to the way the deserialization is made in the base_object template (it just casts without verifying). + # - TODO: scalar values are de facto behaving as if they were nullable. + # - TODO: logging when debugging is set. + openapi_one_of.each do |klass| + begin + next if klass == :AnyType # "nullable: true" + typed_data = find_and_cast_into_type(klass, data) + next if typed_data.respond_to?(:_unparsed) && typed_data._unparsed + return typed_data if typed_data + rescue # rescue all errors so we keep iterating even if the current item lookup raises + end + end + + if openapi_one_of.include?(:AnyType) + data + else + self._unparsed = true + DatadogAPIClient::UnparsedObject.new(data) + end + end + end + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_flat.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_flat.rb new file mode 100644 index 00000000000..e78b2c37a65 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_flat.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V1 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::V1 + # Bar chart widget flat display. + class BarChartWidgetFlat + include BaseGenericModel + + # Bar chart widget flat display type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'type' => :'BarChartWidgetFlatType' + } + 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::V1::BarChartWidgetFlat` 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?(:'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 @type.nil? + true + 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 && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_flat_type.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_flat_type.rb new file mode 100644 index 00000000000..1e022aff188 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_flat_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 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::V1 + # Bar chart widget flat display type. + class BarChartWidgetFlatType + include BaseEnumModel + + FLAT = "flat".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_legend.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_legend.rb new file mode 100644 index 00000000000..0e1a898b991 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_legend.rb @@ -0,0 +1,28 @@ +=begin +#Datadog API V1 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::V1 + # Bar chart widget stacked legend behavior. + class BarChartWidgetLegend + include BaseEnumModel + + AUTOMATIC = "automatic".freeze + INLINE = "inline".freeze + NONE = "none".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_request.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_request.rb new file mode 100644 index 00000000000..f3eb0bfc193 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_request.rb @@ -0,0 +1,261 @@ +=begin +#Datadog API V1 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::V1 + # Updated bar chart widget. + class BarChartWidgetRequest + include BaseGenericModel + + # The log query. + attr_accessor :apm_query + + # The log query. + attr_accessor :audit_query + + # List of conditional formats. + attr_accessor :conditional_formats + + # The log query. + attr_accessor :event_query + + # List of formulas that operate on queries. + attr_accessor :formulas + + # The log query. + attr_accessor :log_query + + # The log query. + attr_accessor :network_query + + # The process query to use in the widget. + attr_accessor :process_query + + # The log query. + attr_accessor :profile_metrics_query + + # Widget query. + attr_accessor :q + + # List of queries that can be returned directly or used in formulas. + attr_accessor :queries + + # Timeseries, scalar, or event list response. Event list response formats are supported by Geomap widgets. + attr_accessor :response_format + + # The log query. + attr_accessor :rum_query + + # The log query. + attr_accessor :security_query + + # The controls for sorting the widget. + attr_accessor :sort + + # Define request widget style. + attr_accessor :style + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'apm_query' => :'apm_query', + :'audit_query' => :'audit_query', + :'conditional_formats' => :'conditional_formats', + :'event_query' => :'event_query', + :'formulas' => :'formulas', + :'log_query' => :'log_query', + :'network_query' => :'network_query', + :'process_query' => :'process_query', + :'profile_metrics_query' => :'profile_metrics_query', + :'q' => :'q', + :'queries' => :'queries', + :'response_format' => :'response_format', + :'rum_query' => :'rum_query', + :'security_query' => :'security_query', + :'sort' => :'sort', + :'style' => :'style' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'apm_query' => :'LogQueryDefinition', + :'audit_query' => :'LogQueryDefinition', + :'conditional_formats' => :'Array', + :'event_query' => :'LogQueryDefinition', + :'formulas' => :'Array', + :'log_query' => :'LogQueryDefinition', + :'network_query' => :'LogQueryDefinition', + :'process_query' => :'ProcessQueryDefinition', + :'profile_metrics_query' => :'LogQueryDefinition', + :'q' => :'String', + :'queries' => :'Array', + :'response_format' => :'FormulaAndFunctionResponseFormat', + :'rum_query' => :'LogQueryDefinition', + :'security_query' => :'LogQueryDefinition', + :'sort' => :'WidgetSortBy', + :'style' => :'WidgetRequestStyle' + } + 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::V1::BarChartWidgetRequest` 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?(:'apm_query') + self.apm_query = attributes[:'apm_query'] + end + + if attributes.key?(:'audit_query') + self.audit_query = attributes[:'audit_query'] + end + + if attributes.key?(:'conditional_formats') + if (value = attributes[:'conditional_formats']).is_a?(Array) + self.conditional_formats = value + end + end + + if attributes.key?(:'event_query') + self.event_query = attributes[:'event_query'] + end + + if attributes.key?(:'formulas') + if (value = attributes[:'formulas']).is_a?(Array) + self.formulas = value + end + end + + if attributes.key?(:'log_query') + self.log_query = attributes[:'log_query'] + end + + if attributes.key?(:'network_query') + self.network_query = attributes[:'network_query'] + end + + if attributes.key?(:'process_query') + self.process_query = attributes[:'process_query'] + end + + if attributes.key?(:'profile_metrics_query') + self.profile_metrics_query = attributes[:'profile_metrics_query'] + end + + if attributes.key?(:'q') + self.q = attributes[:'q'] + end + + if attributes.key?(:'queries') + if (value = attributes[:'queries']).is_a?(Array) + self.queries = value + end + end + + if attributes.key?(:'response_format') + self.response_format = attributes[:'response_format'] + end + + if attributes.key?(:'rum_query') + self.rum_query = attributes[:'rum_query'] + end + + if attributes.key?(:'security_query') + self.security_query = attributes[:'security_query'] + end + + if attributes.key?(:'sort') + self.sort = attributes[:'sort'] + end + + if attributes.key?(:'style') + self.style = attributes[:'style'] + 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 && + apm_query == o.apm_query && + audit_query == o.audit_query && + conditional_formats == o.conditional_formats && + event_query == o.event_query && + formulas == o.formulas && + log_query == o.log_query && + network_query == o.network_query && + process_query == o.process_query && + profile_metrics_query == o.profile_metrics_query && + q == o.q && + queries == o.queries && + response_format == o.response_format && + rum_query == o.rum_query && + security_query == o.security_query && + sort == o.sort && + style == o.style && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [apm_query, audit_query, conditional_formats, event_query, formulas, log_query, network_query, process_query, profile_metrics_query, q, queries, response_format, rum_query, security_query, sort, style, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_scaling.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_scaling.rb new file mode 100644 index 00000000000..da613e9c0a0 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_scaling.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V1 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::V1 + # Bar chart widget scaling definition. + class BarChartWidgetScaling + include BaseEnumModel + + ABSOLUTE = "absolute".freeze + RELATIVE = "relative".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_stacked.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_stacked.rb new file mode 100644 index 00000000000..c7cf2002a64 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_stacked.rb @@ -0,0 +1,133 @@ +=begin +#Datadog API V1 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::V1 + # Bar chart widget stacked display options. + class BarChartWidgetStacked + include BaseGenericModel + + # Bar chart widget stacked legend behavior. + attr_accessor :legend + + # Bar chart widget stacked display type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'legend' => :'legend', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'legend' => :'BarChartWidgetLegend', + :'type' => :'BarChartWidgetStackedType' + } + 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::V1::BarChartWidgetStacked` 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?(:'legend') + self.legend = attributes[:'legend'] + 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 @type.nil? + true + 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 && + legend == o.legend && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [legend, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_stacked_type.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_stacked_type.rb new file mode 100644 index 00000000000..32e71dedafb --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_stacked_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V1 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::V1 + # Bar chart widget stacked display type. + class BarChartWidgetStackedType + include BaseEnumModel + + STACKED = "stacked".freeze + end +end diff --git a/lib/datadog_api_client/v1/models/bar_chart_widget_style.rb b/lib/datadog_api_client/v1/models/bar_chart_widget_style.rb new file mode 100644 index 00000000000..0c7933ea365 --- /dev/null +++ b/lib/datadog_api_client/v1/models/bar_chart_widget_style.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V1 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::V1 + # Style customization for a bar chart widget. + class BarChartWidgetStyle + include BaseGenericModel + + # Bar chart widget display options. + attr_accessor :display + + # Color palette to apply to the widget. + attr_accessor :palette + + # Bar chart widget scaling definition. + attr_accessor :scaling + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'display' => :'display', + :'palette' => :'palette', + :'scaling' => :'scaling' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'display' => :'BarChartWidgetDisplay', + :'palette' => :'String', + :'scaling' => :'BarChartWidgetScaling' + } + 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::V1::BarChartWidgetStyle` 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?(:'display') + self.display = attributes[:'display'] + end + + if attributes.key?(:'palette') + self.palette = attributes[:'palette'] + end + + if attributes.key?(:'scaling') + self.scaling = attributes[:'scaling'] + 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 && + display == o.display && + palette == o.palette && + scaling == o.scaling && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [display, palette, scaling, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v1/models/split_graph_source_widget_definition.rb b/lib/datadog_api_client/v1/models/split_graph_source_widget_definition.rb index b1352c8c6ab..c35221edd76 100644 --- a/lib/datadog_api_client/v1/models/split_graph_source_widget_definition.rb +++ b/lib/datadog_api_client/v1/models/split_graph_source_widget_definition.rb @@ -26,6 +26,7 @@ class << self # List of class defined in oneOf (OpenAPI v3) def openapi_one_of [ + :'BarChartWidgetDefinition', :'ChangeWidgetDefinition', :'GeomapWidgetDefinition', :'QueryValueWidgetDefinition', diff --git a/lib/datadog_api_client/v1/models/widget_definition.rb b/lib/datadog_api_client/v1/models/widget_definition.rb index 66732ddef5b..897fd778977 100644 --- a/lib/datadog_api_client/v1/models/widget_definition.rb +++ b/lib/datadog_api_client/v1/models/widget_definition.rb @@ -28,6 +28,7 @@ def openapi_one_of [ :'AlertGraphWidgetDefinition', :'AlertValueWidgetDefinition', + :'BarChartWidgetDefinition', :'ChangeWidgetDefinition', :'CheckStatusWidgetDefinition', :'DistributionWidgetDefinition',