Skip to content

Commit b383ba4

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Add option to obfuscate extracted values from Synthetics multistep tests (#1473)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 00ec53c commit b383ba4

11 files changed

+41
-25
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.4",
7-
"regenerated": "2023-05-26 16:53:07.986428",
8-
"spec_repo_commit": "fa84acd1"
7+
"regenerated": "2023-05-26 17:55:29.217108",
8+
"spec_repo_commit": "c4844513"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.4",
12-
"regenerated": "2023-05-26 16:53:07.998601",
13-
"spec_repo_commit": "fa84acd1"
12+
"regenerated": "2023-05-26 17:55:29.229049",
13+
"spec_repo_commit": "c4844513"
1414
}
1515
}
1616
}

.generator/schemas/v1/openapi.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13746,6 +13746,9 @@ components:
1374613746
type: string
1374713747
parser:
1374813748
$ref: '#/components/schemas/SyntheticsVariableParser'
13749+
secure:
13750+
description: Determines whether or not the extracted value will be obfuscated.
13751+
type: boolean
1374913752
type:
1375013753
$ref: '#/components/schemas/SyntheticsGlobalVariableParseTestOptionsType'
1375113754
type: object

examples/v1/synthetics/CreateSyntheticsAPITest_1279271422.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
type=SyntheticsGlobalVariableParserType.RAW,
5454
),
5555
type=SyntheticsGlobalVariableParseTestOptionsType.HTTP_HEADER,
56+
secure=True,
5657
),
5758
],
5859
is_critical=True,

src/datadog_api_client/v1/model/synthetics_parsing_options.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ def openapi_types(_):
3232
"field": (str,),
3333
"name": (str,),
3434
"parser": (SyntheticsVariableParser,),
35+
"secure": (bool,),
3536
"type": (SyntheticsGlobalVariableParseTestOptionsType,),
3637
}
3738

3839
attribute_map = {
3940
"field": "field",
4041
"name": "name",
4142
"parser": "parser",
43+
"secure": "secure",
4244
"type": "type",
4345
}
4446

