Skip to content

Commit 7823cc2

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 04fa093a of spec repo
1 parent 651c09a commit 7823cc2

11 files changed

+556
-18
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2023-10-04 20:38:56.966827",
8-
"spec_repo_commit": "79ab1c3c"
7+
"regenerated": "2023-10-05 15:19:58.179302",
8+
"spec_repo_commit": "04fa093a"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2023-10-04 20:38:56.985498",
13-
"spec_repo_commit": "79ab1c3c"
12+
"regenerated": "2023-10-05 15:19:58.196320",
13+
"spec_repo_commit": "04fa093a"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6839,6 +6839,33 @@ components:
68396839
type: string
68406840
readOnly: true
68416841
type: object
6842+
MonitorOptionsCustomSchedule:
6843+
description: Configuration options for the custom schedule. **This feature is
6844+
in private beta.**
6845+
properties:
6846+
recurrences:
6847+
description: Array of custom schedule recurrences.
6848+
items:
6849+
$ref: '#/components/schemas/MonitorOptionsCustomScheduleRecurrence'
6850+
type: array
6851+
type: object
6852+
MonitorOptionsCustomScheduleRecurrence:
6853+
description: Configuration for a recurrence set on the monitor options for custom
6854+
schedule.
6855+
properties:
6856+
rrule:
6857+
description: Defines the recurrence rule (RRULE) for a given schedule.
6858+
example: FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR
6859+
type: string
6860+
start:
6861+
description: Defines the start date and time of the recurring schedule.
6862+
example: '2023-08-31T16:30:00'
6863+
type: string
6864+
timezone:
6865+
description: Defines the timezone the schedule runs on.
6866+
example: Europe/Paris
6867+
type: string
6868+
type: object
68426869
MonitorOptionsNotificationPresets:
68436870
default: show_all
68446871
description: Toggles the display of additional content sent in the monitor notification.
@@ -6856,6 +6883,8 @@ components:
68566883
MonitorOptionsSchedulingOptions:
68576884
description: Configuration options for scheduling.
68586885
properties:
6886+
custom_schedule:
6887+
$ref: '#/components/schemas/MonitorOptionsCustomSchedule'
68596888
evaluation_window:
68606889
$ref: '#/components/schemas/MonitorOptionsSchedulingOptionsEvaluationWindow'
68616890
type: object
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Create a metric monitor with a custom schedule 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.MonitorOptions;
8+
import com.datadog.api.client.v1.model.MonitorOptionsCustomSchedule;
9+
import com.datadog.api.client.v1.model.MonitorOptionsCustomScheduleRecurrence;
10+
import com.datadog.api.client.v1.model.MonitorOptionsSchedulingOptions;
11+
import com.datadog.api.client.v1.model.MonitorOptionsSchedulingOptionsEvaluationWindow;
12+
import com.datadog.api.client.v1.model.MonitorThresholds;
13+
import com.datadog.api.client.v1.model.MonitorType;
14+
import com.datadog.api.client.v1.model.OnMissingDataOption;
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+
.message("some message Notify: @hipchat-channel")
25+
.name("Example-Monitor")
26+
.query("avg(current_1mo):avg:system.load.5{*} > 0.5")
27+
.options(
28+
new MonitorOptions()
29+
.thresholds(new MonitorThresholds().critical(0.5))
30+
.notifyAudit(false)
31+
.onMissingData(OnMissingDataOption.DEFAULT)
32+
.includeTags(false)
33+
.schedulingOptions(
34+
new MonitorOptionsSchedulingOptions()
35+
.evaluationWindow(
36+
new MonitorOptionsSchedulingOptionsEvaluationWindow()
37+
.dayStarts("04:00")
38+
.monthStarts(1))
39+
.customSchedule(
40+
new MonitorOptionsCustomSchedule()
41+
.recurrences(
42+
Collections.singletonList(
43+
new MonitorOptionsCustomScheduleRecurrence()
44+
.rrule("FREQ=DAILY;INTERVAL=1")
45+
.timezone("America/Los_Angeles")
46+
.start("2024-10-26T09:13:00"))))))
47+
.type(MonitorType.QUERY_ALERT);
48+
49+
try {
50+
Monitor result = apiInstance.createMonitor(body);
51+
System.out.println(result);
52+
} catch (ApiException e) {
53+
System.err.println("Exception when calling MonitorsApi#createMonitor");
54+
System.err.println("Status code: " + e.getCode());
55+
System.err.println("Reason: " + e.getResponseBody());
56+
System.err.println("Response headers: " + e.getResponseHeaders());
57+
e.printStackTrace();
58+
}
59+
}
60+
}
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
/*
2+
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
3+
* This product includes software developed at Datadog (https://www.datadoghq.com/).
4+
* Copyright 2019-Present Datadog, Inc.
5+
*/
6+
7+
package com.datadog.api.client.v1.model;
8+
9+
import com.fasterxml.jackson.annotation.JsonAnyGetter;
10+
import com.fasterxml.jackson.annotation.JsonAnySetter;
11+
import com.fasterxml.jackson.annotation.JsonIgnore;
12+
import com.fasterxml.jackson.annotation.JsonInclude;
13+
import com.fasterxml.jackson.annotation.JsonProperty;
14+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
15+
import java.util.ArrayList;
16+
import java.util.HashMap;
17+
import java.util.List;
18+
import java.util.Map;
19+
import java.util.Objects;
20+
21+
/**
22+
* Configuration options for the custom schedule. <strong>This feature is in private beta.</strong>
23+
*/
24+
@JsonPropertyOrder({MonitorOptionsCustomSchedule.JSON_PROPERTY_RECURRENCES})
25+
@jakarta.annotation.Generated(
26+
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
27+
public class MonitorOptionsCustomSchedule {
28+
@JsonIgnore public boolean unparsed = false;
29+
public static final String JSON_PROPERTY_RECURRENCES = "recurrences";
30+
private List<MonitorOptionsCustomScheduleRecurrence> recurrences = null;
31+
32+
public MonitorOptionsCustomSchedule recurrences(
33+
List<MonitorOptionsCustomScheduleRecurrence> recurrences) {
34+
this.recurrences = recurrences;
35+
for (MonitorOptionsCustomScheduleRecurrence item : recurrences) {
36+
this.unparsed |= item.unparsed;
37+
}
38+
return this;
39+
}
40+
41+
public MonitorOptionsCustomSchedule addRecurrencesItem(
42+
MonitorOptionsCustomScheduleRecurrence recurrencesItem) {
43+
if (this.recurrences == null) {
44+
this.recurrences = new ArrayList<>();
45+
}
46+
this.recurrences.add(recurrencesItem);
47+
this.unparsed |= recurrencesItem.unparsed;
48+
return this;
49+
}
50+
51+
/**
52+
* Array of custom schedule recurrences.
53+
*
54+
* @return recurrences
55+
*/
56+
@jakarta.annotation.Nullable
57+
@JsonProperty(JSON_PROPERTY_RECURRENCES)
58+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
59+
public List<MonitorOptionsCustomScheduleRecurrence> getRecurrences() {
60+
return recurrences;
61+
}
62+
63+
public void setRecurrences(List<MonitorOptionsCustomScheduleRecurrence> recurrences) {
64+
this.recurrences = recurrences;
65+
}
66+
67+
/**
68+
* A container for additional, undeclared properties. This is a holder for any undeclared
69+
* properties as specified with the 'additionalProperties' keyword in the OAS document.
70+
*/
71+
private Map<String, Object> additionalProperties;
72+
73+
/**
74+
* Set the additional (undeclared) property with the specified name and value. If the property
75+
* does not already exist, create it otherwise replace it.
76+
*
77+
* @param key The arbitrary key to set
78+
* @param value The associated value
79+
* @return MonitorOptionsCustomSchedule
80+
*/
81+
@JsonAnySetter
82+
public MonitorOptionsCustomSchedule putAdditionalProperty(String key, Object value) {
83+
if (this.additionalProperties == null) {
84+
this.additionalProperties = new HashMap<String, Object>();
85+
}
86+
this.additionalProperties.put(key, value);
87+
return this;
88+
}
89+
90+
/**
91+
* Return the additional (undeclared) property.
92+
*
93+
* @return The additional properties
94+
*/
95+
@JsonAnyGetter
96+
public Map<String, Object> getAdditionalProperties() {
97+
return additionalProperties;
98+
}
99+
100+
/**
101+
* Return the additional (undeclared) property with the specified name.
102+
*
103+
* @param key The arbitrary key to get
104+
* @return The specific additional property for the given key
105+
*/
106+
public Object getAdditionalProperty(String key) {
107+
if (this.additionalProperties == null) {
108+
return null;
109+
}
110+
return this.additionalProperties.get(key);
111+
}
112+
113+
/** Return true if this MonitorOptionsCustomSchedule object is equal to o. */
114+
@Override
115+
public boolean equals(Object o) {
116+
if (this == o) {
117+
return true;
118+
}
119+
if (o == null || getClass() != o.getClass()) {
120+
return false;
121+
}
122+
MonitorOptionsCustomSchedule monitorOptionsCustomSchedule = (MonitorOptionsCustomSchedule) o;
123+
return Objects.equals(this.recurrences, monitorOptionsCustomSchedule.recurrences)
124+
&& Objects.equals(
125+
this.additionalProperties, monitorOptionsCustomSchedule.additionalProperties);
126+
}
127+
128+
@Override
129+
public int hashCode() {
130+
return Objects.hash(recurrences, additionalProperties);
131+
}
132+
133+
@Override
134+
public String toString() {
135+
StringBuilder sb = new StringBuilder();
136+
sb.append("class MonitorOptionsCustomSchedule {\n");
137+
sb.append(" recurrences: ").append(toIndentedString(recurrences)).append("\n");
138+
sb.append(" additionalProperties: ")
139+
.append(toIndentedString(additionalProperties))
140+
.append("\n");
141+
sb.append("}");
142+
return sb.toString();
143+
}
144+
145+
/**
146+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
147+
*/
148+
private String toIndentedString(Object o) {
149+
if (o == null) {
150+
return "null";
151+
}
152+
return o.toString().replace("\n", "\n ");
153+
}
154+
}

0 commit comments

Comments
 (0)