createDashboard method

Future<CreateDashboardResponse> createDashboard({
  1. required String awsAccountId,
  2. required String dashboardId,
  3. required String name,
  4. required DashboardSourceEntity sourceEntity,
  5. DashboardPublishOptions? dashboardPublishOptions,
  6. Parameters? parameters,
  7. List<ResourcePermission>? permissions,
  8. List<Tag>? tags,
  9. String? themeArn,
  10. String? versionDescription,
})

Creates a dashboard from a template. To first create a template, see the CreateTemplate API operation.

A dashboard is an entity in QuickSight that identifies QuickSight reports, created from analyses. You can share QuickSight dashboards. With the right permissions, you can create scheduled email reports from them. If you have the correct permissions, you can create a dashboard from a template that exists in a different AWS account.

May throw ResourceNotFoundException. May throw InvalidParameterValueException. May throw ThrottlingException. May throw ResourceExistsException. May throw ConflictException. May throw UnsupportedUserEditionException. May throw InternalFailureException.

Parameter awsAccountId : The ID of the AWS account where you want to create the dashboard.

Parameter dashboardId : The ID for the dashboard, also added to the IAM policy.

Parameter name : The display name of the dashboard.

Parameter sourceEntity : The entity that you are using as a source when you create the dashboard. In SourceEntity, you specify the type of object you're using as source. You can only create a dashboard from a template, so you use a SourceTemplate entity. If you need to create a dashboard from an analysis, first convert the analysis to a template by using the CreateTemplate API operation. For SourceTemplate, specify the Amazon Resource Name (ARN) of the source template. The SourceTemplateARN can contain any AWS Account and any QuickSight-supported AWS Region.

Use the DataSetReferences entity within SourceTemplate to list the replacement datasets for the placeholders listed in the original. The schema in each dataset must match its placeholder.

Parameter dashboardPublishOptions : Options for publishing the dashboard when you create it:

  • AvailabilityStatus for AdHocFilteringOption - This status can be either ENABLED or DISABLED. When this is set to DISABLED, QuickSight disables the left filter pane on the published dashboard, which can be used for ad hoc (one-time) filtering. This option is ENABLED by default.
  • AvailabilityStatus for ExportToCSVOption - This status can be either ENABLED or DISABLED. The visual option to export data to .CSV format isn't enabled when this is set to DISABLED. This option is ENABLED by default.
  • VisibilityState for SheetControlsOption - This visibility state can be either COLLAPSED or EXPANDED. This option is COLLAPSED by default.

Parameter parameters : The parameters for the creation of the dashboard, which you want to use to override the default settings. A dashboard can have any type of parameters, and some parameters might accept multiple values.

Parameter permissions : A structure that contains the permissions of the dashboard. You can use this structure for granting permissions by providing a list of IAM action information for each principal ARN.

To specify no permissions, omit the permissions list.

Parameter tags : Contains a map of the key-value pairs for the resource tag or tags assigned to the dashboard.

Parameter themeArn : The Amazon Resource Name (ARN) of the theme that is being used for this dashboard. If you add a value for this field, it overrides the value that is used in the source entity. The theme ARN must exist in the same AWS account where you create the dashboard.

Parameter versionDescription : A description for the first version of the dashboard being created.

Implementation

Future<CreateDashboardResponse> createDashboard({
  required String awsAccountId,
  required String dashboardId,
  required String name,
  required DashboardSourceEntity sourceEntity,
  DashboardPublishOptions? dashboardPublishOptions,
  Parameters? parameters,
  List<ResourcePermission>? permissions,
  List<Tag>? tags,
  String? themeArn,
  String? versionDescription,
}) async {
  ArgumentError.checkNotNull(awsAccountId, 'awsAccountId');
  _s.validateStringLength(
    'awsAccountId',
    awsAccountId,
    12,
    12,
    isRequired: true,
  );
  ArgumentError.checkNotNull(dashboardId, 'dashboardId');
  _s.validateStringLength(
    'dashboardId',
    dashboardId,
    1,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(sourceEntity, 'sourceEntity');
  _s.validateStringLength(
    'versionDescription',
    versionDescription,
    1,
    512,
  );
  final $payload = <String, dynamic>{
    'Name': name,
    'SourceEntity': sourceEntity,
    if (dashboardPublishOptions != null)
      'DashboardPublishOptions': dashboardPublishOptions,
    if (parameters != null) 'Parameters': parameters,
    if (permissions != null) 'Permissions': permissions,
    if (tags != null) 'Tags': tags,
    if (themeArn != null) 'ThemeArn': themeArn,
    if (versionDescription != null) 'VersionDescription': versionDescription,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/dashboards/${Uri.encodeComponent(dashboardId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDashboardResponse.fromJson(response);
}