google-cloud-storage 3.2.0__tar.gz → 3.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. {google_cloud_storage-3.2.0/google_cloud_storage.egg-info → google_cloud_storage-3.3.0}/PKG-INFO +1 -1
  2. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/bucket.py +56 -4
  3. google_cloud_storage-3.3.0/google/cloud/storage/ip_filter.py +143 -0
  4. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/version.py +1 -1
  5. google_cloud_storage-3.3.0/google/cloud/storage_v2/__init__.py +140 -0
  6. google_cloud_storage-3.3.0/google/cloud/storage_v2/gapic_metadata.json +263 -0
  7. google_cloud_storage-3.3.0/google/cloud/storage_v2/gapic_version.py +16 -0
  8. google_cloud_storage-3.3.0/google/cloud/storage_v2/py.typed +2 -0
  9. google_cloud_storage-3.3.0/google/cloud/storage_v2/services/__init__.py +15 -0
  10. google_cloud_storage-3.3.0/google/cloud/storage_v2/services/storage/__init__.py +22 -0
  11. google_cloud_storage-3.3.0/google/cloud/storage_v2/services/storage/async_client.py +3443 -0
  12. google_cloud_storage-3.3.0/google/cloud/storage_v2/services/storage/client.py +3836 -0
  13. google_cloud_storage-3.3.0/google/cloud/storage_v2/services/storage/pagers.py +352 -0
  14. google_cloud_storage-3.3.0/google/cloud/storage_v2/services/storage/transports/__init__.py +33 -0
  15. google_cloud_storage-3.3.0/google/cloud/storage_v2/services/storage/transports/base.py +506 -0
  16. google_cloud_storage-3.3.0/google/cloud/storage_v2/services/storage/transports/grpc.py +1185 -0
  17. google_cloud_storage-3.3.0/google/cloud/storage_v2/services/storage/transports/grpc_asyncio.py +1349 -0
  18. google_cloud_storage-3.3.0/google/cloud/storage_v2/types/__init__.py +132 -0
  19. google_cloud_storage-3.3.0/google/cloud/storage_v2/types/storage.py +4964 -0
  20. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0/google_cloud_storage.egg-info}/PKG-INFO +1 -1
  21. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google_cloud_storage.egg-info/SOURCES.txt +21 -1
  22. google_cloud_storage-3.3.0/tests/__init__.py +15 -0
  23. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/test__signing.py +99 -23
  24. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/test_bucket.py +68 -0
  25. google_cloud_storage-3.3.0/tests/unit/gapic/__init__.py +15 -0
  26. google_cloud_storage-3.3.0/tests/unit/gapic/storage_v2/__init__.py +15 -0
  27. google_cloud_storage-3.3.0/tests/unit/gapic/storage_v2/test_storage.py +11512 -0
  28. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_bucket.py +48 -0
  29. google_cloud_storage-3.3.0/tests/unit/test_ip_filter.py +106 -0
  30. google_cloud_storage-3.2.0/tests/system/__init__.py +0 -0
  31. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/LICENSE +0 -0
  32. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/MANIFEST.in +0 -0
  33. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/README.rst +0 -0
  34. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/__init__.py +0 -0
  35. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_helpers.py +0 -0
  36. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_http.py +0 -0
  37. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/__init__.py +0 -0
  38. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/_download.py +0 -0
  39. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/_helpers.py +0 -0
  40. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/_upload.py +0 -0
  41. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/common.py +0 -0
  42. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/py.typed +0 -0
  43. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/requests/__init__.py +0 -0
  44. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/requests/_request_helpers.py +0 -0
  45. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/requests/download.py +0 -0
  46. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_media/requests/upload.py +0 -0
  47. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_opentelemetry_tracing.py +0 -0
  48. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/_signing.py +0 -0
  49. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/acl.py +0 -0
  50. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/batch.py +0 -0
  51. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/blob.py +0 -0
  52. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/client.py +0 -0
  53. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/constants.py +0 -0
  54. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/exceptions.py +0 -0
  55. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/fileio.py +0 -0
  56. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/hmac_key.py +0 -0
  57. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/iam.py +0 -0
  58. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/notification.py +0 -0
  59. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/retry.py +0 -0
  60. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google/cloud/storage/transfer_manager.py +0 -0
  61. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google_cloud_storage.egg-info/dependency_links.txt +0 -0
  62. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google_cloud_storage.egg-info/not-zip-safe +0 -0
  63. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google_cloud_storage.egg-info/requires.txt +0 -0
  64. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/google_cloud_storage.egg-info/top_level.txt +0 -0
  65. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/setup.cfg +0 -0
  66. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/setup.py +0 -0
  67. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/conformance/README.md +0 -0
  68. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/conformance/__init__.py +0 -0
  69. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/conformance/conftest.py +0 -0
  70. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/conformance/retry_strategy_test_data.json +0 -0
  71. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/conformance/test_conformance.py +0 -0
  72. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/data/CloudPlatform_128px_Retina.png +0 -0
  73. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/data/five-point-one-mb-file.zip +0 -0
  74. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/data/simple.txt +0 -0
  75. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/perf/README.md +0 -0
  76. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/perf/_perf_utils.py +0 -0
  77. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/perf/benchmarking.py +0 -0
  78. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/perf/profile_w1r3.py +0 -0
  79. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/__init__.py +0 -0
  80. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/data/brotli.txt +0 -0
  81. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/data/brotli.txt.br +0 -0
  82. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/data/favicon.ico +0 -0
  83. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/data/file.txt +0 -0
  84. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/data/gzipped.txt +0 -0
  85. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/data/gzipped.txt.gz +0 -0
  86. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/data/image1.jpg +0 -0
  87. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/data/image2.jpg +0 -0
  88. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/system/__init__.py +0 -0
  89. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/system/credentials.json.enc +0 -0
  90. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/system/requests/__init__.py +0 -0
  91. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/system/requests/conftest.py +0 -0
  92. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/system/requests/test_download.py +0 -0
  93. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/system/requests/test_upload.py +0 -0
  94. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/system/utils.py +0 -0
  95. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/unit/__init__.py +0 -0
  96. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/unit/requests/__init__.py +0 -0
  97. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/unit/requests/test__helpers.py +0 -0
  98. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/unit/requests/test_download.py +0 -0
  99. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/unit/requests/test_upload.py +0 -0
  100. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/unit/test__download.py +0 -0
  101. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/unit/test__helpers.py +0 -0
  102. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/resumable_media/unit/test__upload.py +0 -0
  103. {google_cloud_storage-3.2.0/tests → google_cloud_storage-3.3.0/tests/system}/__init__.py +0 -0
  104. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/_helpers.py +0 -0
  105. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/conftest.py +0 -0
  106. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/test_blob.py +0 -0
  107. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/test_client.py +0 -0
  108. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/test_fileio.py +0 -0
  109. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/test_hmac_key_metadata.py +0 -0
  110. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/test_kms_integration.py +0 -0
  111. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/test_notification.py +0 -0
  112. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/system/test_transfer_manager.py +0 -0
  113. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/__init__.py +0 -0
  114. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test__helpers.py +0 -0
  115. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test__http.py +0 -0
  116. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test__opentelemetry_tracing.py +0 -0
  117. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test__signing.py +0 -0
  118. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_acl.py +0 -0
  119. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_batch.py +0 -0
  120. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_blob.py +0 -0
  121. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_client.py +0 -0
  122. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_exceptions.py +0 -0
  123. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_fileio.py +0 -0
  124. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_hmac_key.py +0 -0
  125. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_notification.py +0 -0
  126. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_retry.py +0 -0
  127. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/test_transfer_manager.py +0 -0
  128. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/url_signer_v4_test_account.json +0 -0
  129. {google_cloud_storage-3.2.0 → google_cloud_storage-3.3.0}/tests/unit/url_signer_v4_test_data.json +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-cloud-storage
