From bd72f654e6ced8d1fc28d10861353aebce1ca183 Mon Sep 17 00:00:00 2001 From: Dawson Hensel Date: Tue, 30 Aug 2022 12:42:29 -0700 Subject: [PATCH] add linux distro device fields --- .changelog/1073.txt | 3 +++ teams_devices.go | 36 +++++++++++++++++++----------------- teams_devices_test.go | 34 +++++++++++++++++++--------------- 3 files changed, 41 insertions(+), 32 deletions(-) create mode 100644 .changelog/1073.txt diff --git a/.changelog/1073.txt b/.changelog/1073.txt new file mode 100644 index 00000000000..54216744a64 --- /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 2e20e824f90..8836cbe51ce 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 { diff --git a/teams_devices_test.go b/teams_devices_test.go index 566a72a5533..b639c164c09 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)