-
Notifications
You must be signed in to change notification settings - Fork 32
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 57b75ade of spec repo
- Loading branch information
ci.datadog-api-spec
committed
Aug 17, 2022
1 parent
23773af
commit 0266432
Showing
41 changed files
with
459 additions
and
115 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Validate a multi-alert monitor returns "OK" response | ||
|
||
import com.datadog.api.client.ApiClient; | ||
import com.datadog.api.client.ApiException; | ||
import com.datadog.api.client.v1.api.MonitorsApi; | ||
import com.datadog.api.client.v1.model.Monitor; | ||
import com.datadog.api.client.v1.model.MonitorOptions; | ||
import com.datadog.api.client.v1.model.MonitorThresholds; | ||
import com.datadog.api.client.v1.model.MonitorType; | ||
import com.datadog.api.client.v1.model.OnMissingDataOption; | ||
import java.util.Arrays; | ||
|
||
public class Example { | ||
public static void main(String[] args) { | ||
ApiClient defaultClient = ApiClient.getDefaultApiClient(); | ||
MonitorsApi apiInstance = new MonitorsApi(defaultClient); | ||
|
||
Monitor body = | ||
new Monitor() | ||
.name("Example-Validate_a_multi_alert_monitor_returns_OK_response") | ||
.type(MonitorType.LOG_ALERT) | ||
.query( | ||
""" | ||
logs("service:foo AND type:error").index("main").rollup("count").by("source").last("5m") > 2 | ||
""") | ||
.message("some message Notify: @hipchat-channel") | ||
.tags( | ||
Arrays.asList("test:examplevalidateamultialertmonitorreturnsokresponse", "env:ci")) | ||
.priority(3L) | ||
.options( | ||
new MonitorOptions() | ||
.enableLogsSample(true) | ||
.escalationMessage("the situation has escalated") | ||
.evaluationDelay(700L) | ||
.groupRetentionDuration("2d") | ||
.groupbySimpleMonitor(false) | ||
.includeTags(true) | ||
.locked(false) | ||
.newHostDelay(600L) | ||
.noDataTimeframe(null) | ||
.notifyAudit(false) | ||
.notifyNoData(false) | ||
.onMissingData(OnMissingDataOption.SHOW_AND_NOTIFY_NO_DATA) | ||
.renotifyInterval(60L) | ||
.requireFullWindow(true) | ||
.timeoutH(24L) | ||
.thresholds(new MonitorThresholds().critical(2.0).warning(1.0))); | ||
|
||
try { | ||
apiInstance.validateMonitor(body); | ||
} catch (ApiException e) { | ||
System.err.println("Exception when calling MonitorsApi#validateMonitor"); | ||
System.err.println("Status code: " + e.getCode()); | ||
System.err.println("Reason: " + e.getResponseBody()); | ||
System.err.println("Response headers: " + e.getResponseHeaders()); | ||
e.printStackTrace(); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.