diff --git a/google/cloud/storage/blob.py b/google/cloud/storage/blob.py index 205d4aeb2..f25b928c3 100644 --- a/google/cloud/storage/blob.py +++ b/google/cloud/storage/blob.py @@ -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, @@ -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` @@ -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, diff --git a/tests/unit/test_blob.py b/tests/unit/test_blob.py index 018ea4505..d25f0eb39 100644 --- a/tests/unit/test_blob.py +++ b/tests/unit/test_blob.py @@ -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, @@ -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, @@ -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)) @@ -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