startDashboardRefresh method

Future<StartDashboardRefreshResponse> startDashboardRefresh({
  1. required String dashboardId,
  2. Map<String, String>? queryParameterValues,
})

Starts a refresh of the specified dashboard.

Each time a dashboard is refreshed, CloudTrail runs queries to populate the dashboard's widgets. 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.

May throw EventDataStoreNotFoundException. May throw InactiveEventDataStoreException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw UnsupportedOperationException.

Parameter dashboardId : The name or ARN of the dashboard.

Parameter queryParameterValues : The query parameter values for the dashboard

For custom dashboards, the following query parameters are valid: $StartTime$, $EndTime$, and $Period$.

For managed dashboards, the following query parameters are valid: $StartTime$, $EndTime$, $Period$, and $EventDataStoreId$. The $EventDataStoreId$ query parameter is required.

Implementation

Future<StartDashboardRefreshResponse> startDashboardRefresh({
  required String dashboardId,
  Map<String, String>? queryParameterValues,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CloudTrail_20131101.StartDashboardRefresh'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DashboardId': dashboardId,
      if (queryParameterValues != null)
        'QueryParameterValues': queryParameterValues,
    },
  );

  return StartDashboardRefreshResponse.fromJson(jsonResponse.body);
}