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
13 changes: 12 additions & 1 deletion .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19714,6 +19714,10 @@ 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 @@ -19804,7 +19808,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 @@ -19816,6 +19820,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
4 changes: 4 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128015,6 +128015,10 @@ 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
32 changes: 32 additions & 0 deletions examples/v1/synthetics/CreateGlobalVariable_2215516655.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Create a persistent email global variable returns a generated address

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariable;
import com.datadog.api.client.v1.model.SyntheticsGlobalVariableRequest;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);

SyntheticsGlobalVariableRequest body =
new SyntheticsGlobalVariableRequest()
.name("PERSISTENT_EMAIL_EXAMPLESYNTHETIC")
.description("Persistent email variable")
.isEmail(true);

try {
SyntheticsGlobalVariable result = apiInstance.createGlobalVariable(body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#createGlobalVariable");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
51 changes: 51 additions & 0 deletions examples/v2/synthetics/PatchGlobalVariable_3138656940.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Patch a persistent email global variable preserves its address and type

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SyntheticsApi;
import com.datadog.api.client.v2.model.GlobalVariableJsonPatchRequest;
import com.datadog.api.client.v2.model.GlobalVariableJsonPatchRequestData;
import com.datadog.api.client.v2.model.GlobalVariableJsonPatchRequestDataAttributes;
import com.datadog.api.client.v2.model.GlobalVariableJsonPatchType;
import com.datadog.api.client.v2.model.GlobalVariableResponse;
import com.datadog.api.client.v2.model.JsonPatchOperation;
import com.datadog.api.client.v2.model.JsonPatchOperationOp;
import java.util.Collections;

public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
SyntheticsApi apiInstance = new SyntheticsApi(defaultClient);

// there is a valid "synthetics_email_global_variable" in the system
String SYNTHETICS_EMAIL_GLOBAL_VARIABLE_ID =
System.getenv("SYNTHETICS_EMAIL_GLOBAL_VARIABLE_ID");

GlobalVariableJsonPatchRequest body =
new GlobalVariableJsonPatchRequest()
.data(
new GlobalVariableJsonPatchRequestData()
.type(GlobalVariableJsonPatchType.GLOBAL_VARIABLES_JSON_PATCH)
.attributes(
new GlobalVariableJsonPatchRequestDataAttributes()
.jsonPatch(
Collections.singletonList(
new JsonPatchOperation()
.op(JsonPatchOperationOp.REPLACE)
.path("/description")
.value("Updated persistent email variable")))));

try {
GlobalVariableResponse result =
apiInstance.patchGlobalVariable(SYNTHETICS_EMAIL_GLOBAL_VARIABLE_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SyntheticsApi#patchGlobalVariable");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
SyntheticsGlobalVariable.JSON_PROPERTY_ATTRIBUTES,
SyntheticsGlobalVariable.JSON_PROPERTY_DESCRIPTION,
SyntheticsGlobalVariable.JSON_PROPERTY_ID,
SyntheticsGlobalVariable.JSON_PROPERTY_IS_EMAIL,
SyntheticsGlobalVariable.JSON_PROPERTY_IS_FIDO,
SyntheticsGlobalVariable.JSON_PROPERTY_IS_TOTP,
SyntheticsGlobalVariable.JSON_PROPERTY_NAME,
Expand All @@ -45,6 +46,9 @@ public class SyntheticsGlobalVariable {
public static final String JSON_PROPERTY_ID = "id";
private String id;

public static final String JSON_PROPERTY_IS_EMAIL = "is_email";
private Boolean isEmail;

public static final String JSON_PROPERTY_IS_FIDO = "is_fido";
private Boolean isFido;

Expand Down Expand Up @@ -139,6 +143,28 @@ public String getId() {
return id;
}

public SyntheticsGlobalVariable isEmail(Boolean isEmail) {
this.isEmail = isEmail;
return this;
}

/**
* Whether this global variable is a persistent email variable with an email address generated by
* Datadog.
*
* @return isEmail
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_IS_EMAIL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getIsEmail() {
return isEmail;
}

public void setIsEmail(Boolean isEmail) {
this.isEmail = isEmail;
}

public SyntheticsGlobalVariable isFido(Boolean isFido) {
this.isFido = isFido;
return this;
Expand Down Expand Up @@ -357,6 +383,7 @@ public boolean equals(Object o) {
return Objects.equals(this.attributes, syntheticsGlobalVariable.attributes)
&& Objects.equals(this.description, syntheticsGlobalVariable.description)
&& Objects.equals(this.id, syntheticsGlobalVariable.id)
&& Objects.equals(this.isEmail, syntheticsGlobalVariable.isEmail)
&& Objects.equals(this.isFido, syntheticsGlobalVariable.isFido)
&& Objects.equals(this.isTotp, syntheticsGlobalVariable.isTotp)
&& Objects.equals(this.name, syntheticsGlobalVariable.name)
Expand All @@ -373,6 +400,7 @@ public int hashCode() {
attributes,
description,
id,
isEmail,
isFido,
isTotp,
name,
Expand All @@ -390,6 +418,7 @@ public String toString() {
sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" isEmail: ").append(toIndentedString(isEmail)).append("\n");
sb.append(" isFido: ").append(toIndentedString(isFido)).append("\n");
sb.append(" isTotp: ").append(toIndentedString(isTotp)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
import java.util.Map;
import java.util.Objects;

/** Details of the global variable to create. */
/** Details of the global variable to create or update. */
@JsonPropertyOrder({
SyntheticsGlobalVariableRequest.JSON_PROPERTY_ATTRIBUTES,
SyntheticsGlobalVariableRequest.JSON_PROPERTY_DESCRIPTION,
SyntheticsGlobalVariableRequest.JSON_PROPERTY_ID,
SyntheticsGlobalVariableRequest.JSON_PROPERTY_IS_EMAIL,
SyntheticsGlobalVariableRequest.JSON_PROPERTY_IS_FIDO,
SyntheticsGlobalVariableRequest.JSON_PROPERTY_IS_TOTP,
SyntheticsGlobalVariableRequest.JSON_PROPERTY_NAME,
Expand All @@ -45,6 +46,9 @@ public class SyntheticsGlobalVariableRequest {
public static final String JSON_PROPERTY_ID = "id";
private String id;

public static final String JSON_PROPERTY_IS_EMAIL = "is_email";
private Boolean isEmail;

public static final String JSON_PROPERTY_IS_FIDO = "is_fido";
private Boolean isFido;

Expand Down Expand Up @@ -135,6 +139,31 @@ public String getId() {
return id;
}

public SyntheticsGlobalVariableRequest isEmail(Boolean isEmail) {
this.isEmail = isEmail;
return this;
}

/**
* Whether this global variable is a persistent email variable. Set to <code>true</code> and omit
* <code>value</code> when creating a persistent email variable; Datadog generates an immutable
* email address. When updating an existing persistent email variable, omit <code>value</code> and
* either keep <code>is_email</code> set to <code>true</code> or omit it. The variable cannot be
* converted to or from a persistent email variable.
*
* @return isEmail
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_IS_EMAIL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getIsEmail() {
return isEmail;
}

public void setIsEmail(Boolean isEmail) {
this.isEmail = isEmail;
}

public SyntheticsGlobalVariableRequest isFido(Boolean isFido) {
this.isFido = isFido;
return this;
Expand Down Expand Up @@ -355,6 +384,7 @@ public boolean equals(Object o) {
return Objects.equals(this.attributes, syntheticsGlobalVariableRequest.attributes)
&& Objects.equals(this.description, syntheticsGlobalVariableRequest.description)
&& Objects.equals(this.id, syntheticsGlobalVariableRequest.id)
&& Objects.equals(this.isEmail, syntheticsGlobalVariableRequest.isEmail)
&& Objects.equals(this.isFido, syntheticsGlobalVariableRequest.isFido)
&& Objects.equals(this.isTotp, syntheticsGlobalVariableRequest.isTotp)
&& Objects.equals(this.name, syntheticsGlobalVariableRequest.name)
Expand All @@ -372,6 +402,7 @@ public int hashCode() {
attributes,
description,
id,
isEmail,
isFido,
isTotp,
name,
Expand All @@ -389,6 +420,7 @@ public String toString() {
sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" isEmail: ").append(toIndentedString(isEmail)).append("\n");
sb.append(" isFido: ").append(toIndentedString(isFido)).append("\n");
sb.append(" isTotp: ").append(toIndentedString(isTotp)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
SyntheticsGlobalVariable.JSON_PROPERTY_ATTRIBUTES,
SyntheticsGlobalVariable.JSON_PROPERTY_DESCRIPTION,
SyntheticsGlobalVariable.JSON_PROPERTY_ID,
SyntheticsGlobalVariable.JSON_PROPERTY_IS_EMAIL,
SyntheticsGlobalVariable.JSON_PROPERTY_IS_FIDO,
SyntheticsGlobalVariable.JSON_PROPERTY_IS_TOTP,
SyntheticsGlobalVariable.JSON_PROPERTY_NAME,
Expand All @@ -45,6 +46,9 @@ public class SyntheticsGlobalVariable {
public static final String JSON_PROPERTY_ID = "id";
private String id;

public static final String JSON_PROPERTY_IS_EMAIL = "is_email";
private Boolean isEmail;

public static final String JSON_PROPERTY_IS_FIDO = "is_fido";
private Boolean isFido;

Expand Down Expand Up @@ -139,6 +143,28 @@ public String getId() {
return id;
}

public SyntheticsGlobalVariable isEmail(Boolean isEmail) {
this.isEmail = isEmail;
return this;
}

/**
* Whether this global variable is a persistent email variable with an email address generated by
* Datadog.
*
* @return isEmail
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_IS_EMAIL)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public Boolean getIsEmail() {
return isEmail;
}

public void setIsEmail(Boolean isEmail) {
this.isEmail = isEmail;
}

public SyntheticsGlobalVariable isFido(Boolean isFido) {
this.isFido = isFido;
return this;
Expand Down Expand Up @@ -357,6 +383,7 @@ public boolean equals(Object o) {
return Objects.equals(this.attributes, syntheticsGlobalVariable.attributes)
&& Objects.equals(this.description, syntheticsGlobalVariable.description)
&& Objects.equals(this.id, syntheticsGlobalVariable.id)
&& Objects.equals(this.isEmail, syntheticsGlobalVariable.isEmail)
&& Objects.equals(this.isFido, syntheticsGlobalVariable.isFido)
&& Objects.equals(this.isTotp, syntheticsGlobalVariable.isTotp)
&& Objects.equals(this.name, syntheticsGlobalVariable.name)
Expand All @@ -373,6 +400,7 @@ public int hashCode() {
attributes,
description,
id,
isEmail,
isFido,
isTotp,
name,
Expand All @@ -390,6 +418,7 @@ public String toString() {
sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
sb.append(" description: ").append(toIndentedString(description)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" isEmail: ").append(toIndentedString(isEmail)).append("\n");
sb.append(" isFido: ").append(toIndentedString(isFido)).append("\n");
sb.append(" isTotp: ").append(toIndentedString(isTotp)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
Expand Down
12 changes: 12 additions & 0 deletions src/test/resources/com/datadog/api/client/v1/api/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
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
}
Loading
Loading