Skip to content

Commit ff26633

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 925bdeb of spec repo
1 parent e2642e4 commit ff26633

File tree

11 files changed

+243
-1
lines changed

11 files changed

+243
-1
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7255,6 +7255,13 @@ components:
72557255
Monitor:
72567256
description: Object describing a monitor.
72577257
properties:
7258+
assets:
7259+
description: The list of monitor assets tied to a monitor which represents
7260+
key links for users to help take actions on monitor alerts (for example,
7261+
runbooks)
7262+
items:
7263+
$ref: '#/components/schemas/MonitorAsset'
7264+
type: array
72587265
created:
72597266
description: Timestamp of the monitor creation.
72607267
format: date-time
@@ -7338,6 +7345,64 @@ components:
73387345
- type
73397346
- query
73407347
type: object
7348+
MonitorAsset:
7349+
description: 'Represents key links tied to a monitor to help users take action
7350+
on alerts (Runbooks, Dashboards, Workflows)
7351+
7352+
This feature is in Preview and only available to users with the feature enabled.'
7353+
properties:
7354+
category:
7355+
$ref: '#/components/schemas/MonitorAssetCategory'
7356+
name:
7357+
description: Name for the monitor asset
7358+
example: Monitor Runbook
7359+
type: string
7360+
options:
7361+
description: Additional options that you can set on a monitor asset.
7362+
example:
7363+
hide_in_monitor_message: true
7364+
type: object
7365+
resource_key:
7366+
description: Represents the identifier of the internal datadog resource
7367+
that this asset represents. IDs in this field should be passed in as strings.
7368+
example: '12345'
7369+
type: string
7370+
resource_type:
7371+
$ref: '#/components/schemas/MonitorAssetResourceType'
7372+
template_variables:
7373+
description: Allows you to parameterize the url for the monitor asset.
7374+
example:
7375+
env: prod
7376+
region: us-east-1
7377+
type: object
7378+
url:
7379+
description: Url link for the asset
7380+
example: https://app.datadoghq.com
7381+
type: string
7382+
required:
7383+
- name
7384+
- url
7385+
- category
7386+
type: object
7387+
MonitorAssetCategory:
7388+
description: Indicates the type of asset this entity represents on a monitor
7389+
enum:
7390+
- dashboard
7391+
- workflow
7392+
- runbook
7393+
example: dashboard
7394+
type: string
7395+
x-enum-varnames:
7396+
- DASHBOARD
7397+
- WORKFLOW
7398+
- RUNBOOK
7399+
MonitorAssetResourceType:
7400+
description: Type of internal datadog resource associated with a monitor asset
7401+
enum:
7402+
- notebook
7403+
type: string
7404+
x-enum-varnames:
7405+
- NOTEBOOK
73417406
MonitorDeviceID:
73427407
description: ID of the device the Synthetics monitor is running on. Same as
73437408
`SyntheticsDeviceID`.
@@ -8452,6 +8517,14 @@ components:
84528517
MonitorUpdateRequest:
84538518
description: Object describing a monitor update request.
84548519
properties:
8520+
assets:
8521+
description: The list of monitor assets tied to a monitor, which represents
8522+
key links for users to help take actions on monitor alerts (for example,
8523+
runbooks)
8524+
items:
8525+
$ref: '#/components/schemas/MonitorAsset'
8526+
nullable: true
8527+
type: array
84558528
created:
84568529
description: Timestamp of the monitor creation.
84578530
format: date-time
@@ -31529,6 +31602,13 @@ paths:
3152931602
required: false
3153031603
schema:
3153131604
type: boolean
31605+
- description: If this argument is set to `true`, then the returned data includes
31606+
all assets tied to this monitor.
31607+
in: query
31608+
name: with_assets
31609+
required: false
31610+
schema:
31611+
type: boolean
3153231612
responses:
3153331613
'200':
3153431614
content:

features/v1/monitors.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Feature: Monitors
169169
Scenario: Edit a monitor returns "Bad Request" response
170170
Given new "UpdateMonitor" request
171171
And request contains "monitor_id" parameter from "REPLACE.ME"
172-
And body with value {"draft_status": "published", "options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"}
172+
And body with value {"assets": [{"category": "dashboard", "name": "Monitor Runbook", "options": {"hide_in_monitor_message": true}, "resource_key": "12345", "resource_type": "notebook", "template_variables": {"env": "prod", "region": "us-east-1"}, "url": "https://app.datadoghq.com"}], "draft_status": "published", "options": {"evaluation_delay": null, "include_tags": true, "min_failure_duration": 0, "min_location_failed": 1, "new_group_delay": null, "new_host_delay": 300, "no_data_timeframe": null, "notification_preset_name": "show_all", "notify_audit": false, "notify_by": [], "on_missing_data": "default", "renotify_interval": null, "renotify_occurrences": null, "renotify_statuses": ["alert"], "scheduling_options": {"custom_schedule": {"recurrences": [{"rrule": "FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR", "start": "2023-08-31T16:30:00", "timezone": "Europe/Paris"}]}, "evaluation_window": {"day_starts": "04:00", "hour_starts": 0, "month_starts": 1, "timezone": "Europe/Paris"}}, "synthetics_check_id": null, "threshold_windows": {"recovery_window": null, "trigger_window": null}, "thresholds": {"critical_recovery": null, "ok": null, "unknown": null, "warning": null, "warning_recovery": null}, "timeout_h": null, "variables": [{"compute": {"aggregation": "avg", "interval": 60000, "metric": "@duration"}, "data_source": "rum", "group_by": [{"facet": "status", "limit": 10, "sort": {"aggregation": "avg", "order": "desc"}}], "indexes": ["days-3", "days-7"], "name": "query_errors", "search": {"query": "service:query"}}]}, "priority": null, "restricted_roles": [], "tags": [], "type": "query alert"}
173173
When the request is sent
174174
Then the response status is 400 Bad Request
175175

