createTheme method

Future<CreateThemeResponse> createTheme({
  1. required String awsAccountId,
  2. required String baseThemeId,
  3. required ThemeConfiguration configuration,
  4. required String name,
  5. required String themeId,
  6. List<ResourcePermission>? permissions,
  7. List<Tag>? tags,
  8. String? versionDescription,
})

Creates a theme.

A theme is set of configuration options for color and layout. Themes apply to analyses and dashboards. For more information, see Using Themes in Amazon QuickSight in the Amazon QuickSight User Guide.

May throw AccessDeniedException. May throw InvalidParameterValueException. May throw ResourceExistsException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw UnsupportedUserEditionException. May throw LimitExceededException. May throw InternalFailureException.

Parameter awsAccountId : The ID of the AWS account where you want to store the new theme.

Parameter baseThemeId : The ID of the theme that a custom theme will inherit from. All themes inherit from one of the starting themes defined by Amazon QuickSight. For a list of the starting themes, use ListThemes or choose Themes from within a QuickSight analysis.

Parameter configuration : The theme configuration, which contains the theme display properties.

Parameter name : A display name for the theme.

Parameter themeId : An ID for the theme that you want to create. The theme ID is unique per AWS Region in each AWS account.

Parameter permissions : A valid grouping of resource permissions to apply to the new theme.

Parameter tags : A map of the key-value pairs for the resource tag or tags that you want to add to the resource.

Parameter versionDescription : A description of the first version of the theme that you're creating. Every time UpdateTheme is called, a new version is created. Each version of the theme has a description of the version in the VersionDescription field.

Implementation

Future<CreateThemeResponse> createTheme({
  required String awsAccountId,
  required String baseThemeId,
  required ThemeConfiguration configuration,
  required String name,
  required String themeId,
  List<ResourcePermission>? permissions,
  List<Tag>? tags,
  String? versionDescription,
}) async {
  ArgumentError.checkNotNull(awsAccountId, 'awsAccountId');
  _s.validateStringLength(
    'awsAccountId',
    awsAccountId,
    12,
    12,
    isRequired: true,
  );
  ArgumentError.checkNotNull(baseThemeId, 'baseThemeId');
  _s.validateStringLength(
    'baseThemeId',
    baseThemeId,
    1,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(configuration, 'configuration');
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(themeId, 'themeId');
  _s.validateStringLength(
    'themeId',
    themeId,
    1,
    2048,
    isRequired: true,
  );
  _s.validateStringLength(
    'versionDescription',
    versionDescription,
    1,
    512,
  );
  final $payload = <String, dynamic>{
    'BaseThemeId': baseThemeId,
    'Configuration': configuration,
    'Name': name,
    if (permissions != null) 'Permissions': permissions,
    if (tags != null) 'Tags': tags,
    if (versionDescription != null) 'VersionDescription': versionDescription,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/themes/${Uri.encodeComponent(themeId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateThemeResponse.fromJson(response);
}