From c1233314e657953a4375369e736055db3ce104c2 Mon Sep 17 00:00:00 2001 From: Nicky Semenza Date: Thu, 23 Mar 2023 12:58:34 -0700 Subject: [PATCH] update geo_restrictions to be a pointer in the response struct, just like in the request struct noticed this while working on https://github.com/cloudflare/terraform-provider-cloudflare/pull/2319 but this isn't a requirement for that. --- .changelog/1244.txt | 3 +++ ssl.go | 26 +++++++++++++------------- ssl_test.go | 4 ++-- 3 files changed, 18 insertions(+), 15 deletions(-) create mode 100644 .changelog/1244.txt diff --git a/.changelog/1244.txt b/.changelog/1244.txt new file mode 100644 index 00000000000..fa7858c06ff --- /dev/null +++ b/.changelog/1244.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +ssl: make `GeoRestrictions` a pointer inside of ZoneCustomSSL +``` \ No newline at end of file diff --git a/ssl.go b/ssl.go index 125ab02ac8b..178e98c6caf 100644 --- a/ssl.go +++ b/ssl.go @@ -10,19 +10,19 @@ import ( // ZoneCustomSSL represents custom SSL certificate metadata. type ZoneCustomSSL struct { - ID string `json:"id"` - Hosts []string `json:"hosts"` - Issuer string `json:"issuer"` - Signature string `json:"signature"` - Status string `json:"status"` - BundleMethod string `json:"bundle_method"` - GeoRestrictions ZoneCustomSSLGeoRestrictions `json:"geo_restrictions"` - ZoneID string `json:"zone_id"` - UploadedOn time.Time `json:"uploaded_on"` - ModifiedOn time.Time `json:"modified_on"` - ExpiresOn time.Time `json:"expires_on"` - Priority int `json:"priority"` - KeylessServer KeylessSSL `json:"keyless_server"` + ID string `json:"id"` + Hosts []string `json:"hosts"` + Issuer string `json:"issuer"` + Signature string `json:"signature"` + Status string `json:"status"` + BundleMethod string `json:"bundle_method"` + GeoRestrictions *ZoneCustomSSLGeoRestrictions `json:"geo_restrictions,omitempty"` + ZoneID string `json:"zone_id"` + UploadedOn time.Time `json:"uploaded_on"` + ModifiedOn time.Time `json:"modified_on"` + ExpiresOn time.Time `json:"expires_on"` + Priority int `json:"priority"` + KeylessServer KeylessSSL `json:"keyless_server"` } // ZoneCustomSSLGeoRestrictions represents the parameter to create or update diff --git a/ssl_test.go b/ssl_test.go index 78dd51022fc..ea43e63cfeb 100644 --- a/ssl_test.go +++ b/ssl_test.go @@ -64,7 +64,7 @@ func TestCreateSSL(t *testing.T) { Signature: "SHA256WithRSA", Status: "active", BundleMethod: "ubiquitous", - GeoRestrictions: ZoneCustomSSLGeoRestrictions{Label: "us"}, + GeoRestrictions: &ZoneCustomSSLGeoRestrictions{Label: "us"}, ZoneID: "023e105f4ecef8ad9ca31a8372d0c353", UploadedOn: uploadedOn, ModifiedOn: modifiedOn, @@ -266,7 +266,7 @@ func TestUpdateSSL(t *testing.T) { Signature: "SHA256WithRSA", Status: "active", BundleMethod: "ubiquitous", - GeoRestrictions: ZoneCustomSSLGeoRestrictions{Label: "us"}, + GeoRestrictions: &ZoneCustomSSLGeoRestrictions{Label: "us"}, ZoneID: "023e105f4ecef8ad9ca31a8372d0c353", UploadedOn: uploadedOn, ModifiedOn: modifiedOn,