Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7255,6 +7255,13 @@ components:
Monitor:
description: Object describing a monitor.
properties:
assets:
description: 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).
items:
$ref: '#/components/schemas/MonitorAsset'
type: array
created:
description: Timestamp of the monitor creation.
format: date-time
Expand Down Expand Up @@ -7338,6 +7345,64 @@ components:
- type
- query
type: object
MonitorAsset:
description: 'Represents key links tied to a monitor to help users take action
on alerts (runbooks, dashboards, Workflows).

This feature is in Preview and only available to users with the feature enabled.'
properties:
category:
$ref: '#/components/schemas/MonitorAssetCategory'
name:
description: Name for the monitor asset
example: Monitor Runbook
type: string
options:
description: Additional options that you can set on a monitor asset.
example:
hide_in_monitor_message: true
type: object
resource_key:
description: Represents the identifier of the internal datadog resource
that this asset represents. IDs in this field should be passed in as strings.
example: '12345'
type: string
resource_type:
$ref: '#/components/schemas/MonitorAssetResourceType'
template_variables:
description: Allows you to parameterize the URL for the monitor asset.
example:
env: prod
region: us-east-1
type: object
url:
description: Url link for the asset
example: https://app.datadoghq.com
type: string
required:
- name
- url
- category
type: object
MonitorAssetCategory:
description: Indicates the type of asset this entity represents on a monitor.
enum:
- dashboard
- workflow
- runbook
example: dashboard
type: string
x-enum-varnames:
- DASHBOARD
- WORKFLOW
- RUNBOOK
MonitorAssetResourceType:
description: Type of internal datadog resource associated with a monitor asset.
enum:
- notebook
type: string
x-enum-varnames:
- NOTEBOOK
MonitorDeviceID:
description: ID of the device the Synthetics monitor is running on. Same as
`SyntheticsDeviceID`.
Expand Down Expand Up @@ -8452,6 +8517,14 @@ components:
MonitorUpdateRequest:
description: Object describing a monitor update request.
properties:
assets:
description: 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).
items:
$ref: '#/components/schemas/MonitorAsset'
nullable: true
type: array
created:
description: Timestamp of the monitor creation.
format: date-time
Expand Down Expand Up @@ -31569,6 +31642,13 @@ paths:
required: false
schema:
type: boolean
- description: If this argument is set to `true`, then the returned data includes
all assets tied to this monitor.
in: query
name: with_assets
required: false
schema:
type: boolean
responses:
'200':
content:
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,7 @@ public CompletableFuture<ApiResponse<DeletedMonitor>> deleteMonitorWithHttpInfoA
public static class GetMonitorOptionalParameters {
private String groupStates;
private Boolean withDowntimes;
private Boolean withAssets;

/**
* Set groupStates.
Expand All @@ -888,6 +889,18 @@ public GetMonitorOptionalParameters withDowntimes(Boolean withDowntimes) {
this.withDowntimes = withDowntimes;
return this;
}

/**
* Set withAssets.
*
* @param withAssets If this argument is set to <code>true</code>, then the returned data
* includes all assets tied to this monitor. (optional)
* @return GetMonitorOptionalParameters
*/
public GetMonitorOptionalParameters withAssets(Boolean withAssets) {
this.withAssets = withAssets;
return this;
}
}

/**
Expand Down Expand Up @@ -981,6 +994,7 @@ public ApiResponse<Monitor> getMonitorWithHttpInfo(
}
String groupStates = parameters.groupStates;
Boolean withDowntimes = parameters.withDowntimes;
Boolean withAssets = parameters.withAssets;
// create path and map variables
String localVarPath =
"/api/v1/monitor/{monitor_id}"
Expand All @@ -991,6 +1005,7 @@ public ApiResponse<Monitor> getMonitorWithHttpInfo(

localVarQueryParams.addAll(apiClient.parameterToPairs("", "group_states", groupStates));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_downtimes", withDowntimes));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_assets", withAssets));

Invocation.Builder builder =
apiClient.createBuilder(
Expand Down Expand Up @@ -1035,6 +1050,7 @@ public CompletableFuture<ApiResponse<Monitor>> getMonitorWithHttpInfoAsync(
}
String groupStates = parameters.groupStates;
Boolean withDowntimes = parameters.withDowntimes;
Boolean withAssets = parameters.withAssets;
// create path and map variables
String localVarPath =
"/api/v1/monitor/{monitor_id}"
Expand All @@ -1045,6 +1061,7 @@ public CompletableFuture<ApiResponse<Monitor>> getMonitorWithHttpInfoAsync(

localVarQueryParams.addAll(apiClient.parameterToPairs("", "group_states", groupStates));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_downtimes", withDowntimes));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_assets", withAssets));

Invocation.Builder builder;
try {
Expand Down
43 changes: 42 additions & 1 deletion src/main/java/com/datadog/api/client/v1/model/Monitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

/** Object describing a monitor. */
@JsonPropertyOrder({
Monitor.JSON_PROPERTY_ASSETS,
Monitor.JSON_PROPERTY_CREATED,
Monitor.JSON_PROPERTY_CREATOR,
Monitor.JSON_PROPERTY_DELETED,
Expand All @@ -46,6 +47,9 @@
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class Monitor {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_ASSETS = "assets";
private List<MonitorAsset> assets = null;

public static final String JSON_PROPERTY_CREATED = "created";
private OffsetDateTime created;

Expand Down Expand Up @@ -111,6 +115,40 @@ public Monitor(
this.unparsed |= !type.isValid();
}

public Monitor assets(List<MonitorAsset> assets) {
this.assets = assets;
for (MonitorAsset item : assets) {
this.unparsed |= item.unparsed;
}
return this;
}

public Monitor addAssetsItem(MonitorAsset assetsItem) {
if (this.assets == null) {
this.assets = new ArrayList<>();
}
this.assets.add(assetsItem);
this.unparsed |= assetsItem.unparsed;
return this;
}

/**
* 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).
*
* @return assets
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ASSETS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<MonitorAsset> getAssets() {
return assets;
}

public void setAssets(List<MonitorAsset> assets) {
this.assets = assets;
}

/**
* Timestamp of the monitor creation.
*
Expand Down Expand Up @@ -560,7 +598,8 @@ public boolean equals(Object o) {
return false;
}
Monitor monitor = (Monitor) o;
return Objects.equals(this.created, monitor.created)
return Objects.equals(this.assets, monitor.assets)
&& Objects.equals(this.created, monitor.created)
&& Objects.equals(this.creator, monitor.creator)
&& Objects.equals(this.deleted, monitor.deleted)
&& Objects.equals(this.draftStatus, monitor.draftStatus)
Expand All @@ -584,6 +623,7 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
return Objects.hash(
assets,
created,
creator,
deleted,
Expand All @@ -609,6 +649,7 @@ public int hashCode() {
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Monitor {\n");
sb.append(" assets: ").append(toIndentedString(assets)).append("\n");
sb.append(" created: ").append(toIndentedString(created)).append("\n");
sb.append(" creator: ").append(toIndentedString(creator)).append("\n");
sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n");
Expand Down
Loading
Loading