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
40 changes: 27 additions & 13 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19568,10 +19568,14 @@ components:
- CONTAINER
- CALLOUTVALUE
Condition:
description: Targeting condition details.
description: |-
Targeting condition details. A condition is either an inline
predicate with `operator`, `attribute`, and `value`, or a reference to a
saved filter with `saved_filter_id`. The inline fields are omitted for saved-filter
references.
properties:
attribute:
description: The user or request attribute to evaluate.
description: The user or request attribute to evaluate. Omitted for saved-filter references.
example: "country"
type: string
created_at:
Expand All @@ -19586,23 +19590,26 @@ components:
type: string
operator:
$ref: "#/components/schemas/ConditionOperator"
saved_filter_id:
description: The ID of the saved filter referenced by this condition, or null for inline conditions.
example: "550e8400-e29b-41d4-a716-446655440090"
format: uuid
nullable: true
type: string
updated_at:
description: The timestamp when the condition was last updated.
example: "2024-01-01T12:00:00Z"
format: date-time
type: string
value:
description: Values used by the selected operator.
description: Values used by the selected operator. Omitted for saved-filter references.
example: ["US", "CA"]
items:
description: Target value for the selected operator.
type: string
type: array
required:
- id
- operator
- attribute
- value
- created_at
- updated_at
type: object
Expand Down Expand Up @@ -19633,25 +19640,32 @@ components:
- IS_NULL
- EQUALS
ConditionRequest:
description: Condition request payload for targeting rules.
description: |-
Condition request payload for targeting rules. A condition is either an inline
predicate with `operator`, `attribute`, and `value`, or a reference to a
saved filter with `saved_filter_id`. The two shapes are mutually exclusive.
properties:
attribute:
description: The user or request attribute to evaluate.
description: The user or request attribute to evaluate. Required for inline conditions; omit when `saved_filter_id` is set.
example: "user_tier"
type: string
operator:
$ref: "#/components/schemas/ConditionOperator"
saved_filter_id:
description: |-
The ID of a saved filter to reference as this condition. Mutually exclusive
with `operator`, `attribute`, and `value`. When set, the saved filter's
targeting rules are evaluated in place of an inline predicate.
example: "550e8400-e29b-41d4-a716-446655440090"
format: uuid
type: string
value:
description: Values used by the selected operator.
description: Values used by the selected operator. Required for inline conditions; omit when `saved_filter_id` is set.
example: ["premium", "enterprise"]
items:
description: Target value for the selected operator.
type: string
type: array
required:
- operator
- attribute
- value
type: object
ConfigCatCredentials:
description: The definition of the `ConfigCatCredentials` object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ public static void main(String[] args) {
new ConditionRequest()
.attribute("user_tier")
.operator(ConditionOperator.ONE_OF)
.savedFilterId(
UUID.fromString(
"550e8400-e29b-41d4-a716-446655440090"))
.value(
Arrays.asList("premium", "enterprise"))))))
.type(AllocationType.FEATURE_GATE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public static void main(String[] args) {
new ConditionRequest()
.attribute("user_tier")
.operator(ConditionOperator.ONE_OF)
.savedFilterId(
UUID.fromString(
"550e8400-e29b-41d4-a716-446655440090"))
.value(
Arrays.asList(
"premium", "enterprise"))))))
Expand Down
74 changes: 58 additions & 16 deletions src/main/java/com/datadog/api/client/v2/model/Condition.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,19 @@
import java.util.Map;
import java.util.Objects;
import java.util.UUID;
import org.openapitools.jackson.nullable.JsonNullable;

