Skip to content

Commit

Permalink
Regenerate client from commit b7112c44 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jan 17, 2025
1 parent 043e25b commit 8f7d99b
Show file tree
Hide file tree
Showing 12 changed files with 381 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-15 18:03:15.756398",
"spec_repo_commit": "e54847a1"
"regenerated": "2025-01-17 11:27:48.638704",
"spec_repo_commit": "b7112c44"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2025-01-15 18:03:15.771610",
"spec_repo_commit": "e54847a1"
"regenerated": "2025-01-17 11:27:48.654278",
"spec_repo_commit": "b7112c44"
}
}
}
57 changes: 57 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6784,6 +6784,62 @@ components:
- FIREFOX_LAPTOP_LARGE
- FIREFOX_TABLET
- FIREFOX_MOBILE_SMALL
MonitorFormulaAndFunctionCostAggregator:
description: Aggregation methods for metric queries.
enum:
- avg
- sum
- max
- min
- last
- area
- l2norm
- percentile
- stddev
example: avg
type: string
x-enum-varnames:
- AVG
- SUM
- MAX
- MIN
- LAST
- AREA
- L2NORM
- PERCENTILE
- STDDEV
MonitorFormulaAndFunctionCostDataSource:
description: Data source for cost queries.
enum:
- metrics
- cloud_cost
- datadog_usage
example: cloud_cost
type: string
x-enum-varnames:
- METRICS
- CLOUD_COST
- DATADOG_USAGE
MonitorFormulaAndFunctionCostQueryDefinition:
description: A formula and functions cost query.
properties:
aggregator:
$ref: '#/components/schemas/MonitorFormulaAndFunctionCostAggregator'
data_source:
$ref: '#/components/schemas/MonitorFormulaAndFunctionCostDataSource'
name:
description: Name of the query for use in formulas.
example: query1
type: string
query:
description: The monitor query.
example: sum:all.cost{*}.rollup(sum, 86400)
type: string
required:
- name
- data_source
- query
type: object
MonitorFormulaAndFunctionEventAggregation:
description: Aggregation methods for event platform queries.
enum:
Expand Down Expand Up @@ -6934,6 +6990,7 @@ components:
description: A formula and function query.
oneOf:
- $ref: '#/components/schemas/MonitorFormulaAndFunctionEventQueryDefinition'
- $ref: '#/components/schemas/MonitorFormulaAndFunctionCostQueryDefinition'
MonitorGroupSearchResponse:
description: The response of a monitor group search.
example:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2025-01-17T11:21:26.452Z"
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"
}
}
44 changes: 44 additions & 0 deletions examples/v1/monitors/CreateMonitor_1303514967.ts
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));
7 changes: 7 additions & 0 deletions features/v1/monitors.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ Feature: Monitors
Then the response status is 200 OK
And the response "data.ok[0]" has the same value as "monitor.id"

@team:DataDog/monitor-app
Scenario: Create a Cost Monitor returns "OK" response
Given new "CreateMonitor" request
And body with value {"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": [{"data_source": "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"}], "include_tags": true}}
When the request is sent
Then the response status is 200 OK

@team:DataDog/monitor-app
Scenario: Create a RUM formula and functions monitor returns "OK" response
Given new "CreateMonitor" request
Expand Down
3 changes: 3 additions & 0 deletions packages/datadog-api-client-v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,9 @@ export { MetricsQueryResponse } from "./models/MetricsQueryResponse";
export { MetricsQueryUnit } from "./models/MetricsQueryUnit";
export { Monitor } from "./models/Monitor";
export { MonitorDeviceID } from "./models/MonitorDeviceID";
export { MonitorFormulaAndFunctionCostAggregator } from "./models/MonitorFormulaAndFunctionCostAggregator";
export { MonitorFormulaAndFunctionCostDataSource } from "./models/MonitorFormulaAndFunctionCostDataSource";
export { MonitorFormulaAndFunctionCostQueryDefinition } from "./models/MonitorFormulaAndFunctionCostQueryDefinition";
export { MonitorFormulaAndFunctionEventAggregation } from "./models/MonitorFormulaAndFunctionEventAggregation";
export { MonitorFormulaAndFunctionEventQueryDefinition } from "./models/MonitorFormulaAndFunctionEventQueryDefinition";
export { MonitorFormulaAndFunctionEventQueryDefinitionCompute } from "./models/MonitorFormulaAndFunctionEventQueryDefinitionCompute";
Expand Down
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";
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";
Loading

0 comments on commit 8f7d99b

Please sign in to comment.