Skip to content

Commit eff5c27

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 507d0354 of spec repo
1 parent beab1ed commit eff5c27

File tree

13 files changed

+747
-4
lines changed

13 files changed

+747
-4
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2024-09-25 18:54:10.257631",
8-
"spec_repo_commit": "1fa8186c"
7+
"regenerated": "2024-09-26 16:23:52.142020",
8+
"spec_repo_commit": "507d0354"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2024-09-25 18:54:10.272586",
13-
"spec_repo_commit": "1fa8186c"
12+
"regenerated": "2024-09-26 16:23:52.156380",
13+
"spec_repo_commit": "507d0354"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15182,6 +15182,32 @@ components:
1518215182
- EDGE_LAPTOP_LARGE
1518315183
- EDGE_TABLET
1518415184
- EDGE_MOBILE_SMALL
15185+
SyntheticsFetchUptimesPayload:
15186+
description: Object containing IDs of Synthetic tests and a timeframe.
15187+
properties:
15188+
from_ts:
15189+
description: Timestamp in seconds (Unix epoch) for the start of uptime.
15190+
example: 0
15191+
format: int64
15192+
type: integer
15193+
public_ids:
15194+
description: An array of Synthetic test IDs you want to delete.
15195+
example: []
15196+
items:
15197+
description: A Synthetic test ID.
15198+
example: abc-def-123
15199+
type: string
15200+
type: array
15201+
to_ts:
15202+
description: Timestamp in seconds (Unix epoch) for the end of uptime.
15203+
example: 0
15204+
format: int64
15205+
type: integer
15206+
required:
15207+
- from_ts
15208+
- to_ts
15209+
- public_ids
15210+
type: object
1518515211
SyntheticsGetAPITestLatestResultsResponse:
1518615212
description: Object with the latest Synthetic API test run.
1518715213
properties:
@@ -16481,6 +16507,24 @@ components:
1648116507
description: String Port number to use when performing the test. Supports templated
1648216508
variables.
1648316509
type: string
16510+
SyntheticsTestUptime:
16511+
description: Object containing the uptime for a Synthetic test ID.
16512+
properties:
16513+
from_ts:
16514+
description: Timestamp in seconds for the start of uptime.
16515+
format: int64
16516+
type: integer
16517+
overall:
16518+
$ref: '#/components/schemas/SyntheticsUptime'
16519+
public_id:
16520+
description: A Synthetic test ID.
16521+
example: abc-def-123
16522+
type: string
16523+
to_ts:
16524+
description: Timestamp in seconds for the end of uptime.
16525+
format: int64
16526+
type: integer
16527+
type: object
1648416528
SyntheticsTiming:
1648516529
description: 'Object containing all metrics and their values collected for a
1648616530
Synthetic API test.
@@ -16604,6 +16648,62 @@ components:
1660416648
new_status:
1660516649
$ref: '#/components/schemas/SyntheticsTestPauseStatus'
1660616650
type: object
16651+
SyntheticsUptime:
16652+
description: Object containing the uptime information.
16653+
properties:
16654+
errors:
16655+
description: An array of error objects returned while querying the history
16656+
data for the service level objective.
16657+
items:
16658+
$ref: '#/components/schemas/SLOHistoryResponseErrorWithType'
16659+
nullable: true
16660+
type: array
16661+
group:
16662+
description: The location name
16663+
example: name
16664+
type: string
16665+
history:
16666+
description: 'The state transition history for the monitor, represented
16667+
as an array of
16668+
16669+
pairs. Each pair is an array where the first element is the transition
16670+
timestamp
16671+
16672+
in Unix epoch format (integer) and the second element is the state (integer).
16673+
16674+
For the state, an integer value of `0` indicates uptime, `1` indicates
16675+
downtime,
16676+
16677+
and `2` indicates no data.'
16678+
example:
16679+
- - 1579212382
16680+
- 0
16681+
items:
16682+
description: An array of transitions
16683+
example:
16684+
- 1579212382
16685+
- 0
16686+
items:
16687+
description: A timeseries data point which is a tuple of (timestamp,
16688+
value).
16689+
format: double
16690+
type: number
16691+
maxItems: 2
16692+
minItems: 2
16693+
type: array
16694+
type: array
16695+
span_precision:
16696+
description: The number of decimal places to which the SLI value is accurate
16697+
for the given from-to timestamps.
16698+
example: 2.0
16699+
format: double
16700+
type: number
16701+
uptime:
16702+
description: The overall uptime.
16703+
example: 99.99
16704+
format: double
16705+
type: number
16706+
type: object
1660716707
SyntheticsVariableParser:
1660816708
description: Details of the parser to use for the global variable.
1660916709
example:
@@ -31950,6 +32050,49 @@ paths:
3195032050
operator: OR
3195132051
permissions:
3195232052
- synthetics_write
32053+
/api/v1/synthetics/tests/uptimes:
32054+
post:
32055+
description: Fetch uptime for multiple Synthetic tests by ID.
32056+
operationId: FetchUptimes
32057+
requestBody:
32058+
content:
32059+
application/json:
32060+
schema:
32061+
$ref: '#/components/schemas/SyntheticsFetchUptimesPayload'
32062+
description: Public ID list of the Synthetic tests and timeframe.
32063+
required: true
32064+
responses:
32065+
'200':
32066+
content:
32067+
application/json:
32068+
schema:
32069+
items:
32070+
$ref: '#/components/schemas/SyntheticsTestUptime'
32071+
type: array
32072+
description: OK.
32073+
'400':
32074+
content:
32075+
application/json:
32076+
schema:
32077+
$ref: '#/components/schemas/APIErrorResponse'
32078+
description: '- JSON format is wrong'
32079+
'403':
32080+
content:
32081+
application/json:
32082+
schema:
32083+
$ref: '#/components/schemas/APIErrorResponse'
32084+
description: Forbidden
32085+
'429':
32086+
$ref: '#/components/responses/TooManyRequestsResponse'
32087+
security:
32088+
- apiKeyAuth: []
32089+
appKeyAuth: []
32090+
- AuthZ:
32091+
- synthetics_read
32092+
summary: Fetch uptime for multiple tests
32093+
tags:
32094+
- Synthetics
32095+
x-codegen-request-body-name: body
3195332096
/api/v1/synthetics/tests/{public_id}:
3195432097
get:
3195532098
description: Get the detailed configuration associated with a Synthetic test.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2024-09-11T13:09:28.349Z

