@@ -24,6 +24,7 @@ def set_retention_policy(bucket_name, retention_period):
2424 # [START storage_set_retention_policy]
2525 # bucket_name = "my-bucket"
2626 # retention_period = 10
27+
2728 storage_client = storage .Client ()
2829 bucket = storage_client .bucket (bucket_name )
2930
@@ -40,6 +41,7 @@ def remove_retention_policy(bucket_name):
4041 """Removes the retention policy on a given bucket"""
4142 # [START storage_remove_retention_policy]
4243 # bucket_name = "my-bucket"
44+
4345 storage_client = storage .Client ()
4446 bucket = storage_client .bucket (bucket_name )
4547 bucket .reload ()
@@ -60,6 +62,7 @@ def lock_retention_policy(bucket_name):
6062 """Locks the retention policy on a given bucket"""
6163 # [START storage_lock_retention_policy]
6264 # bucket_name = "my-bucket"
65+
6366 storage_client = storage .Client ()
6467 # get_bucket gets the current metageneration value for the bucket,
6568 # required by lock_retention_policy.
@@ -79,6 +82,7 @@ def get_retention_policy(bucket_name):
7982 """Gets the retention policy on a given bucket"""
8083 # [START storage_get_retention_policy]
8184 # bucket_name = "my-bucket"
85+
8286 storage_client = storage .Client ()
8387 bucket = storage_client .bucket (bucket_name )
8488 bucket .reload ()
@@ -99,6 +103,7 @@ def set_temporary_hold(bucket_name, blob_name):
99103 # [START storage_set_temporary_hold]
100104 # bucket_name = "my-bucket"
101105 # blob_name = "my-blob"
106+
102107 storage_client = storage .Client ()
103108 bucket = storage_client .bucket (bucket_name )
104109 blob = bucket .blob (blob_name )
@@ -115,6 +120,7 @@ def release_temporary_hold(bucket_name, blob_name):
115120 # [START storage_release_temporary_hold]
116121 # bucket_name = "my-bucket"
117122 # blob_name = "my-blob"
123+
118124 storage_client = storage .Client ()
119125 bucket = storage_client .bucket (bucket_name )
120126 blob = bucket .blob (blob_name )
@@ -131,6 +137,7 @@ def set_event_based_hold(bucket_name, blob_name):
131137 # [START storage_set_event_based_hold]
132138 # bucket_name = "my-bucket"
133139 # blob_name = "my-blob"
140+
134141 storage_client = storage .Client ()
135142 bucket = storage_client .bucket (bucket_name )
136143 blob = bucket .blob (blob_name )
@@ -147,6 +154,7 @@ def release_event_based_hold(bucket_name, blob_name):
147154 # [START storage_release_event_based_hold]
148155 # bucket_name = "my-bucket"
149156 # blob_name = "my-blob"
157+
150158 storage_client = storage .Client ()
151159 bucket = storage_client .bucket (bucket_name )
152160 blob = bucket .blob (blob_name )
@@ -162,6 +170,7 @@ def enable_default_event_based_hold(bucket_name):
162170 """Enables the default event based hold on a given bucket"""
163171 # [START storage_enable_default_event_based_hold]
164172 # bucket_name = "my-bucket"
173+
165174 storage_client = storage .Client ()
166175 bucket = storage_client .bucket (bucket_name )
167176
@@ -176,6 +185,7 @@ def disable_default_event_based_hold(bucket_name):
176185 """Disables the default event based hold on a given bucket"""
177186 # [START storage_disable_default_event_based_hold]
178187 # bucket_name = "my-bucket"
188+
179189 storage_client = storage .Client ()
180190 bucket = storage_client .bucket (bucket_name )
181191
@@ -190,6 +200,7 @@ def get_default_event_based_hold(bucket_name):
190200 """Gets the default event based hold on a given bucket"""
191201 # [START storage_get_default_event_based_hold]
192202 # bucket_name = "my-bucket"
203+
193204 storage_client = storage .Client ()
194205 bucket = storage_client .bucket (bucket_name )
195206 bucket .reload ()
0 commit comments