2828class Dataset (Construct ):
2929 external_interface = {}
3030
31- def __init__ (self , scope : Construct , id : str , ** kwargs ) -> None :
31+ def __init__ (
32+ self ,
33+ scope : Construct ,
34+ id : str ,
35+ dataset : str ,
36+ s3_prefix : str ,
37+ org : str = None ,
38+ data_domain : str = None ,
39+ raw_bucket : str = None ,
40+ stage_bucket : str = None ,
41+ analytics_bucket : str = None ,
42+ artifacts_bucket : str = None ,
43+ lakeformation_dataaccess_role : str = None ,
44+ ** kwargs ,
45+ ) -> None :
3246 super ().__init__ (scope , id )
3347
34- # using context values would be better(?) for CDK but we haven't decided yet what the story is around ServiceCatalog and CloudFormation modules
35- # perhaps both (context values feeding into CfnParameter) would be a nice-enough solution. Not sure though. TODO
48+ # if arguments are passed to the constructor, their values are fed to CfnParameter() below as default
49+ # if arguments aren't specified, standard SDLF SSM parameters are checked instead
50+ # the jury is still out on the usage of CfnParameter(),
51+ # and there is still work to get the latest SSM parameter values as well as using a prefix to allow multiple deployments TODO
52+ raw_bucket = raw_bucket or "{{resolve:ssm:/sdlf/storage/rRawBucket:1}}"
53+ stage_bucket = stage_bucket or "{{resolve:ssm:/sdlf/storage/rStageBucket:1}}"
54+ analytics_bucket = analytics_bucket or "{{resolve:ssm:/sdlf/storage/rAnalyticsBucket:1}}"
55+ artifacts_bucket = artifacts_bucket or "{{resolve:ssm:/sdlf/storage/rArtifactsBucket:1}}"
56+ lakeformation_dataaccess_role = (
57+ lakeformation_dataaccess_role or "{{resolve:ssm:/sdlf/storage/rLakeFormationDataAccessRoleArn:1}}"
58+ )
59+ org = org or "{{resolve:ssm:/sdlf/storage/rOrganization:1}}"
60+ data_domain = data_domain or "{{resolve:ssm:/sdlf/storage/rDomain:1}}"
61+
3662 p_pipelinereference = CfnParameter (
3763 self ,
3864 "pPipelineReference" ,
@@ -45,54 +71,54 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
4571 "pOrg" ,
4672 description = "Name of the organization owning the datalake" ,
4773 type = "String" ,
48- default = "{{resolve:ssm:/sdlf/storage/pOrg :1}}" ,
74+ default = "{{resolve:ssm:/sdlf/storage/rOrganization :1}}" ,
4975 )
5076 p_org .override_logical_id ("pOrg" )
5177 p_domain = CfnParameter (
5278 self ,
5379 "pDomain" ,
5480 description = "Data domain name" ,
5581 type = "String" ,
56- default = "{{resolve:ssm:/sdlf/storage/pDomain :1}}" ,
82+ default = "{{resolve:ssm:/sdlf/storage/rDomain :1}}" ,
5783 )
5884 p_domain .override_logical_id ("pDomain" )
5985 p_rawbucket = CfnParameter (
6086 self ,
6187 "pRawBucket" ,
6288 description = "The raw bucket for the solution" ,
6389 type = "String" ,
64- default = "{{resolve:ssm:/sdlf/storage/rRawBucket:1}}" ,
90+ default = raw_bucket ,
6591 )
6692 p_rawbucket .override_logical_id ("pRawBucket" )
6793 p_stagebucket = CfnParameter (
6894 self ,
6995 "pStageBucket" ,
7096 description = "The stage bucket for the solution" ,
7197 type = "String" ,
72- default = "{{resolve:ssm:/sdlf/storage/rStageBucket:1}}" ,
98+ default = stage_bucket ,
7399 )
74100 p_stagebucket .override_logical_id ("pStageBucket" )
75101 p_analyticsbucket = CfnParameter (
76102 self ,
77103 "pAnalyticsBucket" ,
78104 description = "The analytics bucket for the solution" ,
79105 type = "String" ,
80- default = "{{resolve:ssm:/sdlf/storage/rAnalyticsBucket:1}}" ,
106+ default = analytics_bucket ,
81107 )
82108 p_analyticsbucket .override_logical_id ("pAnalyticsBucket" )
83109 p_artifactsbucket = CfnParameter (
84110 self ,
85111 "pArtifactsBucket" ,
86112 description = "The artifacts bucket used by CodeBuild and CodePipeline" ,
87113 type = "String" ,
88- default = "{{resolve:ssm:/sdlf/storage/rArtifactsBucket:1}}" ,
114+ default = artifacts_bucket ,
89115 )
90116 p_artifactsbucket .override_logical_id ("pArtifactsBucket" )
91117 p_lakeformationdataaccessrole = CfnParameter (
92118 self ,
93119 "pLakeFormationDataAccessRole" ,
94120 type = "String" ,
95- default = "{{resolve:ssm:/sdlf/storage/rLakeFormationDataAccessRoleArn:1}}" ,
121+ default = lakeformation_dataaccess_role ,
96122 )
97123 p_lakeformationdataaccessrole .override_logical_id ("pLakeFormationDataAccessRole" )
98124 p_datasetname = CfnParameter (
@@ -101,6 +127,7 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
101127 description = "The name of the dataset (all lowercase, no symbols or spaces)" ,
102128 type = "String" ,
103129 allowed_pattern = "[a-z0-9]{2,14}" ,
130+ default = dataset ,
104131 )
105132 p_datasetname .override_logical_id ("pDatasetName" )
106133 p_s3prefix = CfnParameter (
@@ -109,6 +136,7 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
109136 description = "S3 prefix or full bucket if empty/not provided" ,
110137 type = "String" ,
111138 allowed_pattern = "[a-z0-9]*" ,
139+ default = s3_prefix ,
112140 )
113141 p_s3prefix .override_logical_id ("pS3Prefix" )
114142 p_cicdrole = CfnParameter (
0 commit comments