Skip to content

Commit 3db7c5b

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 50c62af of spec repo
1 parent a1f1bff commit 3db7c5b

13 files changed

+695
-13
lines changed

.generator/schemas/v1/openapi.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7255,6 +7255,12 @@ 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 take action on monitor alerts (for example, runbooks).
7261+
items:
7262+
$ref: '#/components/schemas/MonitorAsset'
7263+
type: array
72587264
created:
72597265
description: Timestamp of the monitor creation.
72607266
format: date-time
@@ -7338,6 +7344,52 @@ components:
73387344
- type
73397345
- query
73407346
type: object
7347+
MonitorAsset:
7348+
description: 'Represents key links tied to a monitor to help users take action
7349+
on alerts.
7350+
7351+
This feature is in Preview and only available to users with the feature enabled.'
7352+
properties:
7353+
category:
7354+
$ref: '#/components/schemas/MonitorAssetCategory'
7355+
name:
7356+
description: Name for the monitor asset
7357+
example: Monitor Runbook
7358+
type: string
7359+
resource_key:
7360+
description: Represents the identifier of the internal Datadog resource
7361+
that this asset represents. IDs in this field should be passed in as strings.
7362+
example: '12345'
7363+
type: string
7364+
resource_type:
7365+
$ref: '#/components/schemas/MonitorAssetResourceType'
7366+
url:
7367+
description: URL link for the asset. For links with an internal resource
7368+
type set, this should be the relative path to where the Datadog domain
7369+
is appended internally. For external links, this should be the full URL
7370+
path.
7371+
example: /notebooks/12345
7372+
type: string
7373+
required:
7374+
- name
7375+
- url
7376+
- category
7377+
type: object
7378+
MonitorAssetCategory:
7379+
description: Indicates the type of asset this entity represents on a monitor.
7380+
enum:
7381+
- runbook
7382+
example: runbook
7383+
type: string
7384+
x-enum-varnames:
7385+
- RUNBOOK
7386+
MonitorAssetResourceType:
7387+
description: Type of internal Datadog resource associated with a monitor asset.
7388+
enum:
7389+
- notebook
7390+
type: string
7391+
x-enum-varnames:
7392+
- NOTEBOOK
73417393
MonitorDeviceID:
73427394
description: ID of the device the Synthetics monitor is running on. Same as
73437395
`SyntheticsDeviceID`.
@@ -8452,6 +8504,13 @@ components:
84528504
MonitorUpdateRequest:
84538505
description: Object describing a monitor update request.
84548506
properties:
8507+
assets:
8508+
description: The list of monitor assets tied to a monitor, which represents
8509+
key links for users to take action on monitor alerts (for example, runbooks).
8510+
items:
8511+
$ref: '#/components/schemas/MonitorAsset'
8512+
nullable: true
8513+
type: array
84558514
created:
84568515
description: Timestamp of the monitor creation.
84578516
format: date-time
@@ -31584,6 +31643,13 @@ paths:
3158431643
required: false
3158531644
schema:
3158631645
type: boolean
31646+
- description: If this argument is set to `true`, the returned data includes
31647+
all assets tied to this monitor.
31648+
in: query
31649+
name: with_assets
31650+
required: false
31651+
schema:
31652+
type: boolean
3158731653
responses:
3158831654
'200':
3158931655
content:
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Create a monitor with assets returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v1.api.MonitorsApi;
6+
import com.datadog.api.client.v1.model.Monitor;
7+
import com.datadog.api.client.v1.model.MonitorAsset;
8+
import com.datadog.api.client.v1.model.MonitorAssetCategory;
9+
import com.datadog.api.client.v1.model.MonitorAssetResourceType;
10+
import com.datadog.api.client.v1.model.MonitorOptions;
11+
import com.datadog.api.client.v1.model.MonitorOptionsSchedulingOptions;
12+
import com.datadog.api.client.v1.model.MonitorOptionsSchedulingOptionsEvaluationWindow;
13+
import com.datadog.api.client.v1.model.MonitorThresholds;
14+
import com.datadog.api.client.v1.model.MonitorType;
15+
import java.util.Collections;
16+
17+
public class Example {
18+
public static void main(String[] args) {
19+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
20+
MonitorsApi apiInstance = new MonitorsApi(defaultClient);
21+
22+
Monitor body =
23+
new Monitor()
24+
.assets(
25+
Collections.singletonList(
26+
new MonitorAsset()
27+
.category(MonitorAssetCategory.RUNBOOK)
28+
.name("Monitor Runbook")
29+
.resourceKey("12345")
30+
.resourceType(MonitorAssetResourceType.NOTEBOOK)
31+
.url("/notebooks/12345")))
32+
.name("Example-Monitor")
33+
.type(MonitorType.METRIC_ALERT)
34+
.query("avg(current_1mo):avg:system.load.5{*} > 0.5")
35+
.message("some message Notify: @hipchat-channel")
36+
.options(
37+
new MonitorOptions()
38+
.thresholds(new MonitorThresholds().critical(0.5))
39+
.schedulingOptions(
40+
new MonitorOptionsSchedulingOptions()
41+
.evaluationWindow(
42+
new MonitorOptionsSchedulingOptionsEvaluationWindow()
43+
.dayStarts("04:00")
44+
.monthStarts(1))));
45+
46+
try {
47+
Monitor result = apiInstance.createMonitor(body);
48+
System.out.println(result);
49+
} catch (ApiException e) {
50+
System.err.println("Exception when calling MonitorsApi#createMonitor");
51+
System.err.println("Status code: " + e.getCode());
52+
System.err.println("Reason: " + e.getResponseBody());
53+
System.err.println("Response headers: " + e.getResponseHeaders());
54+
e.printStackTrace();
55+
}
56+
}
57+
}