@@ -47,6 +49,7 @@ def __init__(
4749
field: Union[str, UnsetType] = unset,
4850
name: Union[str, UnsetType] = unset,
4951
parser: Union[SyntheticsVariableParser, UnsetType] = unset,
52+
secure: Union[bool, UnsetType] = unset,
5053
type: Union[SyntheticsGlobalVariableParseTestOptionsType, UnsetType] = unset,
5154
**kwargs,
5255
):
@@ -62,6 +65,9 @@ def __init__(
6265
:param parser: Details of the parser to use for the global variable.
6366
:type parser: SyntheticsVariableParser, optional
6467
68+
:param secure: Determines whether or not the extracted value will be obfuscated.
69+
:type secure: bool, optional
70+
6571
:param type: Property of the Synthetic Test Response to use for a Synthetic global variable.
6672
:type type: SyntheticsGlobalVariableParseTestOptionsType, optional
6773
"""
@@ -71,6 +77,8 @@ def __init__(
7177
kwargs["name"] = name
7278
if parser is not unset:
7379
kwargs["parser"] = parser
80+
if secure is not unset:
81+
kwargs["secure"] = secure
7482
if type is not unset:
7583
kwargs["type"] = type
7684
super().__init__(kwargs)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2023-01-05T15:20:23.898Z
1+
2023-05-23T13:41:47.597Z

tests/v1/cassettes/test_scenarios/test_create_a_global_variable_from_test_returns_ok_response.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
interactions:
22
- request:
3-
body: '{"config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"type":"http_header"}],"isCritical":true,"name":"request
3+
body: '{"config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"secure":true,"type":"http_header"}],"isCritical":true,"name":"request
44
is sent","request":{"method":"GET","timeout":10,"url":"https://datadoghq.com"},"retry":{"count":5,"interval":1000},"subtype":"http"}]},"locations":["aws:us-east-2"],"message":"BDD
5-
test payload: synthetics_api_test_multi_step_payload.json","name":"Test-Create_a_global_variable_from_test_returns_OK_response-1672932023","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_a_global_variable_from_test_returns_OK_response-1672932023","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"subtype":"multi","tags":["testing:api"],"type":"api"}'
5+
test payload: synthetics_api_test_multi_step_payload.json","name":"Test-Create_a_global_variable_from_test_returns_OK_response-1684849307","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_a_global_variable_from_test_returns_OK_response-1684849307","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"subtype":"multi","tags":["testing:api"],"type":"api"}'
66
headers:
77
accept:
88
- application/json
@@ -12,17 +12,17 @@ interactions:
1212
uri: https://api.datadoghq.com/api/v1/synthetics/tests/api
1313
response:
1414
body:
15-
string: '{"status":"live","public_id":"prg-fny-su9","tags":["testing:api"],"org_id":321813,"locations":["aws:us-east-2"],"message":"BDD
16-
test payload: synthetics_api_test_multi_step_payload.json","deleted_at":null,"name":"Test-Create_a_global_variable_from_test_returns_OK_response-1672932023","monitor_id":106967129,"type":"api","created_at":"2023-01-05T15:20:24.483020+00:00","modified_at":"2023-01-05T15:20:24.483020+00:00","subtype":"multi","config":{"steps":[{"retry":{"count":5,"interval":1000},"name":"request
17-
is sent","request":{"url":"https://datadoghq.com","method":"GET","timeout":10},"subtype":"http","allowFailure":true,"assertions":[{"operator":"is","type":"statusCode","target":200}],"isCritical":true,"id":"dg9-uxx-k65","extractedValues":[{"field":"server","parser":{"type":"raw"},"type":"http_header","name":"EXTRACTED_VALUE"}]}],"configVariables":[{"pattern":"content-type","type":"text","example":"content-type","name":"PROPERTY"}]},"options":{"accept_self_signed":false,"retry":{"count":3,"interval":1000},"min_location_failed":1,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"monitor_priority":5,"monitor_name":"Test-Create_a_global_variable_from_test_returns_OK_response-1672932023","tick_every":60}}'
15+
string: '{"public_id":"wk3-pn7-sn3","name":"Test-Create_a_global_variable_from_test_returns_OK_response-1684849307","status":"live","type":"api","tags":["testing:api"],"created_at":"2023-05-23T13:41:47.888352+00:00","modified_at":"2023-05-23T13:41:47.888352+00:00","config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"secure":true,"type":"http_header"}],"isCritical":true,"name":"request
16+
is sent","request":{"method":"GET","timeout":10,"url":"https://datadoghq.com"},"retry":{"count":5,"interval":1000},"subtype":"http","id":"ymn-tzt-isn"}]},"message":"BDD
17+
test payload: synthetics_api_test_multi_step_payload.json","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_a_global_variable_from_test_returns_OK_response-1684849307","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"multi","deleted_at":null,"monitor_id":119820627,"org_id":321813}'
1818
headers:
1919
content-type:
2020
- application/json
2121
status:
2222
code: 200
2323
message: OK
2424
- request:
25-
body: '{"description":"","name":"GLOBAL_VARIABLE_PAYLOAD_TESTCREATEAGLOBALVARIABLEFROMTESTRETURNSOKRESPONSE1672932023","parse_test_options":{"localVariableName":"EXTRACTED_VALUE","type":"local_variable"},"parse_test_public_id":"prg-fny-su9","tags":[],"value":{"options":{"totp_parameters":{"digits":6,"refresh_interval":30}},"secure":false,"value":""}}'
25+
body: '{"description":"","name":"GLOBAL_VARIABLE_PAYLOAD_TESTCREATEAGLOBALVARIABLEFROMTESTRETURNSOKRESPONSE1684849307","parse_test_options":{"localVariableName":"EXTRACTED_VALUE","type":"local_variable"},"parse_test_public_id":"wk3-pn7-sn3","tags":[],"value":{"options":{"totp_parameters":{"digits":6,"refresh_interval":30}},"secure":false,"value":""}}'
2626
headers:
2727
accept:
2828
- application/json
@@ -32,7 +32,7 @@ interactions:
3232
uri: https://api.datadoghq.com/api/v1/synthetics/variables
3333
response:
3434
body:
35-
string: '{"parse_test_options":{"type":"local_variable","localVariableName":"EXTRACTED_VALUE"},"parse_test_extracted_at":null,"description":"","tags":[],"last_error":null,"is_totp":null,"value":{"options":{"totp_parameters":{"digits":6,"refresh_interval":30}},"value":"","secure":false},"parse_test_public_id":"prg-fny-su9","parse_test_name":null,"type":"variable","id":"2dcbf35a-34a9-4254-8ddb-417593377a20","name":"GLOBAL_VARIABLE_PAYLOAD_TESTCREATEAGLOBALVARIABLEFROMTESTRETURNSOKRESPONSE1672932023"}
35+
string: '{"id":"c1b94a97-87df-440f-b5fc-ef7f391bf07a","name":"GLOBAL_VARIABLE_PAYLOAD_TESTCREATEAGLOBALVARIABLEFROMTESTRETURNSOKRESPONSE1684849307","description":"","type":"variable","tags":[],"parse_test_public_id":"wk3-pn7-sn3","parse_test_name":null,"parse_test_options":{"localVariableName":"EXTRACTED_VALUE","type":"local_variable"},"parse_test_extracted_at":null,"is_totp":null,"is_fido":null,"last_error":null,"value":{"options":{"totp_parameters":{"digits":6,"refresh_interval":30}},"secure":false,"value":""}}
3636
3737
'
3838
headers:
@@ -47,7 +47,7 @@ interactions:
4747
accept:
4848
- '*/*'
4949
method: DELETE
50-
uri: https://api.datadoghq.com/api/v1/synthetics/variables/2dcbf35a-34a9-4254-8ddb-417593377a20
50+
uri: https://api.datadoghq.com/api/v1/synthetics/variables/c1b94a97-87df-440f-b5fc-ef7f391bf07a
5151
response:
5252
body:
5353
string: ''
@@ -58,7 +58,7 @@ interactions:
5858
code: 200
5959
message: OK
6060
- request:
61-
body: '{"public_ids":["prg-fny-su9"]}'
61+
body: '{"public_ids":["wk3-pn7-sn3"]}'
6262
headers:
6363
accept:
6464
- application/json
@@ -68,7 +68,7 @@ interactions:
6868
uri: https://api.datadoghq.com/api/v1/synthetics/tests/delete
6969
response:
7070
body:
71-
string: '{"deleted_tests":[{"deleted_at":"2023-01-05T15:20:26.202732+00:00","public_id":"prg-fny-su9"}]}
71+
string: '{"deleted_tests":[{"public_id":"wk3-pn7-sn3","deleted_at":"2023-05-23T13:41:48.789772+00:00"}]}
7272
7373
'
7474
headers:
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2022-08-30T12:59:30.516Z
1+
2023-05-22T14:08:52.406Z

tests/v1/cassettes/test_scenarios/test_create_an_api_test_with_multi_subtype_returns_ok_returns_the_created_test_details_response.yaml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
interactions:
22
- request:
3-
body: '{"config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"type":"http_header"}],"isCritical":true,"name":"request
3+
body: '{"config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"secure":true,"type":"http_header"}],"isCritical":true,"name":"request
44
is sent","request":{"method":"GET","timeout":10,"url":"https://datadoghq.com"},"retry":{"count":5,"interval":1000},"subtype":"http"}]},"locations":["aws:us-east-2"],"message":"BDD
5-
test payload: synthetics_api_test_multi_step_payload.json","name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1661864370","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1661864370","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"subtype":"multi","tags":["testing:api"],"type":"api"}'
5+
test payload: synthetics_api_test_multi_step_payload.json","name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1684764532","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1684764532","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"subtype":"multi","tags":["testing:api"],"type":"api"}'
66
headers:
77
accept:
88
- application/json
@@ -12,17 +12,17 @@ interactions:
1212
uri: https://api.datadoghq.com/api/v1/synthetics/tests/api
1313
response:
1414
body:
15-
string: '{"status":"live","public_id":"mtz-ccy-e3x","tags":["testing:api"],"org_id":321813,"locations":["aws:us-east-2"],"message":"BDD
16-
test payload: synthetics_api_test_multi_step_payload.json","deleted_at":null,"name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1661864370","monitor_id":81568663,"type":"api","created_at":"2022-08-30T12:59:31.130267+00:00","modified_at":"2022-08-30T12:59:31.130267+00:00","subtype":"multi","config":{"steps":[{"retry":{"count":5,"interval":1000},"name":"request
17-
is sent","request":{"url":"https://datadoghq.com","method":"GET","timeout":10},"subtype":"http","allowFailure":true,"assertions":[{"operator":"is","type":"statusCode","target":200}],"isCritical":true,"id":"vst-9t6-t7t","extractedValues":[{"field":"server","parser":{"type":"raw"},"type":"http_header","name":"EXTRACTED_VALUE"}]}],"configVariables":[{"pattern":"content-type","type":"text","example":"content-type","name":"PROPERTY"}]},"options":{"accept_self_signed":false,"retry":{"count":3,"interval":1000},"min_location_failed":1,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"monitor_priority":5,"monitor_name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1661864370","tick_every":60}}'
15+
string: '{"public_id":"i52-inf-ua8","name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1684764532","status":"live","type":"api","tags":["testing:api"],"created_at":"2023-05-22T14:08:52.875670+00:00","modified_at":"2023-05-22T14:08:52.875670+00:00","config":{"configVariables":[{"example":"content-type","name":"PROPERTY","pattern":"content-type","type":"text"}],"steps":[{"allowFailure":true,"assertions":[{"operator":"is","target":200,"type":"statusCode"}],"extractedValues":[{"field":"server","name":"EXTRACTED_VALUE","parser":{"type":"raw"},"secure":true,"type":"http_header"}],"isCritical":true,"name":"request
16+
is sent","request":{"method":"GET","timeout":10,"url":"https://datadoghq.com"},"retry":{"count":5,"interval":1000},"subtype":"http","id":"enf-w74-k4y"}]},"message":"BDD
17+
test payload: synthetics_api_test_multi_step_payload.json","options":{"accept_self_signed":false,"allow_insecure":true,"follow_redirects":true,"min_failure_duration":10,"min_location_failed":1,"monitor_name":"Test-Create_an_API_test_with_multi_subtype_returns_OK_Returns_the_created_test_details_response-1684764532","monitor_priority":5,"retry":{"count":3,"interval":1000},"tick_every":60},"locations":["aws:us-east-2"],"subtype":"multi","deleted_at":null,"monitor_id":119714203,"org_id":569509}'
1818
headers:
1919
content-type:
2020
- application/json
2121
status:
2222
code: 200
2323
message: OK
2424
- request:
25-
body: '{"public_ids":["mtz-ccy-e3x"]}'
25+
body: '{"public_ids":["i52-inf-ua8"]}'
2626
headers:
2727
accept:
2828
- application/json
@@ -32,7 +32,9 @@ interactions:
3232
uri: https://api.datadoghq.com/api/v1/synthetics/tests/delete
3333
response:
3434
body:
35-
string: '{"deleted_tests":[{"deleted_at":"2022-08-30T12:59:36.624525+00:00","public_id":"mtz-ccy-e3x"}]}'
35+
string: '{"deleted_tests":[{"public_id":"i52-inf-ua8","deleted_at":"2023-05-22T14:08:53.980399+00:00"}]}
36+
37+
'
3638
headers:
3739
content-type:
3840
- application/json

tests/v1/features/given.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@
199199
"parameters": [
200200
{
201201
"name": "body",
202-
"value": "{\n \"config\": {\n \"configVariables\": [\n {\n \"example\": \"content-type\",\n \"name\": \"PROPERTY\",\n \"pattern\": \"content-type\",\n \"type\": \"text\"\n }\n ],\n \"steps\": [\n {\n \"allowFailure\": true,\n \"assertions\": [\n {\n \"operator\": \"is\",\n \"type\": \"statusCode\",\n \"target\": 200\n }\n ],\n \"extractedValues\": [\n {\n \"field\": \"server\",\n \"name\": \"EXTRACTED_VALUE\",\n \"parser\": {\n \"type\": \"raw\"\n },\n \"type\": \"http_header\"\n }\n ],\n \"isCritical\": true,\n \"name\": \"request is sent\",\n \"request\": {\n \"method\": \"GET\",\n \"timeout\": 10,\n \"url\": \"https://datadoghq.com\"\n },\n \"retry\": {\n \"count\": 5,\n \"interval\": 1000\n },\n \"subtype\": \"http\"\n }\n ]\n },\n \"locations\": [\"aws:us-east-2\"],\n \"message\": \"BDD test payload: synthetics_api_test_multi_step_payload.json\",\n \"name\": \"{{ unique }}\",\n \"options\": {\n \"accept_self_signed\": false,\n \"allow_insecure\": true,\n \"follow_redirects\": true,\n \"min_failure_duration\": 10,\n \"min_location_failed\": 1,\n \"monitor_name\": \"{{ unique }}\",\n \"monitor_priority\": 5,\n \"retry\": { \"count\": 3, \"interval\": 1000 },\n \"tick_every\": 60\n },\n \"subtype\": \"multi\",\n \"tags\": [\"testing:api\"],\n \"type\": \"api\"\n}\n"
202+
"value": "{\n \"config\": {\n \"configVariables\": [\n {\n \"example\": \"content-type\",\n \"name\": \"PROPERTY\",\n \"pattern\": \"content-type\",\n \"type\": \"text\"\n }\n ],\n \"steps\": [\n {\n \"allowFailure\": true,\n \"assertions\": [\n {\n \"operator\": \"is\",\n \"type\": \"statusCode\",\n \"target\": 200\n }\n ],\n \"extractedValues\": [\n {\n \"field\": \"server\",\n \"name\": \"EXTRACTED_VALUE\",\n \"parser\": {\n \"type\": \"raw\"\n },\n \"type\": \"http_header\",\n \"secure\": true\n }\n ],\n \"isCritical\": true,\n \"name\": \"request is sent\",\n \"request\": {\n \"method\": \"GET\",\n \"timeout\": 10,\n \"url\": \"https://datadoghq.com\"\n },\n \"retry\": {\n \"count\": 5,\n \"interval\": 1000\n },\n \"subtype\": \"http\"\n }\n ]\n },\n \"locations\": [\"aws:us-east-2\"],\n \"message\": \"BDD test payload: synthetics_api_test_multi_step_payload.json\",\n \"name\": \"{{ unique }}\",\n \"options\": {\n \"accept_self_signed\": false,\n \"allow_insecure\": true,\n \"follow_redirects\": true,\n \"min_failure_duration\": 10,\n \"min_location_failed\": 1,\n \"monitor_name\": \"{{ unique }}\",\n \"monitor_priority\": 5,\n \"retry\": { \"count\": 3, \"interval\": 1000 },\n \"tick_every\": 60\n },\n \"subtype\": \"multi\",\n \"tags\": [\"testing:api\"],\n \"type\": \"api\"\n}\n"
203203
}
204204
],
205205
"step": "there is a valid \"synthetics_api_test_multi_step\" in the system",

0 commit comments

Comments
 (0)