Skip to content

Commit

Permalink
Add new exclude_office_ips field to policy
Browse files Browse the repository at this point in the history
  • Loading branch information
suhrit-cf committed Feb 10, 2023
1 parent a38234c commit dc84128
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 30 deletions.
3 changes: 3 additions & 0 deletions .changelog/1205.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
devices_policy: Add new exclude_office_ips field to policy
```
2 changes: 2 additions & 0 deletions devices_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type DeviceSettingsPolicy struct {
Match *string `json:"match"`
Precedence *int `json:"precedence"`
Default bool `json:"default"`
ExcludeOfficeIps *bool `json:"exclude_office_ips"`
}

type DeviceSettingsPolicyResponse struct {
Expand All @@ -68,6 +69,7 @@ type DeviceSettingsPolicyRequest struct {
Name *string `json:"name,omitempty"`
Match *string `json:"match,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
ExcludeOfficeIps *bool `json:"exclude_office_ips"`
}

// UpdateDeviceClientCertificates controls the zero trust zone used to provision client certificates.
Expand Down
64 changes: 34 additions & 30 deletions devices_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,21 @@ var (
{Address: "10.0.0.0/8"},
{Address: "100.64.0.0/10"},
},
GatewayUniqueID: StringPtr("t1235"),
SupportURL: StringPtr(""),
CaptivePortal: IntPtr(180),
AllowModeSwitch: BoolPtr(false),
SwitchLocked: BoolPtr(false),
AllowUpdates: BoolPtr(false),
AutoConnect: IntPtr(0),
AllowedToLeave: BoolPtr(true),
Enabled: BoolPtr(true),
PolicyID: nil,
Name: nil,
Match: nil,
Precedence: nil,
Default: true,
GatewayUniqueID: StringPtr("t1235"),
SupportURL: StringPtr(""),
CaptivePortal: IntPtr(180),
AllowModeSwitch: BoolPtr(false),
SwitchLocked: BoolPtr(false),
AllowUpdates: BoolPtr(false),
AutoConnect: IntPtr(0),
AllowedToLeave: BoolPtr(true),
Enabled: BoolPtr(true),
PolicyID: nil,
Name: nil,
Match: nil,
Precedence: nil,
Default: true,
ExcludeOfficeIps: BoolPtr(false),
}

nonDefaultDeviceSettingsPolicy = DeviceSettingsPolicy{
Expand All @@ -56,20 +57,21 @@ var (
{Address: "10.0.0.0/8"},
{Address: "100.64.0.0/10"},
},
GatewayUniqueID: StringPtr("t1235"),
SupportURL: StringPtr(""),
CaptivePortal: IntPtr(180),
AllowModeSwitch: BoolPtr(false),
SwitchLocked: BoolPtr(false),
AllowUpdates: BoolPtr(false),
AutoConnect: IntPtr(0),
AllowedToLeave: BoolPtr(true),
PolicyID: &deviceSettingsPolicyID,
Enabled: BoolPtr(true),
Name: StringPtr("test"),
Match: &deviceSettingsPolicyMatch,
Precedence: &deviceSettingsPolicyPrecedence,
Default: false,
GatewayUniqueID: StringPtr("t1235"),
SupportURL: StringPtr(""),
CaptivePortal: IntPtr(180),
AllowModeSwitch: BoolPtr(false),
SwitchLocked: BoolPtr(false),
AllowUpdates: BoolPtr(false),
AutoConnect: IntPtr(0),
AllowedToLeave: BoolPtr(true),
PolicyID: &deviceSettingsPolicyID,
Enabled: BoolPtr(true),
Name: StringPtr("test"),
Match: &deviceSettingsPolicyMatch,
Precedence: &deviceSettingsPolicyPrecedence,
Default: false,
ExcludeOfficeIps: BoolPtr(true),
}

defaultDeviceSettingsPolicyJson = `{
Expand Down Expand Up @@ -102,7 +104,8 @@ var (
"auto_connect": 0,
"allowed_to_leave": true,
"enabled": true,
"default": true
"default": true,
"exclude_office_ips":false
}`

nonDefaultDeviceSettingsPolicyJson = fmt.Sprintf(`{
Expand Down Expand Up @@ -139,7 +142,8 @@ var (
"name": "test",
"match": %#v,
"precedence": 10,
"default": false
"default": false,
"exclude_office_ips":true
}`, deviceSettingsPolicyID, deviceSettingsPolicyMatch)
)

Expand Down

0 comments on commit dc84128

Please sign in to comment.