-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
- Loading branch information
1 parent
0179b15
commit cf15a03
Showing
12 changed files
with
381 additions
and
4 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
1 change: 1 addition & 0 deletions
1
...s/v1/Monitors_4022238206/Create-a-Cost-Monitor-returns-OK-response_3620580695/frozen.json
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 @@ | ||
"2025-01-17T11:21:26.452Z" |
110 changes: 110 additions & 0 deletions
110
...v1/Monitors_4022238206/Create-a-Cost-Monitor-returns-OK-response_3620580695/recording.har
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,110 @@ | ||
{ | ||
"log": { | ||
"_recordingName": "Monitors/Create a Cost Monitor returns \"OK\" response", | ||
"creator": { | ||
"comment": "persister:fs", | ||
"name": "Polly.JS", | ||
"version": "6.0.5" | ||
}, | ||
"entries": [ | ||
{ | ||
"_id": "d16d3cd4da227a00e7aba69082fd390c", | ||
"_order": 0, | ||
"cache": {}, | ||
"request": { | ||
"bodySize": 557, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"_fromType": "array", | ||
"name": "accept", | ||
"value": "application/json" | ||
}, | ||
{ | ||
"_fromType": "array", | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 553, | ||
"httpVersion": "HTTP/1.1", | ||
"method": "POST", | ||
"postData": { | ||
"mimeType": "application/json", | ||
"params": [], | ||
"text": "{\"message\":\"some message Notify: @hipchat-channel\",\"name\":\"Example Monitor\",\"options\":{\"include_tags\":true,\"thresholds\":{\"critical\":5,\"warning\":3},\"variables\":[{\"aggregator\":\"sum\",\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)\"}]},\"priority\":3,\"query\":\"formula(\\\"exclude_null(query1)\\\").last(\\\"7d\\\").anomaly(direction=\\\"above\\\", threshold=10) >= 5\",\"tags\":[\"test:examplemonitor\",\"env:ci\"],\"type\":\"cost alert\"}" | ||
}, | ||
"queryString": [], | ||
"url": "https://api.datadoghq.com/api/v1/monitor" | ||
}, | ||
"response": { | ||
"bodySize": 1068, | ||
"content": { | ||
"mimeType": "application/json", | ||
"size": 1068, | ||
"text": "{\"id\":162921056,\"org_id\":321813,\"type\":\"cost alert\",\"name\":\"Example Monitor\",\"message\":\"some message Notify: @hipchat-channel\",\"tags\":[\"test:examplemonitor\",\"env:ci\"],\"query\":\"formula(\\\"exclude_null(query1)\\\").last(\\\"7d\\\").anomaly(direction=\\\"above\\\", threshold=10) >= 5\",\"options\":{\"include_tags\":true,\"thresholds\":{\"critical\":5.0,\"warning\":3.0},\"variables\":[{\"aggregator\":\"sum\",\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)\"}],\"notify_no_data\":false,\"notify_audit\":false,\"new_host_delay\":300,\"silenced\":{}},\"multi\":false,\"created_at\":1737112886000,\"created\":\"2025-01-17T11:21:26.560275+00:00\",\"modified\":\"2025-01-17T11:21:26.560275+00:00\",\"deleted\":null,\"priority\":3,\"restricted_roles\":null,\"restriction_policy\":null,\"overall_state_modified\":null,\"overall_state\":\"No Data\",\"creator\":{\"name\":\"CI Account\",\"handle\":\"9919ec9b-ebc7-49ee-8dc8-03626e717cca\",\"email\":\"team-intg-tools-libs-spam@datadoghq.com\",\"id\":2320499}}\n" | ||
}, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 649, | ||
"httpVersion": "HTTP/1.1", | ||
"redirectURL": "", | ||
"status": 200, | ||
"statusText": "OK" | ||
}, | ||
"startedDateTime": "2025-01-17T11:21:26.460Z", | ||
"time": 154 | ||
}, | ||
{ | ||
"_id": "ecb89ccc0ef8ed62f948ecbbf3ec4982", | ||
"_order": 0, | ||
"cache": {}, | ||
"request": { | ||
"bodySize": 0, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"_fromType": "array", | ||
"name": "accept", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 514, | ||
"httpVersion": "HTTP/1.1", | ||
"method": "DELETE", | ||
"queryString": [], | ||
"url": "https://api.datadoghq.com/api/v1/monitor/162921056" | ||
}, | ||
"response": { | ||
"bodySize": 33, | ||
"content": { | ||
"mimeType": "application/json", | ||
"size": 33, | ||
"text": "{\"deleted_monitor_id\":162921056}\n" | ||
}, | ||
"cookies": [], | ||
"headers": [ | ||
{ | ||
"name": "content-type", | ||
"value": "application/json" | ||
} | ||
], | ||
"headersSize": 516, | ||
"httpVersion": "HTTP/1.1", | ||
"redirectURL": "", | ||
"status": 200, | ||
"statusText": "OK" | ||
}, | ||
"startedDateTime": "2025-01-17T11:21:26.621Z", | ||
"time": 211 | ||
} | ||
], | ||
"pages": [], | ||
"version": "1.2" | ||
} | ||
} |
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,44 @@ | ||
/** | ||
* Create a Cost Monitor returns "OK" response | ||
*/ | ||
|
||
import { client, v1 } from "@datadog/datadog-api-client"; | ||
|
||
const configuration = client.createConfiguration(); | ||
const apiInstance = new v1.MonitorsApi(configuration); | ||
|
||
const params: v1.MonitorsApiCreateMonitorRequest = { | ||
body: { | ||
name: "Example Monitor", | ||
type: "cost alert", | ||
query: `formula("exclude_null(query1)").last("7d").anomaly(direction="above", threshold=10) >= 5`, | ||
message: "some message Notify: @hipchat-channel", | ||
tags: ["test:examplemonitor", "env:ci"], | ||
priority: 3, | ||
options: { | ||
thresholds: { | ||
critical: 5, | ||
warning: 3, | ||
}, | ||
variables: [ | ||
{ | ||
dataSource: "cloud_cost", | ||
query: | ||
"sum:aws.cost.net.amortized.shared.resources.allocated{aws_product IN (amplify ,athena, backup, bedrock ) } by {aws_product}.rollup(sum, 86400)", | ||
name: "query1", | ||
aggregator: "sum", | ||
}, | ||
], | ||
includeTags: true, | ||
}, | ||
}, | ||
}; | ||
|
||
apiInstance | ||
.createMonitor(params) | ||
.then((data: v1.Monitor) => { | ||
console.log( | ||
"API called successfully. Returned data: " + JSON.stringify(data) | ||
); | ||
}) | ||
.catch((error: any) => console.error(error)); |
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
32 changes: 32 additions & 0 deletions
32
packages/datadog-api-client-v1/models/MonitorFormulaAndFunctionCostAggregator.ts
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,32 @@ | ||
/** | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2020-Present Datadog, Inc. | ||
*/ | ||
|
||
import { UnparsedObject } from "../../datadog-api-client-common/util"; | ||
|
||
/** | ||
* Aggregation methods for metric queries. | ||
*/ | ||
|
||
export type MonitorFormulaAndFunctionCostAggregator = | ||
| typeof AVG | ||
| typeof SUM | ||
| typeof MAX | ||
| typeof MIN | ||
| typeof LAST | ||
| typeof AREA | ||
| typeof L2NORM | ||
| typeof PERCENTILE | ||
| typeof STDDEV | ||
| UnparsedObject; | ||
export const AVG = "avg"; | ||
export const SUM = "sum"; | ||
export const MAX = "max"; | ||
export const MIN = "min"; | ||
export const LAST = "last"; | ||
export const AREA = "area"; | ||
export const L2NORM = "l2norm"; | ||
export const PERCENTILE = "percentile"; | ||
export const STDDEV = "stddev"; |
20 changes: 20 additions & 0 deletions
20
packages/datadog-api-client-v1/models/MonitorFormulaAndFunctionCostDataSource.ts
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,20 @@ | ||
/** | ||
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. | ||
* This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
* Copyright 2020-Present Datadog, Inc. | ||
*/ | ||
|
||
import { UnparsedObject } from "../../datadog-api-client-common/util"; | ||
|
||
/** | ||
* Data source for cost queries. | ||
*/ | ||
|
||
export type MonitorFormulaAndFunctionCostDataSource = | ||
| typeof METRICS | ||
| typeof CLOUD_COST | ||
| typeof DATADOG_USAGE | ||
| UnparsedObject; | ||
export const METRICS = "metrics"; | ||
export const CLOUD_COST = "cloud_cost"; | ||
export const DATADOG_USAGE = "datadog_usage"; |
Oops, something went wrong.