Sha256: b2725c6586ded1c4fb9d693d7bf52400c62ab72d5bff503493e45b787ba5d60e

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# Create a new dashboard with template variable defaults returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::DashboardsAPI.new

body = DatadogAPIClient::V1::Dashboard.new({
  description: nil,
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
  notify_list: [],
  reflow_type: DatadogAPIClient::V1::DashboardReflowType::AUTO,
  restricted_roles: [],
  template_variables: [
    DatadogAPIClient::V1::DashboardTemplateVariable.new({
      available_values: [
        "my-host",
        "host1",
        "host2",
      ],
      defaults: [
        "my-host",
      ],
      name: "host1",
      prefix: "host",
    }),
  ],
  title: "",
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::HostMapWidgetDefinition.new({
        requests: DatadogAPIClient::V1::HostMapWidgetDefinitionRequests.new({
          fill: DatadogAPIClient::V1::HostMapRequest.new({
            q: "avg:system.cpu.user{*}",
          }),
        }),
        type: DatadogAPIClient::V1::HostMapWidgetDefinitionType::HOSTMAP,
      }),
    }),
  ],
})
p api_instance.create_dashboard(body)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datadog_api_client-2.29.1 examples/v1/dashboards/CreateDashboard_858397694.rb