@@ -24,6 +24,7 @@ def set_retention_policy(bucket_name, retention_period):
24
24
# [START storage_set_retention_policy]
25
25
# bucket_name = "my-bucket"
26
26
# retention_period = 10
27
+
27
28
storage_client = storage .Client ()
28
29
bucket = storage_client .bucket (bucket_name )
29
30
@@ -40,6 +41,7 @@ def remove_retention_policy(bucket_name):
40
41
"""Removes the retention policy on a given bucket"""
41
42
# [START storage_remove_retention_policy]
42
43
# bucket_name = "my-bucket"
44
+
43
45
storage_client = storage .Client ()
44
46
bucket = storage_client .bucket (bucket_name )
45
47
bucket .reload ()
@@ -60,6 +62,7 @@ def lock_retention_policy(bucket_name):
60
62
"""Locks the retention policy on a given bucket"""
61
63
# [START storage_lock_retention_policy]
62
64
# bucket_name = "my-bucket"
65
+
63
66
storage_client = storage .Client ()
64
67
# get_bucket gets the current metageneration value for the bucket,
65
68
# required by lock_retention_policy.
@@ -79,6 +82,7 @@ def get_retention_policy(bucket_name):
79
82
"""Gets the retention policy on a given bucket"""
80
83
# [START storage_get_retention_policy]
81
84
# bucket_name = "my-bucket"
85
+
82
86
storage_client = storage .Client ()
83
87
bucket = storage_client .bucket (bucket_name )
84
88
bucket .reload ()
@@ -99,6 +103,7 @@ def set_temporary_hold(bucket_name, blob_name):
99
103
# [START storage_set_temporary_hold]
100
104
# bucket_name = "my-bucket"
101
105
# blob_name = "my-blob"
106
+
102
107
storage_client = storage .Client ()
103
108
bucket = storage_client .bucket (bucket_name )
104
109
blob = bucket .blob (blob_name )
@@ -115,6 +120,7 @@ def release_temporary_hold(bucket_name, blob_name):
115
120
# [START storage_release_temporary_hold]
116
121
# bucket_name = "my-bucket"
117
122
# blob_name = "my-blob"
123
+
118
124
storage_client = storage .Client ()
119
125
bucket = storage_client .bucket (bucket_name )
120
126
blob = bucket .blob (blob_name )
@@ -131,6 +137,7 @@ def set_event_based_hold(bucket_name, blob_name):
131
137
# [START storage_set_event_based_hold]
132
138
# bucket_name = "my-bucket"
133
139
# blob_name = "my-blob"
140
+
134
141
storage_client = storage .Client ()
135
142
bucket = storage_client .bucket (bucket_name )
136
143
blob = bucket .blob (blob_name )
@@ -147,6 +154,7 @@ def release_event_based_hold(bucket_name, blob_name):
147
154
# [START storage_release_event_based_hold]
148
155
# bucket_name = "my-bucket"
149
156
# blob_name = "my-blob"
157
+
150
158
storage_client = storage .Client ()
151
159
bucket = storage_client .bucket (bucket_name )
152
160
blob = bucket .blob (blob_name )
@@ -162,6 +170,7 @@ def enable_default_event_based_hold(bucket_name):
162
170
"""Enables the default event based hold on a given bucket"""
163
171
# [START storage_enable_default_event_based_hold]
164
172
# bucket_name = "my-bucket"
173
+
165
174
storage_client = storage .Client ()
166
175
bucket = storage_client .bucket (bucket_name )
167
176
@@ -176,6 +185,7 @@ def disable_default_event_based_hold(bucket_name):
176
185
"""Disables the default event based hold on a given bucket"""
177
186
# [START storage_disable_default_event_based_hold]
178
187
# bucket_name = "my-bucket"
188
+
179
189
storage_client = storage .Client ()
180
190
bucket = storage_client .bucket (bucket_name )
181
191
@@ -190,6 +200,7 @@ def get_default_event_based_hold(bucket_name):
190
200
"""Gets the default event based hold on a given bucket"""
191
201
# [START storage_get_default_event_based_hold]
192
202
# bucket_name = "my-bucket"
203
+
193
204
storage_client = storage .Client ()
194
205
bucket = storage_client .bucket (bucket_name )
195
206
bucket .reload ()
0 commit comments