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
153 changes: 152 additions & 1 deletion .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29382,6 +29382,25 @@ components:
data:
$ref: "#/components/schemas/ListDeploymentRuleResponseData"
type: object
DeploymentGatesEvaluationConfiguration:
description: |-
Inline rule definitions for a deployment gate evaluation. When provided, rules are evaluated
directly from this configuration instead of using the pre-configured gate rules.
At least one rule is required.
properties:
dry_run:
description: Gate-level dry run. When enabled, the rules are evaluated normally but the gate always returns `pass`. The real result is visible in the Datadog UI.
example: false
type: boolean
rules:
description: The list of rules to evaluate. At least one rule is required.
items:
$ref: "#/components/schemas/DeploymentGatesEvaluationRule"
minItems: 1
type: array
required:
- rules
type: object
DeploymentGatesEvaluationRequest:
description: Request body for triggering a deployment gate evaluation.
properties:
Expand All @@ -29391,8 +29410,13 @@ components:
- data
type: object
DeploymentGatesEvaluationRequestAttributes:
description: Attributes for a deployment gate evaluation request.
description: |-
Attributes for a deployment gate evaluation request.
When `configuration` is provided, rules are evaluated inline from that configuration.
When omitted, rules are resolved from the pre-configured gate for the given service and environment.
properties:
configuration:
$ref: "#/components/schemas/DeploymentGatesEvaluationConfiguration"
env:
description: The environment of the deployment.
example: "staging"
Expand Down Expand Up @@ -29562,6 +29586,60 @@ components:
type: string
x-enum-varnames:
- DEPLOYMENT_GATES_EVALUATION_RESULT_RESPONSE
DeploymentGatesEvaluationRule:
description: A rule to evaluate as part of a deployment gate evaluation.
discriminator:
mapping:
faulty_deployment_detection: "#/components/schemas/DeploymentGatesFDDRule"
monitor: "#/components/schemas/DeploymentGatesMonitorRule"
propertyName: type
oneOf:
- $ref: "#/components/schemas/DeploymentGatesMonitorRule"
- $ref: "#/components/schemas/DeploymentGatesFDDRule"
DeploymentGatesFDDRule:
description: A faulty deployment detection rule to evaluate as part of a deployment gate evaluation.
properties:
dry_run:
description: Rule-level dry run. When enabled, the rule is evaluated normally but it always returns `pass`. The real result is visible in the Datadog UI.
example: false
type: boolean
name:
description: Human-readable name for this rule.
example: "apm faulty deployment"
type: string
options:
$ref: "#/components/schemas/DeploymentGatesFDDRuleOptions"
type:
$ref: "#/components/schemas/DeploymentGatesFDDRuleType"
required:
- type
- name
type: object
DeploymentGatesFDDRuleOptions:
description: Options for a `faulty_deployment_detection` rule.
properties:
duration:
description: Evaluation window in seconds. Maximum 7200 (2 hours).
example: 900
format: int64
maximum: 7200
type: integer
excluded_resources:
description: APM resource names to exclude from analysis.
example:
- "GET /healthcheck"
items:
type: string
type: array
type: object
DeploymentGatesFDDRuleType:
description: The type identifier for a faulty deployment detection rule.
enum:
- faulty_deployment_detection
example: faulty_deployment_detection
type: string
x-enum-varnames:
- FAULTY_DEPLOYMENT_DETECTION
DeploymentGatesListResponse:
description: Response containing a paginated list of deployment gates.
properties:
Expand Down Expand Up @@ -29596,6 +29674,49 @@ components:
minimum: 1
type: integer
type: object
DeploymentGatesMonitorRule:
description: A monitor rule to evaluate as part of a deployment gate evaluation.
properties:
dry_run:
description: Rule-level dry run. When enabled, the rule is evaluated normally but it always returns `pass`. The real result is visible in the Datadog UI.
example: false
type: boolean
name:
description: Human-readable name for this rule.
example: "error rate monitors"
type: string
options:
$ref: "#/components/schemas/DeploymentGatesMonitorRuleOptions"
type:
$ref: "#/components/schemas/DeploymentGatesMonitorRuleType"
required:
- type
- name
type: object
DeploymentGatesMonitorRuleOptions:
description: Options for a `monitor` rule.
properties:
duration:
description: Evaluation window in seconds. Maximum 7200 (2 hours).
example: 300
format: int64
maximum: 7200
type: integer
query:
description: Monitor search query.
example: "service:transaction-backend env:production"
type: string
required:
- query
type: object
DeploymentGatesMonitorRuleType:
description: The type identifier for a monitor rule.
enum:
- monitor
example: monitor
type: string
x-enum-varnames:
- MONITOR
DeploymentGatesRuleResponse:
description: The result of a single rule evaluation.
properties:
Expand Down Expand Up @@ -121740,12 +121861,17 @@ paths:
Triggers an asynchronous deployment gate evaluation for the given service and environment.
Returns an evaluation ID that can be used to poll for the result via the
`GET /api/v2/deployments/gates/evaluation/{id}` endpoint.

