Repository: cloudflare/cloudflare-go
Pull request #1811 (2024-04-16 22:36:39)

GATE-5639: update teams account via PATCH and add custom certificate setting
## Description

Adds a fix for BUGS-726 in which the custom certificate setting was being overwritten. This adds the existing custom certificate setting to Teams account configuration.

Documentation in https://developers.cloudflare.com/api/operations/zero-trust-accounts-update-zero-trust-account-configuration

## Has your change been tested?

Tests in a/teams_accounts_test.go. 

## Types of changes

What sort of change does your code introduce/modify?

- [x] Bug fix (non-breaking change which fixes an issue)

## Checklist:

- [x] My code follows the code style of this project.
- [x] I have added tests to cover my changes.
- [x] All new and existing tests passed.
- [x] This change is using publicly documented in [cloudflare/api-schemas](https://github.com/cloudflare/api-schemas) 
      and relies on stable APIs.

[1]: https://help.github.com/articles/closing-issues-using-keywords/


github-actions[bot]: changelog detected :white_check_mark:
alyssamw: Removed change to PATCH to follow terraform conventions 

Patch:
diff --git a/.changelog/1811.txt b/.changelog/1811.txt
new file mode 100644
index 000000000..86b6399a2
--- /dev/null
+++ b/.changelog/1811.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+teams_account: adds custom certificate setting to teams account configuration
+```
diff --git a/teams_accounts.go b/teams_accounts.go
index fc8fbb984..a027dbee9 100644
--- a/teams_accounts.go
+++ b/teams_accounts.go
@@ -46,6 +46,7 @@ type TeamsAccountSettings struct {
 	ProtocolDetection     *TeamsProtocolDetection     `json:"protocol_detection,omitempty"`
 	BodyScanning          *TeamsBodyScanning          `json:"body_scanning,omitempty"`
 	ExtendedEmailMatching *TeamsExtendedEmailMatching `json:"extended_email_matching,omitempty"`
+	CustomCertificate     *TeamsCustomCertificate     `json:"custom_certificate,omitempty"`
 }
 
 type BrowserIsolation struct {
@@ -103,6 +104,14 @@ type TeamsExtendedEmailMatching struct {
 	Enabled *bool `json:"enabled,omitempty"`
 }
 
+type TeamsCustomCertificate struct {
+	Enabled       *bool      `json:"enabled,omitempty"`
+	ID            string     `json:"id,omitempty"`
+	BindingStatus string     `json:"binding_status,omitempty"`
+	QsPackId      string     `json:"qs_pack_id,omitempty"`
+	UpdatedAt     *time.Time `json:"updated_at,omitempty"`
+}
+
 type TeamsRuleType = string
 
 const (


Test patch:
diff --git a/teams_accounts_test.go b/teams_accounts_test.go
index a7d096d1c..10f4807a2 100644
--- a/teams_accounts_test.go
+++ b/teams_accounts_test.go
@@ -169,6 +169,9 @@ func TestTeamsAccountUpdateConfiguration(t *testing.T) {
 					},
 					"extended_email_matching": {
 						"enabled": true
+					},
+					"custom_certificate": {
+						"enabled": true
 					}
 				}
 			}
@@ -184,6 +187,9 @@ func TestTeamsAccountUpdateConfiguration(t *testing.T) {
 		ExtendedEmailMatching: &TeamsExtendedEmailMatching{
 			Enabled: BoolPtr(true),
 		},
+		CustomCertificate: &TeamsCustomCertificate{
+			Enabled: BoolPtr(true),
+		},
 	}
 
 	mux.HandleFunc("/accounts/"+testAccountID+"/gateway/configuration", handler)