@@ -3,10 +3,14 @@ import {BlockPublicAccess, Bucket, BucketAccessControl, BucketEncryption} from '
33import { BucketDeployment , Source } from 'aws-cdk-lib/aws-s3-deployment' ;
44import { CfnDataSet , CfnDataSource , CfnTemplate } from 'aws-cdk-lib/aws-quicksight' ;
55import { CfnManagedPolicy } from 'aws-cdk-lib/aws-iam' ;
6- import { Stack , StackProps } from 'aws-cdk-lib' ;
6+ import { Stack } from 'aws-cdk-lib' ;
77import { dataTransforms } from './data-transforms' ;
88import { inputColumns } from './input-columns' ;
99
10+ interface QuicksightExampleProps {
11+ quicksightAccountArn : string ;
12+ }
13+
1014export class QuicksightExampleStack extends Stack {
1115 /**
1216 * location of the manifest json file in the s3 bucket.
@@ -25,13 +29,11 @@ export class QuicksightExampleStack extends Stack {
2529
2630 public static QUICKSIGHT_DATASET_NAME = 'quicksightExampleDataset' ;
2731
28-
29- constructor ( scope : Construct , id : string , props ?: StackProps ) {
30- super ( scope , id , props ) ;
32+ constructor ( scope : Construct , id : string , props : QuicksightExampleProps ) {
33+ super ( scope , id ) ;
3134
3235 const { bucket, deployment } = this . createBucket ( ) ;
33- const accountQuicksight = 'arn:aws:quicksight:<region>:<accountid>:user/<namespace>/<username>' ;
34- this . createQuicksightResources ( bucket , deployment , accountQuicksight ) ;
36+ this . createQuicksightResources ( bucket , deployment , props . quicksightAccountArn ) ;
3537 }
3638
3739 // creates s3 bucket and deploys test data
@@ -62,7 +64,7 @@ export class QuicksightExampleStack extends Stack {
6264 QuicksightExampleStack . MANIFEST_KEY ,
6365 manifest
6466 ) ;
65- // deploy them
67+ // deploy them and the files stored in the data directory
6668 const deployment = new BucketDeployment ( this , 'BucketDeployment' , {
6769 sources : [ sourceInternal , Source . asset ( './data' ) ] ,
6870 destinationBucket : bucket ,
@@ -154,10 +156,13 @@ export class QuicksightExampleStack extends Stack {
154156 }
155157 )
156158
157- // quicksight needs these to be created so we waiting for the
159+ // quicksight needs these to be created so we're waiting for the creation of these resources
158160 quicksightS3DataSource . node . addDependency ( managedPolicy ) ;
159161 quicksightS3DataSource . node . addDependency ( deployment ) ;
160162
163+ /**
164+ * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-quicksight-dataset-physicaltable.html
165+ */
161166 const physicalTableProperties : CfnDataSet . PhysicalTableProperty = {
162167 s3Source : {
163168 dataSourceArn : quicksightS3DataSource . attrArn ,
@@ -170,8 +175,9 @@ export class QuicksightExampleStack extends Stack {
170175 }
171176 }
172177 }
178+
173179 /**
174- * @see https://docs.aws.amazon.com/quicksight /latest/APIReference/API_LogicalTable .html
180+ * @see https://docs.aws.amazon.com/AWSCloudFormation /latest/UserGuide/aws-properties-quicksight-dataset-logicaltable .html
175181 */
176182 const logicalTableProperties : CfnDataSet . LogicalTableProperty = {
177183 alias : 's3-extract-data-cast' ,
0 commit comments