-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Regenerate client from commit 1bea0809 of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Apr 5, 2022
1 parent
1f9ca27
commit 47f1acb
Showing
14 changed files
with
446 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Validate an existing monitor returns "OK" response | ||
|
||
package main | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"os" | ||
"strconv" | ||
|
||
datadog "github.com/DataDog/datadog-api-client-go/api/v1/datadog" | ||
) | ||
|
||
func main() { | ||
// there is a valid "monitor" in the system | ||
MonitorID, _ := strconv.ParseInt(os.Getenv("MONITOR_ID"), 10, 64) | ||
|
||
body := datadog.Monitor{ | ||
Name: datadog.PtrString("Example-Validate_an_existing_monitor_returns_OK_response"), | ||
Type: datadog.MONITORTYPE_LOG_ALERT, | ||
Query: `logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2`, | ||
Message: datadog.PtrString("some message Notify: @hipchat-channel"), | ||
Tags: &[]string{ | ||
"test:examplevalidateanexistingmonitorreturnsokresponse", | ||
"env:ci", | ||
}, | ||
Priority: *datadog.NewNullableInt64(datadog.PtrInt64(3)), | ||
Options: &datadog.MonitorOptions{ | ||
EnableLogsSample: datadog.PtrBool(true), | ||
EscalationMessage: datadog.PtrString("the situation has escalated"), | ||
EvaluationDelay: *datadog.NewNullableInt64(datadog.PtrInt64(700)), | ||
GroupbySimpleMonitor: datadog.PtrBool(true), | ||
IncludeTags: datadog.PtrBool(true), | ||
Locked: datadog.PtrBool(false), | ||
NewHostDelay: *datadog.NewNullableInt64(datadog.PtrInt64(600)), | ||
NoDataTimeframe: *datadog.NewNullableInt64(nil), | ||
NotifyAudit: datadog.PtrBool(false), | ||
NotifyNoData: datadog.PtrBool(false), | ||
RenotifyInterval: *datadog.NewNullableInt64(datadog.PtrInt64(60)), | ||
RequireFullWindow: datadog.PtrBool(true), | ||
TimeoutH: *datadog.NewNullableInt64(datadog.PtrInt64(24)), | ||
Thresholds: &datadog.MonitorThresholds{ | ||
Critical: datadog.PtrFloat64(2), | ||
Warning: *datadog.NewNullableFloat64(datadog.PtrFloat64(1)), | ||
}, | ||
}, | ||
} | ||
ctx := datadog.NewDefaultContext(context.Background()) | ||
configuration := datadog.NewConfiguration() | ||
apiClient := datadog.NewAPIClient(configuration) | ||
resp, r, err := apiClient.MonitorsApi.ValidateExistingMonitor(ctx, MonitorID, body) | ||
|
||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "Error when calling `MonitorsApi.ValidateExistingMonitor`: %v\n", err) | ||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) | ||
} | ||
|
||
responseContent, _ := json.MarshalIndent(resp, "", " ") | ||
fmt.Fprintf(os.Stdout, "Response from `MonitorsApi.ValidateExistingMonitor`:\n%s\n", responseContent) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ature_Monitors/Scenario_Validate_an_existing_monitor_returns_Invalid_JSON_response.freeze
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2022-04-04T09:34:37.709Z |
Oops, something went wrong.