Skip to content

Commit 2b3e8f9

Browse files
feat: add predefined_acl to create_resumable_upload_session (#878)
Co-authored-by: Denis DelGrosso <85250797+ddelgrosso1@users.noreply.github.com>
1 parent e0be194 commit 2b3e8f9

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

google/cloud/storage/blob.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2861,6 +2861,7 @@ def create_resumable_upload_session(
28612861
client=None,
28622862
timeout=_DEFAULT_TIMEOUT,
28632863
checksum=None,
2864+
predefined_acl=None,
28642865
if_generation_match=None,
28652866
if_generation_not_match=None,
28662867
if_metageneration_match=None,
@@ -2942,6 +2943,9 @@ def create_resumable_upload_session(
29422943
delete the uploaded object automatically. Supported values
29432944
are "md5", "crc32c" and None. The default is None.
29442945
2946+
:type predefined_acl: str
2947+
:param predefined_acl: (Optional) Predefined access control list
2948+
29452949
:type if_generation_match: long
29462950
:param if_generation_match:
29472951
(Optional) See :ref:`using-if-generation-match`
@@ -3015,7 +3019,7 @@ def create_resumable_upload_session(
30153019
content_type,
30163020
size,
30173021
None,
3018-
predefined_acl=None,
3022+
predefined_acl=predefined_acl,
30193023
if_generation_match=if_generation_match,
30203024
if_generation_not_match=if_generation_not_match,
30213025
if_metageneration_match=if_metageneration_match,

tests/unit/test_blob.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3572,6 +3572,7 @@ def _create_resumable_upload_session_helper(
35723572
origin=None,
35733573
side_effect=None,
35743574
timeout=None,
3575+
predefined_acl=None,
35753576
if_generation_match=None,
35763577
if_generation_not_match=None,
35773578
if_metageneration_match=None,
@@ -3611,6 +3612,7 @@ def _create_resumable_upload_session_helper(
36113612
size=size,
36123613
origin=origin,
36133614
client=client,
3615+
predefined_acl=predefined_acl,
36143616
if_generation_match=if_generation_match,
36153617
if_generation_not_match=if_generation_not_match,
36163618
if_metageneration_match=if_metageneration_match,
@@ -3629,6 +3631,9 @@ def _create_resumable_upload_session_helper(
36293631
)
36303632

36313633
qs_params = [("uploadType", "resumable")]
3634+
if predefined_acl is not None:
3635+
qs_params.append(("predefinedAcl", predefined_acl))
3636+
36323637
if if_generation_match is not None:
36333638
qs_params.append(("ifGenerationMatch", if_generation_match))
36343639

@@ -3672,6 +3677,9 @@ def test_create_resumable_upload_session_with_custom_timeout(self):
36723677
def test_create_resumable_upload_session_with_origin(self):
36733678
self._create_resumable_upload_session_helper(origin="http://google.com")
36743679

3680+
def test_create_resumable_upload_session_with_predefined_acl(self):
3681+
self._create_resumable_upload_session_helper(predefined_acl="private")
3682+
36753683
def test_create_resumable_upload_session_with_generation_match(self):
36763684
self._create_resumable_upload_session_helper(
36773685
if_generation_match=123456, if_metageneration_match=2

0 commit comments

Comments
 (0)