createAnalysis method

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

Creates an analysis in Amazon QuickSight.

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

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 AWS 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 QuickSight console.

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.

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 AWS Identity and Access Management (IAM) action information for each principal listed by Amazon Resource Name (ARN).

To specify no permissions, omit Permissions.

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 QuickSight console, make sure that you have access to it.

Implementation

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