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
222 changes: 192 additions & 30 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions examples/v2/ai-gateway/CreateAiGatewayRoutingRule.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from datadog_api_client.v2.model.ai_gateway_nullable_routing_rule_tier_ordering import (
AiGatewayNullableRoutingRuleTierOrdering,
)
from datadog_api_client.v2.model.ai_gateway_routing_classifier_request import AiGatewayRoutingClassifierRequest
from datadog_api_client.v2.model.ai_gateway_routing_reasoning_level import AiGatewayRoutingReasoningLevel
from datadog_api_client.v2.model.ai_gateway_routing_rule_create_attributes import AiGatewayRoutingRuleCreateAttributes
from datadog_api_client.v2.model.ai_gateway_routing_rule_create_data import AiGatewayRoutingRuleCreateData
Expand All @@ -23,14 +24,22 @@
slug="coding",
tiers=[
AiGatewayRoutingRuleTierRequest(
classifier=AiGatewayRoutingClassifierRequest(
confidence_threshold=0.5,
context="Requests come from engineers.",
model="gpt-6-luna",
provider="openai",
),
ordering=AiGatewayNullableRoutingRuleTierOrdering.CONFIGURED,
targets=[
AiGatewayRoutingRuleTargetRequest(
default=False,
id=901,
model="gpt-5.2-codex",
model_id=101,
provider="prod-us",
reasoning_level=AiGatewayRoutingReasoningLevel.MEDIUM,
rubric="Short factual questions.",
slug="coding-fallback",
type=AiGatewayRoutingRuleTargetType.MODEL,
weight=70,
Expand Down
17 changes: 16 additions & 1 deletion examples/v2/ai-gateway/UpdateAiGatewayRoutingRule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Replace an AI Gateway routing rule returns "OK" response
Update an AI Gateway routing rule returns "OK" response
"""

from os import environ
Expand All @@ -8,6 +8,7 @@
from datadog_api_client.v2.model.ai_gateway_nullable_routing_rule_tier_ordering import (
AiGatewayNullableRoutingRuleTierOrdering,
)
from datadog_api_client.v2.model.ai_gateway_routing_classifier_request import AiGatewayRoutingClassifierRequest
from datadog_api_client.v2.model.ai_gateway_routing_reasoning_level import AiGatewayRoutingReasoningLevel
from datadog_api_client.v2.model.ai_gateway_routing_rule_replace_attributes import AiGatewayRoutingRuleReplaceAttributes
from datadog_api_client.v2.model.ai_gateway_routing_rule_replace_data import AiGatewayRoutingRuleReplaceData
Expand All @@ -16,20 +17,34 @@
from datadog_api_client.v2.model.ai_gateway_routing_rule_target_type import AiGatewayRoutingRuleTargetType
from datadog_api_client.v2.model.ai_gateway_routing_rule_tier_request import AiGatewayRoutingRuleTierRequest
from datadog_api_client.v2.model.ai_gateway_routing_rule_type import AiGatewayRoutingRuleType
from datetime import datetime
from dateutil.tz import tzutc

body = AiGatewayRoutingRuleReplaceRequest(
data=AiGatewayRoutingRuleReplaceData(
attributes=AiGatewayRoutingRuleReplaceAttributes(
expected_updated_at=datetime(2026, 8, 24, 12, 0, tzinfo=tzutc()),
removed_target_ids=[
901,
],
tiers=[
AiGatewayRoutingRuleTierRequest(
classifier=AiGatewayRoutingClassifierRequest(
confidence_threshold=0.5,
context="Requests come from engineers.",
model="gpt-6-luna",
provider="openai",
),
ordering=AiGatewayNullableRoutingRuleTierOrdering.CONFIGURED,
targets=[
AiGatewayRoutingRuleTargetRequest(
default=False,
id=901,
model="gpt-5.2-codex",
model_id=101,
provider="prod-us",
reasoning_level=AiGatewayRoutingReasoningLevel.MEDIUM,
rubric="Short factual questions.",
slug="coding-fallback",
type=AiGatewayRoutingRuleTargetType.MODEL,
weight=70,
Expand Down
14 changes: 7 additions & 7 deletions src/datadog_api_client/v2/api/ai_gateway_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ def create_ai_gateway_routing_rule(
) -> AiGatewayRoutingRuleResponse:
"""Create an AI Gateway routing rule.

Create an organization-owned routing rule. Data capture overrides are managed independently. Each tier has an ordering, which defaults to configured. A weighted_affinity tier distributes first-choice assignments by relative target weights (1 to 10000, default 1) and accepts only distinct model targets with an explicit provider. Weights need not total 100. Configured tiers must omit weights or set them to null.
Create an organization-owned route with ``ai_gateway_config_write``. New provider/model and route references require View. New routes use standard unrestricted defaults. To restrict configuration access, create the route and then apply a restriction policy using its numeric route_id. Sharing follows standard restriction-policy propagation and does not grant or revoke policy-authorized inference. Data capture overrides are managed independently. Each tier has an ordering, which defaults to configured. A weighted_affinity tier distributes first-choice assignments by relative target weights (1 to 10000, default 1) and accepts only distinct model targets with an explicit provider. Weights need not total 100. Configured tiers must omit weights or set them to null.

:type body: AiGatewayRoutingRuleCreateRequest
:rtype: AiGatewayRoutingRuleResponse
Expand Down Expand Up @@ -1748,7 +1748,7 @@ def delete_ai_gateway_provider(
) -> None:
"""Delete an AI Gateway provider.

Requires ``ai_gateway_config_write`` and provider Edit. Models and pricing inherit provider access. This also applies when force=true. Existing cascades remain and can affect policies the caller cannot edit. Delete a provider by ID. Providers used by routing rules return provider_in_use with HTTP 409 and the affected rules in error metadata. Retry with force=true to remove provider targets and delete rules left without targets. Surviving tiers keep their ordering and weights. A deletion that would rewrite a surviving tier with an unknown ordering_issue fails with HTTP 409 and code routing_rule_unknown_ordering until that rule is replaced or deleted.
Requires ``ai_gateway_config_write`` and provider View/Edit. Models and pricing inherit provider access. Every affected route and policy membership requires the corresponding Edit permission; force=true never bypasses authorization. Providers used by routing rules return provider_in_use with HTTP 409. Each JSON:API error item's ``meta`` contains blocked, restricted_dependencies, policies, rules_to_delete, and rules_to_update. Visible policy entries contain id, name, and editable; visible route entries contain id, slug, and editable. Hidden dependencies are omitted from every collection and reported only by restricted_dependencies. A blocked response changes no configuration; an authorized editor must first remove the blocking references. Retry with force=true to confirm an authorized cascade that removes provider targets and deletes rules left without targets. Surviving tiers keep their ordering and weights. A deletion that would rewrite a surviving tier with an unknown ordering_issue fails with HTTP 409 and code routing_rule_unknown_ordering until that rule is replaced or deleted.

:param id: Provider ID.
:type id: int
Expand Down Expand Up @@ -1789,7 +1789,7 @@ def delete_ai_gateway_routing_rule(
) -> None:
"""Delete an AI Gateway routing rule.

Delete a routing rule. Referenced rules require force=true. Surviving tiers keep their ordering and weights. A deletion that would rewrite a surviving tier with an unknown ordering_issue fails with HTTP 409 and code routing_rule_unknown_ordering until that rule is replaced or deleted.
Delete a route with ``ai_gateway_config_write`` and route View/Edit. Every affected route and policy membership requires the corresponding Edit permission. The force=true parameter confirms impact and never bypasses authorization. A denied or unavailable check changes no configuration. Visible dependencies include editable; hidden dependencies are omitted and reported only by restricted_dependencies. A blocked response means an authorized editor must first remove blocking references. Each JSON:API error item's ``meta`` contains blocked, restricted_dependencies, policies, rules_to_delete, and rules_to_update. Visible policy entries contain id, name, and editable. Route deletion entries contain rule, reason, and editable; update entries contain rule, removed_tiers, and editable. Each rule contains route_id, slug, tiers, created_at, and updated_at with hidden nested selections redacted. The removed_tiers array identifies original tier numbers removed entirely by the cascade. Already-authorized in-flight operations may finish. Referenced rules require force=true. Surviving tiers keep their ordering and weights. A deletion that would rewrite a surviving tier with an unknown ordering_issue fails with HTTP 409 and code routing_rule_unknown_ordering until that rule is replaced or deleted. Restriction cleanup occurs only after confirmed deletion. Cleanup failure returns 500 with configuration_deleted=true and permissions_cleanup_failed=true; refresh instead of assuming the route still exists.

:param slug: Organization-unique routing rule slug.
:type slug: str
Expand Down Expand Up @@ -2008,7 +2008,7 @@ def get_ai_gateway_routing_rule(
) -> AiGatewayRoutingRuleResponse:
"""Get an AI Gateway routing rule.

Get a routing rule by its organization-unique slug.
Get a routing rule by slug with ``ai_gateway_config_read`` and route View. Hidden and missing routes both return 404. Hidden target identities are omitted; parent-local target IDs remain available for retention.

:param slug: Organization-unique routing rule slug.
:type slug: str
Expand Down Expand Up @@ -2269,7 +2269,7 @@ def list_ai_gateway_routing_rules(
) -> AiGatewayRoutingRuleListResponse:
"""List AI Gateway routing rules.

List all routing rules for the organization.
List the organization's routing rules that the caller has View access to. Requires ``ai_gateway_config_read``. Hidden route references are omitted from nested targets.

:rtype: AiGatewayRoutingRuleListResponse
"""
Expand Down Expand Up @@ -2497,9 +2497,9 @@ def update_ai_gateway_routing_rule(
slug: str,
body: AiGatewayRoutingRuleReplaceRequest,
) -> AiGatewayRoutingRuleResponse:
"""Replace an AI Gateway routing rule.
"""Update an AI Gateway routing rule.

Replace a routing rule's tiers. The slug is immutable; data capture is managed independently. This is a full replacement: omitted or null ordering resets the tier to configured, and omitted or null weights in a weighted_affinity tier reset to 1. Omitted or null reasoning_level clears a model destination's reasoning override. Replacing a rule repairs tiers reported with an ordering_issue.
Update a route with ``ai_gateway_config_write`` and route View/Edit. The slug is immutable; data capture is managed independently. Omitting tiers preserves the entire graph. When tiers are supplied, saved parent-local target IDs retain omitted destination and reasoning, weight, rubric, and default settings. Omitted ordering/classifier settings preserve the saved same-position tier. Explicit null resets nullable settings. New references require View on their resources. A hidden target omitted from tiers must be explicitly listed in removed_target_ids, otherwise the update fails without changes. expected_updated_at rejects stale updates with 409. Sharing-only saves do not replace target rows. Hidden and missing routes return the same 404; visible non-editors receive 403. Inference authorization is unchanged.

:param slug: Organization-unique routing rule slug.
:type slug: str
Expand Down
23 changes: 13 additions & 10 deletions src/datadog_api_client/v2/api/restriction_policies_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ def delete_restriction_policy(
"""Delete a restriction policy.

Deletes the restriction policy associated with a specified resource.
For AI Gateway provider policies, requires ``ai_gateway_config_write`` and standard restriction-policy authorization.
Deleting a provider policy restores normal unrestricted defaults.
For AI Gateway provider and route policies, requires ``ai_gateway_config_write`` and standard restriction-policy authorization.
Deleting a provider or route policy restores normal unrestricted defaults.

:param resource_id: Identifier, formatted as ``type:id``. Supported types: ``ai-gateway-provider`` , ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``powerpack`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``synthetics-global-variable`` , ``synthetics-test`` , ``synthetics-private-location`` , ``monitor`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline`` , ``case-management-project`` , ``monitor-notification-rule`` , ``status-page`` , ``feature-flag`` , ``network-path-config``.
:param resource_id: Identifier, formatted as ``type:id``. Supported types: ``ai-gateway-provider`` , ``ai-gateway-route`` , ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``powerpack`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``synthetics-global-variable`` , ``synthetics-test`` , ``synthetics-private-location`` , ``monitor`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline`` , ``case-management-project`` , ``monitor-notification-rule`` , ``status-page`` , ``feature-flag`` , ``network-path-config``.
:type resource_id: str
:rtype: None
"""
Expand All @@ -130,9 +130,9 @@ def get_restriction_policy(
"""Get a restriction policy.

Retrieves the restriction policy associated with a specified resource.
For AI Gateway provider policies, requires ``ai_gateway_config_read``.
For AI Gateway provider and route policies, requires ``ai_gateway_config_read``.

:param resource_id: Identifier, formatted as ``type:id``. Supported types: ``ai-gateway-provider`` , ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``powerpack`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``synthetics-global-variable`` , ``synthetics-test`` , ``synthetics-private-location`` , ``monitor`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline`` , ``case-management-project`` , ``monitor-notification-rule`` , ``status-page`` , ``feature-flag`` , ``network-path-config``.
:param resource_id: Identifier, formatted as ``type:id``. Supported types: ``ai-gateway-provider`` , ``ai-gateway-route`` , ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``powerpack`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``synthetics-global-variable`` , ``synthetics-test`` , ``synthetics-private-location`` , ``monitor`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline`` , ``case-management-project`` , ``monitor-notification-rule`` , ``status-page`` , ``feature-flag`` , ``network-path-config``.
:type resource_id: str
:rtype: RestrictionPolicyResponse
"""
Expand All @@ -157,6 +157,7 @@ def update_restriction_policy(
Restriction policies can be applied to the following resources:

* AI Gateway Providers: ``ai-gateway-provider``
* AI Gateway Routes: ``ai-gateway-route``
* Dashboards: ``dashboard``
* Integration Services: ``integration-service``
* Integration Webhooks: ``integration-webhook``
Expand Down Expand Up @@ -186,12 +187,12 @@ def update_restriction_policy(
* Feature Flags: ``feature-flag``
* Network Path Configs: ``network-path-config``

AI Gateway provider policies control configuration and inherited model/catalog/pricing visibility.
The editor relation includes View. Providers have no Run relation; restriction policies don't affect inference.
Reading provider policies requires ``ai_gateway_config_read``. Updating or deleting them requires
AI Gateway provider policies control configuration and inherited model/catalog/pricing visibility. Route policies control route configuration and identifying nested references.
The editor relation includes View. Providers and routes have no Run relation; restriction policies don't affect inference.
Reading provider or route policies requires ``ai_gateway_config_read``. Updating or deleting them requires
``ai_gateway_config_write`` and follows standard restriction-policy authorization, including
administrator recovery and self-lockout checks.
Providers without a restriction policy retain the normal unrestricted defaults.
Providers and routes without a restriction policy retain the normal unrestricted defaults.

**Supported relations for resources**

Expand All @@ -202,6 +203,8 @@ def update_restriction_policy(
- Supported Relations
* - AI Gateway Providers
- ``viewer`` , ``editor``
* - AI Gateway Routes
- ``viewer`` , ``editor``
* - Dashboards
- ``viewer`` , ``editor``
* - Integration Services
Expand Down Expand Up @@ -260,7 +263,7 @@ def update_restriction_policy(
- ``viewer`` , ``editor``


:param resource_id: Identifier, formatted as ``type:id``. Supported types: ``ai-gateway-provider`` , ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``powerpack`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``synthetics-global-variable`` , ``synthetics-test`` , ``synthetics-private-location`` , ``monitor`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline`` , ``case-management-project`` , ``monitor-notification-rule`` , ``status-page`` , ``feature-flag`` , ``network-path-config``.
:param resource_id: Identifier, formatted as ``type:id``. Supported types: ``ai-gateway-provider`` , ``ai-gateway-route`` , ``dashboard`` , ``integration-service`` , ``integration-webhook`` , ``notebook`` , ``powerpack`` , ``reference-table`` , ``security-rule`` , ``slo`` , ``synthetics-global-variable`` , ``synthetics-test`` , ``synthetics-private-location`` , ``monitor`` , ``workflow`` , ``app-builder-app`` , ``connection`` , ``connection-group`` , ``rum-application`` , ``cross-org-connection`` , ``spreadsheet`` , ``on-call-schedule`` , ``on-call-escalation-policy`` , ``on-call-team-routing-rules`` , ``logs-pipeline`` , ``case-management-project`` , ``monitor-notification-rule`` , ``status-page`` , ``feature-flag`` , ``network-path-config``.
:type resource_id: str
:param body: Restriction policy payload
:type body: RestrictionPolicyUpdateRequest
Expand Down
Loading
Loading