Skip to content
Open
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
12 changes: 11 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19275,6 +19275,9 @@ components:
description: Unique identifier of the global variable.
readOnly: true
type: string
is_email:
description: Whether this global variable is a persistent email variable with an email address generated by Datadog.
type: boolean
is_fido:
description: Determines if the global variable is a FIDO variable.
type: boolean
Expand Down Expand Up @@ -19365,7 +19368,7 @@ components:
- REGEX
- X_PATH
SyntheticsGlobalVariableRequest:
description: Details of the global variable to create.
description: Details of the global variable to create or update.
properties:
attributes:
$ref: "#/components/schemas/SyntheticsGlobalVariableAttributes"
Expand All @@ -19377,6 +19380,13 @@ components:
description: Unique identifier of the global variable.
readOnly: true
type: string
is_email:
description: |-
Whether this global variable is a persistent email variable. Set to `true` and omit `value` when creating
a persistent email variable; Datadog generates an immutable email address. When updating an existing
persistent email variable, omit `value` and either keep `is_email` set to `true` or omit it.
The variable cannot be converted to or from a persistent email variable.
type: boolean
is_fido:
description: Determines if the global variable is a FIDO variable.
type: boolean
Expand Down
3 changes: 3 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123866,6 +123866,9 @@ components:
description: Unique identifier of the global variable.
readOnly: true
type: string
is_email:
description: Whether this global variable is a persistent email variable with an email address generated by Datadog.
type: boolean
is_fido:
description: Determines if the global variable is a FIDO variable.
type: boolean
Expand Down
23 changes: 23 additions & 0 deletions examples/v1/synthetics/CreateGlobalVariable_2215516655.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Create a persistent email global variable returns a generated address
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_global_variable_request import SyntheticsGlobalVariableRequest

body = SyntheticsGlobalVariableRequest(
name="PERSISTENT_EMAIL_EXAMPLESYNTHETIC",
description="Persistent email variable",
tags=[],
is_email=True,
)

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = SyntheticsApi(api_client)
response = api_instance.create_global_variable(body=body)

