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
37 changes: 31 additions & 6 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3435,9 +3435,10 @@ components:
$ref: '#/components/schemas/WidgetCustomLink'
type: array
requests:
description: 'Array of one request object to display in the widget. The
request must contain a `group-by` tag whose value is a country ISO code.

description: 'Array of request objects to display in the widget. The array
may have one optional request object for region layer and/or one optional
request object for points layer. The request for region layer must contain
a `group-by` tag whose value is a country ISO code.

See the [Request JSON schema documentation](https://docs.datadoghq.com/dashboards/graphing_json/request_json)

Expand All @@ -3448,7 +3449,7 @@ components:
query: <METRIC_1>{<SCOPE_1>}
items:
$ref: '#/components/schemas/GeomapWidgetRequest'
maxItems: 1
maxItems: 2
minItems: 1
type: array
style:
Expand Down Expand Up @@ -3506,8 +3507,9 @@ components:
focus: WORLD
properties:
focus:
description: The 2-letter ISO code of a country to focus the map on. Or
`WORLD`.
description: The 2-letter ISO code of a country to focus the map on, or
`WORLD` for global view, or a region (`EMEA`, `APAC`, `LATAM`), or a continent
(`NORTH_AMERICA`, `SOUTH_AMERICA`, `EUROPE`, `AFRICA`, `ASIA`, `OCEANIA`).
example: WORLD
type: string
required:
Expand All @@ -3526,6 +3528,12 @@ components:
items:
$ref: '#/components/schemas/ListStreamColumn'
type: array
conditional_formats:
description: Threshold (numeric) conditional formatting rules may be used
by the regions layer.
items:
$ref: '#/components/schemas/WidgetConditionalFormat'
type: array
formulas:
description: List of formulas that operate on queries.
items:
Expand All @@ -3551,6 +3559,23 @@ components:
$ref: '#/components/schemas/LogQueryDefinition'
sort:
$ref: '#/components/schemas/WidgetSortBy'
style:
$ref: '#/components/schemas/GeomapWidgetRequestStyle'
text_formats:
description: Text formatting rules may be used by the points layer.
items:
$ref: '#/components/schemas/TableWidgetTextFormatRule'
type: array
type: object
GeomapWidgetRequestStyle:
description: The style to apply to the request for points layer.
example:
color_by: status
properties:
color_by:
description: The category to color the points by.
example: status
type: string
type: object
GraphSnapshot:
description: Object representing a graph snapshot.
Expand Down
166 changes: 166 additions & 0 deletions examples/v1_dashboards_CreateDashboard_9836563.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
// Create a geomap widget with conditional formats and text formats
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_dashboards::DashboardsAPI;
use datadog_api_client::datadogV1::model::Dashboard;
use datadog_api_client::datadogV1::model::DashboardLayoutType;
use datadog_api_client::datadogV1::model::DashboardReflowType;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventAggregation;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinition;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionCompute;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventQueryDefinitionSearch;
use datadog_api_client::datadogV1::model::FormulaAndFunctionEventsDataSource;
use datadog_api_client::datadogV1::model::FormulaAndFunctionQueryDefinition;
use datadog_api_client::datadogV1::model::FormulaAndFunctionResponseFormat;
use datadog_api_client::datadogV1::model::FormulaType;
use datadog_api_client::datadogV1::model::GeomapWidgetDefinition;
use datadog_api_client::datadogV1::model::GeomapWidgetDefinitionStyle;
use datadog_api_client::datadogV1::model::GeomapWidgetDefinitionType;
use datadog_api_client::datadogV1::model::GeomapWidgetDefinitionView;
use datadog_api_client::datadogV1::model::GeomapWidgetRequest;
use datadog_api_client::datadogV1::model::GeomapWidgetRequestStyle;
use datadog_api_client::datadogV1::model::ListStreamColumn;
use datadog_api_client::datadogV1::model::ListStreamColumnWidth;
use datadog_api_client::datadogV1::model::ListStreamQuery;
use datadog_api_client::datadogV1::model::ListStreamSource;
use datadog_api_client::datadogV1::model::TableWidgetTextFormatMatch;
use datadog_api_client::datadogV1::model::TableWidgetTextFormatMatchType;
use datadog_api_client::datadogV1::model::TableWidgetTextFormatPalette;
use datadog_api_client::datadogV1::model::TableWidgetTextFormatRule;
use datadog_api_client::datadogV1::model::Widget;
use datadog_api_client::datadogV1::model::WidgetComparator;
use datadog_api_client::datadogV1::model::WidgetConditionalFormat;
use datadog_api_client::datadogV1::model::WidgetDefinition;
use datadog_api_client::datadogV1::model::WidgetFormula;
use datadog_api_client::datadogV1::model::WidgetFormulaSort;
use datadog_api_client::datadogV1::model::WidgetLayout;
use datadog_api_client::datadogV1::model::WidgetPalette;
use datadog_api_client::datadogV1::model::WidgetSort;
use datadog_api_client::datadogV1::model::WidgetSortBy;
use datadog_api_client::datadogV1::model::WidgetSortOrderBy;

#[tokio::main]
async fn main() {
let body =
Dashboard::new(
DashboardLayoutType::ORDERED,
"Example-Dashboard".to_string(),
vec![
Widget::new(
WidgetDefinition::GeomapWidgetDefinition(
Box::new(
GeomapWidgetDefinition::new(
vec![
GeomapWidgetRequest::new()
.conditional_formats(
vec![
WidgetConditionalFormat::new(
WidgetComparator::GREATER_THAN,
WidgetPalette::WHITE_ON_GREEN,
1000.0,
)
],
)
.formulas(vec![WidgetFormula::new("query1".to_string())])
.queries(
vec![
FormulaAndFunctionQueryDefinition
::FormulaAndFunctionEventQueryDefinition(
Box::new(
FormulaAndFunctionEventQueryDefinition::new(
FormulaAndFunctionEventQueryDefinitionCompute::new(
FormulaAndFunctionEventAggregation::COUNT,
),
FormulaAndFunctionEventsDataSource::RUM,
"query1".to_string(),
)
.group_by(vec![])
.indexes(vec!["*".to_string()])
.search(
FormulaAndFunctionEventQueryDefinitionSearch::new(
"@type:session".to_string(),
),
),
),
)
],
)
.response_format(FormulaAndFunctionResponseFormat::SCALAR)
.sort(
WidgetSortBy::new()
.count(250)
.order_by(
vec![
WidgetSortOrderBy::WidgetFormulaSort(
Box::new(
WidgetFormulaSort::new(
0,
WidgetSort::DESCENDING,
FormulaType::FORMULA,
),
),
)
],
),
),
GeomapWidgetRequest::new()
.columns(
vec![
ListStreamColumn::new(
"@network.client.geoip.location.latitude".to_string(),
ListStreamColumnWidth::AUTO,
),
ListStreamColumn::new(
"@network.client.geoip.location.longitude".to_string(),
ListStreamColumnWidth::AUTO,
),
ListStreamColumn::new(
"@network.client.geoip.country.iso_code".to_string(),
ListStreamColumnWidth::AUTO,
),
ListStreamColumn::new(
"@network.client.geoip.subdivision.name".to_string(),
ListStreamColumnWidth::AUTO,
)
],
)
.query(
ListStreamQuery::new(ListStreamSource::LOGS_STREAM, "".to_string())
.indexes(vec![])
.storage("hot".to_string()),
)
.response_format(FormulaAndFunctionResponseFormat::EVENT_LIST)
.style(GeomapWidgetRequestStyle::new().color_by("status".to_string()))
.text_formats(
vec![
TableWidgetTextFormatRule::new(
TableWidgetTextFormatMatch::new(
TableWidgetTextFormatMatchType::IS,
"error".to_string(),
),
).palette(TableWidgetTextFormatPalette::WHITE_ON_RED)
],
)
],
GeomapWidgetDefinitionStyle::new("hostmap_blues".to_string(), false),
GeomapWidgetDefinitionType::GEOMAP,
GeomapWidgetDefinitionView::new("NORTH_AMERICA".to_string()),
).title("Log Count by Service and Source".to_string()),
),
),
).layout(WidgetLayout::new(6, 12, 0, 0))
],
)
.description(Some("Example-Dashboard".to_string()))
.notify_list(Some(vec![]))
.reflow_type(DashboardReflowType::FIXED)
.tags(Some(vec![]))
.template_variables(Some(vec![]));
let configuration = datadog::Configuration::new();
let api = DashboardsAPI::with_config(configuration);
let resp = api.create_dashboard(body).await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
38 changes: 20 additions & 18 deletions src/datadogV1/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,26 @@ pub mod model_group_type;
pub use self::model_group_type::GroupType;
pub mod model_widget_sort_order_by;
pub use self::model_widget_sort_order_by::WidgetSortOrderBy;
pub mod model_geomap_widget_request_style;
pub use self::model_geomap_widget_request_style::GeomapWidgetRequestStyle;
pub mod model_table_widget_text_format_rule;
pub use self::model_table_widget_text_format_rule::TableWidgetTextFormatRule;
pub mod model_table_widget_text_format_match;
pub use self::model_table_widget_text_format_match::TableWidgetTextFormatMatch;
pub mod model_table_widget_text_format_match_type;
pub use self::model_table_widget_text_format_match_type::TableWidgetTextFormatMatchType;
pub mod model_table_widget_text_format_palette;
pub use self::model_table_widget_text_format_palette::TableWidgetTextFormatPalette;
pub mod model_table_widget_text_format_replace_all;
pub use self::model_table_widget_text_format_replace_all::TableWidgetTextFormatReplaceAll;
pub mod model_table_widget_text_format_replace_all_type;
pub use self::model_table_widget_text_format_replace_all_type::TableWidgetTextFormatReplaceAllType;
pub mod model_table_widget_text_format_replace_substring;
pub use self::model_table_widget_text_format_replace_substring::TableWidgetTextFormatReplaceSubstring;
pub mod model_table_widget_text_format_replace_substring_type;
pub use self::model_table_widget_text_format_replace_substring_type::TableWidgetTextFormatReplaceSubstringType;
pub mod model_table_widget_text_format_replace;
pub use self::model_table_widget_text_format_replace::TableWidgetTextFormatReplace;
pub mod model_geomap_widget_definition_style;
pub use self::model_geomap_widget_definition_style::GeomapWidgetDefinitionStyle;
pub mod model_geomap_widget_definition_type;
Expand Down Expand Up @@ -516,24 +536,6 @@ pub mod model_table_widget_has_search_bar;
pub use self::model_table_widget_has_search_bar::TableWidgetHasSearchBar;
pub mod model_table_widget_request;
pub use self::model_table_widget_request::TableWidgetRequest;
pub mod model_table_widget_text_format_rule;
pub use self::model_table_widget_text_format_rule::TableWidgetTextFormatRule;
pub mod model_table_widget_text_format_match;
pub use self::model_table_widget_text_format_match::TableWidgetTextFormatMatch;
pub mod model_table_widget_text_format_match_type;
pub use self::model_table_widget_text_format_match_type::TableWidgetTextFormatMatchType;
pub mod model_table_widget_text_format_palette;
pub use self::model_table_widget_text_format_palette::TableWidgetTextFormatPalette;
pub mod model_table_widget_text_format_replace_all;
pub use self::model_table_widget_text_format_replace_all::TableWidgetTextFormatReplaceAll;
pub mod model_table_widget_text_format_replace_all_type;
pub use self::model_table_widget_text_format_replace_all_type::TableWidgetTextFormatReplaceAllType;
pub mod model_table_widget_text_format_replace_substring;
pub use self::model_table_widget_text_format_replace_substring::TableWidgetTextFormatReplaceSubstring;
pub mod model_table_widget_text_format_replace_substring_type;
pub use self::model_table_widget_text_format_replace_substring_type::TableWidgetTextFormatReplaceSubstringType;
pub mod model_table_widget_text_format_replace;
pub use self::model_table_widget_text_format_replace::TableWidgetTextFormatReplace;
pub mod model_table_widget_definition_type;
pub use self::model_table_widget_definition_type::TableWidgetDefinitionType;
pub mod model_timeseries_widget_definition;
Expand Down
3 changes: 1 addition & 2 deletions src/datadogV1/model/model_geomap_widget_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ pub struct GeomapWidgetDefinition {
/// A list of custom links.
#[serde(rename = "custom_links")]
pub custom_links: Option<Vec<crate::datadogV1::model::WidgetCustomLink>>,
/// Array of one request object to display in the widget. The request must contain a `group-by` tag whose value is a country ISO code.
///
/// Array of request objects to display in the widget. The array may have one optional request object for region layer and/or one optional request object for points layer. The request for region layer must contain a `group-by` tag whose value is a country ISO code.
/// See the [Request JSON schema documentation](<https://docs.datadoghq.com/dashboards/graphing_json/request_json>)
/// for information about building the `REQUEST_SCHEMA`.
#[serde(rename = "requests")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::fmt::{self, Formatter};
#[skip_serializing_none]
#[derive(Clone, Debug, PartialEq, Serialize)]
pub struct GeomapWidgetDefinitionView {
/// The 2-letter ISO code of a country to focus the map on. Or `WORLD`.
/// The 2-letter ISO code of a country to focus the map on, or `WORLD` for global view, or a region (`EMEA`, `APAC`, `LATAM`), or a continent (`NORTH_AMERICA`, `SOUTH_AMERICA`, `EUROPE`, `AFRICA`, `ASIA`, `OCEANIA`).
#[serde(rename = "focus")]
pub focus: String,
#[serde(flatten)]
Expand Down
Loading