cassettes/features/v1/synthetics/Fetch-uptime-for-multiple-tests-returns-OK-response.yml

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Fetch uptime for multiple tests returns "OK." response
2+
3+
require "datadog_api_client"
4+
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
5+
6+
body = DatadogAPIClient::V1::SyntheticsFetchUptimesPayload.new({
7+
from_ts: 1726041488,
8+
public_ids: [
9+
"p8m-9gw-nte",
10+
],
11+
to_ts: 1726055954,
12+
})
13+
p api_instance.fetch_uptimes(body)

features/scenarios_model_mapping.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,9 @@
746746
"v1.TriggerCITests" => {
747747
"body" => "SyntheticsCITestBody",
748748
},
749+
"v1.FetchUptimes" => {
750+
"body" => "SyntheticsFetchUptimesPayload",
751+
},
749752
"v1.GetTest" => {
750753
"public_id" => "String",
751754
},

features/v1/synthetics.feature

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,23 @@ Feature: Synthetics
413413
Then the response status is 200 OK
414414
And the response "name" is equal to "{{ synthetics_api_test.name }}-updated"
415415

416+
@generated @skip @team:DataDog/synthetics-ct
417+
Scenario: Fetch uptime for multiple tests returns "- JSON format is wrong" response
418+
Given new "FetchUptimes" request
419+
And body with value {"from_ts": 0, "public_ids": [], "to_ts": 0}
420+
When the request is sent
421+
Then the response status is 400 - JSON format is wrong
422+
423+
@replay-only @team:DataDog/synthetics-ct
424+
Scenario: Fetch uptime for multiple tests returns "OK." response
425+
Given new "FetchUptimes" request
426+
And body with value {"from_ts": 1726041488, "public_ids": ["p8m-9gw-nte"], "to_ts": 1726055954}
427+
When the request is sent
428+
Then the response status is 200 OK
429+
And the response "[0].public_id" is equal to "p8m-9gw-nte"
430+
And the response "[0].overall.uptime" is equal to 83.05682373046875
431+
And the response "[0].overall.history" has length 2
432+
416433
@generated @skip @team:DataDog/synthetics-ct
417434
Scenario: Get a browser test result returns "- Synthetic Monitoring is not activated for the user" response
418435
Given new "GetBrowserTestResult" request