print(response)
41 changes: 41 additions & 0 deletions examples/v2/synthetics/PatchGlobalVariable_3138656940.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
"""
Patch a persistent email global variable preserves its address and type
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.synthetics_api import SyntheticsApi
from datadog_api_client.v2.model.global_variable_json_patch_request import GlobalVariableJsonPatchRequest
from datadog_api_client.v2.model.global_variable_json_patch_request_data import GlobalVariableJsonPatchRequestData
from datadog_api_client.v2.model.global_variable_json_patch_request_data_attributes import (
GlobalVariableJsonPatchRequestDataAttributes,
)
from datadog_api_client.v2.model.global_variable_json_patch_type import GlobalVariableJsonPatchType
from datadog_api_client.v2.model.json_patch_operation import JsonPatchOperation
from datadog_api_client.v2.model.json_patch_operation_op import JsonPatchOperationOp

# there is a valid "synthetics_email_global_variable" in the system
SYNTHETICS_EMAIL_GLOBAL_VARIABLE_ID = environ["SYNTHETICS_EMAIL_GLOBAL_VARIABLE_ID"]

body = GlobalVariableJsonPatchRequest(
data=GlobalVariableJsonPatchRequestData(
type=GlobalVariableJsonPatchType.GLOBAL_VARIABLES_JSON_PATCH,
attributes=GlobalVariableJsonPatchRequestDataAttributes(
json_patch=[
JsonPatchOperation(
op=JsonPatchOperationOp.REPLACE,
path="/description",
value="Updated persistent email variable",
),
],
),
),
)

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = SyntheticsApi(api_client)
response = api_instance.patch_global_variable(variable_id=SYNTHETICS_EMAIL_GLOBAL_VARIABLE_ID, body=body)

print(response)
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def openapi_types(_):
"attributes": (SyntheticsGlobalVariableAttributes,),
"description": (str,),
"id": (str,),
"is_email": (bool,),
"is_fido": (bool,),
"is_totp": (bool,),
"name": (str,),
Expand All @@ -47,6 +48,7 @@ def openapi_types(_):
"attributes": "attributes",
"description": "description",
"id": "id",
"is_email": "is_email",
"is_fido": "is_fido",
"is_totp": "is_totp",
"name": "name",
Expand All @@ -67,6 +69,7 @@ def __init__(
value: SyntheticsGlobalVariableValue,
attributes: Union[SyntheticsGlobalVariableAttributes, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
is_email: Union[bool, UnsetType] = unset,
is_fido: Union[bool, UnsetType] = unset,
is_totp: Union[bool, UnsetType] = unset,
parse_test_options: Union[SyntheticsGlobalVariableParseTestOptions, UnsetType] = unset,
Expand All @@ -85,6 +88,9 @@ def __init__(
:param id: Unique identifier of the global variable.
:type id: str, optional

:param is_email: Whether this global variable is a persistent email variable with an email address generated by Datadog.
:type is_email: bool, optional

:param is_fido: Determines if the global variable is a FIDO variable.
:type is_fido: bool, optional

Expand All @@ -110,6 +116,8 @@ def __init__(
kwargs["attributes"] = attributes
if id is not unset:
kwargs["id"] = id
if is_email is not unset:
kwargs["is_email"] = is_email
if is_fido is not unset:
kwargs["is_fido"] = is_fido
if is_totp is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def openapi_types(_):
"attributes": (SyntheticsGlobalVariableAttributes,),
"description": (str,),
"id": (str,),
"is_email": (bool,),
"is_fido": (bool,),
"is_totp": (bool,),
"name": (str,),
Expand All @@ -47,6 +48,7 @@ def openapi_types(_):
"attributes": "attributes",
"description": "description",
"id": "id",
"is_email": "is_email",
"is_fido": "is_fido",
"is_totp": "is_totp",
"name": "name",
Expand All @@ -66,6 +68,7 @@ def __init__(
tags: List[str],
attributes: Union[SyntheticsGlobalVariableAttributes, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
is_email: Union[bool, UnsetType] = unset,
is_fido: Union[bool, UnsetType] = unset,
is_totp: Union[bool, UnsetType] = unset,
parse_test_options: Union[SyntheticsGlobalVariableParseTestOptions, UnsetType] = unset,
Expand All @@ -74,7 +77,7 @@ def __init__(
**kwargs,
):
"""
Details of the global variable to create.
Details of the global variable to create or update.

