Skip to content

Commit

Permalink
Merge pull request #1294 from suhrit-cf/master
Browse files Browse the repository at this point in the history
Add description to device non default settings policy
  • Loading branch information
jacobbednarz committed May 26, 2023
2 parents d5bc8b5 + e8eafdc commit c9ed99e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/1294.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
devices_policy: Add missing description field to policy
```
2 changes: 2 additions & 0 deletions devices_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type DeviceSettingsPolicy struct {
Precedence *int `json:"precedence"`
Default bool `json:"default"`
ExcludeOfficeIps *bool `json:"exclude_office_ips"`
Description *string `json:"description"`
}

type DeviceSettingsPolicyResponse struct {
Expand Down Expand Up @@ -80,6 +81,7 @@ type DeviceSettingsPolicyRequest struct {
Match *string `json:"match,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
ExcludeOfficeIps *bool `json:"exclude_office_ips"`
Description *string `json:"description,omitempty"`
}

// UpdateDeviceClientCertificates controls the zero trust zone used to provision client certificates.
Expand Down
12 changes: 8 additions & 4 deletions devices_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var (
Precedence: nil,
Default: true,
ExcludeOfficeIps: BoolPtr(false),
Description: nil,
}

nonDefaultDeviceSettingsPolicy = DeviceSettingsPolicy{
Expand Down Expand Up @@ -72,6 +73,7 @@ var (
Precedence: &deviceSettingsPolicyPrecedence,
Default: false,
ExcludeOfficeIps: BoolPtr(true),
Description: StringPtr("Test Description"),
}

defaultDeviceSettingsPolicyJson = `{
Expand Down Expand Up @@ -143,7 +145,8 @@ var (
"match": %#v,
"precedence": 10,
"default": false,
"exclude_office_ips":true
"exclude_office_ips":true,
"description":"Test Description"
}`, deviceSettingsPolicyID, deviceSettingsPolicyMatch)
)

Expand Down Expand Up @@ -240,9 +243,10 @@ func TestCreateDeviceSettingsPolicy(t *testing.T) {
mux.HandleFunc("/accounts/"+testAccountID+"/devices/policy", handler)

actual, err := client.CreateDeviceSettingsPolicy(context.Background(), testAccountID, DeviceSettingsPolicyRequest{
Precedence: IntPtr(10),
Match: &deviceSettingsPolicyMatch,
Name: StringPtr("test"),
Precedence: IntPtr(10),
Match: &deviceSettingsPolicyMatch,
Name: StringPtr("test"),
Description: StringPtr("Test Description"),
})

if assert.NoError(t, err) {
Expand Down

0 comments on commit c9ed99e

Please sign in to comment.