diff --git a/.changelog/1464.txt b/.changelog/1464.txt new file mode 100644 index 00000000000..d2bb00b1579 --- /dev/null +++ b/.changelog/1464.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +device_posture_rules: add support for Access client fields in device posture integrations +``` \ No newline at end of file diff --git a/device_posture_rule.go b/device_posture_rule.go index 664d5241f3e..02c0cfe46eb 100644 --- a/device_posture_rule.go +++ b/device_posture_rule.go @@ -11,12 +11,14 @@ import ( // DevicePostureIntegrationConfig contains authentication information // for a device posture integration. type DevicePostureIntegrationConfig struct { - ClientID string `json:"client_id,omitempty"` - ClientSecret string `json:"client_secret,omitempty"` - AuthUrl string `json:"auth_url,omitempty"` - ApiUrl string `json:"api_url,omitempty"` - ClientKey string `json:"client_key,omitempty"` - CustomerID string `json:"customer_id,omitempty"` + ClientID string `json:"client_id,omitempty"` + ClientSecret string `json:"client_secret,omitempty"` + AuthUrl string `json:"auth_url,omitempty"` + ApiUrl string `json:"api_url,omitempty"` + ClientKey string `json:"client_key,omitempty"` + CustomerID string `json:"customer_id,omitempty"` + AccessClientID string `json:"access_client_id,omitempty"` + AccessClientSecret string `json:"access_client_secret,omitempty"` } // DevicePostureIntegration represents a device posture integration. diff --git a/device_posture_rule_test.go b/device_posture_rule_test.go index 79ce77c511f..b9b72b2b820 100644 --- a/device_posture_rule_test.go +++ b/device_posture_rule_test.go @@ -228,6 +228,55 @@ func TestDevicePostureIntegrationCreate(t *testing.T) { } } +func TestDevicePostureIntegrationTaniumCreate(t *testing.T) { + setup() + defer teardown() + + id := "480f4f69-1a28-4fdd-9240-1ed29f0ac1db" + handler := func(w http.ResponseWriter, r *http.Request) { + assert.Equal(t, http.MethodPost, r.Method, "Expected method 'POST', got %s", r.Method) + w.Header().Set("content-type", "application/json") + fmt.Fprintf(w, `{ + "success": true, + "errors": [], + "messages": [], + "result": { + "id": "%s", + "interval": "1h", + "type": "tanium_s2s", + "name": "My Tanium integration", + "config": { + "api_url": "https://api_url.example.com", + "client_secret": "test_client_secret", + "access_client_id": "test_access_client_id", + "access_client_secret": "test_access_client_secret" + } + } + }`, id) + } + + want := DevicePostureIntegration{ + IntegrationID: id, + Name: "My Tanium integration", + Type: "tanium_s2s", + Interval: "1h", + Config: DevicePostureIntegrationConfig{ + ApiUrl: "https://api_url.example.com", + ClientSecret: "test_client_secret", + AccessClientID: "test_access_client_id", + AccessClientSecret: "test_access_client_secret", + }, + } + + mux.HandleFunc("/accounts/"+testAccountID+"/devices/posture/integration", handler) + + actual, err := client.CreateDevicePostureIntegration(context.Background(), testAccountID, want) + + if assert.NoError(t, err) { + assert.Equal(t, want, actual) + } +} + func TestDevicePostureIntegrationDelete(t *testing.T) { setup() defer teardown()