When the `configuration` attribute is provided, rules are evaluated inline from that configuration
and no pre-configured gate is required. When `configuration` is omitted, rules are resolved from the
gate pre-configured for the given service and environment via the Datadog UI, API, or Terraform.
operationId: TriggerDeploymentGatesEvaluation
requestBody:
content:
application/json:
examples:
default:
summary: Evaluate a pre-configured gate
value:
data:
attributes:
Expand All @@ -121755,6 +121881,31 @@ paths:
service: transaction-backend
version: v1.2.3
type: deployment_gates_evaluation_request
with-configuration:
summary: Evaluate with inline rule configuration
value:
data:
attributes:
configuration:
dry_run: false
rules:
- dry_run: false
name: error rate monitors
options:
duration: 300
query: "service:transaction-backend env:production"
type: monitor
- dry_run: false
name: apm faulty deployment
options:
duration: 900
excluded_resources:
- "GET /healthcheck"
type: faulty_deployment_detection
env: production
service: transaction-backend
version: 1.2.3
type: deployment_gates_evaluation_request
schema:
$ref: "#/components/schemas/DeploymentGatesEvaluationRequest"
required: true
Expand Down
4 changes: 4 additions & 0 deletions api/datadogV2/api_deployment_gates.go
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,10 @@ func (a *DeploymentGatesApi) ListDeploymentGates(ctx _context.Context, o ...List
// Triggers an asynchronous deployment gate evaluation for the given service and environment.
// Returns an evaluation ID that can be used to poll for the result via the
// `GET /api/v2/deployments/gates/evaluation/{id}` endpoint.
//
// When the `configuration` attribute is provided, rules are evaluated inline from that configuration
// and no pre-configured gate is required. When `configuration` is omitted, rules are resolved from the
// gate pre-configured for the given service and environment via the Datadog UI, API, or Terraform.
func (a *DeploymentGatesApi) TriggerDeploymentGatesEvaluation(ctx _context.Context, body DeploymentGatesEvaluationRequest) (DeploymentGatesEvaluationResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
Expand Down
138 changes: 138 additions & 0 deletions api/datadogV2/model_deployment_gates_evaluation_configuration.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
// 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 datadogV2

import (
"fmt"

"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
)

// DeploymentGatesEvaluationConfiguration Inline rule definitions for a deployment gate evaluation. When provided, rules are evaluated
// directly from this configuration instead of using the pre-configured gate rules.
// At least one rule is required.
type DeploymentGatesEvaluationConfiguration struct {
// Gate-level dry run. When enabled, the rules are evaluated normally but the gate always returns `pass`. The real result is visible in the Datadog UI.
DryRun *bool `json:"dry_run,omitempty"`
// The list of rules to evaluate. At least one rule is required.
Rules []DeploymentGatesEvaluationRule `json:"rules"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:"-"`
AdditionalProperties map[string]interface{} `json:"-"`
}

// NewDeploymentGatesEvaluationConfiguration instantiates a new DeploymentGatesEvaluationConfiguration object.
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed.
func NewDeploymentGatesEvaluationConfiguration(rules []DeploymentGatesEvaluationRule) *DeploymentGatesEvaluationConfiguration {
this := DeploymentGatesEvaluationConfiguration{}
this.Rules = rules
return &this
}

// NewDeploymentGatesEvaluationConfigurationWithDefaults instantiates a new DeploymentGatesEvaluationConfiguration object.
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set.
func NewDeploymentGatesEvaluationConfigurationWithDefaults() *DeploymentGatesEvaluationConfiguration {
this := DeploymentGatesEvaluationConfiguration{}
return &this
}

// GetDryRun returns the DryRun field value if set, zero value otherwise.
func (o *DeploymentGatesEvaluationConfiguration) GetDryRun() bool {
if o == nil || o.DryRun == nil {
var ret bool
return ret
}
return *o.DryRun
}

// GetDryRunOk returns a tuple with the DryRun field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *DeploymentGatesEvaluationConfiguration) GetDryRunOk() (*bool, bool) {
if o == nil || o.DryRun == nil {
return nil, false
}
return o.DryRun, true
}

// HasDryRun returns a boolean if a field has been set.
func (o *DeploymentGatesEvaluationConfiguration) HasDryRun() bool {
return o != nil && o.DryRun != nil
}

// SetDryRun gets a reference to the given bool and assigns it to the DryRun field.
func (o *DeploymentGatesEvaluationConfiguration) SetDryRun(v bool) {
o.DryRun = &v
}

// GetRules returns the Rules field value.
func (o *DeploymentGatesEvaluationConfiguration) GetRules() []DeploymentGatesEvaluationRule {
if o == nil {
var ret []DeploymentGatesEvaluationRule
return ret
}
return o.Rules
}

// GetRulesOk returns a tuple with the Rules field value
// and a boolean to check if the value has been set.
func (o *DeploymentGatesEvaluationConfiguration) GetRulesOk() (*[]DeploymentGatesEvaluationRule, bool) {
if o == nil {
return nil, false
}
return &o.Rules, true
}

// SetRules sets field value.
func (o *DeploymentGatesEvaluationConfiguration) SetRules(v []DeploymentGatesEvaluationRule) {
o.Rules = v
}

// MarshalJSON serializes the struct using spec logic.
func (o DeploymentGatesEvaluationConfiguration) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return datadog.Marshal(o.UnparsedObject)
}
if o.DryRun != nil {
toSerialize["dry_run"] = o.DryRun
}
toSerialize["rules"] = o.Rules

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return datadog.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *DeploymentGatesEvaluationConfiguration) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
DryRun *bool `json:"dry_run,omitempty"`
Rules *[]DeploymentGatesEvaluationRule `json:"rules"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
if all.Rules == nil {
return fmt.Errorf("required field rules missing")
}
additionalProperties := make(map[string]interface{})
if err = datadog.UnmarshalUseNumber(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"dry_run", "rules"})
} else {
return err
}
o.DryRun = all.DryRun
o.Rules = *all.Rules

if len(additionalProperties) > 0 {
o.AdditionalProperties = additionalProperties
}

return nil
}
Loading
Loading