UpdateDashboardCommand

Updates the specified dashboard.

To set a refresh schedule, CloudTrail must be granted permissions to run the StartDashboardRefresh operation to refresh the dashboard on your behalf. To provide permissions, run the PutResourcePolicy operation to attach a resource-based policy to the dashboard. For more information, see Resource-based policy example for a dashboard  in the CloudTrail User Guide.

CloudTrail runs queries to populate the dashboard's widgets during a manual or scheduled refresh. CloudTrail must be granted permissions to run the StartQuery operation on your behalf. To provide permissions, run the PutResourcePolicy operation to attach a resource-based policy to each event data store. For more information, see Example: Allow CloudTrail to run queries to populate a dashboard  in the CloudTrail User Guide.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CloudTrailClient, UpdateDashboardCommand } from "@aws-sdk/client-cloudtrail"; // ES Modules import
// const { CloudTrailClient, UpdateDashboardCommand } = require("@aws-sdk/client-cloudtrail"); // CommonJS import
const client = new CloudTrailClient(config);
const input = { // UpdateDashboardRequest
  DashboardId: "STRING_VALUE", // required
  Widgets: [ // RequestWidgetList
    { // RequestWidget
      QueryStatement: "STRING_VALUE", // required
      QueryParameters: [ // QueryParameters
        "STRING_VALUE",
      ],
      ViewProperties: { // ViewPropertiesMap // required
        "<keys>": "STRING_VALUE",
      },
    },
  ],
  RefreshSchedule: { // RefreshSchedule
    Frequency: { // RefreshScheduleFrequency
      Unit: "HOURS" || "DAYS",
      Value: Number("int"),
    },
    Status: "ENABLED" || "DISABLED",
    TimeOfDay: "STRING_VALUE",
  },
  TerminationProtectionEnabled: true || false,
};
const command = new UpdateDashboardCommand(input);
const response = await client.send(command);
// { // UpdateDashboardResponse
//   DashboardArn: "STRING_VALUE",
//   Name: "STRING_VALUE",
//   Type: "MANAGED" || "CUSTOM",
//   Widgets: [ // WidgetList
//     { // Widget
//       QueryAlias: "STRING_VALUE",
//       QueryStatement: "STRING_VALUE",
//       QueryParameters: [ // QueryParameters
//         "STRING_VALUE",
//       ],
//       ViewProperties: { // ViewPropertiesMap
//         "<keys>": "STRING_VALUE",
//       },
//     },
//   ],
//   RefreshSchedule: { // RefreshSchedule
//     Frequency: { // RefreshScheduleFrequency
//       Unit: "HOURS" || "DAYS",
//       Value: Number("int"),
//     },
//     Status: "ENABLED" || "DISABLED",
//     TimeOfDay: "STRING_VALUE",
//   },
//   TerminationProtectionEnabled: true || false,
//   CreatedTimestamp: new Date("TIMESTAMP"),
//   UpdatedTimestamp: new Date("TIMESTAMP"),
// };

UpdateDashboardCommand Input

See UpdateDashboardCommandInput for more details

Parameter
Type
Description
DashboardId
Required
string | undefined

The name or ARN of the dashboard.

RefreshSchedule
RefreshSchedule | undefined

The refresh schedule configuration for the dashboard.

TerminationProtectionEnabled
boolean | undefined

Specifies whether termination protection is enabled for the dashboard. If termination protection is enabled, you cannot delete the dashboard until termination protection is disabled.

Widgets
RequestWidget[] | undefined

An array of widgets for the dashboard. A custom dashboard can have a maximum of 10 widgets.

To add new widgets, pass in an array that includes the existing widgets along with any new widgets. Run the GetDashboard operation to get the list of widgets for the dashboard.

To remove widgets, pass in an array that includes the existing widgets minus the widgets you want removed.

UpdateDashboardCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
CreatedTimestamp
Date | undefined

The timestamp that shows when the dashboard was created.

DashboardArn
string | undefined

The ARN for the dashboard.

Name
string | undefined

The name for the dashboard.

RefreshSchedule
RefreshSchedule | undefined

The refresh schedule for the dashboard, if configured.

TerminationProtectionEnabled
boolean | undefined

Indicates whether termination protection is enabled for the dashboard.

Type
DashboardType | undefined

The type of dashboard.

UpdatedTimestamp
Date | undefined

The timestamp that shows when the dashboard was updated.

Widgets
Widget[] | undefined

An array of widgets for the dashboard.

Throws

Name
Fault
Details
ConflictException
client

This exception is thrown when the specified resource is not ready for an operation. This can occur when you try to run an operation on a resource before CloudTrail has time to fully load the resource, or because another operation is modifying the resource. If this exception occurs, wait a few minutes, and then try the operation again.

EventDataStoreNotFoundException
client

The specified event data store was not found.

InactiveEventDataStoreException
client

The event data store is inactive.

InsufficientEncryptionPolicyException
client

For the CreateTrail PutInsightSelectors, UpdateTrail, StartQuery, and StartImport operations, this exception is thrown when the policy on the S3 bucket or KMS key does not have sufficient permissions for the operation.

For all other operations, this exception is thrown when the policy for the KMS key does not have sufficient permissions for the operation.

InvalidQueryStatementException
client

The query that was submitted has validation errors, or uses incorrect syntax or unsupported keywords. For more information about writing a query, see Create or edit a query  in the CloudTrail User Guide.

ResourceNotFoundException
client

This exception is thrown when the specified resource is not found.

ServiceQuotaExceededException
client

This exception is thrown when the quota is exceeded. For information about CloudTrail quotas, see Service quotas  in the Amazon Web Services General Reference.

UnsupportedOperationException
client

This exception is thrown when the requested operation is not supported.

CloudTrailServiceException
Base exception class for all service exceptions from CloudTrail service.