diff --git a/docs/storage_snippets.py b/docs/storage_snippets.py index a79c8114201d..415cc8fd27e7 100644 --- a/docs/storage_snippets.py +++ b/docs/storage_snippets.py @@ -220,6 +220,39 @@ def list_buckets(client, to_delete): to_delete.append(bucket) +@snippet +def policy_document(client, to_delete): + # pylint: disable=unused-argument + # [START policy_document] + bucket = client.bucket('my-bucket') + conditions = [ + ['starts-with', '$key', ''], + {'acl': 'public-read'}] + + policy = bucket.generate_upload_policy(conditions) + + # Generate an upload form using the form fields. + policy_fields = ''.join( + ''.format( + key=key, value=value) + for key, value in policy.items() + ) + + upload_form = ( + '