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.

45 changes: 45 additions & 0 deletions examples/v2/deployment-gates/CreateDeploymentRule_2423265690.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Create monitor deployment rule with monitor IDs returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.createDeploymentRule"] = true;
const apiInstance = new v2.DeploymentGatesApi(configuration);

// there is a valid "deployment_gate" in the system
const DEPLOYMENT_GATE_DATA_ID = process.env.DEPLOYMENT_GATE_DATA_ID as string;

// there is a valid "monitor" in the system

const params: v2.DeploymentGatesApiCreateDeploymentRuleRequest = {
body: {
data: {
attributes: {
dryRun: false,
name: "Specific monitor deployment rule",
options: {
monitorIds: [
{
id: "7",
groups: [],
},
],
},
type: "monitor",
},
type: "deployment_rule",
},
},
gateId: DEPLOYMENT_GATE_DATA_ID,
};

apiInstance
.createDeploymentRule(params)
.then((data: v2.DeploymentRuleResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
38 changes: 38 additions & 0 deletions examples/v2/deployment-gates/CreateDeploymentRule_4286388136.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Create monitor deployment rule with query returns "OK" response
*/

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.createDeploymentRule"] = true;
const apiInstance = new v2.DeploymentGatesApi(configuration);

// there is a valid "deployment_gate" in the system
const DEPLOYMENT_GATE_DATA_ID = process.env.DEPLOYMENT_GATE_DATA_ID as string;

const params: v2.DeploymentGatesApiCreateDeploymentRuleRequest = {
body: {
data: {
attributes: {
dryRun: false,
name: "Query monitor deployment rule",
options: {
query: "service:transaction-backend env:production",
},
type: "monitor",
},
type: "deployment_rule",
},
},
gateId: DEPLOYMENT_GATE_DATA_ID,
};

apiInstance
.createDeploymentRule(params)
.then((data: v2.DeploymentRuleResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
21 changes: 21 additions & 0 deletions features/generated-test/test-runner-data/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4893,6 +4893,27 @@
"scenario": "Create deployment rule returns \"OK\" response",
"version": "v2"
},
{
"feature": "Deployment Gates",
"feature_file": "../../v2/deployment_gates.feature",
"file": "v2/deployment-gates/create-monitor-deployment-rule-with-monitor-ids-returns-ok-response.json",
"scenario": "Create monitor deployment rule with monitor IDs returns \"OK\" response",
"version": "v2"
},
{
"feature": "Deployment Gates",
"feature_file": "../../v2/deployment_gates.feature",
"file": "v2/deployment-gates/create-monitor-deployment-rule-with-query-and-monitor-ids-returns-bad-request-response.json",
"scenario": "Create monitor deployment rule with query and monitor IDs returns \"Bad Request\" response",
"version": "v2"
},
{
"feature": "Deployment Gates",
"feature_file": "../../v2/deployment_gates.feature",
"file": "v2/deployment-gates/create-monitor-deployment-rule-with-query-returns-ok-response.json",
"scenario": "Create monitor deployment rule with query returns \"OK\" response",
"version": "v2"
},
{
"feature": "Deployment Gates",
"feature_file": "../../v2/deployment_gates.feature",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"api": "DeploymentGates",
"expected_status": 200,
"feature": "Deployment Gates",
"id": "v2/Deployment Gates/Create monitor deployment rule with monitor IDs returns \"OK\" response",
"operation_id": "CreateDeploymentRule",
"request": {
"body": {
"schema": {
"format": null,
"ref": "CreateDeploymentRuleParams",
"type": "object"
},
"source": "inline",
"value": {
"data": {
"attributes": {
"dry_run": false,
"name": "Specific monitor deployment rule",
"options": {
"monitor_ids": [
{
"groups": [],
"id": "{{ monitor.id }}"
}
]
},
"type": "monitor"
},
"type": "deployment_rule"
}
}
},
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [
{
"explode": null,
"in": "path",
"name": "gate_id",
"required": true,
"schema": {
"format": null,
"ref": null,
"type": "string"
},
"source": {
"path": "deployment_gate.data.id",
"type": "fixture"
},
"style": null
}
],
"path": "/api/v2/deployment_gates/{gate_id}/rules"
},
"scenario": "Create monitor deployment rule with monitor IDs returns \"OK\" response",
"schema_version": 1,
"version": "v2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"api": "DeploymentGates",
"expected_status": 400,
"feature": "Deployment Gates",
"id": "v2/Deployment Gates/Create monitor deployment rule with query and monitor IDs returns \"Bad Request\" response",
"operation_id": "CreateDeploymentRule",
"request": {
"body": {
"schema": {
"format": null,
"ref": "CreateDeploymentRuleParams",
"type": "object"
},
"source": "inline",
"value": {
"data": {
"attributes": {
"dry_run": false,
"name": "Ambiguous monitor deployment rule",
"options": {
"monitor_ids": [
{
"groups": [],
"id": "123456"
}
],
"query": "service:transaction-backend env:production"
},
"type": "monitor"
},
"type": "deployment_rule"
}
}
},
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [
{
"explode": null,
"in": "path",
"name": "gate_id",
"required": true,
"schema": {
"format": null,
"ref": null,
"type": "string"
},
"source": {
"path": "deployment_gate.data.id",
"type": "fixture"
},
"style": null
}
],
"path": "/api/v2/deployment_gates/{gate_id}/rules"
},
"scenario": "Create monitor deployment rule with query and monitor IDs returns \"Bad Request\" response",
"schema_version": 1,
"version": "v2"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"api": "DeploymentGates",
"expected_status": 200,
"feature": "Deployment Gates",
"id": "v2/Deployment Gates/Create monitor deployment rule with query returns \"OK\" response",
"operation_id": "CreateDeploymentRule",
"request": {
"body": {
"schema": {
"format": null,
"ref": "CreateDeploymentRuleParams",
"type": "object"
},
"source": "inline",
"value": {
"data": {
"attributes": {
"dry_run": false,
"name": "Query monitor deployment rule",
"options": {
"query": "service:transaction-backend env:production"
},
"type": "monitor"
},
"type": "deployment_rule"
}
}
},
"content_type": "application/json",
"method": "POST",
"pagination": false,
"parameters": [
{
"explode": null,
"in": "path",
"name": "gate_id",
"required": true,
"schema": {
"format": null,
"ref": null,
"type": "string"
},
"source": {
"path": "deployment_gate.data.id",
"type": "fixture"
},
"style": null
}
],
"path": "/api/v2/deployment_gates/{gate_id}/rules"
},
"scenario": "Create monitor deployment rule with query returns \"OK\" response",
"schema_version": 1,
"version": "v2"
}
31 changes: 31 additions & 0 deletions features/v2/deployment_gates.feature
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,37 @@ Feature: Deployment Gates
When the request is sent
Then the response status is 200 OK

@team:DataDog/ci-app-backend
Scenario: Create monitor deployment rule with monitor IDs returns "OK" response
Given there is a valid "deployment_gate" in the system
And there is a valid "monitor" in the system
And operation "CreateDeploymentRule" enabled
And new "CreateDeploymentRule" request
And request contains "gate_id" parameter from "deployment_gate.data.id"
And body with value {"data": {"attributes": {"dry_run": false, "name": "Specific monitor deployment rule", "options": {"monitor_ids": [{"id": "{{ monitor.id }}", "groups": []}]}, "type": "monitor"}, "type": "deployment_rule"}}
When the request is sent
Then the response status is 200 OK

@team:DataDog/ci-app-backend
Scenario: Create monitor deployment rule with query and monitor IDs returns "Bad Request" response
Given there is a valid "deployment_gate" in the system
And operation "CreateDeploymentRule" enabled
And new "CreateDeploymentRule" request
And request contains "gate_id" parameter from "deployment_gate.data.id"
And body with value {"data": {"attributes": {"dry_run": false, "name": "Ambiguous monitor deployment rule", "options": {"query": "service:transaction-backend env:production", "monitor_ids": [{"id": "123456", "groups": []}]}, "type": "monitor"}, "type": "deployment_rule"}}
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/ci-app-backend
Scenario: Create monitor deployment rule with query returns "OK" response
Given there is a valid "deployment_gate" in the system
And operation "CreateDeploymentRule" enabled
And new "CreateDeploymentRule" request
And request contains "gate_id" parameter from "deployment_gate.data.id"
And body with value {"data": {"attributes": {"dry_run": false, "name": "Query monitor deployment rule", "options": {"query": "service:transaction-backend env:production"}, "type": "monitor"}, "type": "deployment_rule"}}
When the request is sent
Then the response status is 200 OK

@team:DataDog/ci-app-backend
Scenario: Delete deployment gate returns "Bad Request" response
Given operation "DeleteDeploymentGate" enabled
Expand Down
2 changes: 2 additions & 0 deletions packages/datadog-api-client-v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3852,6 +3852,8 @@ export { DeploymentRelationshipData } from "./models/DeploymentRelationshipData"
export { DeploymentRuleDataType } from "./models/DeploymentRuleDataType";
export { DeploymentRuleOptionsFaultyDeploymentDetection } from "./models/DeploymentRuleOptionsFaultyDeploymentDetection";
export { DeploymentRuleOptionsMonitor } from "./models/DeploymentRuleOptionsMonitor";
export { DeploymentRuleOptionsMonitorId } from "./models/DeploymentRuleOptionsMonitorId";
export { DeploymentRuleOptionsMonitorIds } from "./models/DeploymentRuleOptionsMonitorIds";
export { DeploymentRuleResponse } from "./models/DeploymentRuleResponse";
export { DeploymentRuleResponseData } from "./models/DeploymentRuleResponseData";
export { DeploymentRuleResponseDataAttributes } from "./models/DeploymentRuleResponseDataAttributes";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { AttributeTypeMap } from "../../datadog-api-client-common/util";

/**
* Monitor options for deployment rules.
* Monitor query options for deployment rules.
*/
export class DeploymentRuleOptionsMonitor {
/**
Expand All @@ -23,7 +23,7 @@ export class DeploymentRuleOptionsMonitor {
*/
"failOnNoGroupsFound"?: boolean;
/**
* Monitors that match this query are evaluated.
* A query that selects the monitors to evaluate.
*/
"query": string;
/**
Expand Down
Loading
Loading