Skip to content

Commit

Permalink
Merge pull request #243 from DataDog/gabin/synthetics/add-monitor-id
Browse files Browse the repository at this point in the history
Add monitor_id in Synthetics test config
  • Loading branch information
Slavek Kabrda authored Jun 3, 2019
2 parents d479e19 + 16add28 commit e55ea7f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
31 changes: 31 additions & 0 deletions datadog-accessors.go
Original file line number Diff line number Diff line change
Expand Up @@ -14739,6 +14739,37 @@ func (s *SyntheticsTest) SetModifiedBy(v SyntheticsUser) {
s.ModifiedBy = &v
}

// GetMonitorId returns the MonitorId field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetMonitorId() int {
if s == nil || s.MonitorId == nil {
return 0
}
return *s.MonitorId
}

// GetMonitorIdOk returns a tuple with the MonitorId field if it's non-nil, zero value otherwise
// and a boolean to check if the value has been set.
func (s *SyntheticsTest) GetMonitorIdOk() (int, bool) {
if s == nil || s.MonitorId == nil {
return 0, false
}
return *s.MonitorId, true
}

// HasMonitorId returns a boolean if a field has been set.
func (s *SyntheticsTest) HasMonitorId() bool {
if s != nil && s.MonitorId != nil {
return true
}

return false
}

// SetMonitorId allocates a new s.MonitorId and returns the pointer to it.
func (s *SyntheticsTest) SetMonitorId(v int) {
s.MonitorId = &v
}

// GetMonitorStatus returns the MonitorStatus field if non-nil, zero value otherwise.
func (s *SyntheticsTest) GetMonitorStatus() string {
if s == nil || s.MonitorStatus == nil {
Expand Down
1 change: 1 addition & 0 deletions synthetics.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
// SyntheticsTest represents a synthetics test, either api or browser
type SyntheticsTest struct {
PublicId *string `json:"public_id,omitempty"`
MonitorId *int `json:"monitor_id,omitempty"`
Name *string `json:"name,omitempty"`
Type *string `json:"type,omitempty"`
Tags []string `json:"tags"`
Expand Down
10 changes: 10 additions & 0 deletions synthetics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ func TestGetSyntheticsTestApi(t *testing.T) {
t.Fatalf("expect public_id %s. Got %s", expectedPublicId, publicId)
}

expectedMonitorId := 666
if monitorId := c.GetMonitorId(); monitorId != expectedMonitorId {
t.Fatalf("expect monitor_id %d. Got %d", expectedMonitorId, monitorId)
}

expectedName := "Check on example.com"
if name := c.GetName(); name != expectedName {
t.Fatalf("expect name %s. Got %s", expectedName, name)
Expand Down Expand Up @@ -193,6 +198,11 @@ func TestGetSyntheticsTestBrowser(t *testing.T) {
t.Fatalf("expect public_id %s. Got %s", expectedPublicId, publicId)
}

expectedMonitorId := 666
if monitorId := c.GetMonitorId(); monitorId != expectedMonitorId {
t.Fatalf("expect monitor_id %d. Got %d", expectedMonitorId, monitorId)
}

expectedName := "Check on example.com"
if name := c.GetName(); name != expectedName {
t.Fatalf("expect name %s. Got %s", expectedName, name)
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/synthetics/tests/get_test_api.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"public_id": "xxx-xxx-xxx",
"monitor_id": 666,
"tags": [
"example_tag"
],
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/synthetics/tests/get_test_browser.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"public_id": "xxx-xxx-xxx",
"monitor_id": 666,
"tags": [
"example_tag"
],
Expand Down

0 comments on commit e55ea7f

Please sign in to comment.