src/main/java/com/datadog/api/client/v1/api/MonitorsApi.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,7 @@ public CompletableFuture<ApiResponse<DeletedMonitor>> deleteMonitorWithHttpInfoA
863863
public static class GetMonitorOptionalParameters {
864864
private String groupStates;
865865
private Boolean withDowntimes;
866+
private Boolean withAssets;
866867

867868
/**
868869
* Set groupStates.
@@ -888,6 +889,18 @@ public GetMonitorOptionalParameters withDowntimes(Boolean withDowntimes) {
888889
this.withDowntimes = withDowntimes;
889890
return this;
890891
}
892+
893+
/**
894+
* Set withAssets.
895+
*
896+
* @param withAssets If this argument is set to <code>true</code>, the returned data includes
897+
* all assets tied to this monitor. (optional)
898+
* @return GetMonitorOptionalParameters
899+
*/
900+
public GetMonitorOptionalParameters withAssets(Boolean withAssets) {
901+
this.withAssets = withAssets;
902+
return this;
903+
}
891904
}
892905

893906
/**
@@ -981,6 +994,7 @@ public ApiResponse<Monitor> getMonitorWithHttpInfo(
981994
}
982995
String groupStates = parameters.groupStates;
983996
Boolean withDowntimes = parameters.withDowntimes;
997+
Boolean withAssets = parameters.withAssets;
984998
// create path and map variables
985999
String localVarPath =
9861000
"/api/v1/monitor/{monitor_id}"
@@ -991,6 +1005,7 @@ public ApiResponse<Monitor> getMonitorWithHttpInfo(
9911005

9921006
localVarQueryParams.addAll(apiClient.parameterToPairs("", "group_states", groupStates));
9931007
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_downtimes", withDowntimes));
1008+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_assets", withAssets));
9941009

9951010
Invocation.Builder builder =
9961011
apiClient.createBuilder(
@@ -1035,6 +1050,7 @@ public CompletableFuture<ApiResponse<Monitor>> getMonitorWithHttpInfoAsync(
10351050
}
10361051
String groupStates = parameters.groupStates;
10371052
Boolean withDowntimes = parameters.withDowntimes;
1053+
Boolean withAssets = parameters.withAssets;
10381054
// create path and map variables
10391055
String localVarPath =
10401056
"/api/v1/monitor/{monitor_id}"
@@ -1045,6 +1061,7 @@ public CompletableFuture<ApiResponse<Monitor>> getMonitorWithHttpInfoAsync(
10451061

10461062
localVarQueryParams.addAll(apiClient.parameterToPairs("", "group_states", groupStates));
10471063
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_downtimes", withDowntimes));
1064+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_assets", withAssets));
10481065

10491066
Invocation.Builder builder;
10501067
try {

src/main/java/com/datadog/api/client/v1/model/Monitor.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
/** Object describing a monitor. */
2525
@JsonPropertyOrder({
26+
Monitor.JSON_PROPERTY_ASSETS,
2627
Monitor.JSON_PROPERTY_CREATED,
2728
Monitor.JSON_PROPERTY_CREATOR,
2829
Monitor.JSON_PROPERTY_DELETED,
@@ -46,6 +47,9 @@
4647
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
4748
public class Monitor {
4849
@JsonIgnore public boolean unparsed = false;
50+
public static final String JSON_PROPERTY_ASSETS = "assets";
51+
private List<MonitorAsset> assets = null;
52+
4953
public static final String JSON_PROPERTY_CREATED = "created";
5054
private OffsetDateTime created;
5155

@@ -111,6 +115,40 @@ public Monitor(
111115
this.unparsed |= !type.isValid();
112116
}
113117

118+
public Monitor assets(List<MonitorAsset> assets) {
119+
this.assets = assets;
120+
for (MonitorAsset item : assets) {
121+
this.unparsed |= item.unparsed;
122+
}
123+
return this;
124+
}
125+
126+
public Monitor addAssetsItem(MonitorAsset assetsItem) {
127+
if (this.assets == null) {
128+
this.assets = new ArrayList<>();
129+
}
130+
this.assets.add(assetsItem);
131+
this.unparsed |= assetsItem.unparsed;
132+
return this;
133+
}
134+
135+
/**
136+
* The list of monitor assets tied to a monitor, which represents key links for users to take
137+
* action on monitor alerts (for example, runbooks).
138+
*
139+
* @return assets
140+
*/
141+
@jakarta.annotation.Nullable
142+
@JsonProperty(JSON_PROPERTY_ASSETS)
143+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
144+
public List<MonitorAsset> getAssets() {
145+
return assets;
146+
}
147+
148+
public void setAssets(List<MonitorAsset> assets) {
149+
this.assets = assets;
150+
}
151+
114152
/**
115153
* Timestamp of the monitor creation.
116154
*
@@ -560,7 +598,8 @@ public boolean equals(Object o) {
560598
return false;
561599
}
562600
Monitor monitor = (Monitor) o;
563-
return Objects.equals(this.created, monitor.created)
601+
return Objects.equals(this.assets, monitor.assets)
602+
&& Objects.equals(this.created, monitor.created)
564603
&& Objects.equals(this.creator, monitor.creator)
565604
&& Objects.equals(this.deleted, monitor.deleted)
566605
&& Objects.equals(this.draftStatus, monitor.draftStatus)
@@ -584,6 +623,7 @@ public boolean equals(Object o) {
584623
@Override
585624
public int hashCode() {
586625
return Objects.hash(
626+
assets,
587627
created,
588628
creator,
589629
deleted,
@@ -609,6 +649,7 @@ public int hashCode() {
609649
public String toString() {
610650
StringBuilder sb = new StringBuilder();
611651
sb.append("class Monitor {\n");
652+
sb.append(" assets: ").append(toIndentedString(assets)).append("\n");
612653
sb.append(" created: ").append(toIndentedString(created)).append("\n");
613654
sb.append(" creator: ").append(toIndentedString(creator)).append("\n");
614655
sb.append(" deleted: ").append(toIndentedString(deleted)).append("\n");

0 commit comments

Comments
 (0)