Skip to content

Commit

Permalink
fix: Add missing product region tags for Cloud CDN snippets (GoogleCl…
Browse files Browse the repository at this point in the history
…oudPlatform#9258)

## Description

Cloud CDN Snippets are missing product's specific region tags. In this PR, we are only adding region tags. No code changes. For more details, refer to [b/264905390](b/264905390).

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

## Checklist
- [ ] I have followed [Sample Guidelines from AUTHORING_GUIDE.MD](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md)
- [ ] README is updated to include [all relevant information](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#readme-file)
- [ ] **Tests** pass:   `nox -s py-3.9` (see [Test Environment Setup](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup))
- [ ] **Lint** pass:   `nox -s lint` (see [Test Environment Setup](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md#test-environment-setup))
- [ ] These samples need a new **API enabled** in testing projects to pass (let us know which ones)
- [ ] These samples need a new/updated **env vars** in testing projects set to pass (let us know which ones)
- [x] Please **merge** this PR for me once it is approved.
- [ ] This sample adds a new sample directory, and I updated the [CODEOWNERS file](https://togithub.com/GoogleCloudPlatform/python-docs-samples/blob/main/.github/CODEOWNERS) with the codeowners for this sample
  • Loading branch information
msampathkumar authored Mar 10, 2023
1 parent 7011a47 commit 5f8bb22
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cdn/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@


# [START sign_url]
# [START cloudcdn_sign_url]
def sign_url(url, key_name, base64_key, expiration_time):
"""Gets the Signed URL string for the specified URL and configuration.
Expand Down Expand Up @@ -68,8 +69,10 @@ def sign_url(url, key_name, base64_key, expiration_time):
url=url_to_sign, signature=signature)

print(signed_url)
# [END cloudcdn_sign_url]


# [START cloudcdn_sign_url_prefix]
def sign_url_prefix(url, url_prefix, key_name, base64_key, expiration_time):
"""Gets the Signed URL string for the specified URL prefix and configuration.
Expand Down Expand Up @@ -111,10 +114,12 @@ def sign_url_prefix(url, url_prefix, key_name, base64_key, expiration_time):
signature=signature)

print(signed_url)
# [END cloudcdn_sign_url_prefix]
# [END sign_url]


# [START cdn_sign_cookie]
# [START cloudcdn_sign_cookie]
def sign_cookie(url_prefix, key_name, base64_key, expiration_time):
"""Gets the Signed cookie value for the specified URL prefix and configuration.
Expand Down Expand Up @@ -147,6 +152,7 @@ def sign_cookie(url_prefix, key_name, base64_key, expiration_time):
policy=policy, signature=signature)
print(signed_policy)
# [END cdn_sign_cookie]
# [END cloudcdn_sign_cookie]


if __name__ == '__main__':
Expand Down

0 comments on commit 5f8bb22

Please sign in to comment.