Repository: cloudflare/cloudflare-go
Pull request #1826 (2024-04-19 18:12:27)

GFI-151: add ecs_support to teams_location
## Description

The ecs_support field for locations has been present in the API but missing in terraform. This adds it.
https://developers.cloudflare.com/api/operations/zero-trust-gateway-locations-create-zero-trust-gateway-location

## Has your change been tested?

Unit tests

## Types of changes

What sort of change does your code introduce/modify?

- [x] 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.
- [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:

Patch:
diff --git a/.changelog/1826.txt b/.changelog/1826.txt
new file mode 100644
index 000000000..7538106f3
--- /dev/null
+++ b/.changelog/1826.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+gateway: added ecs_support field to teams_location resource
+```
diff --git a/teams_locations.go b/teams_locations.go
index 296d98b13..b6c58304e 100644
--- a/teams_locations.go
+++ b/teams_locations.go
@@ -35,6 +35,7 @@ type TeamsLocation struct {
 	AnonymizedLogsEnabled bool                   `json:"anonymized_logs_enabled"`
 	IPv4Destination       string                 `json:"ipv4_destination"`
 	ClientDefault         bool                   `json:"client_default"`
+	ECSSupport            *bool                  `json:"ecs_support,omitempty"`
 
 	CreatedAt *time.Time `json:"created_at,omitempty"`
 	UpdatedAt *time.Time `json:"updated_at,omitempty"`


Test patch:
diff --git a/teams_locations_test.go b/teams_locations_test.go
index d37d336f3..4eb615b1b 100644
--- a/teams_locations_test.go
+++ b/teams_locations_test.go
@@ -38,6 +38,7 @@ func TestTeamsLocations(t *testing.T) {
 					"anonymized_logs_enabled": false,
 					"ipv4_destination": null,
 					"client_default": false,
+					"ecs_support": false,
 					"created_at": "2020-05-18T22:07:03Z",
 					"updated_at": "2020-05-18T22:07:05Z"
 				}
@@ -60,6 +61,7 @@ func TestTeamsLocations(t *testing.T) {
 		AnonymizedLogsEnabled: false,
 		IPv4Destination:       "",
 		ClientDefault:         false,
+		ECSSupport:            BoolPtr(false),
 		CreatedAt:             &createdAt,
 		UpdatedAt:             &updatedAt,
 	}}
@@ -98,6 +100,7 @@ func TestTeamsLocation(t *testing.T) {
 				"anonymized_logs_enabled": false,
 				"ipv4_destination": null,
 				"client_default": false,
+				"ecs_support": false,
 				"created_at": "2020-05-18T22:07:03Z",
 				"updated_at": "2020-05-18T22:07:05Z"
 			}
@@ -118,6 +121,7 @@ func TestTeamsLocation(t *testing.T) {
 		AnonymizedLogsEnabled: false,
 		IPv4Destination:       "",
 		ClientDefault:         false,
+		ECSSupport:            BoolPtr(false),
 		CreatedAt:             &createdAt,
 		UpdatedAt:             &updatedAt,
 	}
@@ -156,6 +160,7 @@ func TestCreateTeamsLocation(t *testing.T) {
 				"anonymized_logs_enabled": false,
 				"ipv4_destination": null,
 				"client_default": false,
+				"ecs_support": false,
 				"created_at": "2020-05-18T22:07:03Z",
 				"updated_at": "2020-05-18T22:07:05Z"
 			}
@@ -176,6 +181,7 @@ func TestCreateTeamsLocation(t *testing.T) {
 		AnonymizedLogsEnabled: false,
 		IPv4Destination:       "",
 		ClientDefault:         false,
+		ECSSupport:            BoolPtr(false),
 		CreatedAt:             &createdAt,
 		UpdatedAt:             &updatedAt,
 	}
@@ -218,6 +224,7 @@ func TestUpdateTeamsLocation(t *testing.T) {
 				"anonymized_logs_enabled": false,
 				"ipv4_destination": null,
 				"client_default": false,
+				"ecs_support": false,
 				"created_at": "2020-05-18T22:07:03Z",
 				"updated_at": "2020-05-18T22:07:05Z"
 			}
@@ -238,6 +245,7 @@ func TestUpdateTeamsLocation(t *testing.T) {
 		AnonymizedLogsEnabled: false,
 		IPv4Destination:       "",
 		ClientDefault:         false,
+		ECSSupport:            BoolPtr(false),
 		CreatedAt:             &createdAt,
 		UpdatedAt:             &updatedAt,
 	}