From fa1de0e976f66195e8ff090e8958981957a5072b Mon Sep 17 00:00:00 2001 From: Deepanjan Bhattacharyya Date: Fri, 20 Oct 2023 08:21:07 -0700 Subject: [PATCH] Fix setting cache key policy --- src/main/java/gyro/google/compute/BackendBucketCdnPolicy.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/gyro/google/compute/BackendBucketCdnPolicy.java b/src/main/java/gyro/google/compute/BackendBucketCdnPolicy.java index 5740782b..1670fca9 100644 --- a/src/main/java/gyro/google/compute/BackendBucketCdnPolicy.java +++ b/src/main/java/gyro/google/compute/BackendBucketCdnPolicy.java @@ -20,7 +20,6 @@ import java.util.List; import java.util.stream.Collectors; -import com.google.cloud.compute.v1.BackendBucketCdnPolicyCacheKeyPolicy; import gyro.core.resource.Diffable; import gyro.core.resource.Output; import gyro.core.resource.Updatable; @@ -273,7 +272,7 @@ com.google.cloud.compute.v1.BackendBucketCdnPolicy toBackendBucketCdnPolicy() { return com.google.cloud.compute.v1.BackendBucketCdnPolicy.newBuilder() .setSignedUrlCacheMaxAgeSec(getSignedUrlMaxAge()) .setCacheMode(getCacheMode()) - .setCacheKeyPolicy(BackendBucketCdnPolicyCacheKeyPolicy.newBuilder().build()) + .setCacheKeyPolicy(getCacheKeyPolicy() != null ? getCacheKeyPolicy().toBackendBucketCdnPolicyCacheKeyPolicy() : new BackendBucketCdnCacheKeyPolicy().toBackendBucketCdnPolicyCacheKeyPolicy()) .addAllBypassCacheOnRequestHeaders(getBypassCacheOnRequestHeader().stream() .map(BackendBucketCdnBypassCacheOnRequestHeader::toBackendBucketCdnPolicyBypassCacheOnRequestHeader) .collect(Collectors.toList()))