createAnalysis method

Future<CreateAnalysisResponse> createAnalysis({
  1. required String analysisId,
  2. required String awsAccountId,
  3. required String name,
  4. AnalysisDefinition? definition,
  5. List<String>? folderArns,
  6. Parameters? parameters,
  7. List<ResourcePermission>? permissions,
  8. AnalysisSourceEntity? sourceEntity,
  9. List<Tag>? tags,
  10. String? themeArn,
  11. ValidationStrategy? validationStrategy,
})

Creates an analysis in Amazon Quick Sight. Analyses can be created either from a template or from an AnalysisDefinition.

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

Parameter analysisId : The ID for the analysis that you're creating. This ID displays in the URL of the analysis.

Parameter awsAccountId : The ID of the Amazon Web Services account where you are creating an analysis.

Parameter name : A descriptive name for the analysis that you're creating. This name displays for the analysis in the Amazon Quick Sight console.

Parameter definition : The definition of an analysis.

A definition is the data model of all features in a Dashboard, Template, or Analysis.

Either a SourceEntity or a Definition must be provided in order for the request to be valid.

Parameter folderArns : When you create the analysis, Amazon Quick Sight adds the analysis to these folders.

Parameter parameters : The parameter names and override values that you want to use. An analysis can have any parameter type, and some parameters might accept multiple values.

Parameter permissions : A structure that describes the principals and the resource-level permissions on an analysis. You can use the Permissions structure to grant permissions by providing a list of Identity and Access Management (IAM) action information for each principal listed by Amazon Resource Name (ARN).

To specify no permissions, omit Permissions.

Parameter sourceEntity : A source entity to use for the analysis that you're creating. This metadata structure contains details that describe a source template and one or more datasets.

Either a SourceEntity or a Definition must be provided in order for the request to be valid.

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

Parameter themeArn : The ARN for the theme to apply to the analysis that you're creating. To see the theme in the Amazon Quick Sight console, make sure that you have access to it.

Parameter validationStrategy : The option to relax the validation needed to create an analysis with definition objects. This skips the validation step for specific errors.

Implementation

Future<CreateAnalysisResponse> createAnalysis({
  required String analysisId,
  required String awsAccountId,
  required String name,
  AnalysisDefinition? definition,
  List<String>? folderArns,
  Parameters? parameters,
  List<ResourcePermission>? permissions,
  AnalysisSourceEntity? sourceEntity,
  List<Tag>? tags,
  String? themeArn,
  ValidationStrategy? validationStrategy,
}) async {
  final $payload = <String, dynamic>{
    'Name': name,
    if (definition != null) 'Definition': definition,
    if (folderArns != null) 'FolderArns': folderArns,
    if (parameters != null) 'Parameters': parameters,
    if (permissions != null) 'Permissions': permissions,
    if (sourceEntity != null) 'SourceEntity': sourceEntity,
    if (tags != null) 'Tags': tags,
    if (themeArn != null) 'ThemeArn': themeArn,
    if (validationStrategy != null) 'ValidationStrategy': validationStrategy,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/accounts/${Uri.encodeComponent(awsAccountId)}/analyses/${Uri.encodeComponent(analysisId)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateAnalysisResponse.fromJson(response);
}