Skip to content

Commit dad5aef

Browse files
author
ci.datadog-api-spec
committed
Regenerate client from commit 5c0faa1 of spec repo
1 parent bcdfb9e commit dad5aef

11 files changed

Lines changed: 148 additions & 2 deletions

File tree

‎.generator/schemas/v1/openapi.yaml‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19275,6 +19275,9 @@ components:
1927519275
description: Unique identifier of the global variable.
1927619276
readOnly: true
1927719277
type: string
19278+
is_email:
19279+
description: Whether this global variable is a persistent email variable with an email address generated by Datadog.
19280+
type: boolean
1927819281
is_fido:
1927919282
description: Determines if the global variable is a FIDO variable.
1928019283
type: boolean
@@ -19365,7 +19368,7 @@ components:
1936519368
- REGEX
1936619369
- X_PATH
1936719370
SyntheticsGlobalVariableRequest:
19368-
description: Details of the global variable to create.
19371+
description: Details of the global variable to create or update.
1936919372
properties:
1937019373
attributes:
1937119374
$ref: "#/components/schemas/SyntheticsGlobalVariableAttributes"
@@ -19377,6 +19380,13 @@ components:
1937719380
description: Unique identifier of the global variable.
1937819381
readOnly: true
1937919382
type: string
19383+
is_email:
19384+
description: |-
19385+
Whether this global variable is a persistent email variable. Set to `true` and omit `value` when creating
19386+
a persistent email variable; Datadog generates an immutable email address. When updating an existing
19387+
persistent email variable, omit `value` and either keep `is_email` set to `true` or omit it.
19388+
The variable cannot be converted to or from a persistent email variable.
19389+
type: boolean
1938019390
is_fido:
1938119391
description: Determines if the global variable is a FIDO variable.
1938219392
type: boolean

