@@ -14,6 +14,7 @@ export class ShareAPI extends Construct {
1414 public readonly shareFn : Lambda . IFunction
1515 public readonly confirmOwnershipFn : Lambda . IFunction
1616 public readonly sharingStatusFn : Lambda . IFunction
17+ public readonly sharingStatusFingerprintFn : Lambda . IFunction
1718 constructor (
1819 parent : Construct ,
1920 {
@@ -27,7 +28,10 @@ export class ShareAPI extends Construct {
2728 baseLayer : Lambda . ILayerVersion
2829 lambdaSources : Pick <
2930 BackendLambdas ,
30- 'shareDevice' | 'confirmOwnership' | 'sharingStatus'
31+ | 'shareDevice'
32+ | 'confirmOwnership'
33+ | 'sharingStatus'
34+ | 'sharingStatusFingerprint'
3135 >
3236 } ,
3337 ) {
@@ -109,5 +113,35 @@ export class ShareAPI extends Construct {
109113 ...new LambdaLogGroup ( this , 'sharingStatusFnLogs' ) ,
110114 } )
111115 publicDevices . publicDevicesTable . grantReadData ( this . sharingStatusFn )
116+
117+ this . sharingStatusFingerprintFn = new Lambda . Function (
118+ this ,
119+ 'sharingStatusFingerprintFn' ,
120+ {
121+ handler : lambdaSources . sharingStatusFingerprint . handler ,
122+ architecture : Lambda . Architecture . ARM_64 ,
123+ runtime : Lambda . Runtime . NODEJS_20_X ,
124+ timeout : Duration . seconds ( 10 ) ,
125+ memorySize : 1792 ,
126+ code : Lambda . Code . fromAsset (
127+ lambdaSources . sharingStatusFingerprint . zipFile ,
128+ ) ,
129+ description :
130+ 'Returns the sharing status of a device using the fingerprint.' ,
131+ layers : [ baseLayer ] ,
132+ environment : {
133+ VERSION : this . node . getContext ( 'version' ) ,
134+ PUBLIC_DEVICES_TABLE_NAME : publicDevices . publicDevicesTable . tableName ,
135+ PUBLIC_DEVICES_ID_INDEX_NAME : publicDevices . idIndex ,
136+ NODE_NO_WARNINGS : '1' ,
137+ STACK_NAME : Stack . of ( this ) . stackName ,
138+ } ,
139+ ...new LambdaLogGroup ( this , 'sharingStatusFingerprintFnLogs' ) ,
140+ initialPolicy : [ Permissions ( Stack . of ( this ) ) ] ,
141+ } ,
142+ )
143+ publicDevices . publicDevicesTable . grantReadData (
144+ this . sharingStatusFingerprintFn ,
145+ )
112146 }
113147}
0 commit comments