Skip to content

Commit 18016f5

Browse files
committed
Merge branch 'develop' v0.3.2
2 parents 24c7bd1 + 8fb4edb commit 18016f5

File tree

6 files changed

+31
-10
lines changed

6 files changed

+31
-10
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.3.2] - 2022-08-24
8+
### Fixed
9+
- PCA Workflow failure with KMS encrypted recordings caused by the new `SFPostCTRProcessing` Lambda function role not included in KMS Key policy. Function role now included in the `RolesForKMSKey` output.
10+
- CopyObject AccessDenied issue when using BulkMove with recording files that have S3 tags.
11+
712
## [0.3.1] - 2022-08-23
813
### Fixed
914
- Support nested folders in bulk workflow
@@ -68,7 +73,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6873
### Added
6974
- Initial release
7075

71-
[Unreleased]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/compare/v0.3.1...develop
76+
[Unreleased]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/compare/v0.3.2...develop
77+
[0.3.2]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.3.2
7278
[0.3.1]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.3.1
7379
[0.3.0]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.3.0
7480
[0.2.5]: https://github.com/aws-samples/amazon-transcribe-post-call-analytics/releases/tag/v0.2.5

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.1
1+
0.3.2

pca-main-nokendra.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AWSTemplateFormatVersion: "2010-09-09"
22

3-
Description: Amazon Transcribe Post Call Analytics - PCA (v0.3.1) (uksb-1sn29lk73)
3+
Description: Amazon Transcribe Post Call Analytics - PCA (v0.3.2) (uksb-1sn29lk73)
44

55
Parameters:
66

pca-main.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
AWSTemplateFormatVersion: "2010-09-09"
22

3-
Description: Amazon Transcribe Post Call Analytics - PCA (v0.3.1) (uksb-1sn29lk73)
3+
Description: Amazon Transcribe Post Call Analytics - PCA (v0.3.2) (uksb-1sn29lk73)
44

55
Parameters:
66

pca-server/cfn/lib/pca.template

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,5 @@ Outputs:
299299
- !Sub '"${SFFinalProcessingRole.Arn}"'
300300
- !Sub '"${SFCTRGenesysRole.Arn}"'
301301
- !Sub '"${SFTranscribeFailedRole.Arn}"'
302+
- !Sub '"${SFPostCTRProcessingRole.Arn}"'
302303

pca-server/src/pca/pca-aws-sf-bulk-move-files.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,41 @@ def lambda_handler(event, context):
2424

2525
# Get as many files from S3 as we can move this time (minimum of queueSpace and dripRate)
2626
s3Client = boto3.client('s3')
27+
s3 = boto3.resource('s3')
2728
maxKeys = min(dripRate, queueSpace) + 10 # list a few additional keys to allow for some folder objects that won't be moved
2829
response = s3Client.list_objects_v2(Bucket=sourceBucket, MaxKeys=maxKeys)
2930
if "Contents" in response:
3031
# We now have a list of objects that we can use
31-
sourcePrefix = "/" + sourceBucket + "/"
3232
keyPrefix = targetAudioKey
3333
if keyPrefix != "":
3434
keyPrefix += "/"
35-
files = [f for f in response["Contents"] if not f["Key"].endswith("/")][:dripRate] # ignore folder objects
35+
files = [f for f in response["Contents"] if not f["Key"].endswith("/")][:dripRate]
36+
folders = [f for f in response["Contents"] if f["Key"].endswith("/")]
3637
for audioFile in files:
3738
try:
3839
# Copy and delete file
39-
print(f'Copying: Bucket={targetBucket}, CopySource={(sourcePrefix + audioFile["Key"])}, Key={(keyPrefix + audioFile["Key"])}')
40-
copyResponse = s3Client.copy_object(Bucket=targetBucket,
41-
CopySource=(sourcePrefix + audioFile["Key"]),
42-
Key=(keyPrefix + audioFile["Key"]))
40+
copyDestnKey = keyPrefix + audioFile["Key"]
41+
copy_source = {
42+
'Bucket': sourceBucket,
43+
'Key': audioFile["Key"]
44+
}
45+
print(f'Copying: copy_source={copy_source}, targetBucket={targetBucket}, copyDestnKey={copyDestnKey}')
46+
s3.meta.client.copy(copy_source, targetBucket, copyDestnKey)
4347
deleteResponse = s3Client.delete_object(Bucket=sourceBucket, Key=audioFile["Key"])
4448
movedFiles += 1
4549
except Exception as e:
4650
print("Failed to move audio file {}".format(audioFile["Key"]))
4751
print(e)
52+
raise
53+
# Delete any folder objects so they do not appear in subsequent object lists - usually these are created in S3 console only
54+
for folder in folders:
55+
try:
56+
print(f'Deleting folder object: Bucket={sourceBucket}, Key={folder["Key"]}')
57+
deleteResponse = s3Client.delete_object(Bucket=sourceBucket, Key=folder["Key"])
58+
except Exception as e:
59+
print("Failed to delete folder file {}".format(folder["Key"]))
60+
print(e)
61+
raise
4862

4963
# Increase our counter, remove the queue value and return
5064
sfData["filesProcessed"] += movedFiles

0 commit comments

Comments
 (0)