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
81 changes: 81 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17075,6 +17075,12 @@ components:
required:
- id
type: object
DeploymentGateRulesResponse:
description: Response for a deployment gate rules.
properties:
data:
$ref: '#/components/schemas/ListDeploymentRuleResponseData'
type: object
DeploymentMetadata:
description: Metadata object containing the publication creation information.
properties:
Expand Down Expand Up @@ -30199,6 +30205,37 @@ components:
type: string
x-enum-varnames:
- LIST_CONNECTIONS_RESPONSE
ListDeploymentRuleResponseData:
description: Data for a list of deployment rules.
properties:
attributes:
$ref: '#/components/schemas/ListDeploymentRulesResponseDataAttributes'
id:
description: Unique identifier of the deployment rule.
example: 1111-2222-3333-4444-555566667777
type: string
type:
$ref: '#/components/schemas/ListDeploymentRulesDataType'
required:
- type
- attributes
- id
type: object
ListDeploymentRulesDataType:
description: List deployment rule resource type.
enum:
- list_deployment_rules
example: list_deployment_rules
type: string
x-enum-varnames:
- LIST_DEPLOYMENT_RULES
ListDeploymentRulesResponseDataAttributes:
properties:
rules:
items:
$ref: '#/components/schemas/DeploymentRuleResponseDataAttributes'
type: array
type: object
ListDevicesResponse:
description: List devices response.
properties:
Expand Down Expand Up @@ -66236,6 +66273,50 @@ paths:

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/deployment_gates/{gate_id}/rules:
get:
description: Endpoint to get rules for a deployment gate.
operationId: GetDeploymentGateRules
parameters:
- description: The ID of the deployment gate.
in: path
name: gate_id
required: true
schema:
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/DeploymentGateRulesResponse'
description: OK
'400':
$ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
'500':
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPCIAppErrors'
description: Internal Server Error
security:
- apiKeyAuth: []
appKeyAuth: []
summary: Get rules for a deployment gate
tags:
- Deployment Gates
x-permission:
operator: OR
permissions:
- deployment_gates_read
x-unstable: '**Note**: This endpoint is in preview and may be subject to change.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
post:
description: Endpoint to create a deployment rule. A gate for the rule must
already exist.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2025-12-10T19:27:22.958Z

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions examples/v2/deployment-gates/GetDeploymentGateRules.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Get rules for a deployment gate returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.get_deployment_gate_rules".to_sym] = true
end
api_instance = DatadogAPIClient::V2::DeploymentGatesAPI.new

