This is a helper function that given an s3 path such that the path is of the form: bucket/key It will return the bucket and the key represented by the s3 path
(s3_path)
| 217 | |
| 218 | |
| 219 | def find_bucket_key(s3_path): |
| 220 | """ |
| 221 | This is a helper function that given an s3 path such that the path is of |
| 222 | the form: bucket/key |
| 223 | It will return the bucket and the key represented by the s3 path |
| 224 | """ |
| 225 | block_unsupported_resources(s3_path) |
| 226 | match = _S3_ACCESSPOINT_TO_BUCKET_KEY_REGEX.match(s3_path) |
| 227 | if match: |
| 228 | return match.group('bucket'), match.group('key') |
| 229 | match = _S3_OUTPOST_TO_BUCKET_KEY_REGEX.match(s3_path) |
| 230 | if match: |
| 231 | return match.group('bucket'), match.group('key') |
| 232 | s3_components = s3_path.split('/', 1) |
| 233 | bucket = s3_components[0] |
| 234 | s3_key = '' |
| 235 | if len(s3_components) > 1: |
| 236 | s3_key = s3_components[1] |
| 237 | return bucket, s3_key |
| 238 | |
| 239 | |
| 240 | def split_s3_bucket_key(s3_path): |