Repository: cloudflare/cloudflare-go
Pull request #2797 (2024-07-30 22:07:19)

Support admin code override
Support the [admin override code](https://developers.cloudflare.com/cloudflare-one/connections/connect-devices/warp/configure-warp/warp-settings/#admin-override) feature. Will be making a [PR in the Terraform Provider](https://github.com/cloudflare/terraform-provider-cloudflare/pull/3526) to also support this feature.
## Has your change been tested?

Yes. Added tests to the existing teams_accounts_test.go file. 

## Types of changes

What sort of change does your code introduce/modify?

- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)

## Checklist:

- [ X ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ X ] I have added tests to cover my changes.
- [ X ] All new and existing tests passed.
- [ ] This change is using publicly documented in [cloudflare/api-schemas](https://github.com/cloudflare/api-schemas) 
      and relies on stable APIs. (Internal PR will be released soon)

[1]: https://help.github.com/articles/closing-issues-using-keywords/


github-actions[bot]: Oops! It looks like no changelog entry is attached to this PR. Please include a release note as described in https://github.com/cloudflare/cloudflare-go/blob/master/docs/changelog-process.md.

Example: 

~~~
```release-note:TYPE
Release note
```
~~~

If you do not require a release note to be included, please add the `workflow/skip-changelog-entry` label.

Patch:
diff --git a/.changelog/2797.txt b/.changelog/2797.txt
new file mode 100644
index 000000000..f3457d9a0
--- /dev/null
+++ b/.changelog/2797.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+teams_accounts: Add `disable_for_time` attribute
+```
\ No newline at end of file
diff --git a/teams_accounts.go b/teams_accounts.go
index dbded0953..91e1e6a6c 100644
--- a/teams_accounts.go
+++ b/teams_accounts.go
@@ -140,6 +140,7 @@ type TeamsDeviceSettings struct {
 	GatewayProxyUDPEnabled             bool  `json:"gateway_udp_proxy_enabled"`
 	RootCertificateInstallationEnabled bool  `json:"root_certificate_installation_enabled"`
 	UseZTVirtualIP                     *bool `json:"use_zt_virtual_ip"`
+	DisableForTime                     int32 `json:"disable_for_time"`
 }
 
 type TeamsDeviceSettingsResponse struct {


Test patch:
diff --git a/teams_accounts_test.go b/teams_accounts_test.go
index 569d35254..c681e9fef 100644
--- a/teams_accounts_test.go
+++ b/teams_accounts_test.go
@@ -295,7 +295,7 @@ func TestTeamsAccountGetDeviceConfiguration(t *testing.T) {
 			"success": true,
 			"errors": [],
 			"messages": [],
-			"result": {"gateway_proxy_enabled": true,"gateway_udp_proxy_enabled":false, "root_certificate_installation_enabled":true, "use_zt_virtual_ip":false}
+			"result": {"gateway_proxy_enabled": true,"gateway_udp_proxy_enabled":false, "root_certificate_installation_enabled":true, "use_zt_virtual_ip":false, "disable_for_time":3600}
 		}`)
 	}
 
@@ -309,6 +309,7 @@ func TestTeamsAccountGetDeviceConfiguration(t *testing.T) {
 			GatewayProxyUDPEnabled:             false,
 			RootCertificateInstallationEnabled: true,
 			UseZTVirtualIP:                     BoolPtr(false),
+			DisableForTime:                     3600,
 		})
 	}
 }
@@ -324,7 +325,7 @@ func TestTeamsAccountUpdateDeviceConfiguration(t *testing.T) {
 			"success": true,
 			"errors": [],
 			"messages": [],
-			"result": {"gateway_proxy_enabled": true,"gateway_udp_proxy_enabled":true, "root_certificate_installation_enabled":true, "use_zt_virtual_ip":true}
+			"result": {"gateway_proxy_enabled": true,"gateway_udp_proxy_enabled":true, "root_certificate_installation_enabled":true, "use_zt_virtual_ip":true, "disable_for_time":3600}
 		}`)
 	}
 
@@ -335,6 +336,7 @@ func TestTeamsAccountUpdateDeviceConfiguration(t *testing.T) {
 		GatewayProxyEnabled:                true,
 		RootCertificateInstallationEnabled: true,
 		UseZTVirtualIP:                     BoolPtr(true),
+		DisableForTime:                     3600,
 	})
 
 	if assert.NoError(t, err) {
@@ -343,6 +345,7 @@ func TestTeamsAccountUpdateDeviceConfiguration(t *testing.T) {
 			GatewayProxyUDPEnabled:             true,
 			RootCertificateInstallationEnabled: true,
 			UseZTVirtualIP:                     BoolPtr(true),
+			DisableForTime:                     3600,
 		})
 	}
 }