Skip to content

Commit 9d86026

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit e96b02b of spec repo
1 parent b25c67e commit 9d86026

File tree

10 files changed

+288
-0
lines changed

10 files changed

+288
-0
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16644,6 +16644,14 @@ components:
1664416644
required:
1664516645
- id
1664616646
type: object
16647+
DeploymentGateRulesResponse:
16648+
description: Response for a deployment gate rules.
16649+
properties:
16650+
data:
16651+
items:
16652+
$ref: '#/components/schemas/DeploymentRuleResponseData'
16653+
type: array
16654+
type: object
1664716655
DeploymentMetadata:
1664816656
description: Metadata object containing the publication creation information.
1664916657
properties:
@@ -64391,6 +64399,50 @@ paths:
6439164399

6439264400
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6439364401
/api/v2/deployment_gates/{gate_id}/rules:
64402+
get:
64403+
description: Endpoint to get rules for a deployment gate.
64404+
operationId: GetDeploymentGateRules
64405+
parameters:
64406+
- description: The ID of the deployment gate.
64407+
in: path
64408+
name: gate_id
64409+
required: true
64410+
schema:
64411+
type: string
64412+
responses:
64413+
'200':
64414+
content:
64415+
application/json:
64416+
schema:
64417+
$ref: '#/components/schemas/DeploymentGateRulesResponse'
64418+
description: OK
64419+
'400':
64420+
$ref: '#/components/responses/HTTPCDGatesBadRequestResponse'
64421+
'401':
64422+
$ref: '#/components/responses/UnauthorizedResponse'
64423+
'403':
64424+
$ref: '#/components/responses/ForbiddenResponse'
64425+
'429':
64426+
$ref: '#/components/responses/TooManyRequestsResponse'
64427+
'500':
64428+
content:
64429+
application/json:
64430+
schema:
64431+
$ref: '#/components/schemas/HTTPCIAppErrors'
64432+
description: Internal Server Error
64433+
security:
64434+
- apiKeyAuth: []
64435+
appKeyAuth: []
64436+
summary: Get rules for a deployment gate
64437+
tags:
64438+
- Deployment Gates
64439+
x-permission:
64440+
operator: OR
64441+
permissions:
64442+
- deployment_gates_read
64443+
x-unstable: '**Note**: This endpoint is in preview and may be subject to change.
64444+
64445+
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
6439464446
post:
6439564447
description: Endpoint to create a deployment rule. A gate for the rule must
6439664448
already exist.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Get rules for a deployment gate returns "OK" response
2+
3+
require "datadog_api_client"
4+
DatadogAPIClient.configure do |config|
5+
config.unstable_operations["v2.get_deployment_gate_rules".to_sym] = true
6+
end
7+
api_instance = DatadogAPIClient::V2::DeploymentGatesAPI.new
8+
p api_instance.get_deployment_gate_rules("gate_id")

