createDashboard method

Future<CreateDashboardResponse> createDashboard({
  1. required String name,
  2. required List<Widget> widgets,
  3. String? description,
  4. List<ResourceTag>? resourceTags,
})

Creates a new dashboard that can contain multiple widgets displaying cost and usage data. You can add custom widgets or use predefined widgets, arranging them in your preferred layout.

May throw AccessDeniedException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter name : The name of the dashboard. The name must be unique within your account.

Parameter widgets : An array of widget configurations that define the visualizations to be displayed in the dashboard. Each dashboard can contain up to 20 widgets.

Parameter description : A description of the dashboard's purpose or contents.

Parameter resourceTags : The tags to apply to the dashboard resource for organization and management.

Implementation

Future<CreateDashboardResponse> createDashboard({
  required String name,
  required List<Widget> widgets,
  String? description,
  List<ResourceTag>? resourceTags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSBCMDashboardsService.CreateDashboard'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'widgets': widgets,
      if (description != null) 'description': description,
      if (resourceTags != null) 'resourceTags': resourceTags,
    },
  );

  return CreateDashboardResponse.fromJson(jsonResponse.body);
}