From 2b7d531bdc04d4554e1b2938ad9a9e64c4fd184b Mon Sep 17 00:00:00 2001 From: Qin Cheng Chen <qincchen@gmail.com> Date: Fri, 7 May 2021 13:31:14 -0400 Subject: [PATCH 1/4] [graph-editor] Change manual test for new context menu API --- tests/api/v1/datadog/api_dashboards_test.go | 107 ++++++++++---------- 1 file changed, 55 insertions(+), 52 deletions(-) diff --git a/tests/api/v1/datadog/api_dashboards_test.go b/tests/api/v1/datadog/api_dashboards_test.go index 051836fec56..73efdcf35fc 100644 --- a/tests/api/v1/datadog/api_dashboards_test.go +++ b/tests/api/v1/datadog/api_dashboards_test.go @@ -91,10 +91,13 @@ func TestDashboardLifecycle(t *testing.T) { changeWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) changeWidgetDefinition.SetTitleSize("16") changeWidgetDefinition.SetTime(*widgetTime) - changeWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // label := "Test Custom Link label" + customLink := datadog.WidgetCustomLink{} + customLink.SetLabel("Test Custom Link label") + customLink.SetLink("https://app.datadoghq.com/dashboard/lists") + changeWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) changeWidgetDefinition.SetRequests([]datadog.ChangeWidgetRequest{ *changeWidgetRequest, }) @@ -281,10 +284,10 @@ func TestDashboardLifecycle(t *testing.T) { heatMapWidgetDefinition.SetTime(*widgetTime) heatMapWidgetDefinition.SetShowLegend(true) heatMapWidgetDefinition.SetLegendSize("4") - heatMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // heatMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) heatMapWidget := datadog.NewWidget(datadog.HeatMapWidgetDefinitionAsWidgetDefinition(heatMapWidgetDefinition)) @@ -308,10 +311,10 @@ func TestDashboardLifecycle(t *testing.T) { hostMapWidgetDefinition.SetTitle("Test HostMap Widget") hostMapWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) hostMapWidgetDefinition.SetTitleSize("16") - hostMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // hostMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) hostMapWidget := datadog.NewWidget(datadog.HostMapWidgetDefinitionAsWidgetDefinition(hostMapWidgetDefinition)) @@ -401,10 +404,10 @@ func TestDashboardLifecycle(t *testing.T) { queryValueWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) queryValueWidgetDefinition.SetTitleSize("16") queryValueWidgetDefinition.SetTime(*widgetTime) - queryValueWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // queryValueWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) queryValueWidget := datadog.NewWidget(datadog.QueryValueWidgetDefinitionAsWidgetDefinition(queryValueWidgetDefinition)) @@ -475,10 +478,10 @@ func TestDashboardLifecycle(t *testing.T) { scatterPlotWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) scatterPlotWidgetDefinition.SetTitleSize("16") scatterPlotWidgetDefinition.SetTime(*widgetTime) - scatterPlotWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // scatterPlotWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) scatterPlotWidget := datadog.NewWidget(datadog.ScatterPlotWidgetDefinitionAsWidgetDefinition(scatterPlotWidgetDefinition)) @@ -504,10 +507,10 @@ func TestDashboardLifecycle(t *testing.T) { serviceMapWidgetDefinition.SetTitle("Test Service Map Widget") serviceMapWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) serviceMapWidgetDefinition.SetTitleSize("16") - serviceMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // serviceMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) serviceMapWidget := datadog.NewWidget(datadog.ServiceMapWidgetDefinitionAsWidgetDefinition(serviceMapWidgetDefinition)) @@ -554,10 +557,10 @@ func TestDashboardLifecycle(t *testing.T) { tableWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) tableWidgetDefinition.SetTitleSize("16") tableWidgetDefinition.SetTime(*widgetTime) - tableWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // tableWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) tableWidgetDefinition.SetHasSearchBar(datadog.TABLEWIDGETHASSEARCHBAR_AUTO) tableWidget := datadog.NewWidget(datadog.TableWidgetDefinitionAsWidgetDefinition(tableWidgetDefinition)) @@ -580,10 +583,10 @@ func TestDashboardLifecycle(t *testing.T) { tableWidgetApmStatsDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) tableWidgetApmStatsDefinition.SetTitleSize("16") tableWidgetApmStatsDefinition.SetTime(*widgetTime) - tableWidgetApmStatsDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // tableWidgetApmStatsDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) tableWidgetApmStats := datadog.NewWidget(datadog.TableWidgetDefinitionAsWidgetDefinition(tableWidgetApmStatsDefinition)) @@ -632,10 +635,10 @@ func TestDashboardLifecycle(t *testing.T) { timeseriesWidgetDefinition.SetLegendSize("16") timeseriesWidgetDefinition.SetLegendLayout("horizontal") timeseriesWidgetDefinition.SetLegendColumns([]datadog.TimeseriesWidgetLegendColumn{"value", "min", "max"}) - timeseriesWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // timeseriesWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) timeseriesWidget := datadog.NewWidget(datadog.TimeseriesWidgetDefinitionAsWidgetDefinition(timeseriesWidgetDefinition)) @@ -685,10 +688,10 @@ func TestDashboardLifecycle(t *testing.T) { timeseriesWidgetDefinitionProcessQuery.SetTime(*widgetTime) timeseriesWidgetDefinitionProcessQuery.SetShowLegend(true) timeseriesWidgetDefinitionProcessQuery.SetLegendSize("16") - timeseriesWidgetDefinitionProcessQuery.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // timeseriesWidgetDefinitionProcessQuery.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) timeseriesWidgetProcessQuery := datadog.NewWidget(datadog.TimeseriesWidgetDefinitionAsWidgetDefinition(timeseriesWidgetDefinitionProcessQuery)) @@ -741,10 +744,10 @@ func TestDashboardLifecycle(t *testing.T) { timeseriesWidgetDefinitionLogQuery.SetTime(*widgetTime) timeseriesWidgetDefinitionLogQuery.SetShowLegend(true) timeseriesWidgetDefinitionLogQuery.SetLegendSize("16") - timeseriesWidgetDefinitionLogQuery.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // timeseriesWidgetDefinitionLogQuery.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) timeseriesWidgetLogQuery := datadog.NewWidget(datadog.TimeseriesWidgetDefinitionAsWidgetDefinition(timeseriesWidgetDefinitionLogQuery)) @@ -796,10 +799,10 @@ func TestDashboardLifecycle(t *testing.T) { timeseriesWidgetDefinitionEventQuery.SetTime(*widgetTime) timeseriesWidgetDefinitionEventQuery.SetShowLegend(true) timeseriesWidgetDefinitionEventQuery.SetLegendSize("16") - timeseriesWidgetDefinitionEventQuery.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // timeseriesWidgetDefinitionEventQuery.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) timeseriesWidgetEventQuery := datadog.NewWidget(datadog.TimeseriesWidgetDefinitionAsWidgetDefinition(timeseriesWidgetDefinitionEventQuery)) @@ -869,10 +872,10 @@ func TestDashboardLifecycle(t *testing.T) { toplistWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) toplistWidgetDefinition.SetTitleSize("16") toplistWidgetDefinition.SetTime(*widgetTime) - toplistWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - Label: "Test Custom Link label", - Link: "https://app.datadoghq.com/dashboard/lists", - }}) + // toplistWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ + // Label: "Test Custom Link label", + // Link: "https://app.datadoghq.com/dashboard/lists", + // }}) toplistWidget := datadog.NewWidget(datadog.ToplistWidgetDefinitionAsWidgetDefinition(toplistWidgetDefinition)) From f5b7432923475c73ff6cc48288d50629bd3d1eca Mon Sep 17 00:00:00 2001 From: Qin Cheng Chen <qincchen@gmail.com> Date: Fri, 7 May 2021 14:05:44 -0400 Subject: [PATCH 2/4] fix test --- tests/api/v1/datadog/api_dashboards_test.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/api/v1/datadog/api_dashboards_test.go b/tests/api/v1/datadog/api_dashboards_test.go index 73efdcf35fc..d08e66e62d0 100644 --- a/tests/api/v1/datadog/api_dashboards_test.go +++ b/tests/api/v1/datadog/api_dashboards_test.go @@ -91,13 +91,12 @@ func TestDashboardLifecycle(t *testing.T) { changeWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) changeWidgetDefinition.SetTitleSize("16") changeWidgetDefinition.SetTime(*widgetTime) - // label := "Test Custom Link label" - customLink := datadog.WidgetCustomLink{} - customLink.SetLabel("Test Custom Link label") - customLink.SetLink("https://app.datadoghq.com/dashboard/lists") - changeWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ - customLink, - }) + // customLink := datadog.WidgetCustomLink{} + // customLink.SetLabel("Test Custom Link label") + // customLink.SetLink("https://app.datadoghq.com/dashboard/lists") + // changeWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + // customLink, + // }) changeWidgetDefinition.SetRequests([]datadog.ChangeWidgetRequest{ *changeWidgetRequest, }) From 568c514879949ebb5bfc8b1447903c0e4195876a Mon Sep 17 00:00:00 2001 From: Qin Cheng Chen <qincchen@gmail.com> Date: Tue, 11 May 2021 06:26:19 -0400 Subject: [PATCH 3/4] fix test --- tests/api/v1/datadog/api_dashboards_test.go | 98 +++++++++------------ 1 file changed, 44 insertions(+), 54 deletions(-) diff --git a/tests/api/v1/datadog/api_dashboards_test.go b/tests/api/v1/datadog/api_dashboards_test.go index d08e66e62d0..e84c6af3993 100644 --- a/tests/api/v1/datadog/api_dashboards_test.go +++ b/tests/api/v1/datadog/api_dashboards_test.go @@ -51,6 +51,11 @@ func TestDashboardLifecycle(t *testing.T) { widgetLayout.SetX(0) widgetLayout.SetY(0) + // Custom Links + customLink := datadog.WidgetCustomLink{} + customLink.SetLabel("Test Custom Link label") + customLink.SetLink("https://app.datadoghq.com/dashboard/lists") + // Alert Graph Widget alertGraphDefinition := datadog.NewAlertGraphWidgetDefinitionWithDefaults() alertGraphDefinition.SetAlertId("1234") @@ -91,12 +96,9 @@ func TestDashboardLifecycle(t *testing.T) { changeWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) changeWidgetDefinition.SetTitleSize("16") changeWidgetDefinition.SetTime(*widgetTime) - // customLink := datadog.WidgetCustomLink{} - // customLink.SetLabel("Test Custom Link label") - // customLink.SetLink("https://app.datadoghq.com/dashboard/lists") - // changeWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ - // customLink, - // }) + changeWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) changeWidgetDefinition.SetRequests([]datadog.ChangeWidgetRequest{ *changeWidgetRequest, }) @@ -283,10 +285,9 @@ func TestDashboardLifecycle(t *testing.T) { heatMapWidgetDefinition.SetTime(*widgetTime) heatMapWidgetDefinition.SetShowLegend(true) heatMapWidgetDefinition.SetLegendSize("4") - // heatMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + heatMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) heatMapWidget := datadog.NewWidget(datadog.HeatMapWidgetDefinitionAsWidgetDefinition(heatMapWidgetDefinition)) @@ -310,10 +311,9 @@ func TestDashboardLifecycle(t *testing.T) { hostMapWidgetDefinition.SetTitle("Test HostMap Widget") hostMapWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) hostMapWidgetDefinition.SetTitleSize("16") - // hostMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + hostMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) hostMapWidget := datadog.NewWidget(datadog.HostMapWidgetDefinitionAsWidgetDefinition(hostMapWidgetDefinition)) @@ -403,10 +403,9 @@ func TestDashboardLifecycle(t *testing.T) { queryValueWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) queryValueWidgetDefinition.SetTitleSize("16") queryValueWidgetDefinition.SetTime(*widgetTime) - // queryValueWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + queryValueWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) queryValueWidget := datadog.NewWidget(datadog.QueryValueWidgetDefinitionAsWidgetDefinition(queryValueWidgetDefinition)) @@ -477,10 +476,9 @@ func TestDashboardLifecycle(t *testing.T) { scatterPlotWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) scatterPlotWidgetDefinition.SetTitleSize("16") scatterPlotWidgetDefinition.SetTime(*widgetTime) - // scatterPlotWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + scatterPlotWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) scatterPlotWidget := datadog.NewWidget(datadog.ScatterPlotWidgetDefinitionAsWidgetDefinition(scatterPlotWidgetDefinition)) @@ -506,10 +504,9 @@ func TestDashboardLifecycle(t *testing.T) { serviceMapWidgetDefinition.SetTitle("Test Service Map Widget") serviceMapWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) serviceMapWidgetDefinition.SetTitleSize("16") - // serviceMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + serviceMapWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) serviceMapWidget := datadog.NewWidget(datadog.ServiceMapWidgetDefinitionAsWidgetDefinition(serviceMapWidgetDefinition)) @@ -556,10 +553,9 @@ func TestDashboardLifecycle(t *testing.T) { tableWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) tableWidgetDefinition.SetTitleSize("16") tableWidgetDefinition.SetTime(*widgetTime) - // tableWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + tableWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) tableWidgetDefinition.SetHasSearchBar(datadog.TABLEWIDGETHASSEARCHBAR_AUTO) tableWidget := datadog.NewWidget(datadog.TableWidgetDefinitionAsWidgetDefinition(tableWidgetDefinition)) @@ -582,10 +578,9 @@ func TestDashboardLifecycle(t *testing.T) { tableWidgetApmStatsDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) tableWidgetApmStatsDefinition.SetTitleSize("16") tableWidgetApmStatsDefinition.SetTime(*widgetTime) - // tableWidgetApmStatsDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + tableWidgetApmStatsDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) tableWidgetApmStats := datadog.NewWidget(datadog.TableWidgetDefinitionAsWidgetDefinition(tableWidgetApmStatsDefinition)) @@ -634,10 +629,9 @@ func TestDashboardLifecycle(t *testing.T) { timeseriesWidgetDefinition.SetLegendSize("16") timeseriesWidgetDefinition.SetLegendLayout("horizontal") timeseriesWidgetDefinition.SetLegendColumns([]datadog.TimeseriesWidgetLegendColumn{"value", "min", "max"}) - // timeseriesWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + timeseriesWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) timeseriesWidget := datadog.NewWidget(datadog.TimeseriesWidgetDefinitionAsWidgetDefinition(timeseriesWidgetDefinition)) @@ -687,10 +681,9 @@ func TestDashboardLifecycle(t *testing.T) { timeseriesWidgetDefinitionProcessQuery.SetTime(*widgetTime) timeseriesWidgetDefinitionProcessQuery.SetShowLegend(true) timeseriesWidgetDefinitionProcessQuery.SetLegendSize("16") - // timeseriesWidgetDefinitionProcessQuery.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + timeseriesWidgetDefinitionProcessQuery.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) timeseriesWidgetProcessQuery := datadog.NewWidget(datadog.TimeseriesWidgetDefinitionAsWidgetDefinition(timeseriesWidgetDefinitionProcessQuery)) @@ -743,10 +736,9 @@ func TestDashboardLifecycle(t *testing.T) { timeseriesWidgetDefinitionLogQuery.SetTime(*widgetTime) timeseriesWidgetDefinitionLogQuery.SetShowLegend(true) timeseriesWidgetDefinitionLogQuery.SetLegendSize("16") - // timeseriesWidgetDefinitionLogQuery.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + timeseriesWidgetDefinitionLogQuery.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) timeseriesWidgetLogQuery := datadog.NewWidget(datadog.TimeseriesWidgetDefinitionAsWidgetDefinition(timeseriesWidgetDefinitionLogQuery)) @@ -798,10 +790,9 @@ func TestDashboardLifecycle(t *testing.T) { timeseriesWidgetDefinitionEventQuery.SetTime(*widgetTime) timeseriesWidgetDefinitionEventQuery.SetShowLegend(true) timeseriesWidgetDefinitionEventQuery.SetLegendSize("16") - // timeseriesWidgetDefinitionEventQuery.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + timeseriesWidgetDefinitionEventQuery.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) timeseriesWidgetEventQuery := datadog.NewWidget(datadog.TimeseriesWidgetDefinitionAsWidgetDefinition(timeseriesWidgetDefinitionEventQuery)) @@ -871,10 +862,9 @@ func TestDashboardLifecycle(t *testing.T) { toplistWidgetDefinition.SetTitleAlign(datadog.WIDGETTEXTALIGN_CENTER) toplistWidgetDefinition.SetTitleSize("16") toplistWidgetDefinition.SetTime(*widgetTime) - // toplistWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{{ - // Label: "Test Custom Link label", - // Link: "https://app.datadoghq.com/dashboard/lists", - // }}) + toplistWidgetDefinition.SetCustomLinks([]datadog.WidgetCustomLink{ + customLink, + }) toplistWidget := datadog.NewWidget(datadog.ToplistWidgetDefinitionAsWidgetDefinition(toplistWidgetDefinition)) From 0f09409cb3e4ec6cc09aeb39e9030894b6762fb9 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" <packages@datadoghq.com> Date: Fri, 14 May 2021 17:17:39 +0000 Subject: [PATCH 4/4] Regenerate client from commit a1af0e0 of spec repo --- .apigentools-info | 8 +- api/v1/datadog/api/openapi.yaml | 11 +- api/v1/datadog/docs/WidgetCustomLink.md | 68 ++++++++- api/v1/datadog/model_widget_custom_link.go | 167 ++++++++++++++------- 4 files changed, 190 insertions(+), 64 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 9731382beb7..4f336f58aa5 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-05-14 12:57:54.828603", - "spec_repo_commit": "8dce4be" + "regenerated": "2021-05-14 17:16:34.209768", + "spec_repo_commit": "a1af0e0" }, "v2": { "apigentools_version": "1.4.1.dev6", - "regenerated": "2021-05-14 12:58:52.756713", - "spec_repo_commit": "8dce4be" + "regenerated": "2021-05-14 17:17:37.272303", + "spec_repo_commit": "a1af0e0" } } } \ No newline at end of file diff --git a/api/v1/datadog/api/openapi.yaml b/api/v1/datadog/api/openapi.yaml index 89aa8ee981e..36a1cca4768 100644 --- a/api/v1/datadog/api/openapi.yaml +++ b/api/v1/datadog/api/openapi.yaml @@ -26227,6 +26227,9 @@ components: description: Custom links help you connect a data value to a URL, like a Datadog page or your AWS console. properties: + is_hidden: + description: The flag for toggling context menu link visibility. + type: boolean label: description: The label for the custom link URL. Keep the label short and descriptive. Use metrics and tags as variables. @@ -26237,9 +26240,11 @@ components: A relative URL must start with `/`. example: https://app.datadoghq.com/logs?query={{host}} type: string - required: - - label - - link + override_label: + description: The label ID that refers to a context menu link. Can be `logs`, + `hosts`, `traces`, `profiles`, `processes`, `containers`, or `rum`. + example: logs + type: string type: object WidgetDefinition: description: '[Definition of the widget](https://docs.datadoghq.com/dashboards/widgets/).' diff --git a/api/v1/datadog/docs/WidgetCustomLink.md b/api/v1/datadog/docs/WidgetCustomLink.md index 8f3609986c8..211e9e39546 100644 --- a/api/v1/datadog/docs/WidgetCustomLink.md +++ b/api/v1/datadog/docs/WidgetCustomLink.md @@ -4,14 +4,16 @@ Name | Type | Description | Notes ---- | ---- | ----------- | ------ -**Label** | **string** | The label for the custom link URL. Keep the label short and descriptive. Use metrics and tags as variables. | -**Link** | **string** | The URL of the custom link. URL must include `http` or `https`. A relative URL must start with `/`. | +**IsHidden** | Pointer to **bool** | The flag for toggling context menu link visibility. | [optional] +**Label** | Pointer to **string** | The label for the custom link URL. Keep the label short and descriptive. Use metrics and tags as variables. | [optional] +**Link** | Pointer to **string** | The URL of the custom link. URL must include `http` or `https`. A relative URL must start with `/`. | [optional] +**OverrideLabel** | Pointer to **string** | The label ID that refers to a context menu link. Can be `logs`, `hosts`, `traces`, `profiles`, `processes`, `containers`, or `rum`. | [optional] ## Methods ### NewWidgetCustomLink -`func NewWidgetCustomLink(label string, link string, ) *WidgetCustomLink` +`func NewWidgetCustomLink() *WidgetCustomLink` NewWidgetCustomLink instantiates a new WidgetCustomLink object This constructor will assign default values to properties that have it defined, @@ -26,6 +28,31 @@ NewWidgetCustomLinkWithDefaults instantiates a new WidgetCustomLink object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set +### GetIsHidden + +`func (o *WidgetCustomLink) GetIsHidden() bool` + +GetIsHidden returns the IsHidden field if non-nil, zero value otherwise. + +### GetIsHiddenOk + +`func (o *WidgetCustomLink) GetIsHiddenOk() (*bool, bool)` + +GetIsHiddenOk returns a tuple with the IsHidden field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetIsHidden + +`func (o *WidgetCustomLink) SetIsHidden(v bool)` + +SetIsHidden sets IsHidden field to given value. + +### HasIsHidden + +`func (o *WidgetCustomLink) HasIsHidden() bool` + +HasIsHidden returns a boolean if a field has been set. + ### GetLabel `func (o *WidgetCustomLink) GetLabel() string` @@ -45,6 +72,11 @@ and a boolean to check if the value has been set. SetLabel sets Label field to given value. +### HasLabel + +`func (o *WidgetCustomLink) HasLabel() bool` + +HasLabel returns a boolean if a field has been set. ### GetLink @@ -65,6 +97,36 @@ and a boolean to check if the value has been set. SetLink sets Link field to given value. +### HasLink + +`func (o *WidgetCustomLink) HasLink() bool` + +HasLink returns a boolean if a field has been set. + +### GetOverrideLabel + +`func (o *WidgetCustomLink) GetOverrideLabel() string` + +GetOverrideLabel returns the OverrideLabel field if non-nil, zero value otherwise. + +### GetOverrideLabelOk + +`func (o *WidgetCustomLink) GetOverrideLabelOk() (*string, bool)` + +GetOverrideLabelOk returns a tuple with the OverrideLabel field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetOverrideLabel + +`func (o *WidgetCustomLink) SetOverrideLabel(v string)` + +SetOverrideLabel sets OverrideLabel field to given value. + +### HasOverrideLabel + +`func (o *WidgetCustomLink) HasOverrideLabel() bool` + +HasOverrideLabel returns a boolean if a field has been set. [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/api/v1/datadog/model_widget_custom_link.go b/api/v1/datadog/model_widget_custom_link.go index be75f17c969..258ff8985e5 100644 --- a/api/v1/datadog/model_widget_custom_link.go +++ b/api/v1/datadog/model_widget_custom_link.go @@ -10,25 +10,26 @@ package datadog import ( "encoding/json" - "fmt" ) // WidgetCustomLink Custom links help you connect a data value to a URL, like a Datadog page or your AWS console. type WidgetCustomLink struct { + // The flag for toggling context menu link visibility. + IsHidden *bool `json:"is_hidden,omitempty"` // The label for the custom link URL. Keep the label short and descriptive. Use metrics and tags as variables. - Label string `json:"label"` + Label *string `json:"label,omitempty"` // The URL of the custom link. URL must include `http` or `https`. A relative URL must start with `/`. - Link string `json:"link"` + Link *string `json:"link,omitempty"` + // The label ID that refers to a context menu link. Can be `logs`, `hosts`, `traces`, `profiles`, `processes`, `containers`, or `rum`. + OverrideLabel *string `json:"override_label,omitempty"` } // NewWidgetCustomLink instantiates a new WidgetCustomLink object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewWidgetCustomLink(label string, link string) *WidgetCustomLink { +func NewWidgetCustomLink() *WidgetCustomLink { this := WidgetCustomLink{} - this.Label = label - this.Link = link return &this } @@ -40,93 +41,151 @@ func NewWidgetCustomLinkWithDefaults() *WidgetCustomLink { return &this } -// GetLabel returns the Label field value +// GetIsHidden returns the IsHidden field value if set, zero value otherwise. +func (o *WidgetCustomLink) GetIsHidden() bool { + if o == nil || o.IsHidden == nil { + var ret bool + return ret + } + return *o.IsHidden +} + +// GetIsHiddenOk returns a tuple with the IsHidden field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetCustomLink) GetIsHiddenOk() (*bool, bool) { + if o == nil || o.IsHidden == nil { + return nil, false + } + return o.IsHidden, true +} + +// HasIsHidden returns a boolean if a field has been set. +func (o *WidgetCustomLink) HasIsHidden() bool { + if o != nil && o.IsHidden != nil { + return true + } + + return false +} + +// SetIsHidden gets a reference to the given bool and assigns it to the IsHidden field. +func (o *WidgetCustomLink) SetIsHidden(v bool) { + o.IsHidden = &v +} + +// GetLabel returns the Label field value if set, zero value otherwise. func (o *WidgetCustomLink) GetLabel() string { - if o == nil { + if o == nil || o.Label == nil { var ret string return ret } - - return o.Label + return *o.Label } -// GetLabelOk returns a tuple with the Label field value +// GetLabelOk returns a tuple with the Label field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *WidgetCustomLink) GetLabelOk() (*string, bool) { - if o == nil { + if o == nil || o.Label == nil { return nil, false } - return &o.Label, true + return o.Label, true } -// SetLabel sets field value +// HasLabel returns a boolean if a field has been set. +func (o *WidgetCustomLink) HasLabel() bool { + if o != nil && o.Label != nil { + return true + } + + return false +} + +// SetLabel gets a reference to the given string and assigns it to the Label field. func (o *WidgetCustomLink) SetLabel(v string) { - o.Label = v + o.Label = &v } -// GetLink returns the Link field value +// GetLink returns the Link field value if set, zero value otherwise. func (o *WidgetCustomLink) GetLink() string { - if o == nil { + if o == nil || o.Link == nil { var ret string return ret } - - return o.Link + return *o.Link } -// GetLinkOk returns a tuple with the Link field value +// GetLinkOk returns a tuple with the Link field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *WidgetCustomLink) GetLinkOk() (*string, bool) { - if o == nil { + if o == nil || o.Link == nil { return nil, false } - return &o.Link, true + return o.Link, true } -// SetLink sets field value +// HasLink returns a boolean if a field has been set. +func (o *WidgetCustomLink) HasLink() bool { + if o != nil && o.Link != nil { + return true + } + + return false +} + +// SetLink gets a reference to the given string and assigns it to the Link field. func (o *WidgetCustomLink) SetLink(v string) { - o.Link = v + o.Link = &v +} + +// GetOverrideLabel returns the OverrideLabel field value if set, zero value otherwise. +func (o *WidgetCustomLink) GetOverrideLabel() string { + if o == nil || o.OverrideLabel == nil { + var ret string + return ret + } + return *o.OverrideLabel +} + +// GetOverrideLabelOk returns a tuple with the OverrideLabel field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WidgetCustomLink) GetOverrideLabelOk() (*string, bool) { + if o == nil || o.OverrideLabel == nil { + return nil, false + } + return o.OverrideLabel, true +} + +// HasOverrideLabel returns a boolean if a field has been set. +func (o *WidgetCustomLink) HasOverrideLabel() bool { + if o != nil && o.OverrideLabel != nil { + return true + } + + return false +} + +// SetOverrideLabel gets a reference to the given string and assigns it to the OverrideLabel field. +func (o *WidgetCustomLink) SetOverrideLabel(v string) { + o.OverrideLabel = &v } func (o WidgetCustomLink) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if true { + if o.IsHidden != nil { + toSerialize["is_hidden"] = o.IsHidden + } + if o.Label != nil { toSerialize["label"] = o.Label } - if true { + if o.Link != nil { toSerialize["link"] = o.Link } + if o.OverrideLabel != nil { + toSerialize["override_label"] = o.OverrideLabel + } return json.Marshal(toSerialize) } -func (o *WidgetCustomLink) UnmarshalJSON(bytes []byte) (err error) { - required := struct { - Label *string `json:"label"` - Link *string `json:"link"` - }{} - all := struct { - Label string `json:"label"}` - Link string `json:"link"}` - }{} - err = json.Unmarshal(bytes, &required) - if err != nil { - return err - } - if required.Label == nil { - return fmt.Errorf("Required field label missing") - } - if required.Link == nil { - return fmt.Errorf("Required field link missing") - } - err = json.Unmarshal(bytes, &all) - if err != nil { - return err - } - o.Label = all.Label - o.Link = all.Link - return nil -} - type NullableWidgetCustomLink struct { value *WidgetCustomLink isSet bool