Skip to content

Commit 4fac04b

Browse files
committed
fix ci failures
1 parent 123fc27 commit 4fac04b

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

google/cloud/storage/bucket_metadata.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,9 +366,8 @@ BucketMetadataPatchBuilder& BucketMetadataPatchBuilder::SetEncryption(
366366

367367
auto add_config_patch = [&](char const* name, auto const& config) {
368368
if (config.restriction_mode.empty()) return;
369-
builder.AddSubPatch(
370-
name, internal::PatchBuilder()
371-
.SetStringField("restrictionMode", config.restriction_mode));
369+
builder.AddSubPatch(name, internal::PatchBuilder().SetStringField(
370+
"restrictionMode", config.restriction_mode));
372371
};
373372
add_config_patch("googleManagedEncryptionEnforcementConfig",
374373
v.google_managed_encryption_enforcement_config);

google/cloud/storage/examples/storage_bucket_encryption_enforcement_samples.cc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ void SetBucketEncryptionEnforcementConfig(
9999
<< create_bucket("g-" + bucket_name, gmek_encryption)->name()
100100
<< " created with GMEK-only enforcement policy.\n";
101101

102+
// In GCS, a single project cannot create or delete buckets more often than
103+
// once every two seconds. We pause to avoid rate limiting.
104+
std::this_thread::sleep_for(std::chrono::seconds(2));
105+
102106
// Example 2: Enforce CMEK Only
103107
gcs::BucketEncryption cmek_encryption;
104108
cmek_encryption.google_managed_encryption_enforcement_config
@@ -111,6 +115,10 @@ void SetBucketEncryptionEnforcementConfig(
111115
<< create_bucket("c-" + bucket_name, cmek_encryption)->name()
112116
<< " created with CMEK-only enforcement policy.\n";
113117

118+
// In GCS, a single project cannot create or delete buckets more often than
119+
// once every two seconds. We pause to avoid rate limiting.
120+
std::this_thread::sleep_for(std::chrono::seconds(2));
121+
114122
// Example 3: Restrict CSEK (Ransomware Protection)
115123
gcs::BucketEncryption csek_encryption;
116124
csek_encryption.customer_supplied_encryption_enforcement_config
@@ -194,11 +202,14 @@ void RunAll(std::vector<std::string> const& argv) {
194202
// In GCS a single project cannot create or delete buckets more often than
195203
// once every two seconds. We will pause until that time before deleting the
196204
// buckets.
197-
auto pause = std::chrono::steady_clock::now() + std::chrono::seconds(2);
205+
auto constexpr kBucketPeriod = std::chrono::seconds(2);
206+
auto pause = std::chrono::steady_clock::now() + kBucketPeriod;
198207
if (!examples::UsingEmulator()) std::this_thread::sleep_until(pause);
199208

200209
(void)examples::RemoveBucketAndContents(client, "g-" + bucket_name);
210+
if (!examples::UsingEmulator()) std::this_thread::sleep_for(kBucketPeriod);
201211
(void)examples::RemoveBucketAndContents(client, "c-" + bucket_name);
212+
if (!examples::UsingEmulator()) std::this_thread::sleep_for(kBucketPeriod);
202213
(void)examples::RemoveBucketAndContents(client, "rc-" + bucket_name);
203214
}
204215

google/cloud/storage/internal/grpc/bucket_request_parser.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ Status PatchLogging(Bucket& b, nlohmann::json const& l) {
163163
return Status{};
164164
}
165165

166-
167166
Status PatchEncryption(Bucket& b, nlohmann::json const& e) {
168167
if (e.is_null()) {
169168
b.clear_encryption();

0 commit comments

Comments
 (0)