New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(storage): Add cname support for V4 signature #72
Merged
Merged
Changes from 3 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f06d48f
feat(storage): add cname support for v4 signature
HemangChothani ad1afc9
docs(storage): comment changes
HemangChothani 89b4061
Merge remote-tracking branch 'upstream/master' into storage-issue-11
HemangChothani 273f770
feat(storage): address comment
HemangChothani 1c88840
Merge remote-tracking branch 'upstream/master' into storage-issue-11
HemangChothani 4057ae7
feat(storage): doc fix
HemangChothani 7cf7762
Merge branch 'master' into storage-issue-11
frankyn f09a1a8
Merge branch 'master' into storage-issue-11
frankyn 3b96e62
feat(storage): nit addressed
HemangChothani a39064f
Merge remote-tracking branch 'upstream/master' into storage-issue-11
HemangChothani 3f01a04
feat(storage): add conformance tests
HemangChothani f927dc3
Merge branch 'master' into storage-issue-11
frankyn beeae99
Merge branch 'master' into storage-issue-11
frankyn 6af0085
feat(storage): nit
HemangChothani File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
|
@@ -2355,6 +2355,7 @@ def generate_signed_url( | |
credentials=None, | ||
version=None, | ||
virtual_hosted_style=False, | ||
use_cname=None, | ||
): | ||
"""Generates a signed URL for this bucket. | ||
|
||
|
@@ -2373,6 +2374,8 @@ def generate_signed_url( | |
amount of time, you can use this method to generate a URL that | ||
is only valid within a certain time period. | ||
|
||
If ``cname`` is set as an argument of :attr:`api_access_endpoint`, ``https`` works only if using a ``CDN``. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cname no longer used in method signature should be updated. |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add an inline example of using |
||
This is particularly useful if you don't want publicly | ||
accessible buckets, but don't want to require users to explicitly | ||
log in. | ||
|
@@ -2422,6 +2425,13 @@ def generate_signed_url( | |
(Optional) If true, then construct the URL relative the bucket's | ||
virtual hostname, e.g., '<bucket-name>.storage.googleapis.com'. | ||
|
||
:type use_cname: bool | ||
:param use_cname: | ||
(Optional) If true, then construct the URL relative the bucket-bound hostname , | ||
pass ``bucket-bound hostname`` value as argument of ``api_access_endpoint``, | ||
e.g., 'api_access_endpoint = <bucket-bound hostname>'. See: | ||
https://cloud.google.com/storage/docs/request-endpoints#cname | ||
|
||
:raises: :exc:`ValueError` when version is invalid. | ||
:raises: :exc:`TypeError` when expiration is not a valid type. | ||
:raises: :exc:`AttributeError` if credentials is not an instance | ||
|
@@ -2440,10 +2450,13 @@ def generate_signed_url( | |
api_access_endpoint = "https://{bucket_name}.storage.googleapis.com".format( | ||
bucket_name=self.name | ||
) | ||
resource = "/" | ||
|
||
else: | ||
resource = "/{bucket_name}".format(bucket_name=self.name) | ||
|
||
if virtual_hosted_style or use_cname: | ||
resource = "/" | ||
|
||
if credentials is None: | ||
client = self._require_client(client) | ||
credentials = client._credentials | ||
|
This file contains 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use parameter name:
bucket_bound_host_name
. I prefer that this parameter be passed in a string and is an alias forapi_access_endpoint=
. I'd prefer not required two parameters to set bucket_bound_host_name as enabled.