require 'time' require 'datadog_api_client/v1' # setup authorization DatadogAPIClient::V1.configure do |config| # Configure API key authorization: apiKeyAuth config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"] # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['apiKeyAuth'] = 'Bearer' # Configure API key authorization: appKeyAuth config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"] # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil) # config.api_key_prefix['appKeyAuth'] = 'Bearer' end api_instance = DatadogAPIClient::V1::DashboardsApi.new dashboard_id = 'dashboard_id_example' # String | The ID of the dashboard. body = DatadogAPIClient::V1::Dashboard.new({layout_type: DatadogAPIClient::V1::DashboardLayoutType::ORDERED, title: 'title_example', widgets: [DatadogAPIClient::V1::Widget.new({definition: DatadogAPIClient::V1::AlertGraphWidgetDefinition.new({alert_id: 'alert_id_example', type: DatadogAPIClient::V1::AlertGraphWidgetDefinitionType::ALERT_GRAPH, viz_type: DatadogAPIClient::V1::WidgetVizType::TIMESERIES})})]}) # Dashboard | Update Dashboard request body. begin # Update a dashboard result = api_instance.update_dashboard(dashboard_id, body) p result rescue DatadogAPIClient::V1::ApiError => e puts "Error when calling DashboardsApi->update_dashboard: #{e}" end