Skip to content

Commit

Permalink
Regenerate client from commit 824086bb of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jul 11, 2023
1 parent dfb657f commit e104c11
Show file tree
Hide file tree
Showing 11 changed files with 313 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.5",
"regenerated": "2023-07-11 14:36:39.086601",
"spec_repo_commit": "7ca677d6"
"regenerated": "2023-07-11 16:39:40.978975",
"spec_repo_commit": "824086bb"
},
"v2": {
"apigentools_version": "1.6.5",
"regenerated": "2023-07-11 14:36:39.100169",
"spec_repo_commit": "7ca677d6"
"regenerated": "2023-07-11 16:39:40.997312",
"spec_repo_commit": "824086bb"
}
}
}
33 changes: 33 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,38 @@ components:
- service
- stat
type: object
FormulaAndFunctionCloudCostDataSource:
description: Data source for Cloud Cost queries.
enum:
- cloud_cost
example: cloud_cost
type: string
x-enum-varnames:
- CLOUD_COST
FormulaAndFunctionCloudCostQueryDefinition:
description: A formula and functions Cloud Cost query.
example:
data_source: cloud_cost
name: query1
query: sum:aws.cost.amortized{*}
properties:
aggregator:
$ref: '#/components/schemas/WidgetAggregator'
data_source:
$ref: '#/components/schemas/FormulaAndFunctionCloudCostDataSource'
name:
description: Name of the query for use in formulas.
example: my_query
type: string
query:
description: Query for Cloud Cost data.
example: ''
type: string
required:
- data_source
- query
- name
type: object
FormulaAndFunctionEventAggregation:
description: Aggregation methods for event platform queries.
enum:
Expand Down Expand Up @@ -2729,6 +2761,7 @@ components:
- $ref: '#/components/schemas/FormulaAndFunctionApmDependencyStatsQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionApmResourceStatsQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionSLOQueryDefinition'
- $ref: '#/components/schemas/FormulaAndFunctionCloudCostQueryDefinition'
type: object
FormulaAndFunctionResponseFormat:
description: Timeseries, scalar, or event list response. Event list response
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"2023-07-11T14:32:45.409Z"
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"log": {
"_recordingName": "Dashboards/Create a new dashboard with a timeseries widget using formulas and functions cloud cost query",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "6.0.5"
},
"entries": [
{
"_id": "21554e3cbbf51a3f13fd398b7622a007",
"_order": 0,
"cache": {},
"request": {
"bodySize": 577,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
},
{
"_fromType": "array",
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 558,
"httpVersion": "HTTP/1.1",
"method": "POST",
"postData": {
"mimeType": "application/json",
"params": [],
"text": "{\"layout_type\":\"ordered\",\"title\":\"Test-Create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query-1689085965\",\"widgets\":[{\"definition\":{\"requests\":[{\"display_type\":\"bars\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)\"}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"}}]}"
},
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard"
},
"response": {
"bodySize": 988,
"content": {
"mimeType": "application/json",
"size": 988,
"text": "{\"id\":\"kka-2iz-3jf\",\"title\":\"Test-Create_a_new_dashboard_with_a_timeseries_widget_using_formulas_and_functions_cloud_cost_query-1689085965\",\"description\":null,\"author_handle\":\"[email protected]\",\"author_name\":null,\"layout_type\":\"ordered\",\"url\":\"/dashboard/kka-2iz-3jf/test-createanewdashboardwithatimeserieswidgetusingformulasandfunctionscloudcostq\",\"is_read_only\":false,\"template_variables\":null,\"widgets\":[{\"definition\":{\"requests\":[{\"display_type\":\"bars\",\"formulas\":[{\"formula\":\"query1\"}],\"queries\":[{\"data_source\":\"cloud_cost\",\"name\":\"query1\",\"query\":\"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)\"}],\"response_format\":\"timeseries\",\"style\":{\"line_type\":\"solid\",\"line_width\":\"normal\",\"palette\":\"dog_classic\"}}],\"title\":\"Example Cloud Cost Query\",\"title_align\":\"left\",\"title_size\":\"16\",\"type\":\"timeseries\"},\"id\":1004255439340}],\"notify_list\":null,\"created_at\":\"2023-07-11T14:32:45.564617+00:00\",\"modified_at\":\"2023-07-11T14:32:45.564617+00:00\",\"restricted_roles\":[]}\n"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 517,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2023-07-11T14:32:45.418Z",
"time": 219
},
{
"_id": "7c80e62c382149b2a53afcb41ec2fea8",
"_order": 0,
"cache": {},
"request": {
"bodySize": 0,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/json"
}
],
"headersSize": 519,
"httpVersion": "HTTP/1.1",
"method": "DELETE",
"queryString": [],
"url": "https://api.datadoghq.com/api/v1/dashboard/kka-2iz-3jf"
},
"response": {
"bodySize": 39,
"content": {
"mimeType": "application/json",
"size": 39,
"text": "{\"deleted_dashboard_id\":\"kka-2iz-3jf\"}\n"
},
"cookies": [],
"headers": [
{
"name": "content-type",
"value": "application/json"
}
],
"headersSize": 516,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2023-07-11T14:32:45.648Z",
"time": 186
}
],
"pages": [],
"version": "1.2"
}
}
58 changes: 58 additions & 0 deletions examples/v1/dashboards/CreateDashboard_1284514532.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Create a new dashboard with a timeseries widget using formulas and functions cloud cost query
*/

