|
10 | 10 | TierActivationRequest, |
11 | 11 | TierCapacityPoolCreateRequest, |
12 | 12 | TierCapacityPoolPatchRequest, |
13 | | - TierCapacityPoolReplaceRequest, |
14 | 13 | TierConfigurationMutationRequest, |
15 | 14 | TierCreateRequest, |
16 | 15 | TierModelPolicyCreateRequest, |
17 | 16 | TierModelPolicyBulkLimitsRequest, |
18 | 17 | TierModelPolicyPatchRequest, |
19 | | - TierModelPolicyReplaceRequest, |
20 | 18 | TierPatchRequest, |
21 | 19 | TierVersionCreateRequest, |
22 | 20 | ) |
@@ -589,54 +587,6 @@ async def delete_tier_model_policy( |
589 | 587 | return response |
590 | 588 |
|
591 | 589 |
|
592 | | -@router.put( |
593 | | - "/ui/api/tiers/{tier_id}/versions/{tier_version_id}/model-policies", |
594 | | - dependencies=_PLATFORM_ADMIN_DEPENDENCY, |
595 | | -) |
596 | | -async def replace_tier_model_policies( |
597 | | - request: Request, |
598 | | - tier_id: str, |
599 | | - tier_version_id: str, |
600 | | - payload: TierModelPolicyReplaceRequest, |
601 | | -) -> dict[str, Any]: |
602 | | - request_start = perf_counter() |
603 | | - service = _tier_service(request) |
604 | | - request_payload = _payload(payload) |
605 | | - policies_payload = request_payload["policies"] |
606 | | - before_detail: dict[str, Any] | None = None |
607 | | - try: |
608 | | - before_detail = await service.get_tier_version_detail(tier_id, tier_version_id) |
609 | | - records = await service.replace_model_policies( |
610 | | - tier_id, |
611 | | - tier_version_id, |
612 | | - policies_payload, |
613 | | - ) |
614 | | - except TierAdminError as exc: |
615 | | - raise _http_error(exc) from exc |
616 | | - |
617 | | - response = {"data": [serialize_model_policy(record) for record in records]} |
618 | | - tier_policy_invalidation = await _reload_tier_policy_for_audit(request) |
619 | | - await emit_admin_mutation_audit( |
620 | | - request=request, |
621 | | - request_start=request_start, |
622 | | - action=AuditAction.ADMIN_TIER_MODEL_POLICIES_REPLACE, |
623 | | - resource_type="tier_model_policy_set", |
624 | | - resource_id=tier_version_id, |
625 | | - request_payload={ |
626 | | - "tier_id": tier_id, |
627 | | - "policy_count": len(policies_payload), |
628 | | - }, |
629 | | - response_payload={ |
630 | | - "policy_count": len(response["data"]), |
631 | | - "tier_policy_invalidation": tier_policy_invalidation, |
632 | | - }, |
633 | | - before={"policy_count": len(before_detail["model_policies"]) if before_detail else 0}, |
634 | | - after={"policy_count": len(response["data"])}, |
635 | | - metadata={"tier_policy_invalidation": tier_policy_invalidation}, |
636 | | - ) |
637 | | - return response |
638 | | - |
639 | | - |
640 | 590 | @router.get( |
641 | 591 | "/ui/api/tiers/{tier_id}/versions/{tier_version_id}/capacity-pools", |
642 | 592 | dependencies=_PLATFORM_ADMIN_DEPENDENCY, |
@@ -813,51 +763,6 @@ async def delete_tier_capacity_pool( |
813 | 763 | return response |
814 | 764 |
|
815 | 765 |
|
816 | | -@router.put( |
817 | | - "/ui/api/tiers/{tier_id}/versions/{tier_version_id}/capacity-pools", |
818 | | - dependencies=_PLATFORM_ADMIN_DEPENDENCY, |
819 | | -) |
820 | | -async def replace_tier_capacity_pools( |
821 | | - request: Request, |
822 | | - tier_id: str, |
823 | | - tier_version_id: str, |
824 | | - payload: TierCapacityPoolReplaceRequest, |
825 | | -) -> dict[str, Any]: |
826 | | - request_start = perf_counter() |
827 | | - service = _tier_service(request) |
828 | | - request_payload = _payload(payload) |
829 | | - pools_payload = request_payload["pools"] |
830 | | - before_detail: dict[str, Any] | None = None |
831 | | - try: |
832 | | - before_detail = await service.get_tier_version_detail(tier_id, tier_version_id) |
833 | | - records = await service.replace_capacity_pools( |
834 | | - tier_id, |
835 | | - tier_version_id, |
836 | | - pools_payload, |
837 | | - ) |
838 | | - except TierAdminError as exc: |
839 | | - raise _http_error(exc) from exc |
840 | | - |
841 | | - response = {"data": [serialize_capacity_pool(record) for record in records]} |
842 | | - tier_policy_invalidation = await _reload_tier_policy_for_audit(request) |
843 | | - await emit_admin_mutation_audit( |
844 | | - request=request, |
845 | | - request_start=request_start, |
846 | | - action=AuditAction.ADMIN_TIER_CAPACITY_POOLS_REPLACE, |
847 | | - resource_type="tier_capacity_pool_set", |
848 | | - resource_id=tier_version_id, |
849 | | - request_payload={"tier_id": tier_id, "pool_count": len(pools_payload)}, |
850 | | - response_payload={ |
851 | | - "pool_count": len(response["data"]), |
852 | | - "tier_policy_invalidation": tier_policy_invalidation, |
853 | | - }, |
854 | | - before={"pool_count": len(before_detail["capacity_pools"]) if before_detail else 0}, |
855 | | - after={"pool_count": len(response["data"])}, |
856 | | - metadata={"tier_policy_invalidation": tier_policy_invalidation}, |
857 | | - ) |
858 | | - return response |
859 | | - |
860 | | - |
861 | 766 | @router.get( |
862 | 767 | "/ui/api/tiers/{tier_id}/versions/{tier_version_id}/activation-preview", |
863 | 768 | dependencies=_PLATFORM_ADMIN_DEPENDENCY, |
@@ -920,46 +825,6 @@ async def activate_tier_version( |
920 | 825 | return response |
921 | 826 |
|
922 | 827 |
|
923 | | -@router.post( |
924 | | - "/ui/api/tiers/{tier_id}/versions/{tier_version_id}/publish", |
925 | | - dependencies=_PLATFORM_ADMIN_DEPENDENCY, |
926 | | -) |
927 | | -async def publish_tier_version( |
928 | | - request: Request, |
929 | | - tier_id: str, |
930 | | - tier_version_id: str, |
931 | | -) -> dict[str, Any]: |
932 | | - request_start = perf_counter() |
933 | | - service = _tier_service(request) |
934 | | - try: |
935 | | - before = serialize_tier_version( |
936 | | - await service.require_version_for_tier(tier_id, tier_version_id) |
937 | | - ) |
938 | | - published = await service.publish_tier_version( |
939 | | - tier_id, |
940 | | - tier_version_id, |
941 | | - published_by_account_id=_actor_account_id(request), |
942 | | - ) |
943 | | - except TierAdminError as exc: |
944 | | - raise _http_error(exc) from exc |
945 | | - |
946 | | - response = serialize_tier_version(published) |
947 | | - tier_policy_invalidation = await _reload_tier_policy_for_audit(request) |
948 | | - await emit_admin_mutation_audit( |
949 | | - request=request, |
950 | | - request_start=request_start, |
951 | | - action=AuditAction.ADMIN_TIER_VERSION_PUBLISH, |
952 | | - resource_type="tier_version", |
953 | | - resource_id=tier_version_id, |
954 | | - request_payload={"tier_id": tier_id}, |
955 | | - response_payload={**response, "tier_policy_invalidation": tier_policy_invalidation}, |
956 | | - before=before, |
957 | | - after=response, |
958 | | - metadata={"tier_policy_invalidation": tier_policy_invalidation}, |
959 | | - ) |
960 | | - return response |
961 | | - |
962 | | - |
963 | 828 | @router.post( |
964 | 829 | "/ui/api/tiers/{tier_id}/versions/{tier_version_id}/archive", |
965 | 830 | dependencies=_PLATFORM_ADMIN_DEPENDENCY, |
|
0 commit comments