Skip to content

Commit 2b404c2

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 7503b22 of spec repo
1 parent b7b6e35 commit 2b404c2

File tree

10 files changed

+450
-1
lines changed

10 files changed

+450
-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
@@ -31569,6 +31642,13 @@ paths:
3156931642
required: false
3157031643
schema:
3157131644
type: boolean
31645+
- description: If this argument is set to `true`, then the returned data includes
31646+
all assets tied to this monitor.
31647+
in: query
31648+
name: with_assets
31649+
required: false
31650+
schema:
31651+
type: boolean
3157231652
responses:
3157331653
'200':
3157431654
content:

src/datadogV1/api/api_monitors.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ pub struct GetMonitorOptionalParams {
3636
pub group_states: Option<String>,
3737
/// If this argument is set to true, then the returned data includes all current active downtimes for the monitor.
3838
pub with_downtimes: Option<bool>,
39+
/// If this argument is set to `true`, then the returned data includes all assets tied to this monitor.
40+
pub with_assets: Option<bool>,
3941
}
4042

4143
impl GetMonitorOptionalParams {
@@ -49,6 +51,11 @@ impl GetMonitorOptionalParams {
4951
self.with_downtimes = Some(value);
5052
self
5153
}
54+
/// If this argument is set to `true`, then the returned data includes all assets tied to this monitor.
55+
pub fn with_assets(mut self, value: bool) -> Self {
56+
self.with_assets = Some(value);
57+
self
58+
}
5259
}
5360

5461
/// ListMonitorsOptionalParams is a struct for passing parameters to the method [`MonitorsAPI::list_monitors`]
@@ -1242,6 +1249,7 @@ impl MonitorsAPI {
12421249
// unbox and build optional parameters
12431250
let group_states = params.group_states;
12441251
let with_downtimes = params.with_downtimes;
1252+
let with_assets = params.with_assets;
12451253

12461254
let local_client = &self.client;
12471255

@@ -1261,6 +1269,10 @@ impl MonitorsAPI {
12611269
local_req_builder =
12621270
local_req_builder.query(&[("with_downtimes", &local_query_param.to_string())]);
12631271
};
1272+
if let Some(ref local_query_param) = with_assets {
1273+
local_req_builder =
1274+
local_req_builder.query(&[("with_assets", &local_query_param.to_string())]);
1275+
};
12641276

12651277
// build headers
12661278
let mut headers = HeaderMap::new();

src/datadogV1/model/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,12 @@ pub mod model_metric_metadata;
976976
pub use self::model_metric_metadata::MetricMetadata;
977977
pub mod model_monitor;
978978
pub use self::model_monitor::Monitor;
979+
pub mod model_monitor_asset;
980+
pub use self::model_monitor_asset::MonitorAsset;
981+
pub mod model_monitor_asset_category;
982+
pub use self::model_monitor_asset_category::MonitorAssetCategory;
983+
pub mod model_monitor_asset_resource_type;
984+
pub use self::model_monitor_asset_resource_type::MonitorAssetResourceType;
979985
pub mod model_monitor_draft_status;
980986
pub use self::model_monitor_draft_status::MonitorDraftStatus;
981987
pub mod model_matching_downtime;

src/datadogV1/model/model_monitor.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ use std::fmt::{self, Formatter};
1111
#[skip_serializing_none]
1212
#[derive(Clone, Debug, PartialEq, Serialize)]
1313
pub struct Monitor {
14+
/// 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).
15+
#[serde(rename = "assets")]
16+
pub assets: Option<Vec<crate::datadogV1::model::MonitorAsset>>,
1417
/// Timestamp of the monitor creation.
1518
#[serde(rename = "created")]
1619
pub created: Option<chrono::DateTime<chrono::Utc>>,
@@ -92,6 +95,7 @@ pub struct Monitor {
9295
impl Monitor {
9396
pub fn new(query: String, type_: crate::datadogV1::model::MonitorType) -> Monitor {
9497
Monitor {
98+
assets: None,
9599
created: None,
96100
creator: None,
97101
deleted: None,
@@ -115,6 +119,11 @@ impl Monitor {
115119
}
116120
}
117121

122+
pub fn assets(mut self, value: Vec<crate::datadogV1::model::MonitorAsset>) -> Self {
123+
self.assets = Some(value);
124+
self
125+
}
126+
118127
pub fn created(mut self, value: chrono::DateTime<chrono::Utc>) -> Self {
119128
self.created = Some(value);
120129
self
@@ -224,6 +233,7 @@ impl<'de> Deserialize<'de> for Monitor {
224233
where
225234
M: MapAccess<'a>,
226235
{
236+
let mut assets: Option<Vec<crate::datadogV1::model::MonitorAsset>> = None;
227237
let mut created: Option<chrono::DateTime<chrono::Utc>> = None;
228238
let mut creator: Option<crate::datadogV1::model::Creator> = None;
229239
let mut deleted: Option<Option<chrono::DateTime<chrono::Utc>>> = None;
@@ -251,6 +261,12 @@ impl<'de> Deserialize<'de> for Monitor {
251261

252262
while let Some((k, v)) = map.next_entry::<String, serde_json::Value>()? {
253263
match k.as_str() {
264+
"assets" => {
265+
if v.is_null() {
266+
continue;
267+
}
268+
assets = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
269+
}
254270
"created" => {
255271
if v.is_null() {
256272
continue;
@@ -387,6 +403,7 @@ impl<'de> Deserialize<'de> for Monitor {
387403
let type_ = type_.ok_or_else(|| M::Error::missing_field("type_"))?;
388404

389405
let content = Monitor {
406+
assets,
390407
created,
391408
creator,
392409
deleted,

0 commit comments

Comments
 (0)