Sha256: 371562e0be5a8ccae5e2ada57e6996b8e89615e251d78bf14a15020a8431ab42

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# Create a new dashboard with powerpack widget

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

# there is a valid "powerpack" in the system
POWERPACK_DATA_ID = ENV["POWERPACK_DATA_ID"]

body = DatadogAPIClient::V1::Dashboard.new({
  title: "Example-Dashboard with powerpack widget",
  layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED,
  widgets: [
    DatadogAPIClient::V1::Widget.new({
      definition: DatadogAPIClient::V1::PowerpackWidgetDefinition.new({
        type: DatadogAPIClient::V1::PowerpackWidgetDefinitionType::POWERPACK,
        powerpack_id: POWERPACK_DATA_ID,
        template_variables: DatadogAPIClient::V1::PowerpackTemplateVariables.new({
          controlled_externally: [],
          controlled_by_powerpack: [
            DatadogAPIClient::V1::PowerpackTemplateVariableContents.new({
              name: "foo",
              prefix: "bar",
              values: [
                "baz",
                "qux",
                "quuz",
              ],
            }),
          ],
        }),
      }),
      layout: DatadogAPIClient::V1::WidgetLayout.new({
        x: 1,
        y: 1,
        width: 2,
        height: 2,
        is_column_break: false,
      }),
    }),
  ],
  description: "description",
})
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_1754992756.rb