Repository: cloudflare/cloudflare-go
Pull request #1073 (2022-08-30 19:47:49)

Add new os_distro_name and os_distro_revision device fields for posture reporting.
Terraform PR: https://github.com/cloudflare/terraform-provider-cloudflare/pull/1842

## Description

Updated device fields to support new linux distro fields for posture reporting.

## Has your change been tested?

Added the new fields to an existing test.

## Screenshots (if appropriate):

## 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.
- [X] My change requires a change to the documentation.
- [X] 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 (api.cloudflare.com or developers.cloudflare.com) and stable APIs.

[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/1073.txt b/.changelog/1073.txt
new file mode 100644
index 000000000..54216744a
--- /dev/null
+++ b/.changelog/1073.txt
@@ -0,0 +1,3 @@
+```release-note:enhancement
+teams_account: add support for `os_distro_name` and `os_distro_revision`
+```
diff --git a/teams_devices.go b/teams_devices.go
index 2e20e824f..8836cbe51 100644
--- a/teams_devices.go
+++ b/teams_devices.go
@@ -18,23 +18,25 @@ type TeamsDeviceDetail struct {
 }
 
 type TeamsDeviceListItem struct {
-	User         UserItem `json:"user,omitempty"`
-	ID           string   `json:"id,omitempty"`
-	Key          string   `json:"key,omitempty"`
-	DeviceType   string   `json:"device_type,omitempty"`
-	Name         string   `json:"name,omitempty"`
-	Model        string   `json:"model,omitempty"`
-	Manufacturer string   `json:"manufacturer,omitempty"`
-	Deleted      bool     `json:"deleted,omitempty"`
-	Version      string   `json:"version,omitempty"`
-	SerialNumber string   `json:"serial_number,omitempty"`
-	OSVersion    string   `json:"os_version,omitempty"`
-	MacAddress   string   `json:"mac_address,omitempty"`
-	IP           string   `json:"ip,omitempty"`
-	Created      string   `json:"created,omitempty"`
-	Updated      string   `json:"updated,omitempty"`
-	LastSeen     string   `json:"last_seen,omitempty"`
-	RevokedAt    string   `json:"revoked_at,omitempty"`
+	User             UserItem `json:"user,omitempty"`
+	ID               string   `json:"id,omitempty"`
+	Key              string   `json:"key,omitempty"`
+	DeviceType       string   `json:"device_type,omitempty"`
+	Name             string   `json:"name,omitempty"`
+	Model            string   `json:"model,omitempty"`
+	Manufacturer     string   `json:"manufacturer,omitempty"`
+	Deleted          bool     `json:"deleted,omitempty"`
+	Version          string   `json:"version,omitempty"`
+	SerialNumber     string   `json:"serial_number,omitempty"`
+	OSVersion        string   `json:"os_version,omitempty"`
+	OSDistroName     string   `json:"os_distro_name,omitempty"`
+	OsDistroRevision string   `json:"os_distro_revision,omitempty"`
+	MacAddress       string   `json:"mac_address,omitempty"`
+	IP               string   `json:"ip,omitempty"`
+	Created          string   `json:"created,omitempty"`
+	Updated          string   `json:"updated,omitempty"`
+	LastSeen         string   `json:"last_seen,omitempty"`
+	RevokedAt        string   `json:"revoked_at,omitempty"`
 }
 
 type UserItem struct {


Test patch:
diff --git a/teams_devices_test.go b/teams_devices_test.go
index 566a72a55..b639c164c 100644
--- a/teams_devices_test.go
+++ b/teams_devices_test.go
@@ -39,6 +39,8 @@ func TestTeamsDevicesList(t *testing.T) {
               "version": "1.0.0",
               "serial_number": "EXAMPLEHMD6R",
               "os_version": "10.0.0",
+              "os_distro_name": "ubuntu",
+              "os_distro_revision": "1.0.0",
               "mac_address": "00-00-5E-00-53-00",
               "ip": "192.0.2.1",
               "created": "2017-06-14T00:00:00Z",
@@ -58,21 +60,23 @@ func TestTeamsDevicesList(t *testing.T) {
 			Name:  "John Appleseed",
 			Email: "user@example.com",
 		},
-		Key:          "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
-		DeviceType:   "windows",
-		Name:         "My mobile device",
-		Model:        "MyPhone(pro-X)",
-		Manufacturer: "My phone corp",
-		Deleted:      true,
-		Version:      "1.0.0",
-		SerialNumber: "EXAMPLEHMD6R",
-		OSVersion:    "10.0.0",
-		MacAddress:   "00-00-5E-00-53-00",
-		IP:           "192.0.2.1",
-		Created:      "2017-06-14T00:00:00Z",
-		Updated:      "2017-06-14T00:00:00Z",
-		LastSeen:     "2017-06-14T00:00:00Z",
-		RevokedAt:    "2017-06-14T00:00:00Z",
+		Key:              "yek0SUYoOQ10vMGsIYAevozXUQpQtNFJFfFGqER/BGc=",
+		DeviceType:       "windows",
+		Name:             "My mobile device",
+		Model:            "MyPhone(pro-X)",
+		Manufacturer:     "My phone corp",
+		Deleted:          true,
+		Version:          "1.0.0",
+		SerialNumber:     "EXAMPLEHMD6R",
+		OSVersion:        "10.0.0",
+		OSDistroName:     "ubuntu",
+		OsDistroRevision: "1.0.0",
+		MacAddress:       "00-00-5E-00-53-00",
+		IP:               "192.0.2.1",
+		Created:          "2017-06-14T00:00:00Z",
+		Updated:          "2017-06-14T00:00:00Z",
+		LastSeen:         "2017-06-14T00:00:00Z",
+		RevokedAt:        "2017-06-14T00:00:00Z",
 	}}
 
 	mux.HandleFunc("/accounts/"+testAccountID+"/devices", handler)