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.

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 services/deployment_gates/src/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export { DeploymentGatesRuleResponse } from "./models/DeploymentGatesRuleRespons
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
@@ -1,7 +1,7 @@
import { AttributeTypeMap } from "@datadog/datadog-api-client";

/**
* Monitor options for deployment rules.
* Monitor query options for deployment rules.
*/
export class DeploymentRuleOptionsMonitor {
/**
Expand All @@ -17,7 +17,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
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { AttributeTypeMap } from "@datadog/datadog-api-client";

/**
* A specific monitor and the groups to evaluate for it.
*/
export class DeploymentRuleOptionsMonitorId {
/**
* The exact monitor group names to evaluate. An empty array evaluates all groups.
*/
"groups": Array<string>;
/**
* The monitor's decimal ID.
*/
"id": string;
/**
* @ignore
*/
"_unparsed"?: boolean;

/**
* @ignore
*/
static readonly attributeTypeMap: AttributeTypeMap = {
groups: {
baseName: "groups",
type: "Array<string>",
required: true,
},
id: {
baseName: "id",
type: "string",
required: true,
},
};

/**
* @ignore
*/
static getAttributeTypeMap(): AttributeTypeMap {
return DeploymentRuleOptionsMonitorId.attributeTypeMap;
}

public constructor() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { AttributeTypeMap } from "@datadog/datadog-api-client";

import { DeploymentRuleOptionsMonitorId } from "./DeploymentRuleOptionsMonitorId";

/**
* Specific monitor options for deployment rules.
*/
export class DeploymentRuleOptionsMonitorIds {
/**
* Seconds the monitors need to stay in OK status for the rule to pass.
*/
"duration"?: number;
/**
* Whether the rule should fail if a selected monitor group is in a NO DATA state.
*/
"failOnNoData"?: boolean;
/**
* Whether the rule should fail if no monitor groups are found for the selected monitors.
*/
"failOnNoGroupsFound"?: boolean;
/**
* A non-empty list of specific monitors to evaluate.
*/
"monitorIds": Array<DeploymentRuleOptionsMonitorId>;
/**
* Seconds to wait after a deployment starts before evaluating the monitors' statuses.
*/
"warmup"?: number;
/**
* @ignore
*/
"_unparsed"?: boolean;

/**
* @ignore
*/
static readonly attributeTypeMap: AttributeTypeMap = {
duration: {
baseName: "duration",
type: "number",
format: "int64",
},
failOnNoData: {
baseName: "fail_on_no_data",
type: "boolean",
},
failOnNoGroupsFound: {
baseName: "fail_on_no_groups_found",
type: "boolean",
},
monitorIds: {
baseName: "monitor_ids",
type: "Array<DeploymentRuleOptionsMonitorId>",
required: true,
},
warmup: {
baseName: "warmup",
type: "number",
format: "int64",
},
};

/**
* @ignore
*/
static getAttributeTypeMap(): AttributeTypeMap {
return DeploymentRuleOptionsMonitorIds.attributeTypeMap;
}

public constructor() {}
}
Loading
Loading