features/scenarios_model_mapping.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,6 +1862,9 @@
18621862
"v2.CreateDeploymentGate" => {
18631863
"body" => "CreateDeploymentGateParams",
18641864
},
1865+
"v2.GetDeploymentGateRules" => {
1866+
"gate_id" => "String",
1867+
},
18651868
"v2.CreateDeploymentRule" => {
18661869
"gate_id" => "String",
18671870
"body" => "CreateDeploymentRuleParams",

features/v2/deployment_gates.feature

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,22 @@ Feature: Deployment Gates
207207
When the request is sent
208208
Then the response status is 200 OK
209209

210+
@generated @skip @team:DataDog/ci-app-backend
211+
Scenario: Get rules for a deployment gate returns "Bad request." response
212+
Given operation "GetDeploymentGateRules" enabled
213+
And new "GetDeploymentGateRules" request
214+
And request contains "gate_id" parameter from "REPLACE.ME"
215+
When the request is sent
216+
Then the response status is 400 Bad request.
217+
218+
@generated @skip @team:DataDog/ci-app-backend
219+
Scenario: Get rules for a deployment gate returns "OK" response
220+
Given operation "GetDeploymentGateRules" enabled
221+
And new "GetDeploymentGateRules" request
222+
And request contains "gate_id" parameter from "REPLACE.ME"
223+
When the request is sent
224+
Then the response status is 200 OK
225+
210226
@team:DataDog/ci-app-backend
211227
Scenario: Update deployment gate returns "Bad Request" response
212228
Given operation "UpdateDeploymentGate" enabled

features/v2/given.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,18 @@
358358
"tag": "Deployment Gates",
359359
"operationId": "CreateDeploymentGate"
360360
},
361+
{
362+
"parameters": [
363+
{
364+
"name": "gate_id",
365+
"source": "deployment_gate.data.id"
366+
}
367+
],
368+
"step": "there is a valid \"deployment_rule\" in the system",
369+
"key": "deployment_rule",
370+
"tag": "Deployment Gates",
371+
"operationId": "GetDeploymentGateRules"
372+
},
361373
{
362374
"parameters": [
363375
{

features/v2/undo.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,23 @@
13231323
"type": "unsafe"
13241324
}
13251325
},
1326+
"GetDeploymentGateRules": {
1327+
"tag": "Deployment Gates",
1328+
"undo": {
1329+
"operationId": "DeleteDeploymentRule",
1330+
"parameters": [
1331+
{
1332+
"name": "gate_id",
1333+
"source": "data.attributes.gate_id"
1334+
},
1335+
{
1336+
"name": "id",
1337+
"source": "data.id"
1338+
}
1339+
],
1340+
"type": "unsafe"
1341+
}
1342+
},
13261343
"CreateDeploymentRule": {
13271344
"tag": "Deployment Gates",
13281345
"undo": {

lib/datadog_api_client/configuration.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def initialize
240240
"v2.delete_deployment_gate": false,
241241
"v2.delete_deployment_rule": false,
242242
"v2.get_deployment_gate": false,
243+
"v2.get_deployment_gate_rules": false,
243244
"v2.get_deployment_rule": false,
244245
"v2.update_deployment_gate": false,
245246
"v2.update_deployment_rule": false,

lib/datadog_api_client/inflector.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1892,6 +1892,7 @@ def overrides
18921892
"v2.deployment_gate_response_data_attributes" => "DeploymentGateResponseDataAttributes",
18931893
"v2.deployment_gate_response_data_attributes_created_by" => "DeploymentGateResponseDataAttributesCreatedBy",
18941894
"v2.deployment_gate_response_data_attributes_updated_by" => "DeploymentGateResponseDataAttributesUpdatedBy",
1895+
"v2.deployment_gate_rules_response" => "DeploymentGateRulesResponse",
18951896
"v2.deployment_metadata" => "DeploymentMetadata",
18961897
"v2.deployment_relationship" => "DeploymentRelationship",
18971898
"v2.deployment_relationship_data" => "DeploymentRelationshipData",

lib/datadog_api_client/v2/api/deployment_gates_api.rb

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,77 @@ def get_deployment_gate_with_http_info(id, opts = {})
392392
return data, status_code, headers
393393
end
394394

395+
# Get rules for a deployment gate.
396+
#
397+
# @see #get_deployment_gate_rules_with_http_info
398+
def get_deployment_gate_rules(gate_id, opts = {})
399+
data, _status_code, _headers = get_deployment_gate_rules_with_http_info(gate_id, opts)
400+
data
401+
end
402+
403+
# Get rules for a deployment gate.
404+
#
405+
# Endpoint to get rules for a deployment gate.
406+
#
407+
# @param gate_id [String] The ID of the deployment gate.
408+
# @param opts [Hash] the optional parameters
409+
# @return [Array<(DeploymentGateRulesResponse, Integer, Hash)>] DeploymentGateRulesResponse data, response status code and response headers
410+
def get_deployment_gate_rules_with_http_info(gate_id, opts = {})
411+
unstable_enabled = @api_client.config.unstable_operations["v2.get_deployment_gate_rules".to_sym]
412+
if unstable_enabled
413+
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_deployment_gate_rules")
414+
else
415+
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_deployment_gate_rules"))
416+
end
417+
418+
if @api_client.config.debugging
419+
@api_client.config.logger.debug 'Calling API: DeploymentGatesAPI.get_deployment_gate_rules ...'
420+
end
421+
# verify the required parameter 'gate_id' is set
422+
if @api_client.config.client_side_validation && gate_id.nil?
423+
fail ArgumentError, "Missing the required parameter 'gate_id' when calling DeploymentGatesAPI.get_deployment_gate_rules"
424+
end
425+
# resource path
426+
local_var_path = '/api/v2/deployment_gates/{gate_id}/rules'.sub('{gate_id}', CGI.escape(gate_id.to_s).gsub('%2F', '/'))
427+
428+
# query parameters
429+
query_params = opts[:query_params] || {}
430+
431+
# header parameters
432+
header_params = opts[:header_params] || {}
433+
# HTTP header 'Accept' (if needed)
434+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
435+
436+
# form parameters
437+
form_params = opts[:form_params] || {}
438+
439+
# http body (model)
440+
post_body = opts[:debug_body]
441+
442+
# return_type
443+
return_type = opts[:debug_return_type] || 'DeploymentGateRulesResponse'
444+
445+
# auth_names
446+
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]
447+
448+
new_options = opts.merge(
449+
:operation => :get_deployment_gate_rules,
450+
:header_params => header_params,
451+
:query_params => query_params,
452+
:form_params => form_params,
453+
:body => post_body,
454+
:auth_names => auth_names,
455+
:return_type => return_type,
456+
:api_version => "V2"
457+
)
458+
459+
data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
460+
if @api_client.config.debugging
461+
@api_client.config.logger.debug "API called: DeploymentGatesAPI#get_deployment_gate_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
462+
end
463+
return data, status_code, headers
464+
end
465+
395466
# Get deployment rule.
396467
#
397468
# @see #get_deployment_rule_with_http_info
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
=begin
2+
#Datadog API V2 Collection
3+
4+
#Collection of all Datadog Public endpoints.
5+
6+
The version of the OpenAPI document: 1.0
7+
Contact: support@datadoghq.com
8+
Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator
9+
10+
Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
11+
This product includes software developed at Datadog (https://www.datadoghq.com/).
12+
Copyright 2020-Present Datadog, Inc.
13+
14+
=end
15+
16+
require 'date'
17+
require 'time'
18+
19+
module DatadogAPIClient::V2
20+
# Response for a deployment gate rules.
21+
class DeploymentGateRulesResponse
22+
include BaseGenericModel
23+
24+
#
25+
attr_accessor :data
26+
27+
attr_accessor :additional_properties
28+
29+
# Attribute mapping from ruby-style variable name to JSON key.
30+
# @!visibility private
31+
def self.attribute_map
32+
{
33+
:'data' => :'data'
34+
}
35+
end
36+
37+
# Attribute type mapping.
38+
# @!visibility private
39+
def self.openapi_types
40+
{
41+
:'data' => :'Array<DeploymentRuleResponseData>'
42+
}
43+
end
44+
45+
# Initializes the object
46+
# @param attributes [Hash] Model attributes in the form of hash
47+
# @!visibility private
48+
def initialize(attributes = {})
49+
if (!attributes.is_a?(Hash))
50+
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::DeploymentGateRulesResponse` initialize method"
51+
end
52+
53+
self.additional_properties = {}
54+
# check to see if the attribute exists and convert string to symbol for hash key
55+
attributes = attributes.each_with_object({}) { |(k, v), h|
56+
if (!self.class.attribute_map.key?(k.to_sym))
57+
self.additional_properties[k.to_sym] = v
58+
else
59+
h[k.to_sym] = v
60+
end
61+
}
62+
63+
if attributes.key?(:'data')
64+
if (value = attributes[:'data']).is_a?(Array)
65+
self.data = value
66+
end
67+
end
68+
end
69+
70+
# Returns the object in the form of hash, with additionalProperties support.
71+
# @return [Hash] Returns the object in the form of hash
72+
# @!visibility private
73+
def to_hash
74+
hash = {}
75+
self.class.attribute_map.each_pair do |attr, param|
76+
value = self.send(attr)
77+
if value.nil?
78+
is_nullable = self.class.openapi_nullable.include?(attr)
79+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
80+
end
81+
82+
hash[param] = _to_hash(value)
83+
end
84+
self.additional_properties.each_pair do |attr, value|
85+
hash[attr] = value
86+
end
87+
hash
88+
end
89+
90+
# Checks equality by comparing each attribute.
91+
# @param o [Object] Object to be compared
92+
# @!visibility private
93+
def ==(o)
94+
return true if self.equal?(o)
95+
self.class == o.class &&
96+
data == o.data &&
97+
additional_properties == o.additional_properties
98+
end
99+
100+
# Calculates hash code according to all attributes.
101+
# @return [Integer] Hash code
102+
# @!visibility private
103+
def hash
104+
[data, additional_properties].hash
105+
end
106+
end
107+
end

0 commit comments

Comments
 (0)