diff --git a/.changelog/3758.txt b/.changelog/3758.txt new file mode 100644 index 00000000000..2ab7e3829b1 --- /dev/null +++ b/.changelog/3758.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +teams_location: make location parameters optional +``` \ No newline at end of file diff --git a/teams_locations.go b/teams_locations.go index 489993a8293..319f7c6c6d7 100644 --- a/teams_locations.go +++ b/teams_locations.go @@ -32,16 +32,15 @@ type TeamsLocation struct { Ip string `json:"ip,omitempty"` Subdomain string `json:"doh_subdomain"` AnonymizedLogsEnabled bool `json:"anonymized_logs_enabled"` - IPv4Destination string `json:"ipv4_destination"` - IPv4DestinationBackup string `json:"ipv4_destination_backup"` - DNSDestinationIPsID string `json:"dns_destination_ips_id"` - DNSDestinationIPv6BlockID string `json:"dns_destination_ipv6_block_id"` + IPv4Destination string `json:"ipv4_destination,omitempty"` + IPv4DestinationBackup string `json:"ipv4_destination_backup,omitempty"` + DNSDestinationIPsID *string `json:"dns_destination_ips_id,omitempty"` + DNSDestinationIPv6BlockID *string `json:"dns_destination_ipv6_block_id,omitempty"` ClientDefault bool `json:"client_default"` ECSSupport *bool `json:"ecs_support,omitempty"` Endpoints *TeamsLocationEndpoints `json:"endpoints,omitempty"` - - CreatedAt *time.Time `json:"created_at,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` } type TeamsLocationEndpoints struct { diff --git a/teams_locations_test.go b/teams_locations_test.go index 9acb094cfaa..b374c00edc1 100644 --- a/teams_locations_test.go +++ b/teams_locations_test.go @@ -54,6 +54,8 @@ func TestTeamsLocations(t *testing.T) { createdAt, _ := time.Parse(time.RFC3339, "2020-05-18T22:07:03Z") updatedAt, _ := time.Parse(time.RFC3339, "2020-05-18T22:07:05Z") + ipv4Id := "9da8e0c9-e9cc-4bbd-85c5-b351fc373354" + ipv6Id := "8da8e0c9-e9cc-4bbd-85c5-b351fc373354" want := []TeamsLocation{{ ID: "0f8185414dec4a5e9034f3d917c17890", Name: "home", @@ -63,8 +65,8 @@ func TestTeamsLocations(t *testing.T) { AnonymizedLogsEnabled: false, IPv4Destination: "1.2.3.4", IPv4DestinationBackup: "1.2.3.5", - DNSDestinationIPsID: "9da8e0c9-e9cc-4bbd-85c5-b351fc373354", - DNSDestinationIPv6BlockID: "8da8e0c9-e9cc-4bbd-85c5-b351fc373354", + DNSDestinationIPsID: &ipv4Id, + DNSDestinationIPv6BlockID: &ipv6Id, ClientDefault: false, ECSSupport: BoolPtr(false), CreatedAt: &createdAt,