3
- Version: 3.2.0
3
+ Version: 3.3.0
4
4
  Summary: Google Cloud Storage API client library
5
5
  Home-page: https://github.com/googleapis/python-storage
6
6
  Author: Google LLC
@@ -56,6 +56,7 @@ from google.cloud.storage.constants import PUBLIC_ACCESS_PREVENTION_INHERITED
56
56
  from google.cloud.storage.constants import REGIONAL_LEGACY_STORAGE_CLASS
57
57
  from google.cloud.storage.constants import REGION_LOCATION_TYPE
58
58
  from google.cloud.storage.constants import STANDARD_STORAGE_CLASS
59
+ from google.cloud.storage.ip_filter import IPFilter
59
60
  from google.cloud.storage.notification import BucketNotification
60
61
  from google.cloud.storage.notification import NONE_PAYLOAD_FORMAT
61
62
  from google.cloud.storage.retry import DEFAULT_RETRY
@@ -88,6 +89,7 @@ _LOCATION_SETTER_MESSAGE = (
88
89
  _FROM_STRING_MESSAGE = (
89
90
  "Bucket.from_string() is deprecated. " "Use Bucket.from_uri() instead."
90
91
  )
92
+ _IP_FILTER_PROPERTY = "ipFilter"
91
93
 
92
94
 
93
95
  def _blobs_page_start(iterator, page, response):
@@ -2255,10 +2257,7 @@ class Bucket(_PropertyMixin):
2255
2257
  timeout=_DEFAULT_TIMEOUT,
2256
2258
  retry=DEFAULT_RETRY_IF_GENERATION_SPECIFIED,
2257
2259
  ):
