Skip to content
Merged
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
56 changes: 56 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36150,6 +36150,8 @@ components:
$ref: "#/components/schemas/DowntimeNotifyEndStates"
notify_end_types:
$ref: "#/components/schemas/DowntimeNotifyEndTypes"
run_as:
$ref: "#/components/schemas/DowntimeRunAs"
schedule:
$ref: "#/components/schemas/DowntimeScheduleResponse"
scope:
Expand All @@ -36176,6 +36178,49 @@ components:
oneOf:
- $ref: "#/components/schemas/User"
- $ref: "#/components/schemas/DowntimeMonitorIncludedItem"
DowntimeRunAs:
description: |-
The principals (users, roles, or teams) allowed to act on behalf of the downtime.

**Note**: This feature is currently in Preview and may not be available for all organizations.
items:
$ref: "#/components/schemas/DowntimeRunAsItem"
readOnly: true
type: array
DowntimeRunAsItem:
description: A set of principals allowed to act on behalf of the downtime.
properties:
principals:
description: List of principals allowed to act on behalf of the downtime.
items:
$ref: "#/components/schemas/DowntimeRunAsPrincipal"
type: array
type: object
DowntimeRunAsPrincipal:
description: A principal (user, role, or team) allowed to act on behalf of the downtime.
properties:
id:
description: The ID of the principal.
example: "00000000-0000-1234-0000-000000000000"
type: string
type:
$ref: "#/components/schemas/DowntimeRunAsPrincipalType"
required:
- id
- type
type: object
DowntimeRunAsPrincipalType:
description: The type of principal allowed to act on behalf of the downtime.
enum:
- user
- role
- team
example: "user"
type: string
x-enum-varnames:
- USER
- ROLE
- TEAM
DowntimeScheduleCreateRequest:
description: Schedule for the downtime.
oneOf:
Expand Down Expand Up @@ -153062,6 +153107,17 @@ paths:
schema:
example: "created_by,monitor"
type: string
- description: |-
If `true`, include the `run_as` attribute in the response, which lists the principals allowed to
act on behalf of the downtime.

**Note**: This feature is currently in Preview and may not be available for all organizations.
in: query
name: with_run_as
required: false
schema:
default: false
type: boolean
responses:
"200":
content:
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/com/datadog/api/client/v2/api/DowntimesApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ public CompletableFuture<ApiResponse<DowntimeResponse>> createDowntimeWithHttpIn
/** Manage optional parameters to getDowntime. */
public static class GetDowntimeOptionalParameters {
private String include;
private Boolean withRunAs;

/**
* Set include.
Expand All @@ -337,6 +338,20 @@ public GetDowntimeOptionalParameters include(String include) {
this.include = include;
return this;
}

/**
* Set withRunAs.
*
* @param withRunAs If <code>true</code>, include the <code>run_as</code> attribute in the
* response, which lists the principals allowed to act on behalf of the downtime.
* <strong>Note</strong>: This feature is currently in Preview and may not be available for
* all organizations. (optional, default to false)
* @return GetDowntimeOptionalParameters
*/
public GetDowntimeOptionalParameters withRunAs(Boolean withRunAs) {
this.withRunAs = withRunAs;
return this;
}
}

