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
4,892 changes: 2,446 additions & 2,446 deletions .generator/schemas/v1/openapi.yaml

Large diffs are not rendered by default.

26,331 changes: 13,196 additions & 13,135 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Create monitor deployment rule with monitor IDs returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.DeploymentGatesApi;
import com.datadog.api.client.v2.model.CreateDeploymentRuleParams;
import com.datadog.api.client.v2.model.CreateDeploymentRuleParamsData;
import com.datadog.api.client.v2.model.CreateDeploymentRuleParamsDataAttributes;
import com.datadog.api.client.v2.model.DeploymentRuleDataType;
import com.datadog.api.client.v2.model.DeploymentRuleOptionsMonitorId;
import com.datadog.api.client.v2.model.DeploymentRuleOptionsMonitorIds;
import com.datadog.api.client.v2.model.DeploymentRuleResponse;
import com.datadog.api.client.v2.model.DeploymentRulesOptions;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.createDeploymentRule", true);
DeploymentGatesApi apiInstance = new DeploymentGatesApi(defaultClient);

// there is a valid "deployment_gate" in the system
String DEPLOYMENT_GATE_DATA_ID = System.getenv("DEPLOYMENT_GATE_DATA_ID");

// there is a valid "monitor" in the system
Long MONITOR_ID = Long.parseLong(System.getenv("MONITOR_ID"));

CreateDeploymentRuleParams body =
new CreateDeploymentRuleParams()
.data(
new CreateDeploymentRuleParamsData()
.attributes(
new CreateDeploymentRuleParamsDataAttributes()
.dryRun(false)
.name("Specific monitor deployment rule")
.options(
new DeploymentRulesOptions(
new DeploymentRuleOptionsMonitorIds()
.monitorIds(
Collections.singletonList(
new DeploymentRuleOptionsMonitorId().id("7")))))
.type("monitor"))
.type(DeploymentRuleDataType.DEPLOYMENT_RULE));

try {
DeploymentRuleResponse result =
apiInstance.createDeploymentRule(DEPLOYMENT_GATE_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeploymentGatesApi#createDeploymentRule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Create monitor deployment rule with query returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.DeploymentGatesApi;
import com.datadog.api.client.v2.model.CreateDeploymentRuleParams;
import com.datadog.api.client.v2.model.CreateDeploymentRuleParamsData;
import com.datadog.api.client.v2.model.CreateDeploymentRuleParamsDataAttributes;
import com.datadog.api.client.v2.model.DeploymentRuleDataType;
import com.datadog.api.client.v2.model.DeploymentRuleOptionsMonitor;
import com.datadog.api.client.v2.model.DeploymentRuleResponse;
import com.datadog.api.client.v2.model.DeploymentRulesOptions;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setUnstableOperationEnabled("v2.createDeploymentRule", true);
DeploymentGatesApi apiInstance = new DeploymentGatesApi(defaultClient);

// there is a valid "deployment_gate" in the system
String DEPLOYMENT_GATE_DATA_ID = System.getenv("DEPLOYMENT_GATE_DATA_ID");

CreateDeploymentRuleParams body =
new CreateDeploymentRuleParams()
.data(
new CreateDeploymentRuleParamsData()
.attributes(
new CreateDeploymentRuleParamsDataAttributes()
.dryRun(false)
.name("Query monitor deployment rule")
.options(
new DeploymentRulesOptions(
new DeploymentRuleOptionsMonitor()
.query("service:transaction-backend env:production")))
.type("monitor"))
.type(DeploymentRuleDataType.DEPLOYMENT_RULE));

try {
DeploymentRuleResponse result =
apiInstance.createDeploymentRule(DEPLOYMENT_GATE_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling DeploymentGatesApi#createDeploymentRule");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import java.util.Objects;

/** Monitor options for deployment rules. */
/** Monitor query options for deployment rules. */
@JsonPropertyOrder({
DeploymentRuleOptionsMonitor.JSON_PROPERTY_DURATION,
DeploymentRuleOptionsMonitor.JSON_PROPERTY_FAIL_ON_NO_DATA,
Expand Down Expand Up @@ -117,7 +117,7 @@ public DeploymentRuleOptionsMonitor query(String query) {
}

/**
* Monitors that match this query are evaluated.
* A query that selects the monitors to evaluate.
*
* @return query
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
* 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.JsonCreator;
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.List;
import java.util.Objects;

/** A specific monitor and the groups to evaluate for it. */
@JsonPropertyOrder({
DeploymentRuleOptionsMonitorId.JSON_PROPERTY_GROUPS,
DeploymentRuleOptionsMonitorId.JSON_PROPERTY_ID
})
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class DeploymentRuleOptionsMonitorId {
@JsonIgnore public boolean unparsed = false;
public static final String JSON_PROPERTY_GROUPS = "groups";
private List<String> groups = new ArrayList<>();

public static final String JSON_PROPERTY_ID = "id";
private String id;

public DeploymentRuleOptionsMonitorId() {}

@JsonCreator
public DeploymentRuleOptionsMonitorId(
@JsonProperty(required = true, value = JSON_PROPERTY_GROUPS) List<String> groups,
@JsonProperty(required = true, value = JSON_PROPERTY_ID) String id) {
this.groups = groups;
this.id = id;
}

public DeploymentRuleOptionsMonitorId groups(List<String> groups) {
this.groups = groups;
return this;
}

public DeploymentRuleOptionsMonitorId addGroupsItem(String groupsItem) {
this.groups.add(groupsItem);
return this;
}

/**
* The exact monitor group names to evaluate. An empty array evaluates all groups.
*
* @return groups
*/
@JsonProperty(JSON_PROPERTY_GROUPS)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public List<String> getGroups() {
return groups;
}

public void setGroups(List<String> groups) {
this.groups = groups;
}

public DeploymentRuleOptionsMonitorId id(String id) {
this.id = id;
return this;
}

/**
* The monitor's decimal ID.
*
* @return id
*/
@JsonProperty(JSON_PROPERTY_ID)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

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

@Override
public int hashCode() {
return Objects.hash(groups, id);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DeploymentRuleOptionsMonitorId {\n");
sb.append(" groups: ").append(toIndentedString(groups)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).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