diff --git a/.gitignore b/.gitignore index b98422d..c26eb63 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ _testmain.go # vim swap files .*.sw? +.idea \ No newline at end of file diff --git a/datasource.go b/datasource.go index a5b40de..e4673b8 100644 --- a/datasource.go +++ b/datasource.go @@ -37,6 +37,9 @@ type JSONData struct { CustomMetricsNamespaces string `json:"customMetricsNamespaces,omitempty"` DefaultRegion string `json:"defaultRegion,omitempty"` TlsSkipVerify bool `json:"tlsSkipVerify,omitempty"` + HttpMethod string `json:"httpMethod,omitempty"` + QueryTimeout string `json:"queryTimeout,omitempty"` + TimeInterval string `json:"timeInterval,omitempty"` } // SecureJSONData is a representation of the datasource `secureJsonData` property diff --git a/datasource_test.go b/datasource_test.go index c2ee1b7..4988719 100644 --- a/datasource_test.go +++ b/datasource_test.go @@ -73,3 +73,32 @@ func TestNewDataSource(t *testing.T) { t.Error("datasource creation response should return the created datasource ID") } } + +func TestNewPrometheusDataSource(t *testing.T) { + server, client := gapiTestTools(200, createdDataSourceJSON) + defer server.Close() + + ds := &DataSource{ + Name: "foo_prometheus", + Type: "prometheus", + URL: "http://some-url.com", + Access: "access", + IsDefault: true, + JSONData: JSONData{ + HttpMethod: "POST", + QueryTimeout: "60s", + TimeInterval: "1m", + }, + } + + created, err := client.NewDataSource(ds) + if err != nil { + t.Error(err) + } + + t.Log(pretty.PrettyFormat(created)) + + if created != 1 { + t.Error("datasource creation response should return the created datasource ID") + } +}