Skip to content

Commit

Permalink
fix lint by changing bool to *bool in device_posture_rule.go
Browse files Browse the repository at this point in the history
  • Loading branch information
jlu-cloudflare committed Jul 21, 2024
1 parent 5e0fb0f commit 11d06ec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
12 changes: 6 additions & 6 deletions device_posture_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@ type DevicePostureRuleMatch struct {
type DevicePostureRuleInput struct {
ID string `json:"id,omitempty"`
Path string `json:"path,omitempty"`
Exists bool `json:"exists,omitempty"`
Exists *bool `json:"exists,omitempty"`
Thumbprint string `json:"thumbprint,omitempty"`
Sha256 string `json:"sha256,omitempty"`
Running bool `json:"running,omitempty"`
RequireAll bool `json:"requireAll,omitempty"`
Running *bool `json:"running,omitempty"`
RequireAll *bool `json:"requireAll,omitempty"`
CheckDisks []string `json:"checkDisks,omitempty"`
Enabled bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Version string `json:"version,omitempty"`
VersionOperator string `json:"versionOperator,omitempty"`
Overall string `json:"overall,omitempty"`
Expand All @@ -194,8 +194,8 @@ type DevicePostureRuleInput struct {
CommonName string `json:"cn,omitempty"`
ActiveThreats int `json:"active_threats,omitempty"`
NetworkStatus string `json:"network_status,omitempty"`
Infected bool `json:"infected,omitempty"`
IsActive bool `json:"is_active,omitempty"`
Infected *bool `json:"infected,omitempty"`
IsActive *bool `json:"is_active,omitempty"`
EidLastSeen string `json:"eid_last_seen,omitempty"`
RiskLevel string `json:"risk_level,omitempty"`
State string `json:"state,omitempty"`
Expand Down
16 changes: 9 additions & 7 deletions device_posture_rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,10 @@ func TestDevicePostureRules(t *testing.T) {
Input: DevicePostureRuleInput{
ID: "9e597887-345e-4a32-a09c-68811b129768",
Path: "/tmp/data.zta",
Exists: true,
Exists: newBoolPointer(true),
Thumbprint: "asdfasdfasdfasdf",
Sha256: "D75398FC796D659DEB4170569DCFEC63E3897C71E3AE8642FD3139A554AEE21E",
Running: true,
Running: newBoolPointer(true),
},
}}

Expand Down Expand Up @@ -413,7 +413,7 @@ func TestDevicePostureFileRule(t *testing.T) {
Match: []DevicePostureRuleMatch{{Platform: "ios"}},
Input: DevicePostureRuleInput{
Path: "/tmp/test",
Exists: true,
Exists: newBoolPointer(true),
Sha256: "42b4daec3962691f5893a966245e5ea30f9f8df7254e7b7af43a171e3e29c857",
},
}
Expand Down Expand Up @@ -468,7 +468,7 @@ func TestDevicePostureDiskEncryptionRule(t *testing.T) {
Expiration: "1h",
Match: []DevicePostureRuleMatch{{Platform: "ios"}},
Input: DevicePostureRuleInput{
RequireAll: true,
RequireAll: newBoolPointer(true),
CheckDisks: []string{"C", "D"},
},
}
Expand Down Expand Up @@ -680,8 +680,6 @@ func TestDevicePostureClientCertificateRuleV2(t *testing.T) {
`)
}

checkPrivateKey := true

want := DevicePostureRule{
ID: "480f4f69-1a28-4fdd-9240-1ed29f0ac1db",
Name: "My rule name",
Expand All @@ -693,7 +691,7 @@ func TestDevicePostureClientCertificateRuleV2(t *testing.T) {
Input: DevicePostureRuleInput{
CertificateID: "d2c04b78-3ba2-4294-8efa-4e85aef0777f",
CommonName: "example.com",
CheckPrivateKey: &checkPrivateKey,
CheckPrivateKey: newBoolPointer(true),
ExtendedKeyUsage: []string{"clientAuth", "emailProtection"},
Locations: CertificateLocations{
TrustStores: []string{"system"},
Expand Down Expand Up @@ -851,3 +849,7 @@ func TestDeleteDevicePostureRule(t *testing.T) {

assert.NoError(t, err)
}

func newBoolPointer(b bool) *bool {
return &b
}

0 comments on commit 11d06ec

Please sign in to comment.