Skip to content

Commit dac14d5

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 7aa3087 of spec repo
1 parent 60c02c0 commit dac14d5

10 files changed

Lines changed: 587 additions & 0 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36150,6 +36150,8 @@ components:
3615036150
$ref: "#/components/schemas/DowntimeNotifyEndStates"
3615136151
notify_end_types:
3615236152
$ref: "#/components/schemas/DowntimeNotifyEndTypes"
36153+
run_as:
36154+
$ref: "#/components/schemas/DowntimeRunAs"
3615336155
schedule:
3615436156
$ref: "#/components/schemas/DowntimeScheduleResponse"
3615536157
scope:
@@ -36176,6 +36178,49 @@ components:
3617636178
oneOf:
3617736179
- $ref: "#/components/schemas/User"
3617836180
- $ref: "#/components/schemas/DowntimeMonitorIncludedItem"
36181+
DowntimeRunAs:
36182+
description: |-
36183+
The principals (users, roles, or teams) allowed to act on behalf of the downtime.
36184+
36185+
**Note**: This feature is currently in Preview and may not be available for all organizations.
36186+
items:
36187+
$ref: "#/components/schemas/DowntimeRunAsItem"
36188+
readOnly: true
36189+
type: array
36190+
DowntimeRunAsItem:
36191+
description: A set of principals allowed to act on behalf of the downtime.
36192+
properties:
36193+
principals:
36194+
description: List of principals allowed to act on behalf of the downtime.
36195+
items:
36196+
$ref: "#/components/schemas/DowntimeRunAsPrincipal"
36197+
type: array
36198+
type: object
36199+
DowntimeRunAsPrincipal:
36200+
description: A principal (user, role, or team) allowed to act on behalf of the downtime.
36201+
properties:
36202+
id:
36203+
description: The ID of the principal.
36204+
example: "00000000-0000-1234-0000-000000000000"
36205+
type: string
36206+
type:
36207+
$ref: "#/components/schemas/DowntimeRunAsPrincipalType"
36208+
required:
36209+
- id
36210+
- type
36211+
type: object
36212+
DowntimeRunAsPrincipalType:
36213+
description: The type of principal allowed to act on behalf of the downtime.
36214+
enum:
36215+
- user
36216+
- role
36217+
- team
36218+
example: "user"
36219+
type: string
36220+
x-enum-varnames:
36221+
- USER
36222+
- ROLE
36223+
- TEAM
3617936224
DowntimeScheduleCreateRequest:
3618036225
description: Schedule for the downtime.
3618136226
oneOf:
@@ -153062,6 +153107,17 @@ paths:
153062153107
schema:
153063153108
example: "created_by,monitor"
153064153109
type: string
153110+
- description: |-
153111+
If `true`, include the `run_as` attribute in the response, which lists the principals allowed to
153112+
act on behalf of the downtime.
153113+
153114+
**Note**: This feature is currently in Preview and may not be available for all organizations.
153115+
in: query
153116+
name: with_run_as
153117+
required: false
153118+
schema:
153119+
default: false
153120+
type: boolean
153065153121
responses:
153066153122
"200":
153067153123
content:
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Get a downtime with run_as returns "OK" response
2+
3+
import com.datadog.api.client.ApiClient;
4+
import com.datadog.api.client.ApiException;
5+
import com.datadog.api.client.v2.api.DowntimesApi;
6+
import com.datadog.api.client.v2.api.DowntimesApi.GetDowntimeOptionalParameters;
7+
import com.datadog.api.client.v2.model.DowntimeResponse;
8+
9+
public class Example {
10+
public static void main(String[] args) {
11+
ApiClient defaultClient = ApiClient.getDefaultApiClient();
12+
DowntimesApi apiInstance = new DowntimesApi(defaultClient);
13+
14+
// there is a valid "downtime_v2" in the system
15+
String DOWNTIME_V2_DATA_ID = System.getenv("DOWNTIME_V2_DATA_ID");
16+
17+
try {
18+
DowntimeResponse result =
19+
apiInstance.getDowntime(
20+
DOWNTIME_V2_DATA_ID, new GetDowntimeOptionalParameters().withRunAs(true));
21+
System.out.println(result);
22+
} catch (ApiException e) {
23+
System.err.println("Exception when calling DowntimesApi#getDowntime");
24+
System.err.println("Status code: " + e.getCode());
25+
System.err.println("Reason: " + e.getResponseBody());
26+
System.err.println("Response headers: " + e.getResponseHeaders());
27+
e.printStackTrace();
28+
}
29+
}
30+
}