‎.generator/schemas/v2/openapi.yaml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123866,6 +123866,9 @@ components:
123866123866
description: Unique identifier of the global variable.
123867123867
readOnly: true
123868123868
type: string
123869+
is_email:
123870+
description: Whether this global variable is a persistent email variable with an email address generated by Datadog.
123871+
type: boolean
123869123872
is_fido:
123870123873
description: Determines if the global variable is a FIDO variable.
123871123874
type: boolean
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
Create a persistent email global variable returns a generated address
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
8+
from datadog_api_client.v1.model.synthetics_global_variable_request import SyntheticsGlobalVariableRequest
9+
10+
body = SyntheticsGlobalVariableRequest(
11+
name="PERSISTENT_EMAIL_EXAMPLESYNTHETIC",
12+
description="Persistent email variable",
13+
tags=[],
14+
is_email=True,
15+
)
16+
17+
configuration = Configuration()
18+
configuration.access_token = environ["DD_BEARER_TOKEN"]
19+
with ApiClient(configuration) as api_client:
20+
api_instance = SyntheticsApi(api_client)
21+
response = api_instance.create_global_variable(body=body)
22+
23+
print(response)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""
2+
Patch a persistent email global variable preserves its address and type
3+
"""
4+
5+
from os import environ
6+
from datadog_api_client import ApiClient, Configuration
7+
from datadog_api_client.v2.api.synthetics_api import SyntheticsApi
8+
from datadog_api_client.v2.model.global_variable_json_patch_request import GlobalVariableJsonPatchRequest
9+
from datadog_api_client.v2.model.global_variable_json_patch_request_data import GlobalVariableJsonPatchRequestData
10+
from datadog_api_client.v2.model.global_variable_json_patch_request_data_attributes import (
11+
GlobalVariableJsonPatchRequestDataAttributes,
12+
)
13+
from datadog_api_client.v2.model.global_variable_json_patch_type import GlobalVariableJsonPatchType
14+
from datadog_api_client.v2.model.json_patch_operation import JsonPatchOperation
15+
from datadog_api_client.v2.model.json_patch_operation_op import JsonPatchOperationOp
16+
17+
# there is a valid "synthetics_email_global_variable" in the system
18+
SYNTHETICS_EMAIL_GLOBAL_VARIABLE_ID = environ["SYNTHETICS_EMAIL_GLOBAL_VARIABLE_ID"]
19+
20+
body = GlobalVariableJsonPatchRequest(
21+
data=GlobalVariableJsonPatchRequestData(
22+
type=GlobalVariableJsonPatchType.GLOBAL_VARIABLES_JSON_PATCH,
23+
attributes=GlobalVariableJsonPatchRequestDataAttributes(
24+
json_patch=[
25+
JsonPatchOperation(
26+
op=JsonPatchOperationOp.REPLACE,
27+
path="/description",
28+
value="Updated persistent email variable",
29+
),
30+
],
31+
),
32+
),
33+
)
34+
35+
configuration = Configuration()
36+
configuration.access_token = environ["DD_BEARER_TOKEN"]
37+
with ApiClient(configuration) as api_client:
38+
api_instance = SyntheticsApi(api_client)
39+
response = api_instance.patch_global_variable(variable_id=SYNTHETICS_EMAIL_GLOBAL_VARIABLE_ID, body=body)
40+
41+
print(response)

‎src/datadog_api_client/v1/model/synthetics_global_variable.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def openapi_types(_):
3434
"attributes": (SyntheticsGlobalVariableAttributes,),
3535
"description": (str,),
3636
"id": (str,),
37+
"is_email": (bool,),
3738
"is_fido": (bool,),
3839
"is_totp": (bool,),
3940
"name": (str,),
@@ -47,6 +48,7 @@ def openapi_types(_):
4748
"attributes": "attributes",
4849
"description": "description",
4950
"id": "id",
51+
"is_email": "is_email",
5052
"is_fido": "is_fido",
5153
"is_totp": "is_totp",
5254
"name": "name",
@@ -67,6 +69,7 @@ def __init__(
6769
value: SyntheticsGlobalVariableValue,
6870
attributes: Union[SyntheticsGlobalVariableAttributes, UnsetType] = unset,
6971
id: Union[str, UnsetType] = unset,
72+
is_email: Union[bool, UnsetType] = unset,
7073
is_fido: Union[bool, UnsetType] = unset,
7174
is_totp: Union[bool, UnsetType] = unset,
7275
parse_test_options: Union[SyntheticsGlobalVariableParseTestOptions, UnsetType] = unset,
@@ -85,6 +88,9 @@ def __init__(
8588
:param id: Unique identifier of the global variable.
8689
:type id: str, optional
8790
91+
:param is_email: Whether this global variable is a persistent email variable with an email address generated by Datadog.
92+
:type is_email: bool, optional
93+
8894
:param is_fido: Determines if the global variable is a FIDO variable.
8995
:type is_fido: bool, optional
9096
@@ -110,6 +116,8 @@ def __init__(
110116
kwargs["attributes"] = attributes
111117
if id is not unset:
112118
kwargs["id"] = id
119+
if is_email is not unset:
120+
kwargs["is_email"] = is_email
113121
if is_fido is not unset:
114122
kwargs["is_fido"] = is_fido
115123
if is_totp is not unset:

‎src/datadog_api_client/v1/model/synthetics_global_variable_request.py‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def openapi_types(_):
3434
"attributes": (SyntheticsGlobalVariableAttributes,),
3535
"description": (str,),
3636
"id": (str,),
37+
"is_email": (bool,),
3738
"is_fido": (bool,),
3839
"is_totp": (bool,),
3940
"name": (str,),
@@ -47,6 +48,7 @@ def openapi_types(_):
4748
"attributes": "attributes",
4849
"description": "description",
4950
"id": "id",
51+
"is_email": "is_email",
5052
"is_fido": "is_fido",
5153
"is_totp": "is_totp",
5254
"name": "name",
@@ -66,6 +68,7 @@ def __init__(
6668
tags: List[str],
6769
attributes: Union[SyntheticsGlobalVariableAttributes, UnsetType] = unset,
6870
id: Union[str, UnsetType] = unset,
71+
is_email: Union[bool, UnsetType] = unset,
6972
is_fido: Union[bool, UnsetType] = unset,
7073
is_totp: Union[bool, UnsetType] = unset,
7174
parse_test_options: Union[SyntheticsGlobalVariableParseTestOptions, UnsetType] = unset,
@@ -74,7 +77,7 @@ def __init__(
7477
**kwargs,
7578
):
7679
"""
77-
Details of the global variable to create.
80+
Details of the global variable to create or update.
7881
7982
:param attributes: Attributes of the global variable.
8083
:type attributes: SyntheticsGlobalVariableAttributes, optional
@@ -85,6 +88,12 @@ def __init__(
8588
:param id: Unique identifier of the global variable.
8689
:type id: str, optional
8790
91+
:param is_email: Whether this global variable is a persistent email variable. Set to ``true`` and omit ``value`` when creating
92+
a persistent email variable; Datadog generates an immutable email address. When updating an existing
93+
persistent email variable, omit ``value`` and either keep ``is_email`` set to ``true`` or omit it.
94+
The variable cannot be converted to or from a persistent email variable.
95+
:type is_email: bool, optional
96+
8897
:param is_fido: Determines if the global variable is a FIDO variable.
8998
:type is_fido: bool, optional
9099
@@ -110,6 +119,8 @@ def __init__(
110119
kwargs["attributes"] = attributes
111120
if id is not unset:
112121
kwargs["id"] = id
122+
if is_email is not unset:
123+
kwargs["is_email"] = is_email
113124
if is_fido is not unset:
114125
kwargs["is_fido"] = is_fido
115126
if is_totp is not unset:

‎src/datadog_api_client/v2/model/synthetics_global_variable.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def openapi_types(_):
3434
"attributes": (SyntheticsGlobalVariableAttributes,),
3535
"description": (str,),
3636
"id": (str,),
37+
"is_email": (bool,),
3738
"is_fido": (bool,),
3839
"is_totp": (bool,),
3940
"name": (str,),
@@ -47,6 +48,7 @@ def openapi_types(_):
4748
"attributes": "attributes",
4849
"description": "description",
4950
"id": "id",
51+
"is_email": "is_email",
5052
"is_fido": "is_fido",
5153
"is_totp": "is_totp",
5254
"name": "name",
@@ -67,6 +69,7 @@ def __init__(
6769
value: SyntheticsGlobalVariableValue,
6870
attributes: Union[SyntheticsGlobalVariableAttributes, UnsetType] = unset,
6971
id: Union[str, UnsetType] = unset,
72+
is_email: Union[bool, UnsetType] = unset,
7073
is_fido: Union[bool, UnsetType] = unset,
7174
is_totp: Union[bool, UnsetType] = unset,
7275
parse_test_options: Union[SyntheticsGlobalVariableParseTestOptions, UnsetType] = unset,
@@ -85,6 +88,9 @@ def __init__(
8588
:param id: Unique identifier of the global variable.
8689
:type id: str, optional
8790
91+
:param is_email: Whether this global variable is a persistent email variable with an email address generated by Datadog.
92+
:type is_email: bool, optional
93+
8894
:param is_fido: Determines if the global variable is a FIDO variable.
8995
:type is_fido: bool, optional
9096
@@ -110,6 +116,8 @@ def __init__(
110116
kwargs["attributes"] = attributes
111117
if id is not unset:
112118
kwargs["id"] = id
119+
if is_email is not unset:
120+
kwargs["is_email"] = is_email
113121
if is_fido is not unset:
114122
kwargs["is_fido"] = is_fido
115123
if is_totp is not unset:

‎tests/v1/features/given.json‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,18 @@
306306
"tag": "Synthetics",
307307
"operationId": "TriggerTests"
308308
},
309+
{
310+
"parameters": [
311+
{
312+
"name": "body",
313+
"value": "{\n \"name\": \"PERSISTENT_EMAIL_{{ unique_upper_alnum }}\",\n \"description\": \"Persistent email variable\",\n \"tags\": [],\n \"is_email\": true\n}\n"
314+
}
315+
],
316+
"step": "there is a valid \"synthetics_email_global_variable\" in the system",
317+
"key": "synthetics_email_global_variable",
318+
"tag": "Synthetics",
319+
"operationId": "CreateGlobalVariable"
320+
},
309321
{
310322
"parameters": [
311323
{

‎tests/v1/features/synthetics.feature‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ Feature: Synthetics
179179
When the request is sent
180180
Then the response status is 200 OK
181181

182+
@integration-only @team:ddoghq/synthetics-orchestrating-managing
183+
Scenario: Create a persistent email global variable returns a generated address
184+
Given new "CreateGlobalVariable" request
185+
And body with value {"name": "PERSISTENT_EMAIL_{{ unique_upper_alnum }}", "description": "Persistent email variable", "tags": [], "is_email": true}
186+
When the request is sent
187+
Then the response status is 200 OK
188+
And the response "is_email" is equal to true
189+
And the response "value.secure" is equal to false
190+
And the response "value" has field "value"
191+
182192
@replay-only @team:ddoghq/synthetics-orchestrating-managing
183193
Scenario: Create a private location returns "OK" response
184194
Given there is a valid "role" in the system
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "PERSISTENT_EMAIL_{{ unique_upper_alnum }}",
3+
"description": "Persistent email variable",
4+
"tags": [],
5+
"is_email": true
6+
}

0 commit comments

Comments
 (0)