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 @@ -62,6 +62,7 @@
ConditionRequest(
attribute="user_tier",
operator=ConditionOperator.ONE_OF,
saved_filter_id=UUID("550e8400-e29b-41d4-a716-446655440090"),
value=[
"premium",
"enterprise",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
ConditionRequest(
attribute="user_tier",
operator=ConditionOperator.ONE_OF,
saved_filter_id=UUID("550e8400-e29b-41d4-a716-446655440090"),
value=[
"premium",
"enterprise",
Expand Down
43 changes: 30 additions & 13 deletions src/datadog_api_client/v2/model/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, TYPE_CHECKING
from typing import List, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
datetime,
none_type,
unset,
UnsetType,
UUID,
)

Expand All @@ -27,6 +30,7 @@ def openapi_types(_):
"created_at": (datetime,),
"id": (UUID,),
"operator": (ConditionOperator,),
"saved_filter_id": (UUID, none_type),
"updated_at": (datetime,),
"value": ([str],),
}
Expand All @@ -36,25 +40,30 @@ def openapi_types(_):
"created_at": "created_at",
"id": "id",
"operator": "operator",
"saved_filter_id": "saved_filter_id",
"updated_at": "updated_at",
"value": "value",
}

def __init__(
self_,
attribute: str,
created_at: datetime,
id: UUID,
operator: ConditionOperator,
updated_at: datetime,
value: List[str],
attribute: Union[str, UnsetType] = unset,
operator: Union[ConditionOperator, UnsetType] = unset,
saved_filter_id: Union[UUID, none_type, UnsetType] = unset,
value: Union[List[str], UnsetType] = unset,
**kwargs,
):
"""
Targeting condition details.
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.

:param attribute: The user or request attribute to evaluate.
:type attribute: str
:param attribute: The user or request attribute to evaluate. Omitted for saved-filter references.
:type attribute: str, optional

:param created_at: The timestamp when the condition was created.
:type created_at: datetime
Expand All @@ -63,19 +72,27 @@ def __init__(
:type id: UUID

:param operator: The operator used in a targeting condition.
:type operator: ConditionOperator
:type operator: ConditionOperator, optional

:param saved_filter_id: The ID of the saved filter referenced by this condition, or null for inline conditions.
:type saved_filter_id: UUID, none_type, optional

:param updated_at: The timestamp when the condition was last updated.
:type updated_at: datetime

:param value: Values used by the selected operator.
:type value: [str]
:param value: Values used by the selected operator. Omitted for saved-filter references.
:type value: [str], optional
"""
if attribute is not unset:
kwargs["attribute"] = attribute
if operator is not unset:
kwargs["operator"] = operator
if saved_filter_id is not unset:
kwargs["saved_filter_id"] = saved_filter_id
if value is not unset:
kwargs["value"] = value
super().__init__(kwargs)

self_.attribute = attribute
self_.created_at = created_at
self_.id = id
self_.operator = operator
self_.updated_at = updated_at
self_.value = value
47 changes: 35 additions & 12 deletions src/datadog_api_client/v2/model/condition_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
# Copyright 2019-Present Datadog, Inc.
from __future__ import annotations

from typing import List, TYPE_CHECKING
from typing import List, Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
UUID,
)


Expand All @@ -23,30 +26,50 @@ def openapi_types(_):
return {
"attribute": (str,),
"operator": (ConditionOperator,),
"saved_filter_id": (UUID,),
"value": ([str],),
}

attribute_map = {
"attribute": "attribute",
"operator": "operator",
"saved_filter_id": "saved_filter_id",
"value": "value",
}

def __init__(self_, attribute: str, operator: ConditionOperator, value: List[str], **kwargs):
def __init__(
self_,
attribute: Union[str, UnsetType] = unset,
operator: Union[ConditionOperator, UnsetType] = unset,
saved_filter_id: Union[UUID, UnsetType] = unset,
value: Union[List[str], UnsetType] = unset,
**kwargs,
):
"""
Condition request payload for targeting rules.
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.

:param attribute: The user or request attribute to evaluate.
:type attribute: str
:param attribute: The user or request attribute to evaluate. Required for inline conditions; omit when ``saved_filter_id`` is set.
:type attribute: str, optional

:param operator: The operator used in a targeting condition.
:type operator: ConditionOperator
:type operator: ConditionOperator, optional

:param value: Values used by the selected operator.
:type value: [str]
:param saved_filter_id: 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.
:type saved_filter_id: UUID, optional

:param value: Values used by the selected operator. Required for inline conditions; omit when ``saved_filter_id`` is set.
:type value: [str], optional
"""
if attribute is not unset:
kwargs["attribute"] = attribute
if operator is not unset:
kwargs["operator"] = operator
if saved_filter_id is not unset:
kwargs["saved_filter_id"] = saved_filter_id
if value is not unset:
kwargs["value"] = value
super().__init__(kwargs)

self_.attribute = attribute
self_.operator = operator
self_.value = value
Loading
Loading