src/main/java/com/datadog/api/client/v2/api/DowntimesApi.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ public CompletableFuture<ApiResponse<DowntimeResponse>> createDowntimeWithHttpIn
324324
/** Manage optional parameters to getDowntime. */
325325
public static class GetDowntimeOptionalParameters {
326326
private String include;
327+
private Boolean withRunAs;
327328

328329
/**
329330
* Set include.
@@ -337,6 +338,20 @@ public GetDowntimeOptionalParameters include(String include) {
337338
this.include = include;
338339
return this;
339340
}
341+
342+
/**
343+
* Set withRunAs.
344+
*
345+
* @param withRunAs If <code>true</code>, include the <code>run_as</code> attribute in the
346+
* response, which lists the principals allowed to act on behalf of the downtime.
347+
* <strong>Note</strong>: This feature is currently in Preview and may not be available for
348+
* all organizations. (optional, default to false)
349+
* @return GetDowntimeOptionalParameters
350+
*/
351+
public GetDowntimeOptionalParameters withRunAs(Boolean withRunAs) {
352+
this.withRunAs = withRunAs;
353+
return this;
354+
}
340355
}
341356

342357
/**
@@ -429,6 +444,7 @@ public ApiResponse<DowntimeResponse> getDowntimeWithHttpInfo(
429444
400, "Missing the required parameter 'downtimeId' when calling getDowntime");
430445
}
431446
String include = parameters.include;
447+
Boolean withRunAs = parameters.withRunAs;
432448
// create path and map variables
433449
String localVarPath =
434450
"/api/v2/downtime/{downtime_id}"
@@ -439,6 +455,7 @@ public ApiResponse<DowntimeResponse> getDowntimeWithHttpInfo(
439455
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
440456

441457
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include));
458+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_run_as", withRunAs));
442459

443460
Invocation.Builder builder =
444461
apiClient.createBuilder(
@@ -482,6 +499,7 @@ public CompletableFuture<ApiResponse<DowntimeResponse>> getDowntimeWithHttpInfoA
482499
return result;
483500
}
484501
String include = parameters.include;
502+
Boolean withRunAs = parameters.withRunAs;
485503
// create path and map variables
486504
String localVarPath =
487505
"/api/v2/downtime/{downtime_id}"
@@ -492,6 +510,7 @@ public CompletableFuture<ApiResponse<DowntimeResponse>> getDowntimeWithHttpInfoA
492510
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
493511

494512
localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include));
513+
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_run_as", withRunAs));
495514

496515
Invocation.Builder builder;
497516
try {

src/main/java/com/datadog/api/client/v2/model/DowntimeResponseAttributes.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
DowntimeResponseAttributes.JSON_PROPERTY_MUTE_FIRST_RECOVERY_NOTIFICATION,
3232
DowntimeResponseAttributes.JSON_PROPERTY_NOTIFY_END_STATES,
3333
DowntimeResponseAttributes.JSON_PROPERTY_NOTIFY_END_TYPES,
34+
DowntimeResponseAttributes.JSON_PROPERTY_RUN_AS,
3435
DowntimeResponseAttributes.JSON_PROPERTY_SCHEDULE,
3536
DowntimeResponseAttributes.JSON_PROPERTY_SCOPE,
3637
DowntimeResponseAttributes.JSON_PROPERTY_STATUS
@@ -67,6 +68,9 @@ public class DowntimeResponseAttributes {
6768
public static final String JSON_PROPERTY_NOTIFY_END_TYPES = "notify_end_types";
6869
private List<DowntimeNotifyEndStateActions> notifyEndTypes = null;
6970

71+
public static final String JSON_PROPERTY_RUN_AS = "run_as";
72+
private List<DowntimeRunAsItem> runAs = null;
73+
7074
public static final String JSON_PROPERTY_SCHEDULE = "schedule";
7175
private DowntimeScheduleResponse schedule;
7276

@@ -326,6 +330,21 @@ public void setNotifyEndTypes(List<DowntimeNotifyEndStateActions> notifyEndTypes
326330
this.notifyEndTypes = notifyEndTypes;
327331
}
328332

333+
/**
334+
* The principals (users, roles, or teams) allowed to act on behalf of the downtime.
335+
*
336+
* <p><strong>Note</strong>: This feature is currently in Preview and may not be available for all
337+
* organizations.
338+
*
339+
* @return runAs
340+
*/
341+
@jakarta.annotation.Nullable
342+
@JsonProperty(JSON_PROPERTY_RUN_AS)
343+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
344+
public List<DowntimeRunAsItem> getRunAs() {
345+
return runAs;
346+
}
347+
329348
public DowntimeResponseAttributes schedule(DowntimeScheduleResponse schedule) {
330349
this.schedule = schedule;
331350
this.unparsed |= schedule.unparsed;
@@ -467,6 +486,7 @@ public boolean equals(Object o) {
467486
downtimeResponseAttributes.muteFirstRecoveryNotification)
468487
&& Objects.equals(this.notifyEndStates, downtimeResponseAttributes.notifyEndStates)
469488
&& Objects.equals(this.notifyEndTypes, downtimeResponseAttributes.notifyEndTypes)
489+
&& Objects.equals(this.runAs, downtimeResponseAttributes.runAs)
470490
&& Objects.equals(this.schedule, downtimeResponseAttributes.schedule)
471491
&& Objects.equals(this.scope, downtimeResponseAttributes.scope)
472492
&& Objects.equals(this.status, downtimeResponseAttributes.status)
@@ -486,6 +506,7 @@ public int hashCode() {
486506
muteFirstRecoveryNotification,
487507
notifyEndStates,
488508
notifyEndTypes,
509+
runAs,
489510
schedule,
490511
scope,
491512
status,
@@ -507,6 +528,7 @@ public String toString() {
507528
.append("\n");
508529
sb.append(" notifyEndStates: ").append(toIndentedString(notifyEndStates)).append("\n");
509530
sb.append(" notifyEndTypes: ").append(toIndentedString(notifyEndTypes)).append("\n");
531+
sb.append(" runAs: ").append(toIndentedString(runAs)).append("\n");
510532
sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n");
511533
sb.append(" scope: ").append(toIndentedString(scope)).append("\n");
512534
sb.append(" status: ").append(toIndentedString(status)).append("\n");
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
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.v2.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+
/** A set of principals allowed to act on behalf of the downtime. */
22+
@JsonPropertyOrder({DowntimeRunAsItem.JSON_PROPERTY_PRINCIPALS})
23+
@jakarta.annotation.Generated(
24+
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
25+
public class DowntimeRunAsItem {
26+
@JsonIgnore public boolean unparsed = false;
27+
public static final String JSON_PROPERTY_PRINCIPALS = "principals";
28+
private List<DowntimeRunAsPrincipal> principals = null;
29+
30+
public DowntimeRunAsItem principals(List<DowntimeRunAsPrincipal> principals) {
31+
this.principals = principals;
32+
if (principals != null) {
33+
for (DowntimeRunAsPrincipal item : principals) {
34+
this.unparsed |= item.unparsed;
35+
}
36+
}
37+
return this;
38+
}
39+
40+
public DowntimeRunAsItem addPrincipalsItem(DowntimeRunAsPrincipal principalsItem) {
41+
if (this.principals == null) {
42+
this.principals = new ArrayList<>();
43+
}
44+
this.principals.add(principalsItem);
45+
this.unparsed |= principalsItem.unparsed;
46+
return this;
47+
}
48+
49+
/**
50+
* List of principals allowed to act on behalf of the downtime.
51+
*
52+
* @return principals
53+
*/
54+
@jakarta.annotation.Nullable
55+
@JsonProperty(JSON_PROPERTY_PRINCIPALS)
56+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
57+
public List<DowntimeRunAsPrincipal> getPrincipals() {
58+
return principals;
59+
}
60+
61+
public void setPrincipals(List<DowntimeRunAsPrincipal> principals) {
62+
this.principals = principals;
63+
if (principals != null) {
64+
for (DowntimeRunAsPrincipal item : principals) {
65+
this.unparsed |= item.unparsed;
66+
}
67+
}
68+
}
69+
70+
/**
71+
* A container for additional, undeclared properties. This is a holder for any undeclared
72+
* properties as specified with the 'additionalProperties' keyword in the OAS document.
73+
*/
74+
private Map<String, Object> additionalProperties;
75+
76+
/**
77+
* Set the additional (undeclared) property with the specified name and value. If the property
78+
* does not already exist, create it otherwise replace it.
79+
*
80+
* @param key The arbitrary key to set
81+
* @param value The associated value
82+
* @return DowntimeRunAsItem
83+
*/
84+
@JsonAnySetter
85+
public DowntimeRunAsItem putAdditionalProperty(String key, Object value) {
86+
if (this.additionalProperties == null) {
87+
this.additionalProperties = new HashMap<String, Object>();
88+
}
89+
this.additionalProperties.put(key, value);
90+
return this;
91+
}
92+
93+
/**
94+
* Return the additional (undeclared) property.
95+
*
96+
* @return The additional properties
97+
*/
98+
@JsonAnyGetter
99+
public Map<String, Object> getAdditionalProperties() {
100+
return additionalProperties;
101+
}
102+
103+
/**
104+
* Return the additional (undeclared) property with the specified name.
105+
*
106+
* @param key The arbitrary key to get
107+
* @return The specific additional property for the given key
108+
*/
109+
public Object getAdditionalProperty(String key) {
110+
if (this.additionalProperties == null) {
111+
return null;
112+
}
113+
return this.additionalProperties.get(key);
114+
}
115+
116+
/** Return true if this DowntimeRunAsItem object is equal to o. */
117+
@Override
118+
public boolean equals(Object o) {
119+
if (this == o) {
120+
return true;
121+
}
122+
if (o == null || getClass() != o.getClass()) {
123+
return false;
124+
}
125+
DowntimeRunAsItem downtimeRunAsItem = (DowntimeRunAsItem) o;
126+
return Objects.equals(this.principals, downtimeRunAsItem.principals)
127+
&& Objects.equals(this.additionalProperties, downtimeRunAsItem.additionalProperties);
128+
}
129+
130+
@Override
131+
public int hashCode() {
132+
return Objects.hash(principals, additionalProperties);
133+
}
134+
135+
@Override
136+
public String toString() {
137+
StringBuilder sb = new StringBuilder();
138+
sb.append("class DowntimeRunAsItem {\n");
139+
sb.append(" principals: ").append(toIndentedString(principals)).append("\n");
140+
sb.append(" additionalProperties: ")
141+
.append(toIndentedString(additionalProperties))
142+
.append("\n");
143+
sb.append('}');
144+
return sb.toString();
145+
}
146+
147+
/**
148+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
149+
*/
150+
private String toIndentedString(Object o) {
151+
if (o == null) {
152+
return "null";
153+
}
154+
return o.toString().replace("\n", "\n ");
155+
}
156+
}

0 commit comments

Comments
 (0)