Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 173
feat: public access prevention#304
Merged
tseaver
merged 13 commits into
googleapis:master
from
shaffeeullah:publicaccesspreventionJun 30, 2021
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f9498b9
feat: public access prevention
shaffeeullah 029298b
Merge branch 'master' into publicaccessprevention
shaffeeullah 22f67dd
moved constants
shaffeeullah fc10435
Merge branch 'publicaccessprevention' of github.com:shaffeeullah/pyth…
shaffeeullah f915e45
Merge branch 'master' into publicaccessprevention
shaffeeullah 4838184
Merge branch 'master' into publicaccessprevention
shaffeeullah 9ab8b49
removed unused import
shaffeeullah a95c187
Merge branch 'publicaccessprevention' of github.com:shaffeeullah/pyth…
shaffeeullah a1dcb8a
Merge branch 'master' into publicaccessprevention
shaffeeullah 7b3077d
Merge branch 'master' into publicaccessprevention
shaffeeullah 4264534
docs: include link to the GCS PAP docs in docstring
tseaver f0e6117
Merge branch 'master' into publicaccessprevention
tseaver 157f25e
chore: blacken
tseaver File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -50,6 +50,7 @@ | ||
| from google.cloud.storage.constants import MULTI_REGIONAL_LEGACY_STORAGE_CLASS | ||
| from google.cloud.storage.constants import MULTI_REGION_LOCATION_TYPE | ||
| from google.cloud.storage.constants import NEARLINE_STORAGE_CLASS | ||
| from google.cloud.storage.constants import PUBLIC_ACCESS_PREVENTION_UNSPECIFIED | ||
| from google.cloud.storage.constants import REGIONAL_LEGACY_STORAGE_CLASS | ||
| from google.cloud.storage.constants import REGION_LOCATION_TYPE | ||
| from google.cloud.storage.constants import STANDARD_STORAGE_CLASS | ||
| @@ -383,6 +384,12 @@ class IAMConfiguration(dict): | ||
| :type bucket: :class:`Bucket` | ||
| :params bucket: Bucket for which this instance is the policy. | ||
| :type public_access_prevention: str | ||
| :params public_access_prevention: | ||
| (Optional) Whether the public access prevention policy is 'unspecified' (default) or 'enforced' | ||
tseaver marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. shaffeeullah marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| See: https://cloud.google.com/storage/docs/public-access-prevention | ||
| See: https://cloud.google.com/storage/docs/public-access-prevention | ||
| :type uniform_bucket_level_access_enabled: bool | ||
| :params bucket_policy_only_enabled: | ||
| (Optional) Whether the IAM-only policy is enabled for the bucket. | ||
| @@ -404,6 +411,7 @@ class IAMConfiguration(dict): | ||
| def __init__( | ||
| self, | ||
| bucket, | ||
| public_access_prevention=_default, | ||
| uniform_bucket_level_access_enabled=_default, | ||
| uniform_bucket_level_access_locked_time=_default, | ||
| bucket_policy_only_enabled=_default, | ||
| @@ -428,8 +436,14 @@ def __init__( | ||
| if uniform_bucket_level_access_enabled is _default: | ||
| uniform_bucket_level_access_enabled = False | ||
| if public_access_prevention is _default: | ||
| public_access_prevention = PUBLIC_ACCESS_PREVENTION_UNSPECIFIED | ||
| data = { | ||
| "uniformBucketLevelAccess": {"enabled": uniform_bucket_level_access_enabled} | ||
| "uniformBucketLevelAccess": { | ||
| "enabled": uniform_bucket_level_access_enabled | ||
| }, | ||
| "publicAccessPrevention": public_access_prevention, | ||
| } | ||
| if uniform_bucket_level_access_locked_time is not _default: | ||
| data["uniformBucketLevelAccess"]["lockedTime"] = _datetime_to_rfc3339( | ||
| @@ -464,6 +478,21 @@ def bucket(self): | ||
| """ | ||
| return self._bucket | ||
| @property | ||
| def public_access_prevention(self): | ||
| """Setting for public access prevention policy. Options are 'unspecified' (default) or 'enforced'. | ||
| More information can be found at https://cloud.google.com/storage/docs/public-access-prevention | ||
shaffeeullah marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| :rtype: string | ||
| :returns: the public access prevention status, either 'enforced' or 'unspecified'. | ||
| """ | ||
| return self["publicAccessPrevention"] | ||
| @public_access_prevention.setter | ||
| def public_access_prevention(self, value): | ||
| self["publicAccessPrevention"] = value | ||
| self.bucket._patch_property("iamConfiguration", self) | ||
| @property | ||
| def uniform_bucket_level_access_enabled(self): | ||
| """If set, access checks only use bucket-level IAM policies or above. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.