import { client, v1 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v1.DashboardsApi(configuration);

const params: v1.DashboardsApiCreateDashboardRequest = {
body: {
title: "Example-Dashboard",
widgets: [
{
definition: {
title: "Example Cloud Cost Query",
titleSize: "16",
titleAlign: "left",
type: "timeseries",
requests: [
{
formulas: [
{
formula: "query1",
},
],
queries: [
{
dataSource: "cloud_cost",
name: "query1",
query:
"sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)",
},
],
responseFormat: "timeseries",
style: {
palette: "dog_classic",
lineType: "solid",
lineWidth: "normal",
},
displayType: "bars",
},
],
},
},
],
layoutType: "ordered",
},
};

apiInstance
.createDashboard(params)
.then((data: v1.Dashboard) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
12 changes: 12 additions & 0 deletions features/v1/dashboards.feature
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ Feature: Dashboards
And the response "widgets[0].definition.requests[0].response_format" is equal to "scalar"
And the response "widgets[0].definition.requests[0].queries[0].query" is equal to "sum:my.cool.count.metric{*}"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with a timeseries widget using formulas and functions cloud cost query
Given new "CreateDashboard" request
And body with value { "title": "{{ unique }}", "widgets": [ { "definition": { "title": "Example Cloud Cost Query", "title_size": "16", "title_align": "left", "type": "timeseries", "requests": [ { "formulas": [ { "formula": "query1" } ], "queries": [ { "data_source": "cloud_cost", "name": "query1", "query": "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)" } ], "response_format": "timeseries", "style": { "palette": "dog_classic", "line_type": "solid", "line_width": "normal" }, "display_type": "bars" } ] } } ], "layout_type": "ordered" }
When the request is sent
Then the response status is 200 OK
And the response "widgets[0].definition.requests[0].response_format" is equal to "timeseries"
And the response "widgets[0].definition.requests[0].queries[0].data_source" is equal to "cloud_cost"
And the response "widgets[0].definition.requests[0].queries[0].name" is equal to "query1"
And the response "widgets[0].definition.requests[0].queries[0].query" is equal to "sum:aws.cost.amortized{*} by {aws_product}.rollup(sum, monthly)"
And the response "widgets[0].definition.requests[0].formulas[0].formula" is equal to "query1"

@team:DataDog/dashboards-backend
Scenario: Create a new dashboard with alert_graph widget
Given there is a valid "monitor" in the system
Expand Down
2 changes: 2 additions & 0 deletions packages/datadog-api-client-v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ export { FormulaAndFunctionApmDependencyStatsQueryDefinition } from "./models/Fo
export { FormulaAndFunctionApmResourceStatName } from "./models/FormulaAndFunctionApmResourceStatName";
export { FormulaAndFunctionApmResourceStatsDataSource } from "./models/FormulaAndFunctionApmResourceStatsDataSource";
export { FormulaAndFunctionApmResourceStatsQueryDefinition } from "./models/FormulaAndFunctionApmResourceStatsQueryDefinition";
export { FormulaAndFunctionCloudCostDataSource } from "./models/FormulaAndFunctionCloudCostDataSource";
export { FormulaAndFunctionCloudCostQueryDefinition } from "./models/FormulaAndFunctionCloudCostQueryDefinition";
export { FormulaAndFunctionEventAggregation } from "./models/FormulaAndFunctionEventAggregation";
export { FormulaAndFunctionEventQueryDefinition } from "./models/FormulaAndFunctionEventQueryDefinition";
export { FormulaAndFunctionEventQueryDefinitionCompute } from "./models/FormulaAndFunctionEventQueryDefinitionCompute";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* 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 Cloud Cost queries.
*/

export type FormulaAndFunctionCloudCostDataSource =
| typeof CLOUD_COST
| UnparsedObject;
export const CLOUD_COST = "cloud_cost";
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* 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 { FormulaAndFunctionCloudCostDataSource } from "./FormulaAndFunctionCloudCostDataSource";
import { WidgetAggregator } from "./WidgetAggregator";

import { AttributeTypeMap } from "../../datadog-api-client-common/util";

/**
* A formula and functions Cloud Cost query.
*/
export class FormulaAndFunctionCloudCostQueryDefinition {
/**
* Aggregator used for the request.
*/
"aggregator"?: WidgetAggregator;
/**
* Data source for Cloud Cost queries.
*/
"dataSource": FormulaAndFunctionCloudCostDataSource;
/**
* Name of the query for use in formulas.
*/
"name": string;
/**
* Query for Cloud Cost data.
*/
"query": string;

/**
* @ignore
*/
"_unparsed"?: boolean;

/**
* @ignore
*/
static readonly attributeTypeMap: AttributeTypeMap = {
aggregator: {
baseName: "aggregator",
type: "WidgetAggregator",
},
dataSource: {
baseName: "data_source",
type: "FormulaAndFunctionCloudCostDataSource",
required: true,
},
name: {
baseName: "name",
type: "string",
required: true,
},
query: {
baseName: "query",
type: "string",
required: true,
},
};

/**
* @ignore
*/
static getAttributeTypeMap(): AttributeTypeMap {
return FormulaAndFunctionCloudCostQueryDefinition.attributeTypeMap;
}

public constructor() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
import { FormulaAndFunctionApmDependencyStatsQueryDefinition } from "./FormulaAndFunctionApmDependencyStatsQueryDefinition";
import { FormulaAndFunctionApmResourceStatsQueryDefinition } from "./FormulaAndFunctionApmResourceStatsQueryDefinition";
import { FormulaAndFunctionCloudCostQueryDefinition } from "./FormulaAndFunctionCloudCostQueryDefinition";
import { FormulaAndFunctionEventQueryDefinition } from "./FormulaAndFunctionEventQueryDefinition";
import { FormulaAndFunctionMetricQueryDefinition } from "./FormulaAndFunctionMetricQueryDefinition";
import { FormulaAndFunctionProcessQueryDefinition } from "./FormulaAndFunctionProcessQueryDefinition";
Expand All @@ -23,4 +24,5 @@ export type FormulaAndFunctionQueryDefinition =
| FormulaAndFunctionApmDependencyStatsQueryDefinition
| FormulaAndFunctionApmResourceStatsQueryDefinition
| FormulaAndFunctionSLOQueryDefinition
| FormulaAndFunctionCloudCostQueryDefinition
| UnparsedObject;
Loading

0 comments on commit e104c11

Please sign in to comment.