Skip to content
Merged
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
278 changes: 278 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108555,6 +108555,181 @@ components:
required:
- data
type: object
SavedFilterAttributes:
description: Saved filter details, including the full targeting rules and conditions.
properties:
archived_at:
description: The time the saved filter was archived. Omitted when the filter is not archived.
example: "2026-01-03T12:00:00Z"
format: date-time
type: string
created_at:
description: The time the saved filter was created.
example: "2026-01-01T12:00:00Z"
format: date-time
type: string
created_by:
description: The ID of the user who created the saved filter.
example: "550e8400-e29b-41d4-a716-446655440091"
type: string
creation_type:
$ref: "#/components/schemas/SavedFilterCreationType"
description:
description: A description of the saved filter. Omitted when no description is set.
example: Users selected by email address or organization ID.
type: string
migration_metadata:
description: Optional JSON metadata supplied by migration tools for tracking the source of a saved filter.
example:
provider: launchdarkly
segment_key: early-access-users
name:
description: The name of the saved filter.
example: Early access users
type: string
targeting_rules:
description: Targeting rules combined with OR. Conditions within each rule are combined with AND. Both saved lists and saved rules use this structure.
items:
$ref: "#/components/schemas/SavedFilterTargetingRule"
type: array
updated_at:
description: The time the saved filter was last updated.
example: "2026-01-02T12:00:00Z"
format: date-time
type: string
required:
- name
- creation_type
- targeting_rules
- created_by
- created_at
- updated_at
type: object
SavedFilterCondition:
description: An inline condition in a saved filter targeting rule.
properties:
attribute:
description: The attribute evaluated by the condition.
example: email
type: string
id:
description: The ID of the condition.
example: "550e8400-e29b-41d4-a716-446655440093"
format: uuid
type: string
operator:
$ref: "#/components/schemas/SavedFilterConditionOperator"
value:
description: Values used by the condition operator.
example:
- user@example.com
items:
type: string
type: array
required:
- id
- operator
- attribute
- value
type: object
SavedFilterConditionOperator:
description: The comparison operator used by a saved filter condition.
enum:
- LT
- LTE
- GT
- GTE
- MATCHES
- NOT_MATCHES
- ONE_OF
- NOT_ONE_OF
- IS_NULL
- EQUALS
- SEMVER_EQ
- SEMVER_NEQ
- SEMVER_LT
- SEMVER_LTE
- SEMVER_GT
- SEMVER_GTE
example: ONE_OF
type: string
x-enum-varnames:
- LT
- LTE
- GT
- GTE
- MATCHES
- NOT_MATCHES
- ONE_OF
- NOT_ONE_OF
- IS_NULL
- EQUALS
- SEMVER_EQ
- SEMVER_NEQ
- SEMVER_LT
- SEMVER_LTE
- SEMVER_GT
- SEMVER_GTE
SavedFilterCreationType:
description: How the saved filter was authored. RULES indicates rule-based authoring and LIST indicates list import. Both types return targeting rules and conditions.
enum:
- RULES
- LIST
example: RULES
type: string
x-enum-varnames:
- RULES
- LIST
SavedFilterData:
description: A saved filter resource.
properties:
attributes:
$ref: "#/components/schemas/SavedFilterAttributes"
id:
description: The ID of the saved filter.
example: "550e8400-e29b-41d4-a716-446655440090"
format: uuid
type: string
type:
$ref: "#/components/schemas/SavedFilterDataType"
required:
- id
- type
- attributes
type: object
SavedFilterDataType:
description: The saved filter resource type.
enum:
- saved-filters
example: saved-filters
type: string
x-enum-varnames:
- SAVED_FILTERS
SavedFilterResponse:
description: Response containing a saved filter and its targeting rules.
properties:
data:
$ref: "#/components/schemas/SavedFilterData"
required:
- data
type: object
SavedFilterTargetingRule:
description: A targeting rule in a saved filter. A rule matches when all its conditions match.
properties:
conditions:
description: Conditions combined with AND within this targeting rule.
items:
$ref: "#/components/schemas/SavedFilterCondition"
type: array
id:
description: The ID of the targeting rule.
example: "550e8400-e29b-41d4-a716-446655440092"
format: uuid
type: string
required:
- id
- conditions
type: object
ScaRequest:
description: The top-level request object for submitting a Software Composition Analysis (SCA) scan result.
properties:
Expand Down Expand Up @@ -171735,6 +171910,109 @@ paths:
operator: AND
permissions:
- feature_flag_config_write
/api/v2/feature-flags/saved-filters/{saved_filter_id}:
get:
description: |-
Returns a saved filter by ID, including its full targeting rules, conditions, and values.
Supports both saved lists and saved rules. Targeting rules are combined with OR,
and conditions within each rule are combined with AND.
Returns the stored filter definition rather than evaluating it against users or organizations.
Archived filters can be retrieved. Filters that are deleted or belong to another organization return a not found error.
operationId: GetSavedFilter
parameters:
- description: The ID of the saved filter.
example: "550e8400-e29b-41d4-a716-446655440090"
in: path
name: saved_filter_id
required: true
schema:
format: uuid
type: string
responses:
"200":
content:
application/json:
examples:
default:
summary: A saved rule matching an email address OR an organization ID
value:
data:
attributes:
created_at: "2026-01-01T12:00:00Z"
created_by: "550e8400-e29b-41d4-a716-446655440091"
creation_type: RULES
description: Users selected by email address or organization ID.
name: Early access users
targeting_rules:
- conditions:
- attribute: email
id: "550e8400-e29b-41d4-a716-446655440093"
operator: ONE_OF
value: ["user@example.com"]
id: "550e8400-e29b-41d4-a716-446655440092"
- conditions:
- attribute: org_id
id: "550e8400-e29b-41d4-a716-446655440095"
operator: ONE_OF
value: ["12345", "67890"]
id: "550e8400-e29b-41d4-a716-446655440094"
updated_at: "2026-01-02T12:00:00Z"
id: "550e8400-e29b-41d4-a716-446655440090"
type: saved-filters
saved_list:
summary: A saved list containing user IDs
value:
data:
attributes:
created_at: "2026-01-01T12:00:00Z"
created_by: "550e8400-e29b-41d4-a716-446655440091"
creation_type: LIST
name: Early access user list
targeting_rules:
- conditions:
- attribute: user_id
id: "550e8400-e29b-41d4-a716-446655440098"
operator: ONE_OF
value: ["user-123", "user-456"]
id: "550e8400-e29b-41d4-a716-446655440097"
updated_at: "2026-01-02T12:00:00Z"
id: "550e8400-e29b-41d4-a716-446655440096"
type: saved-filters
schema:
$ref: "#/components/schemas/SavedFilterResponse"
description: OK
"400":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Bad Request
"403":
content:
application/json:
schema:
$ref: "#/components/schemas/APIErrorResponse"
description: Forbidden
"404":
content:
application/json:
schema:
$ref: "#/components/schemas/JSONAPIErrorResponse"
description: Not Found
"429":
$ref: "#/components/responses/TooManyRequestsResponse"
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- feature_flag_config_read
summary: Get a saved filter
tags:
- Feature Flags
x-permission:
operator: AND
permissions:
- feature_flag_config_read
/api/v2/feature-flags/{feature_flag_id}:
get:
description: |-
Expand Down
18 changes: 18 additions & 0 deletions examples/v2/feature-flags/GetSavedFilter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Get a saved filter returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi
from uuid import UUID

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = FeatureFlagsApi(api_client)
response = api_instance.get_saved_filter(
saved_filter_id=UUID("8c051ac8-df7a-496e-b5c0-de691a411100"),
)