private/bdd_runner/src/support/scenarios_model_mapping.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1581,6 +1581,10 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
15811581
type: "boolean",
15821582
format: "",
15831583
},
1584+
withAssets: {
1585+
type: "boolean",
1586+
format: "",
1587+
},
15841588
operationResponseType: "Monitor",
15851589
},
15861590
"MonitorsApi.V1.UpdateMonitor": {

services/monitors/src/v1/MonitorsApi.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
201201
monitorId: number,
202202
groupStates?: string,
203203
withDowntimes?: boolean,
204+
withAssets?: boolean,
204205
_options?: Configuration,
205206
): Promise<RequestContext> {
206207
const _config = _options || this.configuration;
@@ -249,6 +250,13 @@ export class MonitorsApiRequestFactory extends BaseAPIRequestFactory {
249250
"",
250251
);
251252
}
253+
if (withAssets !== undefined) {
254+
requestContext.setQueryParam(
255+
"with_assets",
256+
serialize(withAssets, TypingInfo, "boolean", ""),
257+
"",
258+
);
259+
}
252260

253261
// Apply auth methods
254262
applySecurityAuthentication(_config, requestContext, [
@@ -1318,6 +1326,11 @@ export interface MonitorsApiGetMonitorRequest {
13181326
* @type boolean
13191327
*/
13201328
withDowntimes?: boolean;
1329+
/**
1330+
* If this argument is set to `true`, then the returned data includes all assets tied to this monitor.
1331+
* @type boolean
1332+
*/
1333+
withAssets?: boolean;
13211334
}
13221335

13231336
export interface MonitorsApiListMonitorsRequest {
@@ -1779,6 +1792,7 @@ export class MonitorsApi {
17791792
param.monitorId,
17801793
param.groupStates,
17811794
param.withDowntimes,
1795+
param.withAssets,
17821796
options,
17831797
);
17841798
return requestContextPromise.then((requestContext) => {

services/monitors/src/v1/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ export { Creator } from "./models/Creator";
1919
export { DeletedMonitor } from "./models/DeletedMonitor";
2020
export { MatchingDowntime } from "./models/MatchingDowntime";
2121
export { Monitor } from "./models/Monitor";
22+
export { MonitorAsset } from "./models/MonitorAsset";
23+
export { MonitorAssetCategory } from "./models/MonitorAssetCategory";
24+
export { MonitorAssetResourceType } from "./models/MonitorAssetResourceType";
2225
export { MonitorDeviceID } from "./models/MonitorDeviceID";
2326
export { MonitorDraftStatus } from "./models/MonitorDraftStatus";
2427
export { MonitorFormulaAndFunctionCostAggregator } from "./models/MonitorFormulaAndFunctionCostAggregator";

services/monitors/src/v1/models/Monitor.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { AttributeTypeMap } from "@datadog/datadog-api-client";
22

33
import { Creator } from "./Creator";
44
import { MatchingDowntime } from "./MatchingDowntime";
5+
import { MonitorAsset } from "./MonitorAsset";
56
import { MonitorDraftStatus } from "./MonitorDraftStatus";
67
import { MonitorOptions } from "./MonitorOptions";
78
import { MonitorOverallStates } from "./MonitorOverallStates";
@@ -12,6 +13,10 @@ import { MonitorType } from "./MonitorType";
1213
* Object describing a monitor.
1314
*/
1415
export class Monitor {
16+
/**
17+
* The list of monitor assets tied to a monitor which represents key links for users to help take actions on monitor alerts (for example, runbooks)
18+
*/
19+
"assets"?: Array<MonitorAsset>;
1520
/**
1621
* Timestamp of the monitor creation.
1722
*/
@@ -104,6 +109,10 @@ export class Monitor {
104109
* @ignore
105110
*/
106111
static readonly attributeTypeMap: AttributeTypeMap = {
112+
assets: {
113+
baseName: "assets",
114+
type: "Array<MonitorAsset>",
115+
},
107116
created: {
108117
baseName: "created",
109118
type: "Date",
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import { AttributeTypeMap } from "@datadog/datadog-api-client";
2+
3+
import { MonitorAssetCategory } from "./MonitorAssetCategory";
4+
import { MonitorAssetResourceType } from "./MonitorAssetResourceType";
5+
6+
/**
7+
* Represents key links tied to a monitor to help users take action on alerts (Runbooks, Dashboards, Workflows)
8+
* This feature is in Preview and only available to users with the feature enabled.
9+
*/
10+
export class MonitorAsset {
11+
/**
12+
* Indicates the type of asset this entity represents on a monitor
13+
*/
14+
"category": MonitorAssetCategory;
15+
/**
16+
* Name for the monitor asset
17+
*/
18+
"name": string;
19+
/**
20+
* Additional options that you can set on a monitor asset.
21+
*/
22+
"options"?: any;
23+
/**
24+
* Represents the identifier of the internal datadog resource that this asset represents. IDs in this field should be passed in as strings.
25+
*/
26+
"resourceKey"?: string;
27+
/**
28+
* Type of internal datadog resource associated with a monitor asset
29+
*/
30+
"resourceType"?: MonitorAssetResourceType;
31+
/**
32+
* Allows you to parameterize the url for the monitor asset.
33+
*/
34+
"templateVariables"?: any;
35+
/**
36+
* Url link for the asset
37+
*/
38+
"url": string;
39+
/**
40+
* A container for additional, undeclared properties.
41+
* This is a holder for any undeclared properties as specified with
42+
* the 'additionalProperties' keyword in the OAS document.
43+
*/
44+
"additionalProperties"?: { [key: string]: any };
45+
/**
46+
* @ignore
47+
*/
48+
"_unparsed"?: boolean;
49+
50+
/**
51+
* @ignore
52+
*/
53+
static readonly attributeTypeMap: AttributeTypeMap = {
54+
category: {
55+
baseName: "category",
56+
type: "MonitorAssetCategory",
57+
required: true,
58+
},
59+
name: {
60+
baseName: "name",
61+
type: "string",
62+
required: true,
63+
},
64+
options: {
65+
baseName: "options",
66+
type: "any",
67+
},
68+
resourceKey: {
69+
baseName: "resource_key",
70+
type: "string",
71+
},
72+
resourceType: {
73+
baseName: "resource_type",
74+
type: "MonitorAssetResourceType",
75+
},
76+
templateVariables: {
77+
baseName: "template_variables",
78+
type: "any",
79+
},
80+
url: {
81+
baseName: "url",
82+
type: "string",
83+
required: true,
84+
},
85+
additionalProperties: {
86+
baseName: "additionalProperties",
87+
type: "{ [key: string]: any; }",
88+
},
89+
};
90+
91+
/**
92+
* @ignore
93+
*/
94+
static getAttributeTypeMap(): AttributeTypeMap {
95+
return MonitorAsset.attributeTypeMap;
96+
}
97+
98+
public constructor() {}
99+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { UnparsedObject } from "@datadog/datadog-api-client";
2+
3+
/**
4+
* Indicates the type of asset this entity represents on a monitor
5+
*/
6+
export type MonitorAssetCategory =
7+
| typeof DASHBOARD
8+
| typeof WORKFLOW
9+
| typeof RUNBOOK
10+
| UnparsedObject;
11+
export const DASHBOARD = "dashboard";
12+
export const WORKFLOW = "workflow";
13+
export const RUNBOOK = "runbook";
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { UnparsedObject } from "@datadog/datadog-api-client";
2+
3+
/**
4+
* Type of internal datadog resource associated with a monitor asset
5+
*/
6+
export type MonitorAssetResourceType = typeof NOTEBOOK | UnparsedObject;
7+
export const NOTEBOOK = "notebook";

services/monitors/src/v1/models/MonitorUpdateRequest.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { AttributeTypeMap } from "@datadog/datadog-api-client";
22

33
import { Creator } from "./Creator";
4+
import { MonitorAsset } from "./MonitorAsset";
45
import { MonitorDraftStatus } from "./MonitorDraftStatus";
56
import { MonitorOptions } from "./MonitorOptions";
67
import { MonitorOverallStates } from "./MonitorOverallStates";
@@ -11,6 +12,10 @@ import { MonitorType } from "./MonitorType";
1112
* Object describing a monitor update request.
1213
*/
1314
export class MonitorUpdateRequest {
15+
/**
16+
* The list of monitor assets tied to a monitor, which represents key links for users to help take actions on monitor alerts (for example, runbooks)
17+
*/
18+
"assets"?: Array<MonitorAsset>;
1419
/**
1520
* Timestamp of the monitor creation.
1621
*/
@@ -99,6 +104,10 @@ export class MonitorUpdateRequest {
99104
* @ignore
100105
*/
101106
static readonly attributeTypeMap: AttributeTypeMap = {
107+
assets: {
108+
baseName: "assets",
109+
type: "Array<MonitorAsset>",
110+
},
102111
created: {
103112
baseName: "created",
104113
type: "Date",

0 commit comments

Comments
 (0)