:param attributes: Attributes of the global variable.
:type attributes: SyntheticsGlobalVariableAttributes, optional
Expand All @@ -85,6 +88,12 @@ def __init__(
:param id: Unique identifier of the global variable.
:type id: str, optional

:param is_email: Whether this global variable is a persistent email variable. Set to ``true`` and omit ``value`` when creating
a persistent email variable; Datadog generates an immutable email address. When updating an existing
persistent email variable, omit ``value`` and either keep ``is_email`` set to ``true`` or omit it.
The variable cannot be converted to or from a persistent email variable.
:type is_email: bool, optional

:param is_fido: Determines if the global variable is a FIDO variable.
:type is_fido: bool, optional

Expand All @@ -110,6 +119,8 @@ def __init__(
kwargs["attributes"] = attributes
if id is not unset:
kwargs["id"] = id
if is_email is not unset:
kwargs["is_email"] = is_email
if is_fido is not unset:
kwargs["is_fido"] = is_fido
if is_totp is not unset:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def openapi_types(_):
"attributes": (SyntheticsGlobalVariableAttributes,),
"description": (str,),
"id": (str,),
"is_email": (bool,),
"is_fido": (bool,),
"is_totp": (bool,),
"name": (str,),
Expand All @@ -47,6 +48,7 @@ def openapi_types(_):
"attributes": "attributes",
"description": "description",
"id": "id",
"is_email": "is_email",
"is_fido": "is_fido",
"is_totp": "is_totp",
"name": "name",
Expand All @@ -67,6 +69,7 @@ def __init__(
value: SyntheticsGlobalVariableValue,
attributes: Union[SyntheticsGlobalVariableAttributes, UnsetType] = unset,
id: Union[str, UnsetType] = unset,
is_email: Union[bool, UnsetType] = unset,
is_fido: Union[bool, UnsetType] = unset,
is_totp: Union[bool, UnsetType] = unset,
parse_test_options: Union[SyntheticsGlobalVariableParseTestOptions, UnsetType] = unset,
Expand All @@ -85,6 +88,9 @@ def __init__(
:param id: Unique identifier of the global variable.
:type id: str, optional

:param is_email: Whether this global variable is a persistent email variable with an email address generated by Datadog.
:type is_email: bool, optional

:param is_fido: Determines if the global variable is a FIDO variable.
:type is_fido: bool, optional

Expand All @@ -110,6 +116,8 @@ def __init__(
kwargs["attributes"] = attributes
if id is not unset:
kwargs["id"] = id
if is_email is not unset:
kwargs["is_email"] = is_email
if is_fido is not unset:
kwargs["is_fido"] = is_fido
if is_totp is not unset:
Expand Down
12 changes: 12 additions & 0 deletions tests/v1/features/given.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,18 @@
"tag": "Synthetics",
"operationId": "TriggerTests"
},
{
"parameters": [
{
"name": "body",
"value": "{\n \"name\": \"PERSISTENT_EMAIL_{{ unique_upper_alnum }}\",\n \"description\": \"Persistent email variable\",\n \"tags\": [],\n \"is_email\": true\n}\n"
}
],
"step": "there is a valid \"synthetics_email_global_variable\" in the system",
"key": "synthetics_email_global_variable",
"tag": "Synthetics",
"operationId": "CreateGlobalVariable"
},
{
"parameters": [
{
Expand Down
10 changes: 10 additions & 0 deletions tests/v1/features/synthetics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@ Feature: Synthetics
When the request is sent
Then the response status is 200 OK

@integration-only @team:ddoghq/synthetics-orchestrating-managing
Scenario: Create a persistent email global variable returns a generated address
Given new "CreateGlobalVariable" request
And body with value {"name": "PERSISTENT_EMAIL_{{ unique_upper_alnum }}", "description": "Persistent email variable", "tags": [], "is_email": true}
When the request is sent
Then the response status is 200 OK
And the response "is_email" is equal to true
And the response "value.secure" is equal to false
And the response "value" has field "value"

@replay-only @team:ddoghq/synthetics-orchestrating-managing
Scenario: Create a private location returns "OK" response
Given there is a valid "role" in the system
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "PERSISTENT_EMAIL_{{ unique_upper_alnum }}",
"description": "Persistent email variable",
"tags": [],
"is_email": true
}
14 changes: 14 additions & 0 deletions tests/v2/features/synthetics.feature
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,20 @@ Feature: Synthetics
When the request is sent
Then the response status is 200 OK

@integration-only @team:ddoghq/synthetics-orchestrating-managing
Scenario: Patch a persistent email global variable preserves its address and type
Given there is a valid "synthetics_email_global_variable" in the system
And new "PatchGlobalVariable" request
And request contains "variable_id" parameter from "synthetics_email_global_variable.id"
And body with value {"data": {"type": "global_variables_json_patch", "attributes": {"json_patch": [{"op": "replace", "path": "/description", "value": "Updated persistent email variable"}]}}}
When the request is sent
Then the response status is 200 OK
And the response "data.id" has the same value as "synthetics_email_global_variable.id"
And the response "data.attributes.description" is equal to "Updated persistent email variable"
And the response "data.attributes.is_email" is equal to true
And the response "data.attributes.value.secure" is equal to false
And the response "data.attributes.value.value" has the same value as "synthetics_email_global_variable.value.value"

@generated @skip @team:ddoghq/synthetics-orchestrating-managing
Scenario: Patch a test suite returns "API error response." response
Given new "PatchTestSuite" request
Expand Down
Loading