print(response)
18 changes: 18 additions & 0 deletions examples/v2/feature-flags/GetSavedFilter_375197246.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Get a saved filter returns a saved list
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.feature_flags_api import FeatureFlagsApi
from uuid import UUID

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = FeatureFlagsApi(api_client)
response = api_instance.get_saved_filter(
saved_filter_id=UUID("fb44ff15-fe17-4bab-afe8-9a8eb0cf586c"),
)

print(response)
45 changes: 45 additions & 0 deletions src/datadog_api_client/v2/api/feature_flags_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from datadog_api_client.v2.model.create_environment_request import CreateEnvironmentRequest
from datadog_api_client.v2.model.update_environment_request import UpdateEnvironmentRequest
from datadog_api_client.v2.model.allocation_exposure_schedule_response import AllocationExposureScheduleResponse
from datadog_api_client.v2.model.saved_filter_response import SavedFilterResponse
from datadog_api_client.v2.model.update_feature_flag_request import UpdateFeatureFlagRequest
from datadog_api_client.v2.model.allocation_response import AllocationResponse
from datadog_api_client.v2.model.create_allocations_request import CreateAllocationsRequest
Expand Down Expand Up @@ -321,6 +322,29 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._get_saved_filter_endpoint = _Endpoint(
settings={
"response_type": (SavedFilterResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/feature-flags/saved-filters/{saved_filter_id}",
"operation_id": "get_saved_filter",
"http_method": "GET",
"version": "v2",
},
params_map={
"saved_filter_id": {
"required": True,
"openapi_types": (UUID,),
"attribute": "saved_filter_id",
"location": "path",
},
},
headers_map={
"accept": ["application/json"],
},
api_client=api_client,
)

self._list_feature_flags_endpoint = _Endpoint(
settings={
"response_type": (ListFeatureFlagsResponse,),
Expand Down Expand Up @@ -946,6 +970,27 @@ def get_feature_flags_environment(

return self._get_feature_flags_environment_endpoint.call_with_http_info(**kwargs)

def get_saved_filter(
self,
saved_filter_id: UUID,
) -> SavedFilterResponse:
"""Get a saved filter.

Returns a saved filter by ID, including its full targeting rules, conditions, and values.
Supports both saved lists and saved rules. Targeting rules are combined with OR,
and conditions within each rule are combined with AND.
Returns the stored filter definition rather than evaluating it against users or organizations.
Archived filters can be retrieved. Filters that are deleted or belong to another organization return a not found error.

:param saved_filter_id: The ID of the saved filter.
:type saved_filter_id: UUID
:rtype: SavedFilterResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["saved_filter_id"] = saved_filter_id

return self._get_saved_filter_endpoint.call_with_http_info(**kwargs)

def list_feature_flags(
self,
*,
Expand Down
Loading
Loading