# there is a valid "deployment_gate" in the system
DEPLOYMENT_GATE_DATA_ID = ENV["DEPLOYMENT_GATE_DATA_ID"]
p api_instance.get_deployment_gate_rules(DEPLOYMENT_GATE_DATA_ID)
3 changes: 3 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1890,6 +1890,9 @@
"v2.CreateDeploymentGate" => {
"body" => "CreateDeploymentGateParams",
},
"v2.GetDeploymentGateRules" => {
"gate_id" => "String",
},
"v2.CreateDeploymentRule" => {
"gate_id" => "String",
"body" => "CreateDeploymentRuleParams",
Expand Down
17 changes: 17 additions & 0 deletions features/v2/deployment_gates.feature
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,23 @@ Feature: Deployment Gates
When the request is sent
Then the response status is 200 OK

@generated @skip @team:DataDog/ci-app-backend
Scenario: Get rules for a deployment gate returns "Bad request." response
Given operation "GetDeploymentGateRules" enabled
And new "GetDeploymentGateRules" request
And request contains "gate_id" parameter from "REPLACE.ME"
When the request is sent
Then the response status is 400 Bad request.

@team:DataDog/ci-app-backend
Scenario: Get rules for a deployment gate returns "OK" response
Given there is a valid "deployment_gate" in the system
And operation "GetDeploymentGateRules" enabled
And new "GetDeploymentGateRules" request
And request contains "gate_id" parameter from "deployment_gate.data.id"
When the request is sent
Then the response status is 200 OK

@team:DataDog/ci-app-backend
Scenario: Update deployment gate returns "Bad Request" response
Given operation "UpdateDeploymentGate" enabled
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,12 @@
"type": "unsafe"
}
},
"GetDeploymentGateRules": {
"tag": "Deployment Gates",
"undo": {
"type": "safe"
}
},
"CreateDeploymentRule": {
"tag": "Deployment Gates",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ def initialize
"v2.delete_deployment_gate": false,
"v2.delete_deployment_rule": false,
"v2.get_deployment_gate": false,
"v2.get_deployment_gate_rules": false,
"v2.get_deployment_rule": false,
"v2.update_deployment_gate": false,
"v2.update_deployment_rule": false,
Expand Down
4 changes: 4 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,7 @@ def overrides
"v2.deployment_gate_response_data_attributes" => "DeploymentGateResponseDataAttributes",
"v2.deployment_gate_response_data_attributes_created_by" => "DeploymentGateResponseDataAttributesCreatedBy",
"v2.deployment_gate_response_data_attributes_updated_by" => "DeploymentGateResponseDataAttributesUpdatedBy",
"v2.deployment_gate_rules_response" => "DeploymentGateRulesResponse",
"v2.deployment_metadata" => "DeploymentMetadata",
"v2.deployment_relationship" => "DeploymentRelationship",
"v2.deployment_relationship_data" => "DeploymentRelationshipData",
Expand Down Expand Up @@ -2794,6 +2795,9 @@ def overrides
"v2.list_connections_response_data_attributes_connections_items" => "ListConnectionsResponseDataAttributesConnectionsItems",
"v2.list_connections_response_data_attributes_connections_items_join" => "ListConnectionsResponseDataAttributesConnectionsItemsJoin",
"v2.list_connections_response_data_type" => "ListConnectionsResponseDataType",
"v2.list_deployment_rule_response_data" => "ListDeploymentRuleResponseData",
"v2.list_deployment_rules_data_type" => "ListDeploymentRulesDataType",
"v2.list_deployment_rules_response_data_attributes" => "ListDeploymentRulesResponseDataAttributes",
"v2.list_devices_response" => "ListDevicesResponse",
"v2.list_devices_response_metadata" => "ListDevicesResponseMetadata",
"v2.list_devices_response_metadata_page" => "ListDevicesResponseMetadataPage",
Expand Down
71 changes: 71 additions & 0 deletions lib/datadog_api_client/v2/api/deployment_gates_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,77 @@ def get_deployment_gate_with_http_info(id, opts = {})
return data, status_code, headers
end

# Get rules for a deployment gate.
#
# @see #get_deployment_gate_rules_with_http_info
def get_deployment_gate_rules(gate_id, opts = {})
data, _status_code, _headers = get_deployment_gate_rules_with_http_info(gate_id, opts)
data
end

# Get rules for a deployment gate.
#
# Endpoint to get rules for a deployment gate.
#
# @param gate_id [String] The ID of the deployment gate.
# @param opts [Hash] the optional parameters
# @return [Array<(DeploymentGateRulesResponse, Integer, Hash)>] DeploymentGateRulesResponse data, response status code and response headers
def get_deployment_gate_rules_with_http_info(gate_id, opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.get_deployment_gate_rules".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_deployment_gate_rules")
else
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_deployment_gate_rules"))
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DeploymentGatesAPI.get_deployment_gate_rules ...'
end
# verify the required parameter 'gate_id' is set
if @api_client.config.client_side_validation && gate_id.nil?
fail ArgumentError, "Missing the required parameter 'gate_id' when calling DeploymentGatesAPI.get_deployment_gate_rules"
end
# resource path
local_var_path = '/api/v2/deployment_gates/{gate_id}/rules'.sub('{gate_id}', CGI.escape(gate_id.to_s).gsub('%2F', '/'))

# query parameters
query_params = opts[:query_params] || {}

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])

# form parameters
form_params = opts[:form_params] || {}

# http body (model)
post_body = opts[:debug_body]

# return_type
return_type = opts[:debug_return_type] || 'DeploymentGateRulesResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

new_options = opts.merge(
:operation => :get_deployment_gate_rules,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type,
:api_version => "V2"
)

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DeploymentGatesAPI#get_deployment_gate_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Get deployment rule.
#
# @see #get_deployment_rule_with_http_info
Expand Down
Loading
Loading