/** Targeting condition details. */
/**
* Targeting condition details. A condition is either an inline predicate with <code>operator</code>
* , <code>attribute</code>, and <code>value</code>, or a reference to a saved filter with <code>
* saved_filter_id</code>. The inline fields are omitted for saved-filter references.
*/
@JsonPropertyOrder({
Condition.JSON_PROPERTY_ATTRIBUTE,
Condition.JSON_PROPERTY_CREATED_AT,
Condition.JSON_PROPERTY_ID,
Condition.JSON_PROPERTY_OPERATOR,
Condition.JSON_PROPERTY_SAVED_FILTER_ID,
Condition.JSON_PROPERTY_UPDATED_AT,
Condition.JSON_PROPERTY_VALUE
})
Expand All @@ -46,29 +52,25 @@ public class Condition {
public static final String JSON_PROPERTY_OPERATOR = "operator";
private ConditionOperator operator;

public static final String JSON_PROPERTY_SAVED_FILTER_ID = "saved_filter_id";
private JsonNullable<UUID> savedFilterId = JsonNullable.<UUID>undefined();

public static final String JSON_PROPERTY_UPDATED_AT = "updated_at";
private OffsetDateTime updatedAt;

public static final String JSON_PROPERTY_VALUE = "value";
private List<String> value = new ArrayList<>();
private List<String> value = null;

public Condition() {}

@JsonCreator
public Condition(
@JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTE) String attribute,
@JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt,
@JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id,
@JsonProperty(required = true, value = JSON_PROPERTY_OPERATOR) ConditionOperator operator,
@JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt,
@JsonProperty(required = true, value = JSON_PROPERTY_VALUE) List<String> value) {
this.attribute = attribute;
@JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt) {
this.createdAt = createdAt;
this.id = id;
this.operator = operator;
this.unparsed |= !operator.isValid();
this.updatedAt = updatedAt;
this.value = value;
}

public Condition attribute(String attribute) {
Expand All @@ -77,12 +79,13 @@ public Condition attribute(String attribute) {
}

/**
* The user or request attribute to evaluate.
* The user or request attribute to evaluate. Omitted for saved-filter references.
*
* @return attribute
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_ATTRIBUTE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public String getAttribute() {
return attribute;
}
Expand Down Expand Up @@ -142,8 +145,9 @@ public Condition operator(ConditionOperator operator) {
*
* @return operator
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_OPERATOR)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public ConditionOperator getOperator() {
return operator;
}
Expand All @@ -155,6 +159,37 @@ public void setOperator(ConditionOperator operator) {
this.operator = operator;
}

public Condition savedFilterId(UUID savedFilterId) {
this.savedFilterId = JsonNullable.<UUID>of(savedFilterId);
return this;
}

/**
* The ID of the saved filter referenced by this condition, or null for inline conditions.
*
* @return savedFilterId
*/
@jakarta.annotation.Nullable
@JsonIgnore
public UUID getSavedFilterId() {
return savedFilterId.orElse(null);
}

@JsonProperty(JSON_PROPERTY_SAVED_FILTER_ID)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public JsonNullable<UUID> getSavedFilterId_JsonNullable() {
return savedFilterId;
}

@JsonProperty(JSON_PROPERTY_SAVED_FILTER_ID)
public void setSavedFilterId_JsonNullable(JsonNullable<UUID> savedFilterId) {
this.savedFilterId = savedFilterId;
}

public void setSavedFilterId(UUID savedFilterId) {
this.savedFilterId = JsonNullable.<UUID>of(savedFilterId);
}

public Condition updatedAt(OffsetDateTime updatedAt) {
this.updatedAt = updatedAt;
return this;
Expand All @@ -181,17 +216,21 @@ public Condition value(List<String> value) {
}

public Condition addValueItem(String valueItem) {
if (this.value == null) {
this.value = new ArrayList<>();
}
this.value.add(valueItem);
return this;
}

/**
* Values used by the selected operator.
* Values used by the selected operator. Omitted for saved-filter references.
*
* @return value
*/
@jakarta.annotation.Nullable
@JsonProperty(JSON_PROPERTY_VALUE)
@JsonInclude(value = JsonInclude.Include.ALWAYS)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
public List<String> getValue() {
return value;
}
Expand Down Expand Up @@ -260,14 +299,16 @@ public boolean equals(Object o) {
&& Objects.equals(this.createdAt, condition.createdAt)
&& Objects.equals(this.id, condition.id)
&& Objects.equals(this.operator, condition.operator)
&& Objects.equals(this.savedFilterId, condition.savedFilterId)
&& Objects.equals(this.updatedAt, condition.updatedAt)
&& Objects.equals(this.value, condition.value)
&& Objects.equals(this.additionalProperties, condition.additionalProperties);
}

@Override
public int hashCode() {
return Objects.hash(attribute, createdAt, id, operator, updatedAt, value, additionalProperties);
return Objects.hash(
attribute, createdAt, id, operator, savedFilterId, updatedAt, value, additionalProperties);
}

@Override
Expand All @@ -278,6 +319,7 @@ public String toString() {
sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" operator: ").append(toIndentedString(operator)).append("\n");
sb.append(" savedFilterId: ").append(toIndentedString(savedFilterId)).append("\n");
sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n");
sb.append(" value: ").append(toIndentedString(value)).append("\n");
sb.append(" additionalProperties: ")
Expand Down
Loading
Loading