Skip to content

Commit

Permalink
feat: add predefined_acl to create_resumable_upload_session (#878)
Browse files Browse the repository at this point in the history
Co-authored-by: Denis DelGrosso <85250797+ddelgrosso1@users.noreply.github.com>
  • Loading branch information
ddelange and ddelgrosso1 committed Oct 4, 2022
1 parent e0be194 commit 2b3e8f9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion google/cloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -2861,6 +2861,7 @@ def create_resumable_upload_session(
client=None,
timeout=_DEFAULT_TIMEOUT,
checksum=None,
predefined_acl=None,
if_generation_match=None,
if_generation_not_match=None,
if_metageneration_match=None,
Expand Down Expand Up @@ -2942,6 +2943,9 @@ def create_resumable_upload_session(
delete the uploaded object automatically. Supported values
are "md5", "crc32c" and None. The default is None.
:type predefined_acl: str
:param predefined_acl: (Optional) Predefined access control list
:type if_generation_match: long
:param if_generation_match:
(Optional) See :ref:`using-if-generation-match`
Expand Down Expand Up @@ -3015,7 +3019,7 @@ def create_resumable_upload_session(
content_type,
size,
None,
predefined_acl=None,
predefined_acl=predefined_acl,
if_generation_match=if_generation_match,
if_generation_not_match=if_generation_not_match,
if_metageneration_match=if_metageneration_match,
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/test_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -3572,6 +3572,7 @@ def _create_resumable_upload_session_helper(
origin=None,
side_effect=None,
timeout=None,
predefined_acl=None,
if_generation_match=None,
if_generation_not_match=None,
if_metageneration_match=None,
Expand Down Expand Up @@ -3611,6 +3612,7 @@ def _create_resumable_upload_session_helper(
size=size,
origin=origin,
client=client,
predefined_acl=predefined_acl,
if_generation_match=if_generation_match,
if_generation_not_match=if_generation_not_match,
if_metageneration_match=if_metageneration_match,
Expand All @@ -3629,6 +3631,9 @@ def _create_resumable_upload_session_helper(
)

qs_params = [("uploadType", "resumable")]
if predefined_acl is not None:
qs_params.append(("predefinedAcl", predefined_acl))

if if_generation_match is not None:
qs_params.append(("ifGenerationMatch", if_generation_match))

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

def test_create_resumable_upload_session_with_predefined_acl(self):
self._create_resumable_upload_session_helper(predefined_acl="private")

def test_create_resumable_upload_session_with_generation_match(self):
self._create_resumable_upload_session_helper(
if_generation_match=123456, if_metageneration_match=2
Expand Down

0 comments on commit 2b3e8f9

Please sign in to comment.