features/v1/undo.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,6 +1208,12 @@
12081208
"type": "idempotent"
12091209
}
12101210
},
1211+
"FetchUptimes": {
1212+
"tag": "Synthetics",
1213+
"undo": {
1214+
"type": "idempotent"
1215+
}
1216+
},
12111217
"GetTest": {
12121218
"tag": "Synthetics",
12131219
"undo": {

lib/datadog_api_client/inflector.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,7 @@ def overrides
619619
"v1.synthetics_delete_tests_response" => "SyntheticsDeleteTestsResponse",
620620
"v1.synthetics_device" => "SyntheticsDevice",
621621
"v1.synthetics_device_id" => "SyntheticsDeviceID",
622+
"v1.synthetics_fetch_uptimes_payload" => "SyntheticsFetchUptimesPayload",
622623
"v1.synthetics_get_api_test_latest_results_response" => "SyntheticsGetAPITestLatestResultsResponse",
623624
"v1.synthetics_get_browser_test_latest_results_response" => "SyntheticsGetBrowserTestLatestResultsResponse",
624625
"v1.synthetics_global_variable" => "SyntheticsGlobalVariable",
@@ -678,13 +679,15 @@ def overrides
678679
"v1.synthetics_test_request_certificate_item" => "SyntheticsTestRequestCertificateItem",
679680
"v1.synthetics_test_request_port" => "SyntheticsTestRequestPort",
680681
"v1.synthetics_test_request_proxy" => "SyntheticsTestRequestProxy",
682+
"v1.synthetics_test_uptime" => "SyntheticsTestUptime",
681683
"v1.synthetics_timing" => "SyntheticsTiming",
682684
"v1.synthetics_trigger_body" => "SyntheticsTriggerBody",
683685
"v1.synthetics_trigger_ci_test_location" => "SyntheticsTriggerCITestLocation",
684686
"v1.synthetics_trigger_ci_test_run_result" => "SyntheticsTriggerCITestRunResult",
685687
"v1.synthetics_trigger_ci_tests_response" => "SyntheticsTriggerCITestsResponse",
686688
"v1.synthetics_trigger_test" => "SyntheticsTriggerTest",
687689
"v1.synthetics_update_test_pause_status_payload" => "SyntheticsUpdateTestPauseStatusPayload",
690+
"v1.synthetics_uptime" => "SyntheticsUptime",
688691
"v1.synthetics_variable_parser" => "SyntheticsVariableParser",
689692
"v1.synthetics_warning_type" => "SyntheticsWarningType",
690693
"v1.table_widget_cell_display_mode" => "TableWidgetCellDisplayMode",

lib/datadog_api_client/v1/api/synthetics_api.rb

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,73 @@ def edit_global_variable_with_http_info(variable_id, body, opts = {})
560560
return data, status_code, headers
561561
end
562562

563+
# Fetch uptime for multiple tests.
564+
#
565+
# @see #fetch_uptimes_with_http_info
566+
def fetch_uptimes(body, opts = {})
567+
data, _status_code, _headers = fetch_uptimes_with_http_info(body, opts)
568+
data
569+
end
570+
571+
# Fetch uptime for multiple tests.
572+
#
573+
# Fetch uptime for multiple Synthetic tests by ID.
574+
#
575+
# @param body [SyntheticsFetchUptimesPayload] Public ID list of the Synthetic tests and timeframe.
576+
# @param opts [Hash] the optional parameters
577+
# @return [Array<(Array<SyntheticsTestUptime>, Integer, Hash)>] Array<SyntheticsTestUptime> data, response status code and response headers
578+
def fetch_uptimes_with_http_info(body, opts = {})
579+
580+
if @api_client.config.debugging
581+
@api_client.config.logger.debug 'Calling API: SyntheticsAPI.fetch_uptimes ...'
582+
end
583+
# verify the required parameter 'body' is set
584+
if @api_client.config.client_side_validation && body.nil?
585+
fail ArgumentError, "Missing the required parameter 'body' when calling SyntheticsAPI.fetch_uptimes"
586+
end
587+
# resource path
588+
local_var_path = '/api/v1/synthetics/tests/uptimes'
589+
590+
# query parameters
591+
query_params = opts[:query_params] || {}
592+
593+
# header parameters
594+
header_params = opts[:header_params] || {}
595+
# HTTP header 'Accept' (if needed)
596+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
597+
# HTTP header 'Content-Type'
598+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
599+
600+
# form parameters
601+
form_params = opts[:form_params] || {}
602+
603+
# http body (model)
604+
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
605+
606+
# return_type
607+
return_type = opts[:debug_return_type] || 'Array<SyntheticsTestUptime>'
608+
609+
# auth_names
610+
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
611+
612+
new_options = opts.merge(
613+
:operation => :fetch_uptimes,
614+
:header_params => header_params,
615+
:query_params => query_params,
616+
:form_params => form_params,
617+
:body => post_body,
618+
:auth_names => auth_names,
619+
:return_type => return_type,
620+
:api_version => "V1"
621+
)
622+
623+
data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)
624+
if @api_client.config.debugging
625+
@api_client.config.logger.debug "API called: SyntheticsAPI#fetch_uptimes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
626+
end
627+
return data, status_code, headers
628+
end
629+
563630
# Get an API test.
564631
#
565632
# @see #get_api_test_with_http_info

0 commit comments

Comments
 (0)