2258
- """Move a blob to a new name within a single HNS bucket.
2259
-
2260
- *This feature is currently only supported for HNS (Heirarchical
2261
- Namespace) buckets.*
2260
+ """Move a blob to a new name atomically.
2262
2261
 
2263
2262
  If :attr:`user_project` is set on the bucket, bills the API request to that project.
2264
2263
 
@@ -3890,6 +3889,59 @@ class Bucket(_PropertyMixin):
3890
3889
  query_parameters=query_parameters,
3891
3890
  )
3892
3891
 
3892
+ @property
3893
+ def ip_filter(self):
3894
+ """Retrieve or set the IP Filter configuration for this bucket.
3895
+
3896
+ See https://cloud.google.com/storage/docs/ip-filtering-overview and
3897
+ https://cloud.google.com/storage/docs/json_api/v1/buckets#ipFilter
3898
+
3899
+ .. note::
3900
+ The getter for this property returns an
3901
+ :class:`~google.cloud.storage.ip_filter.IPFilter` object, which is a
3902
+ structured representation of the bucket's IP filter configuration.
3903
+ Modifying the returned object has no effect. To update the bucket's
3904
+ IP filter, create and assign a new ``IPFilter`` object to this
3905
+ property and then call
3906
+ :meth:`~google.cloud.storage.bucket.Bucket.patch`.
3907
+
3908
+ .. code-block:: python
3909
+
3910
+ from google.cloud.storage.ip_filter import (
3911
+ IPFilter,
3912
+ PublicNetworkSource,
3913
+ )
3914
+
3915
+ ip_filter = IPFilter()
3916
+ ip_filter.mode = "Enabled"
3917
+ ip_filter.public_network_source = PublicNetworkSource(
3918
+ allowed_ip_cidr_ranges=["203.0.113.5/32"]
3919
+ )
3920
+ bucket.ip_filter = ip_filter
3921
+ bucket.patch()
3922
+
3923
+ :setter: Set the IP Filter configuration for this bucket.
3924
+ :getter: Gets the IP Filter configuration for this bucket.
3925
+
3926
+ :rtype: :class:`~google.cloud.storage.ip_filter.IPFilter` or ``NoneType``
3927
+ :returns:
3928
+ An ``IPFilter`` object representing the configuration, or ``None``
3929
+ if no filter is configured.
3930
+ """
3931
+ resource = self._properties.get(_IP_FILTER_PROPERTY)
3932
+ if resource:
3933
+ return IPFilter._from_api_resource(resource)
3934
+ return None
3935
+
3936
+ @ip_filter.setter
3937
+ def ip_filter(self, value):
3938
+ if value is None:
3939
+ self._patch_property(_IP_FILTER_PROPERTY, None)
3940
+ elif isinstance(value, IPFilter):
3941
+ self._patch_property(_IP_FILTER_PROPERTY, value._to_api_resource())
3942
+ else:
3943
+ self._patch_property(_IP_FILTER_PROPERTY, value)
3944
+
3893
3945
 