/**
Expand Down Expand Up @@ -429,6 +444,7 @@ public ApiResponse<DowntimeResponse> getDowntimeWithHttpInfo(
400, "Missing the required parameter 'downtimeId' when calling getDowntime");
}
String include = parameters.include;
Boolean withRunAs = parameters.withRunAs;
// create path and map variables
String localVarPath =
"/api/v2/downtime/{downtime_id}"
Expand All @@ -439,6 +455,7 @@ public ApiResponse<DowntimeResponse> getDowntimeWithHttpInfo(
Map<String, String> localVarHeaderParams = new HashMap<String, String>();

localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_run_as", withRunAs));

Invocation.Builder builder =
apiClient.createBuilder(
Expand Down Expand Up @@ -482,6 +499,7 @@ public CompletableFuture<ApiResponse<DowntimeResponse>> getDowntimeWithHttpInfoA
return result;
}
String include = parameters.include;
Boolean withRunAs = parameters.withRunAs;
// create path and map variables
String localVarPath =
"/api/v2/downtime/{downtime_id}"
Expand All @@ -492,6 +510,7 @@ public CompletableFuture<ApiResponse<DowntimeResponse>> getDowntimeWithHttpInfoA
Map<String, String> localVarHeaderParams = new HashMap<String, String>();

localVarQueryParams.addAll(apiClient.parameterToPairs("", "include", include));
localVarQueryParams.addAll(apiClient.parameterToPairs("", "with_run_as", withRunAs));

Invocation.Builder builder;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
DowntimeResponseAttributes.JSON_PROPERTY_MUTE_FIRST_RECOVERY_NOTIFICATION,
DowntimeResponseAttributes.JSON_PROPERTY_NOTIFY_END_STATES,
DowntimeResponseAttributes.JSON_PROPERTY_NOTIFY_END_TYPES,
DowntimeResponseAttributes.JSON_PROPERTY_RUN_AS,
DowntimeResponseAttributes.JSON_PROPERTY_SCHEDULE,
DowntimeResponseAttributes.JSON_PROPERTY_SCOPE,
DowntimeResponseAttributes.JSON_PROPERTY_STATUS
Expand Down Expand Up @@ -67,6 +68,9 @@ public class DowntimeResponseAttributes {
public static final String JSON_PROPERTY_NOTIFY_END_TYPES = "notify_end_types";
private List<DowntimeNotifyEndStateActions> notifyEndTypes = null;

public static final String JSON_PROPERTY_RUN_AS = "run_as";
private List<DowntimeRunAsItem> runAs = null;

public static final String JSON_PROPERTY_SCHEDULE = "schedule";
private DowntimeScheduleResponse schedule;

Expand Down Expand Up @@ -326,6 +330,21 @@ public void setNotifyEndTypes(List<DowntimeNotifyEndStateActions> notifyEndTypes
this.notifyEndTypes = notifyEndTypes;
}

/**
* The principals (users, roles, or teams) allowed to act on behalf of the downtime.
*
* <p><strong>Note</strong>: This feature is currently in Preview and may not be available for all
* organizations.
*
* @return runAs
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_RUN_AS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<DowntimeRunAsItem> getRunAs() {
return runAs;
}

public DowntimeResponseAttributes schedule(DowntimeScheduleResponse schedule) {
this.schedule = schedule;
this.unparsed |= schedule.unparsed;
Expand Down Expand Up @@ -467,6 +486,7 @@ public boolean equals(Object o) {
downtimeResponseAttributes.muteFirstRecoveryNotification)
&& Objects.equals(this.notifyEndStates, downtimeResponseAttributes.notifyEndStates)
&& Objects.equals(this.notifyEndTypes, downtimeResponseAttributes.notifyEndTypes)
&& Objects.equals(this.runAs, downtimeResponseAttributes.runAs)
&& Objects.equals(this.schedule, downtimeResponseAttributes.schedule)
&& Objects.equals(this.scope, downtimeResponseAttributes.scope)
&& Objects.equals(this.status, downtimeResponseAttributes.status)
Expand All @@ -486,6 +506,7 @@ public int hashCode() {
muteFirstRecoveryNotification,
notifyEndStates,
notifyEndTypes,
runAs,
schedule,
scope,
status,
Expand All @@ -507,6 +528,7 @@ public String toString() {
.append("\n");
sb.append(" notifyEndStates: ").append(toIndentedString(notifyEndStates)).append("\n");
sb.append(" notifyEndTypes: ").append(toIndentedString(notifyEndTypes)).append("\n");
sb.append(" runAs: ").append(toIndentedString(runAs)).append("\n");
sb.append(" schedule: ").append(toIndentedString(schedule)).append("\n");
sb.append(" scope: ").append(toIndentedString(scope)).append("\n");
sb.append(" status: ").append(toIndentedString(status)).append("\n");
Expand Down
156 changes: 156 additions & 0 deletions src/main/java/com/datadog/api/client/v2/model/DowntimeRunAsItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
/*
* Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
* This product includes software developed at Datadog (https://www.datadoghq.com/).
* Copyright 2019-Present Datadog, Inc.
*/

package com.datadog.api.client.v2.model;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/** A set of principals allowed to act on behalf of the downtime. */
@JsonPropertyOrder({DowntimeRunAsItem.JSON_PROPERTY_PRINCIPALS})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class DowntimeRunAsItem {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_PRINCIPALS = "principals";
private List<DowntimeRunAsPrincipal> principals = null;

public DowntimeRunAsItem principals(List<DowntimeRunAsPrincipal> principals) {
this.principals = principals;
if (principals != null) {
for (DowntimeRunAsPrincipal item : principals) {
this.unparsed |= item.unparsed;
}
}
return this;
}

public DowntimeRunAsItem addPrincipalsItem(DowntimeRunAsPrincipal principalsItem) {
if (this.principals == null) {
this.principals = new ArrayList<>();
}
this.principals.add(principalsItem);
this.unparsed |= principalsItem.unparsed;
return this;
}

/**
* List of principals allowed to act on behalf of the downtime.
*
* @return principals
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_PRINCIPALS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<DowntimeRunAsPrincipal> getPrincipals() {
return principals;
}

public void setPrincipals(List<DowntimeRunAsPrincipal> principals) {
this.principals = principals;
if (principals != null) {
for (DowntimeRunAsPrincipal item : principals) {
this.unparsed |= item.unparsed;
}
}
}

/**
* A container for additional, undeclared properties. This is a holder for any undeclared
* properties as specified with the 'additionalProperties' keyword in the OAS document.
*/
private Map<String, Object> additionalProperties;

/**
* Set the additional (undeclared) property with the specified name and value. If the property
* does not already exist, create it otherwise replace it.
*
* @param key The arbitrary key to set
* @param value The associated value
* @return DowntimeRunAsItem
*/
@JsonAnySetter
public DowntimeRunAsItem putAdditionalProperty(String key, Object value) {
if (this.additionalProperties == null) {
this.additionalProperties = new HashMap<String, Object>();
}
this.additionalProperties.put(key, value);
return this;
}

/**
* Return the additional (undeclared) property.
*
* @return The additional properties
*/
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return additionalProperties;
}

/**
* Return the additional (undeclared) property with the specified name.
*
* @param key The arbitrary key to get
* @return The specific additional property for the given key
*/
public Object getAdditionalProperty(String key) {
if (this.additionalProperties == null) {
return null;
}
return this.additionalProperties.get(key);
}

/** Return true if this DowntimeRunAsItem object is equal to o. */
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DowntimeRunAsItem downtimeRunAsItem = (DowntimeRunAsItem) o;
return Objects.equals(this.principals, downtimeRunAsItem.principals)
&& Objects.equals(this.additionalProperties, downtimeRunAsItem.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(principals, additionalProperties);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DowntimeRunAsItem {\n");
sb.append(" principals: ").append(toIndentedString(principals)).append("\n");
sb.append(" additionalProperties: ")
.append(toIndentedString(additionalProperties))
.append("\n");
sb.append('}');
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
Loading
Loading