3894
3946
  class SoftDeletePolicy(dict):
3895
3947
  """Map a bucket's soft delete policy.
@@ -0,0 +1,143 @@
1
+ # Copyright 2014 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """IP Filter configuration for Google Cloud Storage Buckets."""
16
+
17
+ from typing import Dict, Any, Optional, List
18
+
19
+ _MODE = "mode"
20
+ _PUBLIC_NETWORK_SOURCE = "publicNetworkSource"
21
+ _VPC_NETWORK_SOURCES = "vpcNetworkSources"
22
+ _ALLOWED_IP_CIDR_RANGES = "allowedIpCidrRanges"
23
+ _NETWORK = "network"
24
+ _ALLOW_ALL_SERVICE_AGENT_ACCESS = "allowAllServiceAgentAccess"
25
+ _ALLOW_CROSS_ORG_VPCS = "allowCrossOrgVpcs"
26
+
27
+
28
+ class PublicNetworkSource:
29
+ """Represents a public network source for a GCS Bucket IP Filter.
30
+
31
+ :type allowed_ip_cidr_ranges: list(str) or None
32
+ :param allowed_ip_cidr_ranges: A list of public IPv4 or IPv6 ranges in
33
+ CIDR notation that are allowed to access
34
+ the bucket.
35
+ """
36
+
37
+ def __init__(self, allowed_ip_cidr_ranges: Optional[List[str]] = None):
38
+ self.allowed_ip_cidr_ranges = allowed_ip_cidr_ranges or []
39
+
40
+ def _to_api_resource(self) -> Dict[str, Any]:
41
+ """Serializes this object to a dictionary for API requests."""
42
+ return {_ALLOWED_IP_CIDR_RANGES: self.allowed_ip_cidr_ranges}
43
+
44
+
45
+ class VpcNetworkSource:
46
+ """Represents a VPC network source for a GCS Bucket IP Filter.
47
+
48
+ :type network: str
49
+ :param network: The resource name of the VPC network.
50
+
51
+ :type allowed_ip_cidr_ranges: list(str) or None
52
+ :param allowed_ip_cidr_ranges: A list of IPv4 or IPv6 ranges in CIDR
53
+ notation allowed to access the bucket
54
+ from this VPC.
55
+ """
56
+
57
+ def __init__(
58
+ self, network: str, allowed_ip_cidr_ranges: Optional[List[str]] = None
59
+ ):
60
+ self.network = network
61
+ self.allowed_ip_cidr_ranges = allowed_ip_cidr_ranges or []
62
+
63
+ def _to_api_resource(self) -> Dict[str, Any]:
64
+ """Serializes this object to a dictionary for API requests."""
65
+ return {
66
+ _NETWORK: self.network,
67
+ _ALLOWED_IP_CIDR_RANGES: self.allowed_ip_cidr_ranges,
68
+ }
69
+
70
+
71
+ class IPFilter:
72
+ """Represents a GCS Bucket IP Filter configuration.
73
+
74
+ This class is a helper for constructing the IP Filter dictionary to be
75
+ assigned to a bucket's ``ip_filter`` property.
76
+ """
77
+
78
+ """
79
+ Attributes:
80
+ mode (str): Required. The mode of the IP filter. Can be "Enabled" or "Disabled".
81
+ allow_all_service_agent_access (bool): Required. If True, allows Google
82
+ Cloud service agents to bypass the IP filter.
83
+ public_network_source (PublicNetworkSource): (Optional) The configuration
84
+ for requests from the public internet.
85
+ vpc_network_sources (list(VpcNetworkSource)): (Optional) A list of
86
+ configurations for requests from VPC networks.
87
+ allow_cross_org_vpcs (bool): (Optional) If True, allows VPCs from
88
+ other organizations to be used in the configuration.
89
+ """
90
+
91
+ def __init__(self):
92
+ self.mode: Optional[str] = None
93
+ self.public_network_source: Optional[PublicNetworkSource] = None
94
+ self.vpc_network_sources: List[VpcNetworkSource] = []
95
+ self.allow_all_service_agent_access: Optional[bool] = None
96
+ self.allow_cross_org_vpcs: Optional[bool] = None
97
+
98
+ @classmethod
99
+ def _from_api_resource(cls, resource: Dict[str, Any]) -> "IPFilter":
100
+ """Factory: creates an IPFilter instance from a server response."""
101
+ ip_filter = cls()
102
+ ip_filter.mode = resource.get(_MODE)
103
+ ip_filter.allow_all_service_agent_access = resource.get(
104
+ _ALLOW_ALL_SERVICE_AGENT_ACCESS, None
105
+ )
106
+
107
+ public_network_source_data = resource.get(_PUBLIC_NETWORK_SOURCE, None)
108
+ if public_network_source_data:
109
+ ip_filter.public_network_source = PublicNetworkSource(
110
+ allowed_ip_cidr_ranges=public_network_source_data.get(
111
+ _ALLOWED_IP_CIDR_RANGES, []
112
+ )
113
+ )
114
+
115
+ vns_res_list = resource.get(_VPC_NETWORK_SOURCES, [])
116
+ ip_filter.vpc_network_sources = [
117
+ VpcNetworkSource(
118
+ network=vns.get(_NETWORK),
119
+ allowed_ip_cidr_ranges=vns.get(_ALLOWED_IP_CIDR_RANGES, []),
120
+ )
121
+ for vns in vns_res_list
122
+ ]
123
+ ip_filter.allow_cross_org_vpcs = resource.get(_ALLOW_CROSS_ORG_VPCS, None)
124
+ return ip_filter
125
+
126
+ def _to_api_resource(self) -> Dict[str, Any]:
127
+ """Serializes this object to a dictionary for API requests."""
128
+ resource = {
129
+ _MODE: self.mode,
130
+ _ALLOW_ALL_SERVICE_AGENT_ACCESS: self.allow_all_service_agent_access,
131
+ }
132
+
133
+ if self.public_network_source:
134
+ resource[
135
+ _PUBLIC_NETWORK_SOURCE
136
+ ] = self.public_network_source._to_api_resource()
137
+ if self.vpc_network_sources is not None:
138
+ resource[_VPC_NETWORK_SOURCES] = [
139
+ vns._to_api_resource() for vns in self.vpc_network_sources
140
+ ]
141
+ if self.allow_cross_org_vpcs is not None:
142
+ resource[_ALLOW_CROSS_ORG_VPCS] = self.allow_cross_org_vpcs
143
+ return resource
@@ -12,4 +12,4 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
- __version__ = "3.2.0"
15
+ __version__ = "3.3.0"
@@ -0,0 +1,140 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ from google.cloud.storage_v2 import gapic_version as package_version
17
+
18
+ __version__ = package_version.__version__
19
+
20
+
21
+ from .services.storage import StorageClient
22
+ from .services.storage import StorageAsyncClient
23
+
24
+ from .types.storage import AppendObjectSpec
25
+ from .types.storage import BidiReadHandle
26
+ from .types.storage import BidiReadObjectError
27
+ from .types.storage import BidiReadObjectRedirectedError
28
+ from .types.storage import BidiReadObjectRequest
29
+ from .types.storage import BidiReadObjectResponse
30
+ from .types.storage import BidiReadObjectSpec
31
+ from .types.storage import BidiWriteHandle
32
+ from .types.storage import BidiWriteObjectRedirectedError
33
+ from .types.storage import BidiWriteObjectRequest
34
+ from .types.storage import BidiWriteObjectResponse
35
+ from .types.storage import Bucket
36
+ from .types.storage import BucketAccessControl
37
+ from .types.storage import CancelResumableWriteRequest
38
+ from .types.storage import CancelResumableWriteResponse
39
+ from .types.storage import ChecksummedData
40
+ from .types.storage import CommonObjectRequestParams
41
+ from .types.storage import ComposeObjectRequest
42
+ from .types.storage import ContentRange
43
+ from .types.storage import CreateBucketRequest
44
+ from .types.storage import CustomerEncryption
45
+ from .types.storage import DeleteBucketRequest
46
+ from .types.storage import DeleteObjectRequest
47
+ from .types.storage import GetBucketRequest
48
+ from .types.storage import GetObjectRequest
49
+ from .types.storage import ListBucketsRequest
50
+ from .types.storage import ListBucketsResponse
51
+ from .types.storage import ListObjectsRequest
52
+ from .types.storage import ListObjectsResponse
53
+ from .types.storage import LockBucketRetentionPolicyRequest
54
+ from .types.storage import MoveObjectRequest
55
+ from .types.storage import Object
56
+ from .types.storage import ObjectAccessControl
57
+ from .types.storage import ObjectChecksums
58
+ from .types.storage import ObjectContexts
59
+ from .types.storage import ObjectCustomContextPayload
60
+ from .types.storage import ObjectRangeData
61
+ from .types.storage import Owner
62
+ from .types.storage import ProjectTeam
63
+ from .types.storage import QueryWriteStatusRequest
64
+ from .types.storage import QueryWriteStatusResponse
65
+ from .types.storage import ReadObjectRequest
66
+ from .types.storage import ReadObjectResponse
67
+ from .types.storage import ReadRange
68
+ from .types.storage import ReadRangeError
69
+ from .types.storage import RestoreObjectRequest
70
+ from .types.storage import RewriteObjectRequest
71
+ from .types.storage import RewriteResponse
72
+ from .types.storage import ServiceConstants
73
+ from .types.storage import StartResumableWriteRequest
74
+ from .types.storage import StartResumableWriteResponse
75
+ from .types.storage import UpdateBucketRequest
76
+ from .types.storage import UpdateObjectRequest
77
+ from .types.storage import WriteObjectRequest
78
+ from .types.storage import WriteObjectResponse
79
+ from .types.storage import WriteObjectSpec
80
+
81
+ __all__ = (
82
+ "StorageAsyncClient",
83
+ "AppendObjectSpec",
84
+ "BidiReadHandle",
85
+ "BidiReadObjectError",
86
+ "BidiReadObjectRedirectedError",
87
+ "BidiReadObjectRequest",
88
+ "BidiReadObjectResponse",
89
+ "BidiReadObjectSpec",
90
+ "BidiWriteHandle",
91
+ "BidiWriteObjectRedirectedError",
92
+ "BidiWriteObjectRequest",
93
+ "BidiWriteObjectResponse",
94
+ "Bucket",
95
+ "BucketAccessControl",
96
+ "CancelResumableWriteRequest",
97
+ "CancelResumableWriteResponse",
98
+ "ChecksummedData",
99
+ "CommonObjectRequestParams",
100
+ "ComposeObjectRequest",
101
+ "ContentRange",
102
+ "CreateBucketRequest",
103
+ "CustomerEncryption",
104
+ "DeleteBucketRequest",
105
+ "DeleteObjectRequest",
106
+ "GetBucketRequest",
107
+ "GetObjectRequest",
108
+ "ListBucketsRequest",
109
+ "ListBucketsResponse",
110
+ "ListObjectsRequest",
111
+ "ListObjectsResponse",
112
+ "LockBucketRetentionPolicyRequest",
113
+ "MoveObjectRequest",
114
+ "Object",
115
+ "ObjectAccessControl",
116
+ "ObjectChecksums",
117
+ "ObjectContexts",
118
+ "ObjectCustomContextPayload",
119
+ "ObjectRangeData",
120
+ "Owner",
121
+ "ProjectTeam",
122
+ "QueryWriteStatusRequest",
123
+ "QueryWriteStatusResponse",
124
+ "ReadObjectRequest",
125
+ "ReadObjectResponse",
126
+ "ReadRange",
127
+ "ReadRangeError",
128
+ "RestoreObjectRequest",
129
+ "RewriteObjectRequest",
130
+ "RewriteResponse",
131
+ "ServiceConstants",
132
+ "StartResumableWriteRequest",
133
+ "StartResumableWriteResponse",
134
+ "StorageClient",
135
+ "UpdateBucketRequest",
136
+ "UpdateObjectRequest",
137
+ "WriteObjectRequest",
138
+ "WriteObjectResponse",
139
+ "WriteObjectSpec",
140
+ )
@@ -0,0 +1,263 @@
1
+ {
2
+ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
3
+ "language": "python",
4
+ "libraryPackage": "google.cloud.storage_v2",
5
+ "protoPackage": "google.storage.v2",
6
+ "schema": "1.0",
7
+ "services": {
8
+ "Storage": {
9
+ "clients": {
10
+ "grpc": {
11
+ "libraryClient": "StorageClient",
12
+ "rpcs": {
13
+ "BidiReadObject": {
14
+ "methods": [
15
+ "bidi_read_object"
16
+ ]
17
+ },
18
+ "BidiWriteObject": {
19
+ "methods": [
20
+ "bidi_write_object"
21
+ ]
22
+ },
23
+ "CancelResumableWrite": {
24
+ "methods": [
25
+ "cancel_resumable_write"
26
+ ]
27
+ },
28
+ "ComposeObject": {
29
+ "methods": [
30
+ "compose_object"
31
+ ]
32
+ },
33
+ "CreateBucket": {
34
+ "methods": [
35
+ "create_bucket"
36
+ ]
37
+ },
38
+ "DeleteBucket": {
39
+ "methods": [
40
+ "delete_bucket"
41
+ ]
42
+ },
43
+ "DeleteObject": {
44
+ "methods": [
45
+ "delete_object"
46
+ ]
47
+ },
48
+ "GetBucket": {
49
+ "methods": [
50
+ "get_bucket"
51
+ ]
52
+ },
53
+ "GetIamPolicy": {
54
+ "methods": [
55
+ "get_iam_policy"
56
+ ]
57
+ },
58
+ "GetObject": {
59
+ "methods": [
60
+ "get_object"
61
+ ]
62
+ },
63
+ "ListBuckets": {
64
+ "methods": [
65
+ "list_buckets"
66
+ ]
67
+ },
68
+ "ListObjects": {
69
+ "methods": [
70
+ "list_objects"
71
+ ]
72
+ },
73
+ "LockBucketRetentionPolicy": {
74
+ "methods": [
75
+ "lock_bucket_retention_policy"
76
+ ]
77
+ },
78
+ "MoveObject": {
79
+ "methods": [
80
+ "move_object"
81
+ ]
82
+ },
83
+ "QueryWriteStatus": {
84
+ "methods": [
85
+ "query_write_status"
86
+ ]
87
+ },
88
+ "ReadObject": {
89
+ "methods": [
90
+ "read_object"
91
+ ]
92
+ },
93
+ "RestoreObject": {
94
+ "methods": [
95
+ "restore_object"
96
+ ]
97
+ },
98
+ "RewriteObject": {
99
+ "methods": [
100
+ "rewrite_object"
101
+ ]
102
+ },
103
+ "SetIamPolicy": {
104
+ "methods": [
105
+ "set_iam_policy"
106
+ ]
107
+ },
108
+ "StartResumableWrite": {
109
+ "methods": [
110
+ "start_resumable_write"
111
+ ]
112
+ },
113
+ "TestIamPermissions": {
114
+ "methods": [
115
+ "test_iam_permissions"
116
+ ]
117
+ },
118
+ "UpdateBucket": {
119
+ "methods": [
120
+ "update_bucket"
121
+ ]
122
+ },
123
+ "UpdateObject": {
124
+ "methods": [
125
+ "update_object"
126
+ ]
127
+ },
128
+ "WriteObject": {
129
+ "methods": [
130
+ "write_object"
131
+ ]
132
+ }
133
+ }
134
+ },
135
+ "grpc-async": {
136
+ "libraryClient": "StorageAsyncClient",
137
+ "rpcs": {
138
+ "BidiReadObject": {
139
+ "methods": [
140
+ "bidi_read_object"
141
+ ]
142
+ },
143
+ "BidiWriteObject": {
144
+ "methods": [
145
+ "bidi_write_object"
146
+ ]
147
+ },
148
+ "CancelResumableWrite": {
149
+ "methods": [
150
+ "cancel_resumable_write"
151
+ ]
152
+ },
153
+ "ComposeObject": {
154
+ "methods": [
155
+ "compose_object"
156
+ ]
157
+ },
158
+ "CreateBucket": {
159
+ "methods": [
160
+ "create_bucket"
161
+ ]
162
+ },
163
+ "DeleteBucket": {
164
+ "methods": [
165
+ "delete_bucket"
166
+ ]
167
+ },
168
+ "DeleteObject": {
169
+ "methods": [
170
+ "delete_object"
171
+ ]
172
+ },
173
+ "GetBucket": {
174
+ "methods": [
175
+ "get_bucket"
176
+ ]
177
+ },
178
+ "GetIamPolicy": {
179
+ "methods": [
180
+ "get_iam_policy"
181
+ ]
182
+ },
183
+ "GetObject": {
184
+ "methods": [
185
+ "get_object"
186
+ ]
187
+ },
188
+ "ListBuckets": {
189
+ "methods": [
190
+ "list_buckets"
191
+ ]
192
+ },
193
+ "ListObjects": {
194
+ "methods": [
195
+ "list_objects"
196
+ ]
197
+ },
198
+ "LockBucketRetentionPolicy": {
199
+ "methods": [
200
+ "lock_bucket_retention_policy"
201
+ ]
202
+ },
203
+ "MoveObject": {
204
+ "methods": [
205
+ "move_object"
206
+ ]
207
+ },
208
+ "QueryWriteStatus": {
209
+ "methods": [
210
+ "query_write_status"
211
+ ]
212
+ },
213
+ "ReadObject": {
214
+ "methods": [
215
+ "read_object"
216
+ ]
217
+ },
218
+ "RestoreObject": {
219
+ "methods": [
220
+ "restore_object"
221
+ ]
222
+ },
223
+ "RewriteObject": {
224
+ "methods": [
225
+ "rewrite_object"
226
+ ]
227
+ },
228
+ "SetIamPolicy": {
229
+ "methods": [
230
+ "set_iam_policy"
231
+ ]
232
+ },
233
+ "StartResumableWrite": {
234
+ "methods": [
235
+ "start_resumable_write"
236
+ ]
237
+ },
238
+ "TestIamPermissions": {
239
+ "methods": [
240
+ "test_iam_permissions"
241
+ ]
242
+ },
243
+ "UpdateBucket": {
244
+ "methods": [
245
+ "update_bucket"
246
+ ]
247
+ },
248
+ "UpdateObject": {
249
+ "methods": [
250
+ "update_object"
251
+ ]
252
+ },
253
+ "WriteObject": {
254
+ "methods": [
255
+ "write_object"
256
+ ]
257
+ }
258
+ }
259
+ }
260
+ }
261
+ }
262
+ }
263
+ }
@@ -0,0 +1,16 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ __version__ = "0.0.0" # {x-release-please-version}
@@ -0,0 +1,2 @@
1
+ # Marker file for PEP 561.
2
+ # The google-cloud-storage package uses inline types.
@@ -0,0 +1,15 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Copyright 2025 Google LLC
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #