From 6e14bcaf28c248bb0fc7537f1387994dd4c93d8d Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 3 Apr 2026 22:09:55 +0000 Subject: [PATCH] Regenerate client from commit c758880 of spec repo --- .generator/schemas/v2/openapi.yaml | 1224 +++++++++++++++++ .../frozen.json | 1 + .../recording.har | 253 ++++ .../frozen.json | 1 + .../recording.har | 253 ++++ ...eAllocationsForFeatureFlagInEnvironment.ts | 79 ++ ...sForFeatureFlagInEnvironment_3662093014.ts | 49 + .../v2/feature-flags/PauseExposureSchedule.ts | 21 + .../feature-flags/ResumeExposureSchedule.ts | 21 + .../v2/feature-flags/StartExposureSchedule.ts | 21 + .../v2/feature-flags/StopExposureSchedule.ts | 21 + ...eAllocationsForFeatureFlagInEnvironment.ts | 81 ++ ...sForFeatureFlagInEnvironment_3789036209.ts | 78 ++ features/support/scenarios_model_mapping.ts | 58 + features/v2/feature_flags.feature | 224 +++ features/v2/given.json | 21 + features/v2/undo.json | 36 + .../apis/FeatureFlagsApi.ts | 870 ++++++++++++ packages/datadog-api-client-v2/index.ts | 37 + .../models/Allocation.ts | 167 +++ .../models/AllocationDataRequest.ts | 64 + .../models/AllocationDataResponse.ts | 74 + .../models/AllocationDataType.ts | 14 + .../AllocationExposureGuardrailTrigger.ts | 112 ++ .../models/AllocationExposureRolloutStep.ts | 132 ++ .../models/AllocationExposureSchedule.ts | 138 ++ .../models/AllocationExposureScheduleData.ts | 74 + .../AllocationExposureScheduleDataType.ts | 16 + .../AllocationExposureScheduleResponse.ts | 54 + .../models/AllocationResponse.ts | 54 + .../models/AllocationType.ts | 18 + .../datadog-api-client-v2/models/Condition.ts | 102 ++ .../models/ConditionOperator.ts | 34 + .../models/ConditionRequest.ts | 72 + .../models/CreateAllocationsRequest.ts | 54 + .../models/ExposureRolloutStepRequest.ts | 91 ++ .../models/ExposureScheduleRequest.ts | 98 ++ .../models/FeatureFlagAttributes.ts | 8 + .../models/FeatureFlagEnvironment.ts | 8 + .../models/GuardrailMetric.ts | 71 + .../models/GuardrailMetricRequest.ts | 63 + .../models/GuardrailTriggerAction.ts | 18 + .../models/ListAllocationsResponse.ts | 54 + .../models/ObjectSerializer.ts | 67 + .../models/OverwriteAllocationsRequest.ts | 54 + .../models/RolloutOptions.ts | 73 + .../models/RolloutOptionsRequest.ts | 71 + .../models/RolloutStrategy.ts | 18 + .../models/TargetingRule.ts | 84 ++ .../models/TargetingRuleRequest.ts | 54 + .../models/UpsertAllocationRequest.ts | 125 ++ .../models/VariantWeight.ts | 100 ++ .../models/VariantWeightRequest.ts | 71 + 53 files changed, 5656 insertions(+) create mode 100644 cassettes/v2/Feature-Flags_3833710718/Create-allocation-for-a-flag-in-an-environment-returns-Created-response_1397720344/frozen.json create mode 100644 cassettes/v2/Feature-Flags_3833710718/Create-allocation-for-a-flag-in-an-environment-returns-Created-response_1397720344/recording.har create mode 100644 cassettes/v2/Feature-Flags_3833710718/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response_1080924031/frozen.json create mode 100644 cassettes/v2/Feature-Flags_3833710718/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response_1080924031/recording.har create mode 100644 examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.ts create mode 100644 examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.ts create mode 100644 examples/v2/feature-flags/PauseExposureSchedule.ts create mode 100644 examples/v2/feature-flags/ResumeExposureSchedule.ts create mode 100644 examples/v2/feature-flags/StartExposureSchedule.ts create mode 100644 examples/v2/feature-flags/StopExposureSchedule.ts create mode 100644 examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.ts create mode 100644 examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.ts create mode 100644 packages/datadog-api-client-v2/models/Allocation.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationDataRequest.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationDataResponse.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationDataType.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationExposureGuardrailTrigger.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationExposureRolloutStep.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationExposureSchedule.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationExposureScheduleData.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationExposureScheduleDataType.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationExposureScheduleResponse.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationResponse.ts create mode 100644 packages/datadog-api-client-v2/models/AllocationType.ts create mode 100644 packages/datadog-api-client-v2/models/Condition.ts create mode 100644 packages/datadog-api-client-v2/models/ConditionOperator.ts create mode 100644 packages/datadog-api-client-v2/models/ConditionRequest.ts create mode 100644 packages/datadog-api-client-v2/models/CreateAllocationsRequest.ts create mode 100644 packages/datadog-api-client-v2/models/ExposureRolloutStepRequest.ts create mode 100644 packages/datadog-api-client-v2/models/ExposureScheduleRequest.ts create mode 100644 packages/datadog-api-client-v2/models/GuardrailMetric.ts create mode 100644 packages/datadog-api-client-v2/models/GuardrailMetricRequest.ts create mode 100644 packages/datadog-api-client-v2/models/GuardrailTriggerAction.ts create mode 100644 packages/datadog-api-client-v2/models/ListAllocationsResponse.ts create mode 100644 packages/datadog-api-client-v2/models/OverwriteAllocationsRequest.ts create mode 100644 packages/datadog-api-client-v2/models/RolloutOptions.ts create mode 100644 packages/datadog-api-client-v2/models/RolloutOptionsRequest.ts create mode 100644 packages/datadog-api-client-v2/models/RolloutStrategy.ts create mode 100644 packages/datadog-api-client-v2/models/TargetingRule.ts create mode 100644 packages/datadog-api-client-v2/models/TargetingRuleRequest.ts create mode 100644 packages/datadog-api-client-v2/models/UpsertAllocationRequest.ts create mode 100644 packages/datadog-api-client-v2/models/VariantWeight.ts create mode 100644 packages/datadog-api-client-v2/models/VariantWeightRequest.ts diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 45672b441bd8..e83df8269e5f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1277,6 +1277,15 @@ components: example: "550e8400-e29b-41d4-a716-446655440001" format: uuid type: string + exposure_schedule_id: + description: The ID of the exposure schedule. + in: path + name: exposure_schedule_id + required: true + schema: + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string feature_flag_id: description: The ID of the feature flag. in: path @@ -3348,6 +3357,334 @@ components: - WARN - ERROR - OK + Allocation: + description: Targeting rule (allocation) details for a feature flag environment. + properties: + created_at: + description: The timestamp when the targeting rule allocation was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + environment_ids: + description: Environment IDs associated with this targeting rule allocation. + example: + - "550e8400-e29b-41d4-a716-446655440001" + items: + description: Environment ID linked to this targeting rule allocation. + format: uuid + type: string + type: array + experiment_id: + description: The experiment ID linked to this targeting rule allocation. + example: "550e8400-e29b-41d4-a716-446655440030" + nullable: true + type: string + exposure_schedule: + $ref: "#/components/schemas/AllocationExposureSchedule" + guardrail_metrics: + description: Guardrail metrics associated with this targeting rule allocation. + items: + $ref: "#/components/schemas/GuardrailMetric" + type: array + id: + description: The unique identifier of the targeting rule allocation. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + key: + description: The unique key of the targeting rule allocation. + example: "prod-rollout" + type: string + name: + description: The display name of the targeting rule. + example: "Production Rollout" + type: string + order_position: + description: Sort order position within the environment. + example: 0 + format: int64 + type: integer + targeting_rules: + description: Conditions associated with this targeting rule allocation. + items: + $ref: "#/components/schemas/TargetingRule" + type: array + type: + $ref: "#/components/schemas/AllocationType" + updated_at: + description: The timestamp when the targeting rule allocation was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + variant_weights: + description: Weighted variant assignments for this targeting rule allocation. + items: + $ref: "#/components/schemas/VariantWeight" + type: array + required: + - name + - key + - targeting_rules + - variant_weights + - order_position + - environment_ids + - type + - guardrail_metrics + - created_at + - updated_at + type: object + AllocationDataRequest: + description: Data wrapper for allocation request payloads. + properties: + attributes: + $ref: "#/components/schemas/UpsertAllocationRequest" + type: + $ref: "#/components/schemas/AllocationDataType" + required: + - type + - attributes + type: object + AllocationDataResponse: + description: Data wrapper for targeting rule allocation responses. + properties: + attributes: + $ref: "#/components/schemas/Allocation" + id: + description: The unique identifier of the targeting rule allocation. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + type: + $ref: "#/components/schemas/AllocationDataType" + required: + - id + - type + - attributes + type: object + AllocationDataType: + description: The resource type. + enum: + - "allocations" + example: "allocations" + type: string + x-enum-varnames: + - ALLOCATIONS + AllocationExposureGuardrailTrigger: + description: Guardrail trigger details for a progressive rollout. + properties: + allocation_exposure_schedule_id: + description: The progressive rollout ID this trigger belongs to. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + created_at: + description: The timestamp when this trigger was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + flagging_variant_id: + description: The variant ID that triggered this event. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + id: + description: The unique identifier of the guardrail trigger. + example: "550e8400-e29b-41d4-a716-446655440080" + format: uuid + type: string + metric_id: + description: The metric ID associated with the trigger. + example: "metric-error-rate" + type: string + triggered_action: + description: The action that was triggered. + example: "PAUSE" + type: string + updated_at: + description: The timestamp when this trigger was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + required: + - id + - allocation_exposure_schedule_id + - flagging_variant_id + - metric_id + - triggered_action + - created_at + - updated_at + type: object + AllocationExposureRolloutStep: + description: Exposure progression step details. + properties: + allocation_exposure_schedule_id: + description: The progressive rollout ID this step belongs to. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + created_at: + description: The timestamp when the progression step was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + exposure_ratio: + description: The exposure ratio for this step. + example: 0.1 + format: double + maximum: 1 + minimum: 0 + type: number + grouped_step_index: + description: Logical index grouping related steps. + example: 0 + format: int64 + minimum: 0 + type: integer + id: + description: The unique identifier of the progression step. + example: "550e8400-e29b-41d4-a716-446655440040" + format: uuid + type: string + interval_ms: + description: Step duration in milliseconds. + example: 3600000 + format: int64 + nullable: true + type: integer + is_pause_record: + description: Whether this step represents a pause record. + example: false + type: boolean + order_position: + description: Sort order for the progression step. + example: 0 + format: int64 + type: integer + updated_at: + description: The timestamp when the progression step was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + required: + - id + - allocation_exposure_schedule_id + - order_position + - exposure_ratio + - is_pause_record + - grouped_step_index + - created_at + - updated_at + type: object + AllocationExposureSchedule: + description: Progressive release details for a targeting rule allocation. + properties: + absolute_start_time: + description: The absolute UTC start time for this schedule. + example: "2025-06-13T12:00:00Z" + format: date-time + nullable: true + type: string + allocation_id: + description: The targeting rule allocation ID this progressive rollout belongs to. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + control_variant_id: + description: The control variant ID used for experiment comparisons. + example: "550e8400-e29b-41d4-a716-446655440012" + nullable: true + type: string + created_at: + description: The timestamp when the schedule was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + guardrail_triggered_action: + description: Last guardrail action triggered for this schedule. + example: "PAUSE" + nullable: true + type: string + guardrail_triggers: + description: Guardrail trigger records for this schedule. + items: + $ref: "#/components/schemas/AllocationExposureGuardrailTrigger" + type: array + id: + description: The unique identifier of the progressive rollout. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + rollout_options: + $ref: "#/components/schemas/RolloutOptions" + rollout_steps: + description: Ordered progression steps for exposure. + items: + $ref: "#/components/schemas/AllocationExposureRolloutStep" + type: array + updated_at: + description: The timestamp when the schedule was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + required: + - allocation_id + - rollout_options + - rollout_steps + - guardrail_triggers + - created_at + - updated_at + type: object + AllocationExposureScheduleData: + description: Data wrapper for progressive rollout schedule responses. + properties: + attributes: + $ref: "#/components/schemas/AllocationExposureSchedule" + id: + description: The unique identifier of the progressive rollout. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + type: + $ref: "#/components/schemas/AllocationExposureScheduleDataType" + required: + - id + - type + - attributes + type: object + AllocationExposureScheduleDataType: + description: The resource type for progressive rollout schedules. + enum: + - "allocation_exposure_schedules" + example: "allocation_exposure_schedules" + type: string + x-enum-varnames: + - ALLOCATION_EXPOSURE_SCHEDULES + AllocationExposureScheduleResponse: + description: Response containing a progressive rollout schedule. + properties: + data: + $ref: "#/components/schemas/AllocationExposureScheduleData" + required: + - data + type: object + AllocationResponse: + description: Response containing a single targeting rule (allocation). + properties: + data: + $ref: "#/components/schemas/AllocationDataResponse" + required: + - data + type: object + AllocationType: + description: The type of targeting rule (called allocation in the API model). + enum: + - FEATURE_GATE + - CANARY + example: "FEATURE_GATE" + type: string + x-enum-varnames: + - FEATURE_GATE + - CANARY Annotation: description: "A list of annotations used in the workflow. These are like sticky notes for your workflow!" properties: @@ -12764,6 +13101,92 @@ components: - SEARCH - CONTAINER - CALLOUTVALUE + Condition: + description: Targeting condition details. + properties: + attribute: + description: The user or request attribute to evaluate. + example: "country" + type: string + created_at: + description: The timestamp when the condition was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + id: + description: The unique identifier of the condition. + example: "550e8400-e29b-41d4-a716-446655440070" + format: uuid + type: string + operator: + $ref: "#/components/schemas/ConditionOperator" + 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. + 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 + ConditionOperator: + description: The operator used in a targeting condition. + enum: + - LT + - LTE + - GT + - GTE + - MATCHES + - NOT_MATCHES + - ONE_OF + - NOT_ONE_OF + - IS_NULL + - EQUALS + example: "ONE_OF" + type: string + x-enum-varnames: + - LT + - LTE + - GT + - GTE + - MATCHES + - NOT_MATCHES + - ONE_OF + - NOT_ONE_OF + - IS_NULL + - EQUALS + ConditionRequest: + description: Condition request payload for targeting rules. + properties: + attribute: + description: The user or request attribute to evaluate. + example: "user_tier" + type: string + operator: + $ref: "#/components/schemas/ConditionOperator" + value: + description: Values used by the selected operator. + 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. oneOf: @@ -14190,6 +14613,14 @@ components: data: $ref: "#/components/schemas/ActionConnectionData" type: object + CreateAllocationsRequest: + description: Request to create targeting rules (allocations) for a feature flag in an environment. + properties: + data: + $ref: "#/components/schemas/AllocationDataRequest" + required: + - data + type: object CreateAppRequest: description: A request object for creating a new app. example: @@ -24613,6 +25044,78 @@ components: example: "One or several indexes are missing or invalid. Results hold data from the other indexes." type: string type: object + ExposureRolloutStepRequest: + description: Rollout step request payload. + properties: + exposure_ratio: + description: The exposure ratio for this step. + example: 0.5 + format: double + maximum: 1 + minimum: 0 + type: number + grouped_step_index: + description: Logical index grouping related steps. + example: 1 + format: int64 + minimum: 0 + type: integer + id: + description: The unique identifier of the progression step. + example: "550e8400-e29b-41d4-a716-446655440040" + format: uuid + type: string + interval_ms: + description: Step duration in milliseconds. + example: 3600000 + format: int64 + nullable: true + type: integer + is_pause_record: + description: Whether this step represents a pause record. + example: false + type: boolean + required: + - exposure_ratio + - is_pause_record + - grouped_step_index + type: object + ExposureScheduleRequest: + description: Progressive release request payload. + properties: + absolute_start_time: + description: The absolute UTC start time for this schedule. + example: "2025-06-13T12:00:00Z" + format: date-time + nullable: true + type: string + control_variant_id: + description: The control variant ID used for experiment comparisons. + example: "550e8400-e29b-41d4-a716-446655440012" + nullable: true + type: string + control_variant_key: + description: The control variant key used during creation workflows. + example: "control" + nullable: true + type: string + id: + description: The unique identifier of the progressive rollout. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + rollout_options: + $ref: "#/components/schemas/RolloutOptionsRequest" + rollout_steps: + description: Ordered progression steps for exposure. + items: + $ref: "#/components/schemas/ExposureRolloutStepRequest" + minItems: 1 + type: array + required: + - rollout_options + - rollout_steps + type: object FacetInfoRequest: description: Request body for retrieving facet value information for a specified attribute with optional filtering. example: @@ -25109,6 +25612,12 @@ components: description: Indicates whether this feature flag requires approval for changes. example: false type: boolean + tags: + description: Tags associated with the feature flag. + example: [] + items: + type: string + type: array updated_at: description: The timestamp when the feature flag was last updated. example: "2023-01-01T00:00:00Z" @@ -25154,6 +25663,14 @@ components: description: The name of the environment. example: "env-search-term" type: string + environment_queries: + description: Queries that target this environment. + example: + - "test-feature-flag" + - "env-search-term" + items: + type: string + type: array is_production: description: Indicates whether the environment is production. example: false @@ -29346,6 +29863,47 @@ components: example: "env:production" type: string type: array + GuardrailMetric: + description: Guardrail metric details. + properties: + metric_id: + description: The metric ID to monitor. + example: "metric-error-rate" + type: string + trigger_action: + $ref: "#/components/schemas/GuardrailTriggerAction" + triggered_by: + description: The signal or system that triggered the action. + example: "guardrail_monitor" + nullable: true + type: string + required: + - metric_id + - trigger_action + type: object + GuardrailMetricRequest: + description: Guardrail metric request payload. + properties: + metric_id: + description: The metric ID to monitor. + example: "metric-error-rate" + type: string + trigger_action: + $ref: "#/components/schemas/GuardrailTriggerAction" + required: + - metric_id + - trigger_action + type: object + GuardrailTriggerAction: + description: Action to perform when a guardrail threshold is triggered. + enum: + - PAUSE + - ABORT + example: "PAUSE" + type: string + x-enum-varnames: + - PAUSE + - ABORT HTTPBody: description: The definition of `HTTPBody` object. properties: @@ -36653,6 +37211,18 @@ components: format: int64 type: integer type: object + ListAllocationsResponse: + description: Response containing a list of targeting rules (allocations). + properties: + data: + description: List of targeting rules (allocations). + items: + $ref: "#/components/schemas/AllocationDataResponse" + description: Allocation item. + type: array + required: + - data + type: object ListAppKeyRegistrationsResponse: description: A paginated list of app key registrations. properties: @@ -47881,6 +48451,17 @@ components: - ARRAY_NUMBER - ARRAY_BOOLEAN - ARRAY_OBJECT + OverwriteAllocationsRequest: + description: Request to overwrite targeting rules (allocations) for a feature flag in an environment. + properties: + data: + description: Targeting rules (allocations) to replace existing ones with. + items: + $ref: "#/components/schemas/AllocationDataRequest" + type: array + required: + - data + type: object PageUrgency: default: high description: On-Call Page urgency level. @@ -53648,6 +54229,53 @@ components: type: string x-enum-varnames: - ROLES + RolloutOptions: + description: Applied progression options for a progressive rollout. + properties: + autostart: + description: Whether the schedule starts automatically. + example: false + type: boolean + selection_interval_ms: + description: Interval in milliseconds for uniform interval strategies. + example: 3600000 + format: int64 + type: integer + strategy: + $ref: "#/components/schemas/RolloutStrategy" + required: + - strategy + - autostart + - selection_interval_ms + type: object + RolloutOptionsRequest: + description: Rollout options request payload. + properties: + autostart: + description: Whether the schedule should begin automatically. + example: false + nullable: true + type: boolean + selection_interval_ms: + description: Interval in milliseconds for uniform interval strategies. + example: 3600000 + format: int64 + type: integer + strategy: + $ref: "#/components/schemas/RolloutStrategy" + required: + - strategy + type: object + RolloutStrategy: + description: The progression strategy used by a progressive rollout. + enum: + - UNIFORM_INTERVALS + - NO_ROLLOUT + example: "UNIFORM_INTERVALS" + type: string + x-enum-varnames: + - UNIFORM_INTERVALS + - NO_ROLLOUT RoutingRule: description: Represents a routing rule, including its attributes, relationships, and unique identifier. properties: @@ -67088,6 +67716,47 @@ components: description: Tag associated with your event. type: string type: array + TargetingRule: + description: Targeting rule details. + properties: + conditions: + description: Conditions evaluated by this targeting rule. + items: + $ref: "#/components/schemas/Condition" + type: array + created_at: + description: The timestamp when the targeting rule was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + id: + description: The unique identifier of the targeting rule. + example: "550e8400-e29b-41d4-a716-446655440060" + format: uuid + type: string + updated_at: + description: The timestamp when the targeting rule was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + required: + - id + - conditions + - created_at + - updated_at + type: object + TargetingRuleRequest: + description: Targeting rule request payload. + properties: + conditions: + description: Conditions that must match for this rule. + items: + $ref: "#/components/schemas/ConditionRequest" + minItems: 1 + type: array + required: + - conditions + type: object Targets: description: |- List of recipients to notify when a notification rule is triggered. Many different target types are supported, @@ -71274,6 +71943,51 @@ components: data: $ref: "#/components/schemas/WorkflowDataUpdate" type: object + UpsertAllocationRequest: + description: Request to create or update a targeting rule (allocation) for a feature flag environment. + properties: + experiment_id: + description: The experiment ID for experiment-linked allocations. + example: "550e8400-e29b-41d4-a716-446655440030" + nullable: true + type: string + exposure_schedule: + $ref: "#/components/schemas/ExposureScheduleRequest" + guardrail_metrics: + description: Guardrail metrics used to monitor and auto-pause or abort. + items: + $ref: "#/components/schemas/GuardrailMetricRequest" + type: array + id: + description: The unique identifier of the targeting rule allocation. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + key: + description: The unique key of the targeting rule allocation. + example: "prod-rollout" + type: string + name: + description: The display name of the targeting rule. + example: "Production Rollout" + type: string + targeting_rules: + description: Targeting rules that determine audience eligibility. + items: + $ref: "#/components/schemas/TargetingRuleRequest" + type: array + type: + $ref: "#/components/schemas/AllocationType" + variant_weights: + description: Variant distribution weights. + items: + $ref: "#/components/schemas/VariantWeightRequest" + type: array + required: + - name + - key + - type + type: object UpsertCatalogEntityRequest: description: Create or update entity request. oneOf: @@ -72168,6 +72882,60 @@ components: - name - value type: object + VariantWeight: + description: Variant weight details. + properties: + created_at: + description: The timestamp when the variant weight was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + id: + description: Unique identifier of the variant weight assignment. + example: "59061199-e2ff-46e9-8b40-2193e3b21687" + format: uuid + type: string + updated_at: + description: The timestamp when the variant weight was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + value: + description: The percentage weight for the variant. + example: 50 + format: double + type: number + variant: + $ref: "#/components/schemas/Variant" + variant_id: + description: The variant ID. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + required: + - variant_id + - value + type: object + VariantWeightRequest: + description: Variant weight request payload. + properties: + value: + description: The percentage weight for this variant. + example: 50 + format: double + type: number + variant_id: + description: The variant ID to assign weight to. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + variant_key: + description: The variant key to assign weight to. + example: "control" + type: string + required: + - value + type: object Version: description: Version of the notification rule. It is updated when the rule is modified. example: 1 @@ -84899,6 +85667,270 @@ paths: operator: AND permissions: - feature_flag_environment_config_write + /api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/pause: + post: + description: |- + Pauses a progressive rollout while preserving rollout state. + operationId: PauseExposureSchedule + parameters: + - $ref: "#/components/parameters/exposure_schedule_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + absolute_start_time: "2025-06-13T12:00:00Z" + allocation_id: "550e8400-e29b-41d4-a716-446655440020" + control_variant_id: "550e8400-e29b-41d4-a716-446655440012" + created_at: "2024-01-01T12:00:00Z" + guardrail_triggered_action: + guardrail_triggers: [] + id: "550e8400-e29b-41d4-a716-446655440010" + rollout_options: + autostart: false + selection_interval_ms: 3600000 + strategy: "UNIFORM_INTERVALS" + rollout_steps: [] + updated_at: "2024-01-01T12:00:00Z" + schema: + $ref: "#/components/schemas/AllocationExposureScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Pause a progressive rollout + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + /api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/resume: + post: + description: |- + Resumes progression for a previously paused progressive rollout. + operationId: ResumeExposureSchedule + parameters: + - $ref: "#/components/parameters/exposure_schedule_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + absolute_start_time: "2025-06-13T12:00:00Z" + allocation_id: "550e8400-e29b-41d4-a716-446655440020" + control_variant_id: "550e8400-e29b-41d4-a716-446655440012" + created_at: "2024-01-01T12:00:00Z" + guardrail_triggered_action: + guardrail_triggers: [] + id: "550e8400-e29b-41d4-a716-446655440010" + rollout_options: + autostart: false + selection_interval_ms: 3600000 + strategy: "UNIFORM_INTERVALS" + rollout_steps: [] + updated_at: "2024-01-01T12:00:00Z" + schema: + $ref: "#/components/schemas/AllocationExposureScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Resume a progressive rollout + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + /api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/start: + post: + description: |- + Starts a progressive rollout and begins progression. + operationId: StartExposureSchedule + parameters: + - $ref: "#/components/parameters/exposure_schedule_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + absolute_start_time: "2025-06-13T12:00:00Z" + allocation_id: "550e8400-e29b-41d4-a716-446655440020" + control_variant_id: "550e8400-e29b-41d4-a716-446655440012" + created_at: "2024-01-01T12:00:00Z" + guardrail_triggered_action: + guardrail_triggers: [] + id: "550e8400-e29b-41d4-a716-446655440010" + rollout_options: + autostart: false + selection_interval_ms: 3600000 + strategy: "UNIFORM_INTERVALS" + rollout_steps: [] + updated_at: "2024-01-01T12:00:00Z" + schema: + $ref: "#/components/schemas/AllocationExposureScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Start a progressive rollout + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + /api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/stop: + post: + description: |- + Stops a progressive rollout and marks it as aborted. + operationId: StopExposureSchedule + parameters: + - $ref: "#/components/parameters/exposure_schedule_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + absolute_start_time: "2025-06-13T12:00:00Z" + allocation_id: "550e8400-e29b-41d4-a716-446655440020" + control_variant_id: "550e8400-e29b-41d4-a716-446655440012" + created_at: "2024-01-01T12:00:00Z" + guardrail_triggered_action: + guardrail_triggers: [] + id: "550e8400-e29b-41d4-a716-446655440010" + rollout_options: + autostart: false + selection_interval_ms: 3600000 + strategy: "UNIFORM_INTERVALS" + rollout_steps: [] + updated_at: "2024-01-01T12:00:00Z" + schema: + $ref: "#/components/schemas/AllocationExposureScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Stop a progressive rollout + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write /api/v2/feature-flags/{feature_flag_id}: get: description: |- @@ -85042,6 +86074,198 @@ paths: permissions: - feature_flag_config_write - feature_flag_environment_config_read + /api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations: + post: + description: |- + Creates a new targeting rule (allocation) for a specific feature flag in a specific environment. + operationId: CreateAllocationsForFeatureFlagInEnvironment + parameters: + - $ref: "#/components/parameters/feature_flag_id" + - $ref: "#/components/parameters/environment_id" + requestBody: + content: + application/json: + example: + data: + attributes: + key: "prod-rollout" + name: "Production Rollout" + type: "FEATURE_GATE" + variant_weights: + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440001" + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440002" + type: "allocations" + schema: + $ref: "#/components/schemas/CreateAllocationsRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T12:00:00Z" + environment_ids: + - "550e8400-e29b-41d4-a716-446655440001" + guardrail_metrics: [] + id: "550e8400-e29b-41d4-a716-446655440020" + key: "prod-rollout" + name: "Production Rollout" + order_position: 0 + targeting_rules: [] + type: "FEATURE_GATE" + updated_at: "2024-01-01T12:00:00Z" + variant_weights: + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440001" + id: "550e8400-e29b-41d4-a716-446655440020" + type: "allocations" + schema: + $ref: "#/components/schemas/AllocationResponse" + description: Created + "202": + content: + application/json: + schema: + $ref: "#/components/schemas/AllocationResponse" + description: Accepted - Approval required for this change + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create targeting rules for a flag env + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + put: + description: |- + Updates targeting rules (allocations) for a specific feature flag in a specific environment. + This operation replaces the existing allocation set with the request payload. + operationId: UpdateAllocationsForFeatureFlagInEnvironment + parameters: + - $ref: "#/components/parameters/feature_flag_id" + - $ref: "#/components/parameters/environment_id" + requestBody: + content: + application/json: + example: + data: + - attributes: + key: "prod-rollout" + name: "Production Rollout" + type: "FEATURE_GATE" + variant_weights: + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440001" + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440002" + type: "allocations" + schema: + $ref: "#/components/schemas/OverwriteAllocationsRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2024-01-01T12:00:00Z" + environment_ids: + - "550e8400-e29b-41d4-a716-446655440001" + guardrail_metrics: [] + id: "550e8400-e29b-41d4-a716-446655440020" + key: "prod-rollout" + name: "Production Rollout" + order_position: 0 + targeting_rules: [] + type: "FEATURE_GATE" + updated_at: "2024-01-01T12:00:00Z" + variant_weights: + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440001" + id: "550e8400-e29b-41d4-a716-446655440020" + type: "allocations" + schema: + $ref: "#/components/schemas/ListAllocationsResponse" + description: OK + "202": + content: + application/json: + schema: + $ref: "#/components/schemas/ListAllocationsResponse" + description: Accepted - Approval required for this change + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update targeting rules for a flag + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write /api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/disable: post: description: |- diff --git a/cassettes/v2/Feature-Flags_3833710718/Create-allocation-for-a-flag-in-an-environment-returns-Created-response_1397720344/frozen.json b/cassettes/v2/Feature-Flags_3833710718/Create-allocation-for-a-flag-in-an-environment-returns-Created-response_1397720344/frozen.json new file mode 100644 index 000000000000..5217041a1c5e --- /dev/null +++ b/cassettes/v2/Feature-Flags_3833710718/Create-allocation-for-a-flag-in-an-environment-returns-Created-response_1397720344/frozen.json @@ -0,0 +1 @@ +"2026-04-01T20:36:45.896Z" diff --git a/cassettes/v2/Feature-Flags_3833710718/Create-allocation-for-a-flag-in-an-environment-returns-Created-response_1397720344/recording.har b/cassettes/v2/Feature-Flags_3833710718/Create-allocation-for-a-flag-in-an-environment-returns-Created-response_1397720344/recording.har new file mode 100644 index 000000000000..dfc552d6b951 --- /dev/null +++ b/cassettes/v2/Feature-Flags_3833710718/Create-allocation-for-a-flag-in-an-environment-returns-Created-response_1397720344/recording.har @@ -0,0 +1,253 @@ +{ + "log": { + "_recordingName": "Feature Flags/Create allocation for a flag in an environment returns \"Created\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "2000f9fcf1b8bbb8e80e3146f211cc6a", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 826, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 565, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"description\":\"Test feature flag for BDD scenarios\",\"key\":\"test-feature-flag-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"name\":\"Test Feature Flag Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"value_type\":\"BOOLEAN\",\"variants\":[{\"key\":\"variant-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805-1\",\"name\":\"Variant Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805 A\",\"value\":\"true\"},{\"key\":\"variant-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805-2\",\"name\":\"Variant Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805 B\",\"value\":\"false\"}]},\"type\":\"feature-flags\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags" + }, + "response": { + "bodySize": 5139, + "content": { + "mimeType": "application/vnd.api+json", + "size": 5139, + "text": "{\"data\":{\"id\":\"449ff1d1-7a4f-416f-a6ce-be1abd3031c1\",\"type\":\"feature-flags\",\"attributes\":{\"archived_at\":null,\"created_at\":\"2026-04-01T20:36:46.153578Z\",\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"description\":\"Test feature flag for BDD scenarios\",\"distribution_channel\":\"ALL\",\"feature_flag_environments\":[{\"environment_id\":\"592600c2-8327-424d-960f-608c327ee96d\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-9bfe74798563\",\"override_allocation_key\":\"allocation-override-9bfe74798563\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"809cd83d-51ac-4f60-9ce5-cfad4d662114\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-04b9843f6754\",\"override_allocation_key\":\"allocation-override-04b9843f6754\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"21c84268-9fc7-4b6d-82ea-bb2090469aba\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-ac33b80880b1\",\"override_allocation_key\":\"allocation-override-ac33b80880b1\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"0b94dbaa-9efb-419d-8bd7-ef56f3828986\",\"environment_name\":\"Test Environment Test-Typescript-Create_an_environment_returns_Created_response-1773321543\",\"environment_queries\":[\"staging\",\"test\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-1018a5595c76\",\"override_allocation_key\":\"allocation-override-1018a5595c76\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"afdaa512-6307-4965-bf92-62cc6bea5d00\",\"environment_name\":\"Test Environment Test-Typescript-Create_an_environment_returns_Created_response-1773322166\",\"environment_queries\":[\"test-Test-Typescript-Create_an_environment_returns_Created_response-1773322166\",\"env-Test-Typescript-Create_an_environment_returns_Created_response-1773322166\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-9cf98d18b2bc\",\"override_allocation_key\":\"allocation-override-9cf98d18b2bc\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null}],\"key\":\"test-feature-flag-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"last_updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"name\":\"Test Feature Flag Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"require_approval\":false,\"tags\":[],\"updated_at\":\"2026-04-01T20:36:46.153578Z\",\"value_type\":\"BOOLEAN\",\"variants\":[{\"id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"key\":\"variant-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805-1\",\"name\":\"Variant Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805 A\",\"value\":\"true\",\"created_at\":\"2026-04-01T20:36:46.172226Z\",\"updated_at\":\"2026-04-01T20:36:46.172226Z\"},{\"id\":\"b8079ed4-249a-42fb-b9ec-ff95900c37af\",\"key\":\"variant-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805-2\",\"name\":\"Variant Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805 B\",\"value\":\"false\",\"created_at\":\"2026-04-01T20:36:46.181731Z\",\"updated_at\":\"2026-04-01T20:36:46.181731Z\"}]}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 539, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2026-04-01T20:36:45.900Z", + "time": 412 + }, + { + "_id": "b4aa458758966e2f151442bc6eeff4e5", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 362, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 590, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"name\":\"Test Environment Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"queries\":[\"test-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"env-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\"]},\"type\":\"environments\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags/environments" + }, + "response": { + "bodySize": 466, + "content": { + "mimeType": "application/vnd.api+json", + "size": 466, + "text": "{\"data\":{\"id\":\"927d4fe0-11f9-4a08-8859-ae044a4e04f0\",\"type\":\"environments\",\"attributes\":{\"is_production\":false,\"name\":\"Test Environment Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"queries\":[\"test-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"env-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\"],\"require_feature_flag_approval\":false}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 532, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2026-04-01T20:36:46.316Z", + "time": 616 + }, + { + "_id": "77f01765e879a29c75ccffebb4fbb0f2", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 423, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 691, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"guardrail_metrics\":[],\"key\":\"new-targeting-rule-test-create_allocation_for_a_flag_in_an_environment_returns_created_response-1775075805\",\"name\":\"New targeting rule Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"targeting_rules\":[],\"type\":\"CANARY\",\"variant_weights\":[{\"value\":100,\"variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\"}]},\"type\":\"allocations\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags/449ff1d1-7a4f-416f-a6ce-be1abd3031c1/environments/927d4fe0-11f9-4a08-8859-ae044a4e04f0/allocations" + }, + "response": { + "bodySize": 1158, + "content": { + "mimeType": "application/vnd.api+json", + "size": 1158, + "text": "{\"data\":{\"id\":\"adb0e4b9-2c9f-4ce0-bc77-68c11d5e1ba2\",\"type\":\"allocations\",\"attributes\":{\"created_at\":\"2026-04-01T20:36:47.111398323Z\",\"environment_ids\":[\"927d4fe0-11f9-4a08-8859-ae044a4e04f0\"],\"experiment_id\":null,\"guardrail_metrics\":[],\"key\":\"new-targeting-rule-test-create_allocation_for_a_flag_in_an_environment_returns_created_response-1775075805\",\"name\":\"New targeting rule Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"order_position\":0,\"targeting_rules\":[],\"type\":\"CANARY\",\"updated_at\":\"2026-04-01T20:36:47.111398323Z\",\"variant_weights\":[{\"id\":\"9c5fccaf-ca32-49dd-8a48-5a47a6204cc4\",\"created_at\":\"2026-04-01T20:36:47.119918Z\",\"updated_at\":\"2026-04-01T20:36:47.119918Z\",\"value\":100,\"variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"variant\":{\"id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"key\":\"variant-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805-1\",\"name\":\"Variant Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805 A\",\"value\":\"true\",\"created_at\":\"2026-04-01T20:36:46.172226Z\",\"updated_at\":\"2026-04-01T20:36:46.172226Z\"}}]}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 533, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2026-04-01T20:36:46.937Z", + "time": 493 + }, + { + "_id": "cabbc9b015b2d2e2efca19cbffb11dbb", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 563, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags/environments/927d4fe0-11f9-4a08-8859-ae044a4e04f0" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/plain", + "size": 0 + }, + "cookies": [], + "headers": [], + "headersSize": 471, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2026-04-01T20:36:47.435Z", + "time": 326 + }, + { + "_id": "25927ec7499191bfeaadb4db17455be8", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + } + ], + "headersSize": 577, + "httpVersion": "HTTP/1.1", + "method": "POST", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags/449ff1d1-7a4f-416f-a6ce-be1abd3031c1/archive" + }, + "response": { + "bodySize": 5164, + "content": { + "mimeType": "application/vnd.api+json", + "size": 5164, + "text": "{\"data\":{\"id\":\"449ff1d1-7a4f-416f-a6ce-be1abd3031c1\",\"type\":\"feature-flags\",\"attributes\":{\"archived_at\":\"2026-04-01T20:36:47.922174Z\",\"created_at\":\"2026-04-01T20:36:46.153578Z\",\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"description\":\"Test feature flag for BDD scenarios\",\"distribution_channel\":\"ALL\",\"feature_flag_environments\":[{\"environment_id\":\"592600c2-8327-424d-960f-608c327ee96d\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-9bfe74798563\",\"override_allocation_key\":\"allocation-override-9bfe74798563\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"809cd83d-51ac-4f60-9ce5-cfad4d662114\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-04b9843f6754\",\"override_allocation_key\":\"allocation-override-04b9843f6754\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"21c84268-9fc7-4b6d-82ea-bb2090469aba\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-ac33b80880b1\",\"override_allocation_key\":\"allocation-override-ac33b80880b1\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"0b94dbaa-9efb-419d-8bd7-ef56f3828986\",\"environment_name\":\"Test Environment Test-Typescript-Create_an_environment_returns_Created_response-1773321543\",\"environment_queries\":[\"staging\",\"test\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-1018a5595c76\",\"override_allocation_key\":\"allocation-override-1018a5595c76\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"afdaa512-6307-4965-bf92-62cc6bea5d00\",\"environment_name\":\"Test Environment Test-Typescript-Create_an_environment_returns_Created_response-1773322166\",\"environment_queries\":[\"test-Test-Typescript-Create_an_environment_returns_Created_response-1773322166\",\"env-Test-Typescript-Create_an_environment_returns_Created_response-1773322166\"],\"status\":\"DISABLED\",\"default_variant_id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-9cf98d18b2bc\",\"override_allocation_key\":\"allocation-override-9cf98d18b2bc\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null}],\"key\":\"test-feature-flag-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"last_updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"name\":\"Test Feature Flag Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805\",\"require_approval\":false,\"tags\":[],\"updated_at\":\"2026-04-01T20:36:47.922174Z\",\"value_type\":\"BOOLEAN\",\"variants\":[{\"id\":\"4fda6911-d77b-4ca7-ba8d-daa41622e051\",\"key\":\"variant-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805-1\",\"name\":\"Variant Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805 A\",\"value\":\"true\",\"created_at\":\"2026-04-01T20:36:46.172226Z\",\"updated_at\":\"2026-04-01T20:36:46.172226Z\"},{\"id\":\"b8079ed4-249a-42fb-b9ec-ff95900c37af\",\"key\":\"variant-Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805-2\",\"name\":\"Variant Test-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1775075805 B\",\"value\":\"false\",\"created_at\":\"2026-04-01T20:36:46.181731Z\",\"updated_at\":\"2026-04-01T20:36:46.181731Z\"}]}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 539, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2026-04-01T20:36:47.762Z", + "time": 369 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/cassettes/v2/Feature-Flags_3833710718/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response_1080924031/frozen.json b/cassettes/v2/Feature-Flags_3833710718/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response_1080924031/frozen.json new file mode 100644 index 000000000000..8decf282a298 --- /dev/null +++ b/cassettes/v2/Feature-Flags_3833710718/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response_1080924031/frozen.json @@ -0,0 +1 @@ +"2026-04-01T20:36:50.944Z" diff --git a/cassettes/v2/Feature-Flags_3833710718/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response_1080924031/recording.har b/cassettes/v2/Feature-Flags_3833710718/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response_1080924031/recording.har new file mode 100644 index 000000000000..909a75db00f5 --- /dev/null +++ b/cassettes/v2/Feature-Flags_3833710718/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response_1080924031/recording.har @@ -0,0 +1,253 @@ +{ + "log": { + "_recordingName": "Feature Flags/Update targeting rules for a flag in an environment returns \"OK\" response", + "creator": { + "comment": "persister:fs", + "name": "Polly.JS", + "version": "6.0.5" + }, + "entries": [ + { + "_id": "9d154a2b58f53c200baa0e2df1de278b", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 826, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 565, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"description\":\"Test feature flag for BDD scenarios\",\"key\":\"test-feature-flag-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"name\":\"Test Feature Flag Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"value_type\":\"BOOLEAN\",\"variants\":[{\"key\":\"variant-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810-1\",\"name\":\"Variant Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810 A\",\"value\":\"true\"},{\"key\":\"variant-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810-2\",\"name\":\"Variant Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810 B\",\"value\":\"false\"}]},\"type\":\"feature-flags\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags" + }, + "response": { + "bodySize": 5139, + "content": { + "mimeType": "application/vnd.api+json", + "size": 5139, + "text": "{\"data\":{\"id\":\"ede225ed-3a62-4cb5-b678-73851d56c700\",\"type\":\"feature-flags\",\"attributes\":{\"archived_at\":null,\"created_at\":\"2026-04-01T20:36:51.103987Z\",\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"description\":\"Test feature flag for BDD scenarios\",\"distribution_channel\":\"ALL\",\"feature_flag_environments\":[{\"environment_id\":\"592600c2-8327-424d-960f-608c327ee96d\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-2950ef4bf91c\",\"override_allocation_key\":\"allocation-override-2950ef4bf91c\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"809cd83d-51ac-4f60-9ce5-cfad4d662114\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-f27ec0d632e1\",\"override_allocation_key\":\"allocation-override-f27ec0d632e1\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"21c84268-9fc7-4b6d-82ea-bb2090469aba\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-7c7249a02089\",\"override_allocation_key\":\"allocation-override-7c7249a02089\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"0b94dbaa-9efb-419d-8bd7-ef56f3828986\",\"environment_name\":\"Test Environment Test-Typescript-Create_an_environment_returns_Created_response-1773321543\",\"environment_queries\":[\"staging\",\"test\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-c915dfafd596\",\"override_allocation_key\":\"allocation-override-c915dfafd596\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"afdaa512-6307-4965-bf92-62cc6bea5d00\",\"environment_name\":\"Test Environment Test-Typescript-Create_an_environment_returns_Created_response-1773322166\",\"environment_queries\":[\"test-Test-Typescript-Create_an_environment_returns_Created_response-1773322166\",\"env-Test-Typescript-Create_an_environment_returns_Created_response-1773322166\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-af80336ddd7c\",\"override_allocation_key\":\"allocation-override-af80336ddd7c\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null}],\"key\":\"test-feature-flag-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"last_updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"name\":\"Test Feature Flag Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"require_approval\":false,\"tags\":[],\"updated_at\":\"2026-04-01T20:36:51.103987Z\",\"value_type\":\"BOOLEAN\",\"variants\":[{\"id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"key\":\"variant-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810-1\",\"name\":\"Variant Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810 A\",\"value\":\"true\",\"created_at\":\"2026-04-01T20:36:51.109817Z\",\"updated_at\":\"2026-04-01T20:36:51.109817Z\"},{\"id\":\"209acfa7-b3d6-4373-bcb7-162bbe4460c9\",\"key\":\"variant-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810-2\",\"name\":\"Variant Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810 B\",\"value\":\"false\",\"created_at\":\"2026-04-01T20:36:51.115427Z\",\"updated_at\":\"2026-04-01T20:36:51.115427Z\"}]}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 539, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2026-04-01T20:36:50.946Z", + "time": 362 + }, + { + "_id": "a7ca2f07611c748865fbc0ebde5766e9", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 362, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 590, + "httpVersion": "HTTP/1.1", + "method": "POST", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":{\"attributes\":{\"name\":\"Test Environment Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"queries\":[\"test-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"env-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\"]},\"type\":\"environments\"}}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags/environments" + }, + "response": { + "bodySize": 466, + "content": { + "mimeType": "application/vnd.api+json", + "size": 466, + "text": "{\"data\":{\"id\":\"73900c64-e4c9-46a3-ac5b-d5fa80be2b49\",\"type\":\"environments\",\"attributes\":{\"is_production\":false,\"name\":\"Test Environment Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"queries\":[\"test-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"env-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\"],\"require_feature_flag_approval\":false}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 532, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 201, + "statusText": "Created" + }, + "startedDateTime": "2026-04-01T20:36:51.311Z", + "time": 435 + }, + { + "_id": "1679883d48e3e848f306c3c57f7dca71", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 836, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + }, + { + "_fromType": "array", + "name": "content-type", + "value": "application/json" + } + ], + "headersSize": 690, + "httpVersion": "HTTP/1.1", + "method": "PUT", + "postData": { + "mimeType": "application/json", + "params": [], + "text": "{\"data\":[{\"attributes\":{\"exposure_schedule\":{\"rollout_options\":{\"autostart\":false,\"selection_interval_ms\":86400000,\"strategy\":\"UNIFORM_INTERVALS\"},\"rollout_steps\":[{\"exposure_ratio\":0.05,\"grouped_step_index\":0,\"interval_ms\":null,\"is_pause_record\":false},{\"exposure_ratio\":0.25,\"grouped_step_index\":1,\"interval_ms\":null,\"is_pause_record\":false},{\"exposure_ratio\":1,\"grouped_step_index\":2,\"interval_ms\":null,\"is_pause_record\":false}]},\"guardrail_metrics\":[],\"key\":\"overwrite-allocation-test-update_targeting_rules_for_a_flag_in_an_environment_returns_ok_response-1775075810\",\"name\":\"New targeting rule Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"targeting_rules\":[],\"type\":\"CANARY\",\"variant_weights\":[{\"value\":100,\"variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\"}]},\"type\":\"allocations\"}]}" + }, + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags/ede225ed-3a62-4cb5-b678-73851d56c700/environments/73900c64-e4c9-46a3-ac5b-d5fa80be2b49/allocations" + }, + "response": { + "bodySize": 2541, + "content": { + "mimeType": "application/vnd.api+json", + "size": 2541, + "text": "{\"data\":[{\"id\":\"576deb88-9917-4848-87b1-f9ea276f6bf3\",\"type\":\"allocations\",\"attributes\":{\"created_at\":\"2026-04-01T20:36:51.950824558Z\",\"environment_ids\":[\"73900c64-e4c9-46a3-ac5b-d5fa80be2b49\"],\"experiment_id\":null,\"exposure_schedule\":{\"id\":\"871b9d47-219d-469d-89de-e9322ad135fd\",\"allocation_id\":\"576deb88-9917-4848-87b1-f9ea276f6bf3\",\"control_variant_id\":null,\"absolute_start_time\":null,\"rollout_options\":{\"strategy\":\"UNIFORM_INTERVALS\",\"autostart\":false,\"selection_interval_ms\":86400000},\"rollout_steps\":[{\"id\":\"92089f1f-3065-447c-a674-a88d38641967\",\"allocation_exposure_schedule_id\":\"871b9d47-219d-469d-89de-e9322ad135fd\",\"order_position\":0,\"exposure_ratio\":0.05,\"interval_ms\":86400000,\"is_pause_record\":false,\"grouped_step_index\":0,\"created_at\":\"2026-04-01T20:36:51.958618Z\",\"updated_at\":\"2026-04-01T20:36:51.958618Z\"},{\"id\":\"f471ec77-92d2-4d87-9983-e733d53bece5\",\"allocation_exposure_schedule_id\":\"871b9d47-219d-469d-89de-e9322ad135fd\",\"order_position\":1,\"exposure_ratio\":0.25,\"interval_ms\":86400000,\"is_pause_record\":false,\"grouped_step_index\":1,\"created_at\":\"2026-04-01T20:36:51.958618Z\",\"updated_at\":\"2026-04-01T20:36:51.958618Z\"},{\"id\":\"c32bf3c7-1a30-40aa-811e-a5bcde7c10aa\",\"allocation_exposure_schedule_id\":\"871b9d47-219d-469d-89de-e9322ad135fd\",\"order_position\":2,\"exposure_ratio\":1,\"interval_ms\":null,\"is_pause_record\":false,\"grouped_step_index\":2,\"created_at\":\"2026-04-01T20:36:51.958618Z\",\"updated_at\":\"2026-04-01T20:36:51.958618Z\"}],\"guardrail_triggers\":[],\"guardrail_triggered_action\":null,\"created_at\":\"2026-04-01T20:36:51.955888Z\",\"updated_at\":\"2026-04-01T20:36:51.955888Z\"},\"guardrail_metrics\":[],\"key\":\"overwrite-allocation-test-update_targeting_rules_for_a_flag_in_an_environment_returns_ok_response-1775075810\",\"name\":\"New targeting rule Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"order_position\":0,\"targeting_rules\":[],\"type\":\"CANARY\",\"updated_at\":\"2026-04-01T20:36:51.950824558Z\",\"variant_weights\":[{\"id\":\"1833845a-a5aa-45a5-a400-57b522edc42f\",\"created_at\":\"2026-04-01T20:36:51.963476Z\",\"updated_at\":\"2026-04-01T20:36:51.963476Z\",\"value\":100,\"variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"variant\":{\"id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"key\":\"variant-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810-1\",\"name\":\"Variant Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810 A\",\"value\":\"true\",\"created_at\":\"2026-04-01T20:36:51.109817Z\",\"updated_at\":\"2026-04-01T20:36:51.109817Z\"}}]}}]}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 533, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2026-04-01T20:36:51.750Z", + "time": 412 + }, + { + "_id": "5a04f781dad03221b852fe7e9cb52d36", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "*/*" + } + ], + "headersSize": 563, + "httpVersion": "HTTP/1.1", + "method": "DELETE", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags/environments/73900c64-e4c9-46a3-ac5b-d5fa80be2b49" + }, + "response": { + "bodySize": 0, + "content": { + "mimeType": "text/plain", + "size": 0 + }, + "cookies": [], + "headers": [], + "headersSize": 471, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 204, + "statusText": "No Content" + }, + "startedDateTime": "2026-04-01T20:36:52.166Z", + "time": 341 + }, + { + "_id": "fbd767df53ce9f01b6b75f3cf7a6f602", + "_order": 0, + "cache": {}, + "request": { + "bodySize": 0, + "cookies": [], + "headers": [ + { + "_fromType": "array", + "name": "accept", + "value": "application/json" + } + ], + "headersSize": 577, + "httpVersion": "HTTP/1.1", + "method": "POST", + "queryString": [], + "url": "https://api.datadoghq.com/api/v2/feature-flags/ede225ed-3a62-4cb5-b678-73851d56c700/archive" + }, + "response": { + "bodySize": 5164, + "content": { + "mimeType": "application/vnd.api+json", + "size": 5164, + "text": "{\"data\":{\"id\":\"ede225ed-3a62-4cb5-b678-73851d56c700\",\"type\":\"feature-flags\",\"attributes\":{\"archived_at\":\"2026-04-01T20:36:52.682946Z\",\"created_at\":\"2026-04-01T20:36:51.103987Z\",\"created_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"description\":\"Test feature flag for BDD scenarios\",\"distribution_channel\":\"ALL\",\"feature_flag_environments\":[{\"environment_id\":\"592600c2-8327-424d-960f-608c327ee96d\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774470658\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-2950ef4bf91c\",\"override_allocation_key\":\"allocation-override-2950ef4bf91c\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"809cd83d-51ac-4f60-9ce5-cfad4d662114\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774471346\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-f27ec0d632e1\",\"override_allocation_key\":\"allocation-override-f27ec0d632e1\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"21c84268-9fc7-4b6d-82ea-bb2090469aba\",\"environment_name\":\"Test Environment Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\",\"environment_queries\":[\"test-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\",\"env-Test-Typescript-Create_allocation_for_a_flag_in_an_environment_returns_Created_response-1774472385\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-7c7249a02089\",\"override_allocation_key\":\"allocation-override-7c7249a02089\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"0b94dbaa-9efb-419d-8bd7-ef56f3828986\",\"environment_name\":\"Test Environment Test-Typescript-Create_an_environment_returns_Created_response-1773321543\",\"environment_queries\":[\"staging\",\"test\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-c915dfafd596\",\"override_allocation_key\":\"allocation-override-c915dfafd596\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null},{\"environment_id\":\"afdaa512-6307-4965-bf92-62cc6bea5d00\",\"environment_name\":\"Test Environment Test-Typescript-Create_an_environment_returns_Created_response-1773322166\",\"environment_queries\":[\"test-Test-Typescript-Create_an_environment_returns_Created_response-1773322166\",\"env-Test-Typescript-Create_an_environment_returns_Created_response-1773322166\"],\"status\":\"DISABLED\",\"default_variant_id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"override_variant_id\":null,\"default_allocation_key\":\"allocation-default-af80336ddd7c\",\"override_allocation_key\":\"allocation-override-af80336ddd7c\",\"rules\":[],\"rollout_percentage\":0,\"allocations\":null,\"is_production\":false,\"require_feature_flag_approval\":false,\"pending_suggestion_id\":null}],\"key\":\"test-feature-flag-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"last_updated_by\":\"3ad549bf-eba0-11e9-a77a-0705486660d0\",\"name\":\"Test Feature Flag Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810\",\"require_approval\":false,\"tags\":[],\"updated_at\":\"2026-04-01T20:36:52.682946Z\",\"value_type\":\"BOOLEAN\",\"variants\":[{\"id\":\"73ffe05f-ba09-46c0-ba5e-9d14b1da564f\",\"key\":\"variant-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810-1\",\"name\":\"Variant Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810 A\",\"value\":\"true\",\"created_at\":\"2026-04-01T20:36:51.109817Z\",\"updated_at\":\"2026-04-01T20:36:51.109817Z\"},{\"id\":\"209acfa7-b3d6-4373-bcb7-162bbe4460c9\",\"key\":\"variant-Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810-2\",\"name\":\"Variant Test-Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response-1775075810 B\",\"value\":\"false\",\"created_at\":\"2026-04-01T20:36:51.115427Z\",\"updated_at\":\"2026-04-01T20:36:51.115427Z\"}]}}}" + }, + "cookies": [], + "headers": [ + { + "name": "content-type", + "value": "application/vnd.api+json" + } + ], + "headersSize": 539, + "httpVersion": "HTTP/1.1", + "redirectURL": "", + "status": 200, + "statusText": "OK" + }, + "startedDateTime": "2026-04-01T20:36:52.510Z", + "time": 469 + } + ], + "pages": [], + "version": "1.2" + } +} diff --git a/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.ts b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.ts new file mode 100644 index 000000000000..fd9a6e162180 --- /dev/null +++ b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.ts @@ -0,0 +1,79 @@ +/** + * Create targeting rules for a flag env returns "Created" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.FeatureFlagsApi(configuration); + +const params: v2.FeatureFlagsApiCreateAllocationsForFeatureFlagInEnvironmentRequest = + { + body: { + data: { + attributes: { + experimentId: "550e8400-e29b-41d4-a716-446655440030", + exposureSchedule: { + absoluteStartTime: new Date(2025, 6, 13, 12, 0, 0, 0), + controlVariantId: "550e8400-e29b-41d4-a716-446655440012", + controlVariantKey: "control", + id: "550e8400-e29b-41d4-a716-446655440010", + rolloutOptions: { + autostart: false, + selectionIntervalMs: 3600000, + strategy: "UNIFORM_INTERVALS", + }, + rolloutSteps: [ + { + exposureRatio: 0.5, + groupedStepIndex: 1, + id: "550e8400-e29b-41d4-a716-446655440040", + intervalMs: 3600000, + isPauseRecord: false, + }, + ], + }, + guardrailMetrics: [ + { + metricId: "metric-error-rate", + triggerAction: "PAUSE", + }, + ], + id: "550e8400-e29b-41d4-a716-446655440020", + key: "prod-rollout", + name: "Production Rollout", + targetingRules: [ + { + conditions: [ + { + attribute: "user_tier", + operator: "ONE_OF", + value: ["premium", "enterprise"], + }, + ], + }, + ], + type: "FEATURE_GATE", + variantWeights: [ + { + value: 50, + variantId: "550e8400-e29b-41d4-a716-446655440001", + variantKey: "control", + }, + ], + }, + type: "allocations", + }, + }, + featureFlagId: "550e8400-e29b-41d4-a716-446655440000", + environmentId: "550e8400-e29b-41d4-a716-446655440001", + }; + +apiInstance + .createAllocationsForFeatureFlagInEnvironment(params) + .then((data: v2.AllocationResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.ts b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.ts new file mode 100644 index 000000000000..51808ee3cd0d --- /dev/null +++ b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.ts @@ -0,0 +1,49 @@ +/** + * Create allocation for a flag in an environment returns "Created" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.FeatureFlagsApi(configuration); + +// there is a valid "feature_flag" in the system +const FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID = process.env + .FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID as string; +const FEATURE_FLAG_DATA_ID = process.env.FEATURE_FLAG_DATA_ID as string; + +// there is a valid "environment" in the system +const ENVIRONMENT_DATA_ID = process.env.ENVIRONMENT_DATA_ID as string; + +const params: v2.FeatureFlagsApiCreateAllocationsForFeatureFlagInEnvironmentRequest = + { + body: { + data: { + type: "allocations", + attributes: { + name: "New targeting rule Example-Feature-Flag", + key: "new-targeting-rule-example-feature-flag", + targetingRules: [], + variantWeights: [ + { + variantId: FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID, + value: 100, + }, + ], + guardrailMetrics: [], + type: "CANARY", + }, + }, + }, + featureFlagId: FEATURE_FLAG_DATA_ID, + environmentId: ENVIRONMENT_DATA_ID, + }; + +apiInstance + .createAllocationsForFeatureFlagInEnvironment(params) + .then((data: v2.AllocationResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/feature-flags/PauseExposureSchedule.ts b/examples/v2/feature-flags/PauseExposureSchedule.ts new file mode 100644 index 000000000000..3f3bf0d4f3f5 --- /dev/null +++ b/examples/v2/feature-flags/PauseExposureSchedule.ts @@ -0,0 +1,21 @@ +/** + * Pause a progressive rollout returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.FeatureFlagsApi(configuration); + +const params: v2.FeatureFlagsApiPauseExposureScheduleRequest = { + exposureScheduleId: "550e8400-e29b-41d4-a716-446655440010", +}; + +apiInstance + .pauseExposureSchedule(params) + .then((data: v2.AllocationExposureScheduleResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/feature-flags/ResumeExposureSchedule.ts b/examples/v2/feature-flags/ResumeExposureSchedule.ts new file mode 100644 index 000000000000..1bf09fbcbe62 --- /dev/null +++ b/examples/v2/feature-flags/ResumeExposureSchedule.ts @@ -0,0 +1,21 @@ +/** + * Resume a progressive rollout returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.FeatureFlagsApi(configuration); + +const params: v2.FeatureFlagsApiResumeExposureScheduleRequest = { + exposureScheduleId: "550e8400-e29b-41d4-a716-446655440010", +}; + +apiInstance + .resumeExposureSchedule(params) + .then((data: v2.AllocationExposureScheduleResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/feature-flags/StartExposureSchedule.ts b/examples/v2/feature-flags/StartExposureSchedule.ts new file mode 100644 index 000000000000..f5b5254d2e6a --- /dev/null +++ b/examples/v2/feature-flags/StartExposureSchedule.ts @@ -0,0 +1,21 @@ +/** + * Start a progressive rollout returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.FeatureFlagsApi(configuration); + +const params: v2.FeatureFlagsApiStartExposureScheduleRequest = { + exposureScheduleId: "550e8400-e29b-41d4-a716-446655440010", +}; + +apiInstance + .startExposureSchedule(params) + .then((data: v2.AllocationExposureScheduleResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/feature-flags/StopExposureSchedule.ts b/examples/v2/feature-flags/StopExposureSchedule.ts new file mode 100644 index 000000000000..da70339bcc3c --- /dev/null +++ b/examples/v2/feature-flags/StopExposureSchedule.ts @@ -0,0 +1,21 @@ +/** + * Stop a progressive rollout returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.FeatureFlagsApi(configuration); + +const params: v2.FeatureFlagsApiStopExposureScheduleRequest = { + exposureScheduleId: "550e8400-e29b-41d4-a716-446655440010", +}; + +apiInstance + .stopExposureSchedule(params) + .then((data: v2.AllocationExposureScheduleResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.ts b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.ts new file mode 100644 index 000000000000..8cf01250daae --- /dev/null +++ b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.ts @@ -0,0 +1,81 @@ +/** + * Update targeting rules for a flag returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.FeatureFlagsApi(configuration); + +const params: v2.FeatureFlagsApiUpdateAllocationsForFeatureFlagInEnvironmentRequest = + { + body: { + data: [ + { + attributes: { + experimentId: "550e8400-e29b-41d4-a716-446655440030", + exposureSchedule: { + absoluteStartTime: new Date(2025, 6, 13, 12, 0, 0, 0), + controlVariantId: "550e8400-e29b-41d4-a716-446655440012", + controlVariantKey: "control", + id: "550e8400-e29b-41d4-a716-446655440010", + rolloutOptions: { + autostart: false, + selectionIntervalMs: 3600000, + strategy: "UNIFORM_INTERVALS", + }, + rolloutSteps: [ + { + exposureRatio: 0.5, + groupedStepIndex: 1, + id: "550e8400-e29b-41d4-a716-446655440040", + intervalMs: 3600000, + isPauseRecord: false, + }, + ], + }, + guardrailMetrics: [ + { + metricId: "metric-error-rate", + triggerAction: "PAUSE", + }, + ], + id: "550e8400-e29b-41d4-a716-446655440020", + key: "prod-rollout", + name: "Production Rollout", + targetingRules: [ + { + conditions: [ + { + attribute: "user_tier", + operator: "ONE_OF", + value: ["premium", "enterprise"], + }, + ], + }, + ], + type: "FEATURE_GATE", + variantWeights: [ + { + value: 50, + variantId: "550e8400-e29b-41d4-a716-446655440001", + variantKey: "control", + }, + ], + }, + type: "allocations", + }, + ], + }, + featureFlagId: "550e8400-e29b-41d4-a716-446655440000", + environmentId: "550e8400-e29b-41d4-a716-446655440001", + }; + +apiInstance + .updateAllocationsForFeatureFlagInEnvironment(params) + .then((data: v2.ListAllocationsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.ts b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.ts new file mode 100644 index 000000000000..3c9ab08c3dfc --- /dev/null +++ b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.ts @@ -0,0 +1,78 @@ +/** + * Update targeting rules for a flag in an environment returns "OK" response + */ + +import { client, v2 } from "@datadog/datadog-api-client"; + +const configuration = client.createConfiguration(); +const apiInstance = new v2.FeatureFlagsApi(configuration); + +// there is a valid "feature_flag" in the system +const FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID = process.env + .FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID as string; +const FEATURE_FLAG_DATA_ID = process.env.FEATURE_FLAG_DATA_ID as string; + +// there is a valid "environment" in the system +const ENVIRONMENT_DATA_ID = process.env.ENVIRONMENT_DATA_ID as string; + +const params: v2.FeatureFlagsApiUpdateAllocationsForFeatureFlagInEnvironmentRequest = + { + body: { + data: [ + { + type: "allocations", + attributes: { + key: "overwrite-allocation-example-feature-flag", + name: "New targeting rule Example-Feature-Flag", + targetingRules: [], + variantWeights: [ + { + variantId: FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID, + value: 100, + }, + ], + exposureSchedule: { + rolloutOptions: { + strategy: "UNIFORM_INTERVALS", + autostart: false, + selectionIntervalMs: 86400000, + }, + rolloutSteps: [ + { + exposureRatio: 0.05, + intervalMs: undefined, + isPauseRecord: false, + groupedStepIndex: 0, + }, + { + exposureRatio: 0.25, + intervalMs: undefined, + isPauseRecord: false, + groupedStepIndex: 1, + }, + { + exposureRatio: 1, + intervalMs: undefined, + isPauseRecord: false, + groupedStepIndex: 2, + }, + ], + }, + guardrailMetrics: [], + type: "CANARY", + }, + }, + ], + }, + featureFlagId: FEATURE_FLAG_DATA_ID, + environmentId: ENVIRONMENT_DATA_ID, + }; + +apiInstance + .updateAllocationsForFeatureFlagInEnvironment(params) + .then((data: v2.ListAllocationsResponse) => { + console.log( + "API called successfully. Returned data: " + JSON.stringify(data) + ); + }) + .catch((error: any) => console.error(error)); diff --git a/features/support/scenarios_model_mapping.ts b/features/support/scenarios_model_mapping.ts index 1a99db4ccc1a..00dc3f82208a 100644 --- a/features/support/scenarios_model_mapping.ts +++ b/features/support/scenarios_model_mapping.ts @@ -6272,6 +6272,34 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "{}", }, + "v2.PauseExposureSchedule": { + "exposureScheduleId": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "AllocationExposureScheduleResponse", + }, + "v2.ResumeExposureSchedule": { + "exposureScheduleId": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "AllocationExposureScheduleResponse", + }, + "v2.StartExposureSchedule": { + "exposureScheduleId": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "AllocationExposureScheduleResponse", + }, + "v2.StopExposureSchedule": { + "exposureScheduleId": { + "type": "string", + "format": "uuid", + }, + "operationResponseType": "AllocationExposureScheduleResponse", + }, "v2.GetFeatureFlag": { "featureFlagId": { "type": "string", @@ -6297,6 +6325,36 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = { }, "operationResponseType": "FeatureFlagResponse", }, + "v2.UpdateAllocationsForFeatureFlagInEnvironment": { + "featureFlagId": { + "type": "string", + "format": "uuid", + }, + "environmentId": { + "type": "string", + "format": "uuid", + }, + "body": { + "type": "OverwriteAllocationsRequest", + "format": "", + }, + "operationResponseType": "ListAllocationsResponse", + }, + "v2.CreateAllocationsForFeatureFlagInEnvironment": { + "featureFlagId": { + "type": "string", + "format": "uuid", + }, + "environmentId": { + "type": "string", + "format": "uuid", + }, + "body": { + "type": "CreateAllocationsRequest", + "format": "", + }, + "operationResponseType": "AllocationResponse", + }, "v2.DisableFeatureFlagEnvironment": { "featureFlagId": { "type": "string", diff --git a/features/v2/feature_flags.feature b/features/v2/feature_flags.feature index fcf9045b9d94..fd2ff16520c5 100644 --- a/features/v2/feature_flags.feature +++ b/features/v2/feature_flags.feature @@ -53,6 +53,17 @@ Feature: Feature Flags And the response "data.attributes.name" is equal to "Test Feature Flag {{ unique }}" And the response "data.attributes.value_type" is equal to "BOOLEAN" + @team:DataDog/feature-flags + Scenario: Create allocation for a flag in an environment returns "Created" response + Given there is a valid "feature_flag" in the system + And there is a valid "environment" in the system + And new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "feature_flag.data.id" + And request contains "environment_id" parameter from "environment.data.id" + And body with value {"data":{"type":"allocations","attributes":{"name":"New targeting rule {{ unique }}","key":"new-targeting-rule-{{ unique_lower }}","targeting_rules":[],"variant_weights":[{"variant_id":"{{ feature_flag.data.attributes.variants[0].id }}","value":100}],"guardrail_metrics":[],"type":"CANARY"}}} + When the request is sent + Then the response status is 201 Created + @skip @team:DataDog/feature-flags Scenario: Create an environment returns "Bad Request" response Given new "CreateFeatureFlagsEnvironment" request @@ -74,6 +85,51 @@ Feature: Feature Flags When the request is sent Then the response status is 201 Created + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Accepted - Approval required for this change" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 202 Accepted - Approval required for this change + + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Bad Request" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Conflict" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Created" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Not Found" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 404 Not Found + @skip @team:DataDog/feature-flags Scenario: Delete an environment returns "No Content" response Given there is a valid "environment" in the system @@ -190,6 +246,118 @@ Feature: Feature Flags When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/feature-flags + Scenario: Pause a progressive rollout returns "Bad Request" response + Given new "PauseExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Pause a progressive rollout returns "Conflict" response + Given new "PauseExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Pause a progressive rollout returns "Not Found" response + Given new "PauseExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Pause a progressive rollout returns "OK" response + Given new "PauseExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/feature-flags + Scenario: Resume a progressive rollout returns "Bad Request" response + Given new "ResumeExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Resume a progressive rollout returns "Conflict" response + Given new "ResumeExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Resume a progressive rollout returns "Not Found" response + Given new "ResumeExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Resume a progressive rollout returns "OK" response + Given new "ResumeExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/feature-flags + Scenario: Start a progressive rollout returns "Bad Request" response + Given new "StartExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Start a progressive rollout returns "Conflict" response + Given new "StartExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Start a progressive rollout returns "Not Found" response + Given new "StartExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Start a progressive rollout returns "OK" response + Given new "StartExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/feature-flags + Scenario: Stop a progressive rollout returns "Bad Request" response + Given new "StopExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Stop a progressive rollout returns "Conflict" response + Given new "StopExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Stop a progressive rollout returns "Not Found" response + Given new "StopExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Stop a progressive rollout returns "OK" response + Given new "StopExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/feature-flags Scenario: Unarchive a feature flag returns "Bad Request" response Given new "UnarchiveFeatureFlag" request @@ -263,3 +431,59 @@ Feature: Feature Flags And body with value {"data": {"type": "environments", "attributes": {"name": "Updated Test Environment {{ unique }}", "queries": ["updated-{{ unique }}", "live-{{ unique }}"]}}} When the request is sent Then the response status is 200 OK + + @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag in an environment returns "OK" response + Given there is a valid "feature_flag" in the system + And there is a valid "environment" in the system + And new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "feature_flag.data.id" + And request contains "environment_id" parameter from "environment.data.id" + And body with value {"data":[{"type":"allocations","attributes":{"key":"overwrite-allocation-{{ unique_lower }}","name":"New targeting rule {{ unique }}","targeting_rules":[],"variant_weights":[{"variant_id":"{{ feature_flag.data.attributes.variants[0].id }}","value":100}],"exposure_schedule":{"rollout_options":{"strategy":"UNIFORM_INTERVALS","autostart":false,"selection_interval_ms":86400000},"rollout_steps":[{"exposure_ratio":0.05,"interval_ms":null,"is_pause_record":false,"grouped_step_index":0},{"exposure_ratio":0.25,"interval_ms":null,"is_pause_record":false,"grouped_step_index":1},{"exposure_ratio":1,"interval_ms":null,"is_pause_record":false,"grouped_step_index":2}]},"guardrail_metrics":[],"type":"CANARY"}}]} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "Accepted - Approval required for this change" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 202 Accepted - Approval required for this change + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "Bad Request" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "Conflict" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "Not Found" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "OK" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/given.json b/features/v2/given.json index 8413be265af8..12e386bd8f73 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -465,6 +465,27 @@ "tag": "Feature Flags", "operationId": "CreateFeatureFlagsEnvironment" }, + { + "parameters": [ + { + "name": "feature_flag_id", + "source": "feature_flag.data.id" + }, + { + "name": "environment_id", + "source": "environment.data.id" + }, + { + "name": "body", + "value": "{\"data\":[{\"type\":\"allocations\",\"attributes\":{\"name\":\"Exposure Schedule Allocation {{ unique }}\",\"key\":\"exposure-schedule-allocation-{{ unique_lower }}\",\"type\":\"CANARY\",\"targeting_rules\":[],\"variant_weights\":[{\"variant_id\":\"{{ feature_flag.data.attributes.variants[0].id }}\",\"value\":100}],\"exposure_schedule\":{\"rollout_options\":{\"strategy\":\"UNIFORM_INTERVALS\",\"autostart\":false,\"selection_interval_ms\":86400000},\"rollout_steps\":[{\"exposure_ratio\":0.5,\"interval_ms\":null,\"is_pause_record\":false,\"grouped_step_index\":0},{\"exposure_ratio\":1,\"interval_ms\":null,\"is_pause_record\":false,\"grouped_step_index\":1}]},\"guardrail_metrics\":[]}}]}" + } + ], + "source": "data[0].attributes.exposure_schedule", + "step": "there is a valid \"exposure_schedule\" in the system", + "key": "exposure_schedule", + "tag": "Feature Flags", + "operationId": "UpdateAllocationsForFeatureFlagInEnvironment" + }, { "parameters": [ { diff --git a/features/v2/undo.json b/features/v2/undo.json index 8b9940b568da..1f11ffb7e771 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1841,6 +1841,30 @@ "type": "idempotent" } }, + "PauseExposureSchedule": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "ResumeExposureSchedule": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "StartExposureSchedule": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "StopExposureSchedule": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, "GetFeatureFlag": { "tag": "Feature Flags", "undo": { @@ -1866,6 +1890,18 @@ "type": "unsafe" } }, + "CreateAllocationsForFeatureFlagInEnvironment": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "UpdateAllocationsForFeatureFlagInEnvironment": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, "DisableFeatureFlagEnvironment": { "tag": "Feature Flags", "undo": { diff --git a/packages/datadog-api-client-v2/apis/FeatureFlagsApi.ts b/packages/datadog-api-client-v2/apis/FeatureFlagsApi.ts index f5f5d71defcf..658c28a52c23 100644 --- a/packages/datadog-api-client-v2/apis/FeatureFlagsApi.ts +++ b/packages/datadog-api-client-v2/apis/FeatureFlagsApi.ts @@ -16,13 +16,18 @@ import { logger } from "../../../logger"; import { ObjectSerializer } from "../models/ObjectSerializer"; import { ApiException } from "../../datadog-api-client-common/exception"; +import { AllocationExposureScheduleResponse } from "../models/AllocationExposureScheduleResponse"; +import { AllocationResponse } from "../models/AllocationResponse"; import { APIErrorResponse } from "../models/APIErrorResponse"; +import { CreateAllocationsRequest } from "../models/CreateAllocationsRequest"; import { CreateEnvironmentRequest } from "../models/CreateEnvironmentRequest"; import { CreateFeatureFlagRequest } from "../models/CreateFeatureFlagRequest"; import { EnvironmentResponse } from "../models/EnvironmentResponse"; import { FeatureFlagResponse } from "../models/FeatureFlagResponse"; +import { ListAllocationsResponse } from "../models/ListAllocationsResponse"; import { ListEnvironmentsResponse } from "../models/ListEnvironmentsResponse"; import { ListFeatureFlagsResponse } from "../models/ListFeatureFlagsResponse"; +import { OverwriteAllocationsRequest } from "../models/OverwriteAllocationsRequest"; import { UpdateEnvironmentRequest } from "../models/UpdateEnvironmentRequest"; import { UpdateFeatureFlagRequest } from "../models/UpdateFeatureFlagRequest"; @@ -61,6 +66,73 @@ export class FeatureFlagsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async createAllocationsForFeatureFlagInEnvironment( + featureFlagId: string, + environmentId: string, + body: CreateAllocationsRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'featureFlagId' is not null or undefined + if (featureFlagId === null || featureFlagId === undefined) { + throw new RequiredError( + "featureFlagId", + "createAllocationsForFeatureFlagInEnvironment" + ); + } + + // verify required parameter 'environmentId' is not null or undefined + if (environmentId === null || environmentId === undefined) { + throw new RequiredError( + "environmentId", + "createAllocationsForFeatureFlagInEnvironment" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError( + "body", + "createAllocationsForFeatureFlagInEnvironment" + ); + } + + // Path Params + const localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" + .replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))) + .replace("{environment_id}", encodeURIComponent(String(environmentId))); + + // Make Request Context + const requestContext = _config + .getServer( + "v2.FeatureFlagsApi.createAllocationsForFeatureFlagInEnvironment" + ) + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "CreateAllocationsRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async createFeatureFlag( body: CreateFeatureFlagRequest, _options?: Configuration @@ -438,6 +510,142 @@ export class FeatureFlagsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async pauseExposureSchedule( + exposureScheduleId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'exposureScheduleId' is not null or undefined + if (exposureScheduleId === null || exposureScheduleId === undefined) { + throw new RequiredError("exposureScheduleId", "pauseExposureSchedule"); + } + + // Path Params + const localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/pause".replace( + "{exposure_schedule_id}", + encodeURIComponent(String(exposureScheduleId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.FeatureFlagsApi.pauseExposureSchedule") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async resumeExposureSchedule( + exposureScheduleId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'exposureScheduleId' is not null or undefined + if (exposureScheduleId === null || exposureScheduleId === undefined) { + throw new RequiredError("exposureScheduleId", "resumeExposureSchedule"); + } + + // Path Params + const localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/resume".replace( + "{exposure_schedule_id}", + encodeURIComponent(String(exposureScheduleId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.FeatureFlagsApi.resumeExposureSchedule") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async startExposureSchedule( + exposureScheduleId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'exposureScheduleId' is not null or undefined + if (exposureScheduleId === null || exposureScheduleId === undefined) { + throw new RequiredError("exposureScheduleId", "startExposureSchedule"); + } + + // Path Params + const localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/start".replace( + "{exposure_schedule_id}", + encodeURIComponent(String(exposureScheduleId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.FeatureFlagsApi.startExposureSchedule") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + + public async stopExposureSchedule( + exposureScheduleId: string, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'exposureScheduleId' is not null or undefined + if (exposureScheduleId === null || exposureScheduleId === undefined) { + throw new RequiredError("exposureScheduleId", "stopExposureSchedule"); + } + + // Path Params + const localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/stop".replace( + "{exposure_schedule_id}", + encodeURIComponent(String(exposureScheduleId)) + ); + + // Make Request Context + const requestContext = _config + .getServer("v2.FeatureFlagsApi.stopExposureSchedule") + .makeRequestContext(localVarPath, HttpMethod.POST); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async unarchiveFeatureFlag( featureFlagId: string, _options?: Configuration @@ -472,6 +680,73 @@ export class FeatureFlagsApiRequestFactory extends BaseAPIRequestFactory { return requestContext; } + public async updateAllocationsForFeatureFlagInEnvironment( + featureFlagId: string, + environmentId: string, + body: OverwriteAllocationsRequest, + _options?: Configuration + ): Promise { + const _config = _options || this.configuration; + + // verify required parameter 'featureFlagId' is not null or undefined + if (featureFlagId === null || featureFlagId === undefined) { + throw new RequiredError( + "featureFlagId", + "updateAllocationsForFeatureFlagInEnvironment" + ); + } + + // verify required parameter 'environmentId' is not null or undefined + if (environmentId === null || environmentId === undefined) { + throw new RequiredError( + "environmentId", + "updateAllocationsForFeatureFlagInEnvironment" + ); + } + + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError( + "body", + "updateAllocationsForFeatureFlagInEnvironment" + ); + } + + // Path Params + const localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" + .replace("{feature_flag_id}", encodeURIComponent(String(featureFlagId))) + .replace("{environment_id}", encodeURIComponent(String(environmentId))); + + // Make Request Context + const requestContext = _config + .getServer( + "v2.FeatureFlagsApi.updateAllocationsForFeatureFlagInEnvironment" + ) + .makeRequestContext(localVarPath, HttpMethod.PUT); + requestContext.setHeaderParam("Accept", "application/json"); + requestContext.setHttpConfig(_config.httpConfig); + + // Body Params + const contentType = ObjectSerializer.getPreferredMediaType([ + "application/json", + ]); + requestContext.setHeaderParam("Content-Type", contentType); + const serializedBody = ObjectSerializer.stringify( + ObjectSerializer.serialize(body, "OverwriteAllocationsRequest", ""), + contentType + ); + requestContext.setBody(serializedBody); + + // Apply auth methods + applySecurityAuthentication(_config, requestContext, [ + "apiKeyAuth", + "appKeyAuth", + ]); + + return requestContext; + } + public async updateFeatureFlag( featureFlagId: string, body: UpdateFeatureFlagRequest, @@ -638,6 +913,70 @@ export class FeatureFlagsApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to createAllocationsForFeatureFlagInEnvironment + * @throws ApiException if the response code was not in [200, 299] + */ + public async createAllocationsForFeatureFlagInEnvironment( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 201 || response.httpStatusCode === 202) { + const body: AllocationResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationResponse" + ) as AllocationResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 409 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: AllocationResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationResponse", + "" + ) as AllocationResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1163,6 +1502,270 @@ export class FeatureFlagsApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to pauseExposureSchedule + * @throws ApiException if the response code was not in [200, 299] + */ + public async pauseExposureSchedule( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: AllocationExposureScheduleResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationExposureScheduleResponse" + ) as AllocationExposureScheduleResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 409 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: AllocationExposureScheduleResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationExposureScheduleResponse", + "" + ) as AllocationExposureScheduleResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to resumeExposureSchedule + * @throws ApiException if the response code was not in [200, 299] + */ + public async resumeExposureSchedule( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: AllocationExposureScheduleResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationExposureScheduleResponse" + ) as AllocationExposureScheduleResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 409 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: AllocationExposureScheduleResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationExposureScheduleResponse", + "" + ) as AllocationExposureScheduleResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to startExposureSchedule + * @throws ApiException if the response code was not in [200, 299] + */ + public async startExposureSchedule( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: AllocationExposureScheduleResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationExposureScheduleResponse" + ) as AllocationExposureScheduleResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 409 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: AllocationExposureScheduleResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationExposureScheduleResponse", + "" + ) as AllocationExposureScheduleResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to stopExposureSchedule + * @throws ApiException if the response code was not in [200, 299] + */ + public async stopExposureSchedule( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200) { + const body: AllocationExposureScheduleResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationExposureScheduleResponse" + ) as AllocationExposureScheduleResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 409 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: AllocationExposureScheduleResponse = + ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "AllocationExposureScheduleResponse", + "" + ) as AllocationExposureScheduleResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1226,6 +1829,70 @@ export class FeatureFlagsApiResponseProcessor { ); } + /** + * Unwraps the actual response sent by the server from the response context and deserializes the response content + * to the expected objects + * + * @params response Response returned by the server for a request to updateAllocationsForFeatureFlagInEnvironment + * @throws ApiException if the response code was not in [200, 299] + */ + public async updateAllocationsForFeatureFlagInEnvironment( + response: ResponseContext + ): Promise { + const contentType = ObjectSerializer.normalizeMediaType( + response.headers["content-type"] + ); + if (response.httpStatusCode === 200 || response.httpStatusCode === 202) { + const body: ListAllocationsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListAllocationsResponse" + ) as ListAllocationsResponse; + return body; + } + if ( + response.httpStatusCode === 400 || + response.httpStatusCode === 403 || + response.httpStatusCode === 404 || + response.httpStatusCode === 409 || + response.httpStatusCode === 429 + ) { + const bodyText = ObjectSerializer.parse( + await response.body.text(), + contentType + ); + let body: APIErrorResponse; + try { + body = ObjectSerializer.deserialize( + bodyText, + "APIErrorResponse" + ) as APIErrorResponse; + } catch (error) { + logger.debug(`Got error deserializing error: ${error}`); + throw new ApiException( + response.httpStatusCode, + bodyText + ); + } + throw new ApiException(response.httpStatusCode, body); + } + + // Work around for missing responses in specification, e.g. for petstore.yaml + if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { + const body: ListAllocationsResponse = ObjectSerializer.deserialize( + ObjectSerializer.parse(await response.body.text(), contentType), + "ListAllocationsResponse", + "" + ) as ListAllocationsResponse; + return body; + } + + const body = (await response.body.text()) || ""; + throw new ApiException( + response.httpStatusCode, + 'Unknown API Status Code!\nBody: "' + body + '"' + ); + } + /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects @@ -1361,6 +2028,23 @@ export interface FeatureFlagsApiArchiveFeatureFlagRequest { featureFlagId: string; } +export interface FeatureFlagsApiCreateAllocationsForFeatureFlagInEnvironmentRequest { + /** + * The ID of the feature flag. + * @type string + */ + featureFlagId: string; + /** + * The ID of the environment. + * @type string + */ + environmentId: string; + /** + * @type CreateAllocationsRequest + */ + body: CreateAllocationsRequest; +} + export interface FeatureFlagsApiCreateFeatureFlagRequest { /** * @type CreateFeatureFlagRequest @@ -1471,6 +2155,38 @@ export interface FeatureFlagsApiListFeatureFlagsEnvironmentsRequest { offset?: number; } +export interface FeatureFlagsApiPauseExposureScheduleRequest { + /** + * The ID of the exposure schedule. + * @type string + */ + exposureScheduleId: string; +} + +export interface FeatureFlagsApiResumeExposureScheduleRequest { + /** + * The ID of the exposure schedule. + * @type string + */ + exposureScheduleId: string; +} + +export interface FeatureFlagsApiStartExposureScheduleRequest { + /** + * The ID of the exposure schedule. + * @type string + */ + exposureScheduleId: string; +} + +export interface FeatureFlagsApiStopExposureScheduleRequest { + /** + * The ID of the exposure schedule. + * @type string + */ + exposureScheduleId: string; +} + export interface FeatureFlagsApiUnarchiveFeatureFlagRequest { /** * The ID of the feature flag. @@ -1479,6 +2195,23 @@ export interface FeatureFlagsApiUnarchiveFeatureFlagRequest { featureFlagId: string; } +export interface FeatureFlagsApiUpdateAllocationsForFeatureFlagInEnvironmentRequest { + /** + * The ID of the feature flag. + * @type string + */ + featureFlagId: string; + /** + * The ID of the environment. + * @type string + */ + environmentId: string; + /** + * @type OverwriteAllocationsRequest + */ + body: OverwriteAllocationsRequest; +} + export interface FeatureFlagsApiUpdateFeatureFlagRequest { /** * The ID of the feature flag. @@ -1542,6 +2275,32 @@ export class FeatureFlagsApi { }); } + /** + * Creates a new targeting rule (allocation) for a specific feature flag in a specific environment. + * @param param The request object + */ + public createAllocationsForFeatureFlagInEnvironment( + param: FeatureFlagsApiCreateAllocationsForFeatureFlagInEnvironmentRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.createAllocationsForFeatureFlagInEnvironment( + param.featureFlagId, + param.environmentId, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.createAllocationsForFeatureFlagInEnvironment( + responseContext + ); + }); + }); + } + /** * Creates a new feature flag with variants. * @param param The request object @@ -1757,6 +2516,90 @@ export class FeatureFlagsApi { }); } + /** + * Pauses a progressive rollout while preserving rollout state. + * @param param The request object + */ + public pauseExposureSchedule( + param: FeatureFlagsApiPauseExposureScheduleRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.pauseExposureSchedule( + param.exposureScheduleId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.pauseExposureSchedule(responseContext); + }); + }); + } + + /** + * Resumes progression for a previously paused progressive rollout. + * @param param The request object + */ + public resumeExposureSchedule( + param: FeatureFlagsApiResumeExposureScheduleRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.resumeExposureSchedule( + param.exposureScheduleId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.resumeExposureSchedule(responseContext); + }); + }); + } + + /** + * Starts a progressive rollout and begins progression. + * @param param The request object + */ + public startExposureSchedule( + param: FeatureFlagsApiStartExposureScheduleRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.startExposureSchedule( + param.exposureScheduleId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.startExposureSchedule(responseContext); + }); + }); + } + + /** + * Stops a progressive rollout and marks it as aborted. + * @param param The request object + */ + public stopExposureSchedule( + param: FeatureFlagsApiStopExposureScheduleRequest, + options?: Configuration + ): Promise { + const requestContextPromise = this.requestFactory.stopExposureSchedule( + param.exposureScheduleId, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.stopExposureSchedule(responseContext); + }); + }); + } + /** * Unarchives a previously archived feature flag, * making it visible in the main list again. @@ -1779,6 +2622,33 @@ export class FeatureFlagsApi { }); } + /** + * Updates targeting rules (allocations) for a specific feature flag in a specific environment. + * This operation replaces the existing allocation set with the request payload. + * @param param The request object + */ + public updateAllocationsForFeatureFlagInEnvironment( + param: FeatureFlagsApiUpdateAllocationsForFeatureFlagInEnvironmentRequest, + options?: Configuration + ): Promise { + const requestContextPromise = + this.requestFactory.updateAllocationsForFeatureFlagInEnvironment( + param.featureFlagId, + param.environmentId, + param.body, + options + ); + return requestContextPromise.then((requestContext) => { + return this.configuration.httpApi + .send(requestContext) + .then((responseContext) => { + return this.responseProcessor.updateAllocationsForFeatureFlagInEnvironment( + responseContext + ); + }); + }); + } + /** * Updates an existing feature flag's metadata such as * name and description. Does not modify targeting rules or allocations. diff --git a/packages/datadog-api-client-v2/index.ts b/packages/datadog-api-client-v2/index.ts index dc8f33d91335..9df7e79beca7 100644 --- a/packages/datadog-api-client-v2/index.ts +++ b/packages/datadog-api-client-v2/index.ts @@ -405,6 +405,7 @@ export { export { FeatureFlagsApiArchiveFeatureFlagRequest, + FeatureFlagsApiCreateAllocationsForFeatureFlagInEnvironmentRequest, FeatureFlagsApiCreateFeatureFlagRequest, FeatureFlagsApiCreateFeatureFlagsEnvironmentRequest, FeatureFlagsApiDeleteFeatureFlagsEnvironmentRequest, @@ -414,7 +415,12 @@ export { FeatureFlagsApiGetFeatureFlagsEnvironmentRequest, FeatureFlagsApiListFeatureFlagsRequest, FeatureFlagsApiListFeatureFlagsEnvironmentsRequest, + FeatureFlagsApiPauseExposureScheduleRequest, + FeatureFlagsApiResumeExposureScheduleRequest, + FeatureFlagsApiStartExposureScheduleRequest, + FeatureFlagsApiStopExposureScheduleRequest, FeatureFlagsApiUnarchiveFeatureFlagRequest, + FeatureFlagsApiUpdateAllocationsForFeatureFlagInEnvironmentRequest, FeatureFlagsApiUpdateFeatureFlagRequest, FeatureFlagsApiUpdateFeatureFlagsEnvironmentRequest, FeatureFlagsApi, @@ -1307,6 +1313,18 @@ export { AlertEventCustomAttributesLinksItems } from "./models/AlertEventCustomA export { AlertEventCustomAttributesLinksItemsCategory } from "./models/AlertEventCustomAttributesLinksItemsCategory"; export { AlertEventCustomAttributesPriority } from "./models/AlertEventCustomAttributesPriority"; export { AlertEventCustomAttributesStatus } from "./models/AlertEventCustomAttributesStatus"; +export { Allocation } from "./models/Allocation"; +export { AllocationDataRequest } from "./models/AllocationDataRequest"; +export { AllocationDataResponse } from "./models/AllocationDataResponse"; +export { AllocationDataType } from "./models/AllocationDataType"; +export { AllocationExposureGuardrailTrigger } from "./models/AllocationExposureGuardrailTrigger"; +export { AllocationExposureRolloutStep } from "./models/AllocationExposureRolloutStep"; +export { AllocationExposureSchedule } from "./models/AllocationExposureSchedule"; +export { AllocationExposureScheduleData } from "./models/AllocationExposureScheduleData"; +export { AllocationExposureScheduleDataType } from "./models/AllocationExposureScheduleDataType"; +export { AllocationExposureScheduleResponse } from "./models/AllocationExposureScheduleResponse"; +export { AllocationResponse } from "./models/AllocationResponse"; +export { AllocationType } from "./models/AllocationType"; export { Annotation } from "./models/Annotation"; export { AnnotationDisplay } from "./models/AnnotationDisplay"; export { AnnotationDisplayBounds } from "./models/AnnotationDisplayBounds"; @@ -2005,6 +2023,9 @@ export { ComponentProperties } from "./models/ComponentProperties"; export { ComponentPropertiesIsVisible } from "./models/ComponentPropertiesIsVisible"; export { ComponentRecommendation } from "./models/ComponentRecommendation"; export { ComponentType } from "./models/ComponentType"; +export { Condition } from "./models/Condition"; +export { ConditionOperator } from "./models/ConditionOperator"; +export { ConditionRequest } from "./models/ConditionRequest"; export { ConfigCatCredentials } from "./models/ConfigCatCredentials"; export { ConfigCatCredentialsUpdate } from "./models/ConfigCatCredentialsUpdate"; export { ConfigCatIntegration } from "./models/ConfigCatIntegration"; @@ -2101,6 +2122,7 @@ export { CoverageSummaryType } from "./models/CoverageSummaryType"; export { Cpu } from "./models/Cpu"; export { CreateActionConnectionRequest } from "./models/CreateActionConnectionRequest"; export { CreateActionConnectionResponse } from "./models/CreateActionConnectionResponse"; +export { CreateAllocationsRequest } from "./models/CreateAllocationsRequest"; export { CreateAppRequest } from "./models/CreateAppRequest"; export { CreateAppRequestData } from "./models/CreateAppRequestData"; export { CreateAppRequestDataAttributes } from "./models/CreateAppRequestDataAttributes"; @@ -2766,6 +2788,8 @@ export { EventSystemAttributes } from "./models/EventSystemAttributes"; export { EventSystemAttributesCategory } from "./models/EventSystemAttributesCategory"; export { EventSystemAttributesIntegrationId } from "./models/EventSystemAttributesIntegrationId"; export { EventType } from "./models/EventType"; +export { ExposureRolloutStepRequest } from "./models/ExposureRolloutStepRequest"; +export { ExposureScheduleRequest } from "./models/ExposureScheduleRequest"; export { FacetInfoRequest } from "./models/FacetInfoRequest"; export { FacetInfoRequestData } from "./models/FacetInfoRequestData"; export { FacetInfoRequestDataAttributes } from "./models/FacetInfoRequestDataAttributes"; @@ -3076,6 +3100,9 @@ export { GreyNoiseIntegration } from "./models/GreyNoiseIntegration"; export { GreyNoiseIntegrationType } from "./models/GreyNoiseIntegrationType"; export { GreyNoiseIntegrationUpdate } from "./models/GreyNoiseIntegrationUpdate"; export { GroupScalarColumn } from "./models/GroupScalarColumn"; +export { GuardrailMetric } from "./models/GuardrailMetric"; +export { GuardrailMetricRequest } from "./models/GuardrailMetricRequest"; +export { GuardrailTriggerAction } from "./models/GuardrailTriggerAction"; export { HamrOrgConnectionAttributesRequest } from "./models/HamrOrgConnectionAttributesRequest"; export { HamrOrgConnectionAttributesResponse } from "./models/HamrOrgConnectionAttributesResponse"; export { HamrOrgConnectionDataRequest } from "./models/HamrOrgConnectionDataRequest"; @@ -3480,6 +3507,7 @@ export { LeakedKeyAttributes } from "./models/LeakedKeyAttributes"; export { LeakedKeyType } from "./models/LeakedKeyType"; export { Library } from "./models/Library"; export { Links } from "./models/Links"; +export { ListAllocationsResponse } from "./models/ListAllocationsResponse"; export { ListAPIsResponse } from "./models/ListAPIsResponse"; export { ListAPIsResponseData } from "./models/ListAPIsResponseData"; export { ListAPIsResponseDataAttributes } from "./models/ListAPIsResponseDataAttributes"; @@ -4320,6 +4348,7 @@ export { OutcomeType } from "./models/OutcomeType"; export { OutputSchema } from "./models/OutputSchema"; export { OutputSchemaParameters } from "./models/OutputSchemaParameters"; export { OutputSchemaParametersType } from "./models/OutputSchemaParametersType"; +export { OverwriteAllocationsRequest } from "./models/OverwriteAllocationsRequest"; export { PageUrgency } from "./models/PageUrgency"; export { Pagination } from "./models/Pagination"; export { PaginationMeta } from "./models/PaginationMeta"; @@ -4679,6 +4708,9 @@ export { RoleUpdateData } from "./models/RoleUpdateData"; export { RoleUpdateRequest } from "./models/RoleUpdateRequest"; export { RoleUpdateResponse } from "./models/RoleUpdateResponse"; export { RoleUpdateResponseData } from "./models/RoleUpdateResponseData"; +export { RolloutOptions } from "./models/RolloutOptions"; +export { RolloutOptionsRequest } from "./models/RolloutOptionsRequest"; +export { RolloutStrategy } from "./models/RolloutStrategy"; export { RoutingRule } from "./models/RoutingRule"; export { RoutingRuleAction } from "./models/RoutingRuleAction"; export { RoutingRuleAttributes } from "./models/RoutingRuleAttributes"; @@ -5578,6 +5610,8 @@ export { TableRowResourceData } from "./models/TableRowResourceData"; export { TableRowResourceDataAttributes } from "./models/TableRowResourceDataAttributes"; export { TableRowResourceDataType } from "./models/TableRowResourceDataType"; export { TableRowResourceIdentifier } from "./models/TableRowResourceIdentifier"; +export { TargetingRule } from "./models/TargetingRule"; +export { TargetingRuleRequest } from "./models/TargetingRuleRequest"; export { Team } from "./models/Team"; export { TeamAttributes } from "./models/TeamAttributes"; export { TeamConnection } from "./models/TeamConnection"; @@ -5856,6 +5890,7 @@ export { UpdateTenancyConfigDataType } from "./models/UpdateTenancyConfigDataTyp export { UpdateTenancyConfigRequest } from "./models/UpdateTenancyConfigRequest"; export { UpdateWorkflowRequest } from "./models/UpdateWorkflowRequest"; export { UpdateWorkflowResponse } from "./models/UpdateWorkflowResponse"; +export { UpsertAllocationRequest } from "./models/UpsertAllocationRequest"; export { UpsertCatalogEntityRequest } from "./models/UpsertCatalogEntityRequest"; export { UpsertCatalogEntityResponse } from "./models/UpsertCatalogEntityResponse"; export { UpsertCatalogEntityResponseIncludedItem } from "./models/UpsertCatalogEntityResponseIncludedItem"; @@ -5929,6 +5964,8 @@ export { ValidationErrorMeta } from "./models/ValidationErrorMeta"; export { ValidationResponse } from "./models/ValidationResponse"; export { ValueType } from "./models/ValueType"; export { Variant } from "./models/Variant"; +export { VariantWeight } from "./models/VariantWeight"; +export { VariantWeightRequest } from "./models/VariantWeightRequest"; export { VersionHistoryUpdate } from "./models/VersionHistoryUpdate"; export { VersionHistoryUpdateType } from "./models/VersionHistoryUpdateType"; export { ViewershipHistorySessionArray } from "./models/ViewershipHistorySessionArray"; diff --git a/packages/datadog-api-client-v2/models/Allocation.ts b/packages/datadog-api-client-v2/models/Allocation.ts new file mode 100644 index 000000000000..5eb7806c3417 --- /dev/null +++ b/packages/datadog-api-client-v2/models/Allocation.ts @@ -0,0 +1,167 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationExposureSchedule } from "./AllocationExposureSchedule"; +import { AllocationType } from "./AllocationType"; +import { GuardrailMetric } from "./GuardrailMetric"; +import { TargetingRule } from "./TargetingRule"; +import { VariantWeight } from "./VariantWeight"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Targeting rule (allocation) details for a feature flag environment. + */ +export class Allocation { + /** + * The timestamp when the targeting rule allocation was created. + */ + "createdAt": Date; + /** + * Environment IDs associated with this targeting rule allocation. + */ + "environmentIds": Array; + /** + * The experiment ID linked to this targeting rule allocation. + */ + "experimentId"?: string; + /** + * Progressive release details for a targeting rule allocation. + */ + "exposureSchedule"?: AllocationExposureSchedule; + /** + * Guardrail metrics associated with this targeting rule allocation. + */ + "guardrailMetrics": Array; + /** + * The unique identifier of the targeting rule allocation. + */ + "id"?: string; + /** + * The unique key of the targeting rule allocation. + */ + "key": string; + /** + * The display name of the targeting rule. + */ + "name": string; + /** + * Sort order position within the environment. + */ + "orderPosition": number; + /** + * Conditions associated with this targeting rule allocation. + */ + "targetingRules": Array; + /** + * The type of targeting rule (called allocation in the API model). + */ + "type": AllocationType; + /** + * The timestamp when the targeting rule allocation was last updated. + */ + "updatedAt": Date; + /** + * Weighted variant assignments for this targeting rule allocation. + */ + "variantWeights": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + environmentIds: { + baseName: "environment_ids", + type: "Array", + required: true, + }, + experimentId: { + baseName: "experiment_id", + type: "string", + }, + exposureSchedule: { + baseName: "exposure_schedule", + type: "AllocationExposureSchedule", + }, + guardrailMetrics: { + baseName: "guardrail_metrics", + type: "Array", + required: true, + }, + id: { + baseName: "id", + type: "string", + format: "uuid", + }, + key: { + baseName: "key", + type: "string", + required: true, + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + orderPosition: { + baseName: "order_position", + type: "number", + required: true, + format: "int64", + }, + targetingRules: { + baseName: "targeting_rules", + type: "Array", + required: true, + }, + type: { + baseName: "type", + type: "AllocationType", + required: true, + }, + updatedAt: { + baseName: "updated_at", + type: "Date", + required: true, + format: "date-time", + }, + variantWeights: { + baseName: "variant_weights", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return Allocation.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/AllocationDataRequest.ts b/packages/datadog-api-client-v2/models/AllocationDataRequest.ts new file mode 100644 index 000000000000..da975623587e --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationDataRequest.ts @@ -0,0 +1,64 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationDataType } from "./AllocationDataType"; +import { UpsertAllocationRequest } from "./UpsertAllocationRequest"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data wrapper for allocation request payloads. + */ +export class AllocationDataRequest { + /** + * Request to create or update a targeting rule (allocation) for a feature flag environment. + */ + "attributes": UpsertAllocationRequest; + /** + * The resource type. + */ + "type": AllocationDataType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "UpsertAllocationRequest", + required: true, + }, + type: { + baseName: "type", + type: "AllocationDataType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AllocationDataRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/AllocationDataResponse.ts b/packages/datadog-api-client-v2/models/AllocationDataResponse.ts new file mode 100644 index 000000000000..82a1ab8721c0 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationDataResponse.ts @@ -0,0 +1,74 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { Allocation } from "./Allocation"; +import { AllocationDataType } from "./AllocationDataType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data wrapper for targeting rule allocation responses. + */ +export class AllocationDataResponse { + /** + * Targeting rule (allocation) details for a feature flag environment. + */ + "attributes": Allocation; + /** + * The unique identifier of the targeting rule allocation. + */ + "id": string; + /** + * The resource type. + */ + "type": AllocationDataType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "Allocation", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + type: { + baseName: "type", + type: "AllocationDataType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AllocationDataResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/AllocationDataType.ts b/packages/datadog-api-client-v2/models/AllocationDataType.ts new file mode 100644 index 000000000000..af91ad4f3293 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationDataType.ts @@ -0,0 +1,14 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The resource type. + */ + +export type AllocationDataType = typeof ALLOCATIONS | UnparsedObject; +export const ALLOCATIONS = "allocations"; diff --git a/packages/datadog-api-client-v2/models/AllocationExposureGuardrailTrigger.ts b/packages/datadog-api-client-v2/models/AllocationExposureGuardrailTrigger.ts new file mode 100644 index 000000000000..eb774d32a118 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationExposureGuardrailTrigger.ts @@ -0,0 +1,112 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Guardrail trigger details for a progressive rollout. + */ +export class AllocationExposureGuardrailTrigger { + /** + * The progressive rollout ID this trigger belongs to. + */ + "allocationExposureScheduleId": string; + /** + * The timestamp when this trigger was created. + */ + "createdAt": Date; + /** + * The variant ID that triggered this event. + */ + "flaggingVariantId": string; + /** + * The unique identifier of the guardrail trigger. + */ + "id": string; + /** + * The metric ID associated with the trigger. + */ + "metricId": string; + /** + * The action that was triggered. + */ + "triggeredAction": string; + /** + * The timestamp when this trigger was last updated. + */ + "updatedAt": Date; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + allocationExposureScheduleId: { + baseName: "allocation_exposure_schedule_id", + type: "string", + required: true, + format: "uuid", + }, + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + flaggingVariantId: { + baseName: "flagging_variant_id", + type: "string", + required: true, + format: "uuid", + }, + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + metricId: { + baseName: "metric_id", + type: "string", + required: true, + }, + triggeredAction: { + baseName: "triggered_action", + type: "string", + required: true, + }, + updatedAt: { + baseName: "updated_at", + type: "Date", + required: true, + format: "date-time", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AllocationExposureGuardrailTrigger.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/AllocationExposureRolloutStep.ts b/packages/datadog-api-client-v2/models/AllocationExposureRolloutStep.ts new file mode 100644 index 000000000000..bb20d75220b7 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationExposureRolloutStep.ts @@ -0,0 +1,132 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Exposure progression step details. + */ +export class AllocationExposureRolloutStep { + /** + * The progressive rollout ID this step belongs to. + */ + "allocationExposureScheduleId": string; + /** + * The timestamp when the progression step was created. + */ + "createdAt": Date; + /** + * The exposure ratio for this step. + */ + "exposureRatio": number; + /** + * Logical index grouping related steps. + */ + "groupedStepIndex": number; + /** + * The unique identifier of the progression step. + */ + "id": string; + /** + * Step duration in milliseconds. + */ + "intervalMs"?: number; + /** + * Whether this step represents a pause record. + */ + "isPauseRecord": boolean; + /** + * Sort order for the progression step. + */ + "orderPosition": number; + /** + * The timestamp when the progression step was last updated. + */ + "updatedAt": Date; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + allocationExposureScheduleId: { + baseName: "allocation_exposure_schedule_id", + type: "string", + required: true, + format: "uuid", + }, + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + exposureRatio: { + baseName: "exposure_ratio", + type: "number", + required: true, + format: "double", + }, + groupedStepIndex: { + baseName: "grouped_step_index", + type: "number", + required: true, + format: "int64", + }, + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + intervalMs: { + baseName: "interval_ms", + type: "number", + format: "int64", + }, + isPauseRecord: { + baseName: "is_pause_record", + type: "boolean", + required: true, + }, + orderPosition: { + baseName: "order_position", + type: "number", + required: true, + format: "int64", + }, + updatedAt: { + baseName: "updated_at", + type: "Date", + required: true, + format: "date-time", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AllocationExposureRolloutStep.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/AllocationExposureSchedule.ts b/packages/datadog-api-client-v2/models/AllocationExposureSchedule.ts new file mode 100644 index 000000000000..e9e0a84a0cd8 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationExposureSchedule.ts @@ -0,0 +1,138 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationExposureGuardrailTrigger } from "./AllocationExposureGuardrailTrigger"; +import { AllocationExposureRolloutStep } from "./AllocationExposureRolloutStep"; +import { RolloutOptions } from "./RolloutOptions"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Progressive release details for a targeting rule allocation. + */ +export class AllocationExposureSchedule { + /** + * The absolute UTC start time for this schedule. + */ + "absoluteStartTime"?: Date; + /** + * The targeting rule allocation ID this progressive rollout belongs to. + */ + "allocationId": string; + /** + * The control variant ID used for experiment comparisons. + */ + "controlVariantId"?: string; + /** + * The timestamp when the schedule was created. + */ + "createdAt": Date; + /** + * Last guardrail action triggered for this schedule. + */ + "guardrailTriggeredAction"?: string; + /** + * Guardrail trigger records for this schedule. + */ + "guardrailTriggers": Array; + /** + * The unique identifier of the progressive rollout. + */ + "id"?: string; + /** + * Applied progression options for a progressive rollout. + */ + "rolloutOptions": RolloutOptions; + /** + * Ordered progression steps for exposure. + */ + "rolloutSteps": Array; + /** + * The timestamp when the schedule was last updated. + */ + "updatedAt": Date; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + absoluteStartTime: { + baseName: "absolute_start_time", + type: "Date", + format: "date-time", + }, + allocationId: { + baseName: "allocation_id", + type: "string", + required: true, + format: "uuid", + }, + controlVariantId: { + baseName: "control_variant_id", + type: "string", + }, + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + guardrailTriggeredAction: { + baseName: "guardrail_triggered_action", + type: "string", + }, + guardrailTriggers: { + baseName: "guardrail_triggers", + type: "Array", + required: true, + }, + id: { + baseName: "id", + type: "string", + format: "uuid", + }, + rolloutOptions: { + baseName: "rollout_options", + type: "RolloutOptions", + required: true, + }, + rolloutSteps: { + baseName: "rollout_steps", + type: "Array", + required: true, + }, + updatedAt: { + baseName: "updated_at", + type: "Date", + required: true, + format: "date-time", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AllocationExposureSchedule.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/AllocationExposureScheduleData.ts b/packages/datadog-api-client-v2/models/AllocationExposureScheduleData.ts new file mode 100644 index 000000000000..622dc94f995f --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationExposureScheduleData.ts @@ -0,0 +1,74 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationExposureSchedule } from "./AllocationExposureSchedule"; +import { AllocationExposureScheduleDataType } from "./AllocationExposureScheduleDataType"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Data wrapper for progressive rollout schedule responses. + */ +export class AllocationExposureScheduleData { + /** + * Progressive release details for a targeting rule allocation. + */ + "attributes": AllocationExposureSchedule; + /** + * The unique identifier of the progressive rollout. + */ + "id": string; + /** + * The resource type for progressive rollout schedules. + */ + "type": AllocationExposureScheduleDataType; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attributes: { + baseName: "attributes", + type: "AllocationExposureSchedule", + required: true, + }, + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + type: { + baseName: "type", + type: "AllocationExposureScheduleDataType", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AllocationExposureScheduleData.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/AllocationExposureScheduleDataType.ts b/packages/datadog-api-client-v2/models/AllocationExposureScheduleDataType.ts new file mode 100644 index 000000000000..e8f1cacf038e --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationExposureScheduleDataType.ts @@ -0,0 +1,16 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The resource type for progressive rollout schedules. + */ + +export type AllocationExposureScheduleDataType = + | typeof ALLOCATION_EXPOSURE_SCHEDULES + | UnparsedObject; +export const ALLOCATION_EXPOSURE_SCHEDULES = "allocation_exposure_schedules"; diff --git a/packages/datadog-api-client-v2/models/AllocationExposureScheduleResponse.ts b/packages/datadog-api-client-v2/models/AllocationExposureScheduleResponse.ts new file mode 100644 index 000000000000..84a555b29a94 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationExposureScheduleResponse.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationExposureScheduleData } from "./AllocationExposureScheduleData"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing a progressive rollout schedule. + */ +export class AllocationExposureScheduleResponse { + /** + * Data wrapper for progressive rollout schedule responses. + */ + "data": AllocationExposureScheduleData; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "AllocationExposureScheduleData", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AllocationExposureScheduleResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/AllocationResponse.ts b/packages/datadog-api-client-v2/models/AllocationResponse.ts new file mode 100644 index 000000000000..f3c455672c09 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationResponse.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationDataResponse } from "./AllocationDataResponse"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing a single targeting rule (allocation). + */ +export class AllocationResponse { + /** + * Data wrapper for targeting rule allocation responses. + */ + "data": AllocationDataResponse; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "AllocationDataResponse", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return AllocationResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/AllocationType.ts b/packages/datadog-api-client-v2/models/AllocationType.ts new file mode 100644 index 000000000000..73555ffaf889 --- /dev/null +++ b/packages/datadog-api-client-v2/models/AllocationType.ts @@ -0,0 +1,18 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The type of targeting rule (called allocation in the API model). + */ + +export type AllocationType = + | typeof FEATURE_GATE + | typeof CANARY + | UnparsedObject; +export const FEATURE_GATE = "FEATURE_GATE"; +export const CANARY = "CANARY"; diff --git a/packages/datadog-api-client-v2/models/Condition.ts b/packages/datadog-api-client-v2/models/Condition.ts new file mode 100644 index 000000000000..d92668bdb32c --- /dev/null +++ b/packages/datadog-api-client-v2/models/Condition.ts @@ -0,0 +1,102 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { ConditionOperator } from "./ConditionOperator"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Targeting condition details. + */ +export class Condition { + /** + * The user or request attribute to evaluate. + */ + "attribute": string; + /** + * The timestamp when the condition was created. + */ + "createdAt": Date; + /** + * The unique identifier of the condition. + */ + "id": string; + /** + * The operator used in a targeting condition. + */ + "operator": ConditionOperator; + /** + * The timestamp when the condition was last updated. + */ + "updatedAt": Date; + /** + * Values used by the selected operator. + */ + "value": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attribute: { + baseName: "attribute", + type: "string", + required: true, + }, + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + operator: { + baseName: "operator", + type: "ConditionOperator", + required: true, + }, + updatedAt: { + baseName: "updated_at", + type: "Date", + required: true, + format: "date-time", + }, + value: { + baseName: "value", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return Condition.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ConditionOperator.ts b/packages/datadog-api-client-v2/models/ConditionOperator.ts new file mode 100644 index 000000000000..800db1526f71 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ConditionOperator.ts @@ -0,0 +1,34 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The operator used in a targeting condition. + */ + +export type ConditionOperator = + | typeof LT + | typeof LTE + | typeof GT + | typeof GTE + | typeof MATCHES + | typeof NOT_MATCHES + | typeof ONE_OF + | typeof NOT_ONE_OF + | typeof IS_NULL + | typeof EQUALS + | UnparsedObject; +export const LT = "LT"; +export const LTE = "LTE"; +export const GT = "GT"; +export const GTE = "GTE"; +export const MATCHES = "MATCHES"; +export const NOT_MATCHES = "NOT_MATCHES"; +export const ONE_OF = "ONE_OF"; +export const NOT_ONE_OF = "NOT_ONE_OF"; +export const IS_NULL = "IS_NULL"; +export const EQUALS = "EQUALS"; diff --git a/packages/datadog-api-client-v2/models/ConditionRequest.ts b/packages/datadog-api-client-v2/models/ConditionRequest.ts new file mode 100644 index 000000000000..216d56f3b413 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ConditionRequest.ts @@ -0,0 +1,72 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { ConditionOperator } from "./ConditionOperator"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Condition request payload for targeting rules. + */ +export class ConditionRequest { + /** + * The user or request attribute to evaluate. + */ + "attribute": string; + /** + * The operator used in a targeting condition. + */ + "operator": ConditionOperator; + /** + * Values used by the selected operator. + */ + "value": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + attribute: { + baseName: "attribute", + type: "string", + required: true, + }, + operator: { + baseName: "operator", + type: "ConditionOperator", + required: true, + }, + value: { + baseName: "value", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ConditionRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/CreateAllocationsRequest.ts b/packages/datadog-api-client-v2/models/CreateAllocationsRequest.ts new file mode 100644 index 000000000000..7d5c681c904d --- /dev/null +++ b/packages/datadog-api-client-v2/models/CreateAllocationsRequest.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationDataRequest } from "./AllocationDataRequest"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Request to create targeting rules (allocations) for a feature flag in an environment. + */ +export class CreateAllocationsRequest { + /** + * Data wrapper for allocation request payloads. + */ + "data": AllocationDataRequest; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "AllocationDataRequest", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return CreateAllocationsRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ExposureRolloutStepRequest.ts b/packages/datadog-api-client-v2/models/ExposureRolloutStepRequest.ts new file mode 100644 index 000000000000..91d7b3271656 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ExposureRolloutStepRequest.ts @@ -0,0 +1,91 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Rollout step request payload. + */ +export class ExposureRolloutStepRequest { + /** + * The exposure ratio for this step. + */ + "exposureRatio": number; + /** + * Logical index grouping related steps. + */ + "groupedStepIndex": number; + /** + * The unique identifier of the progression step. + */ + "id"?: string; + /** + * Step duration in milliseconds. + */ + "intervalMs"?: number; + /** + * Whether this step represents a pause record. + */ + "isPauseRecord": boolean; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + exposureRatio: { + baseName: "exposure_ratio", + type: "number", + required: true, + format: "double", + }, + groupedStepIndex: { + baseName: "grouped_step_index", + type: "number", + required: true, + format: "int64", + }, + id: { + baseName: "id", + type: "string", + format: "uuid", + }, + intervalMs: { + baseName: "interval_ms", + type: "number", + format: "int64", + }, + isPauseRecord: { + baseName: "is_pause_record", + type: "boolean", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ExposureRolloutStepRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ExposureScheduleRequest.ts b/packages/datadog-api-client-v2/models/ExposureScheduleRequest.ts new file mode 100644 index 000000000000..8c9fb914bb08 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ExposureScheduleRequest.ts @@ -0,0 +1,98 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { ExposureRolloutStepRequest } from "./ExposureRolloutStepRequest"; +import { RolloutOptionsRequest } from "./RolloutOptionsRequest"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Progressive release request payload. + */ +export class ExposureScheduleRequest { + /** + * The absolute UTC start time for this schedule. + */ + "absoluteStartTime"?: Date; + /** + * The control variant ID used for experiment comparisons. + */ + "controlVariantId"?: string; + /** + * The control variant key used during creation workflows. + */ + "controlVariantKey"?: string; + /** + * The unique identifier of the progressive rollout. + */ + "id"?: string; + /** + * Rollout options request payload. + */ + "rolloutOptions": RolloutOptionsRequest; + /** + * Ordered progression steps for exposure. + */ + "rolloutSteps": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + absoluteStartTime: { + baseName: "absolute_start_time", + type: "Date", + format: "date-time", + }, + controlVariantId: { + baseName: "control_variant_id", + type: "string", + }, + controlVariantKey: { + baseName: "control_variant_key", + type: "string", + }, + id: { + baseName: "id", + type: "string", + format: "uuid", + }, + rolloutOptions: { + baseName: "rollout_options", + type: "RolloutOptionsRequest", + required: true, + }, + rolloutSteps: { + baseName: "rollout_steps", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ExposureScheduleRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/FeatureFlagAttributes.ts b/packages/datadog-api-client-v2/models/FeatureFlagAttributes.ts index 40c651521c8b..7fe7a6f53a49 100644 --- a/packages/datadog-api-client-v2/models/FeatureFlagAttributes.ts +++ b/packages/datadog-api-client-v2/models/FeatureFlagAttributes.ts @@ -57,6 +57,10 @@ export class FeatureFlagAttributes { * Indicates whether this feature flag requires approval for changes. */ "requireApproval"?: boolean; + /** + * Tags associated with the feature flag. + */ + "tags"?: Array; /** * The timestamp when the feature flag was last updated. */ @@ -137,6 +141,10 @@ export class FeatureFlagAttributes { baseName: "require_approval", type: "boolean", }, + tags: { + baseName: "tags", + type: "Array", + }, updatedAt: { baseName: "updated_at", type: "Date", diff --git a/packages/datadog-api-client-v2/models/FeatureFlagEnvironment.ts b/packages/datadog-api-client-v2/models/FeatureFlagEnvironment.ts index 4f7409d3fba6..c9cca7750daa 100644 --- a/packages/datadog-api-client-v2/models/FeatureFlagEnvironment.ts +++ b/packages/datadog-api-client-v2/models/FeatureFlagEnvironment.ts @@ -31,6 +31,10 @@ export class FeatureFlagEnvironment { * The name of the environment. */ "environmentName"?: string; + /** + * Queries that target this environment. + */ + "environmentQueries"?: Array; /** * Indicates whether the environment is production. */ @@ -102,6 +106,10 @@ export class FeatureFlagEnvironment { baseName: "environment_name", type: "string", }, + environmentQueries: { + baseName: "environment_queries", + type: "Array", + }, isProduction: { baseName: "is_production", type: "boolean", diff --git a/packages/datadog-api-client-v2/models/GuardrailMetric.ts b/packages/datadog-api-client-v2/models/GuardrailMetric.ts new file mode 100644 index 000000000000..ce5f27080301 --- /dev/null +++ b/packages/datadog-api-client-v2/models/GuardrailMetric.ts @@ -0,0 +1,71 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { GuardrailTriggerAction } from "./GuardrailTriggerAction"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Guardrail metric details. + */ +export class GuardrailMetric { + /** + * The metric ID to monitor. + */ + "metricId": string; + /** + * Action to perform when a guardrail threshold is triggered. + */ + "triggerAction": GuardrailTriggerAction; + /** + * The signal or system that triggered the action. + */ + "triggeredBy"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + metricId: { + baseName: "metric_id", + type: "string", + required: true, + }, + triggerAction: { + baseName: "trigger_action", + type: "GuardrailTriggerAction", + required: true, + }, + triggeredBy: { + baseName: "triggered_by", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return GuardrailMetric.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/GuardrailMetricRequest.ts b/packages/datadog-api-client-v2/models/GuardrailMetricRequest.ts new file mode 100644 index 000000000000..ef7ee556c145 --- /dev/null +++ b/packages/datadog-api-client-v2/models/GuardrailMetricRequest.ts @@ -0,0 +1,63 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { GuardrailTriggerAction } from "./GuardrailTriggerAction"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Guardrail metric request payload. + */ +export class GuardrailMetricRequest { + /** + * The metric ID to monitor. + */ + "metricId": string; + /** + * Action to perform when a guardrail threshold is triggered. + */ + "triggerAction": GuardrailTriggerAction; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + metricId: { + baseName: "metric_id", + type: "string", + required: true, + }, + triggerAction: { + baseName: "trigger_action", + type: "GuardrailTriggerAction", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return GuardrailMetricRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/GuardrailTriggerAction.ts b/packages/datadog-api-client-v2/models/GuardrailTriggerAction.ts new file mode 100644 index 000000000000..47b815ace558 --- /dev/null +++ b/packages/datadog-api-client-v2/models/GuardrailTriggerAction.ts @@ -0,0 +1,18 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * Action to perform when a guardrail threshold is triggered. + */ + +export type GuardrailTriggerAction = + | typeof PAUSE + | typeof ABORT + | UnparsedObject; +export const PAUSE = "PAUSE"; +export const ABORT = "ABORT"; diff --git a/packages/datadog-api-client-v2/models/ListAllocationsResponse.ts b/packages/datadog-api-client-v2/models/ListAllocationsResponse.ts new file mode 100644 index 000000000000..51dd7f2d3e35 --- /dev/null +++ b/packages/datadog-api-client-v2/models/ListAllocationsResponse.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationDataResponse } from "./AllocationDataResponse"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Response containing a list of targeting rules (allocations). + */ +export class ListAllocationsResponse { + /** + * List of targeting rules (allocations). + */ + "data": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return ListAllocationsResponse.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/ObjectSerializer.ts b/packages/datadog-api-client-v2/models/ObjectSerializer.ts index 2ad66a66a747..0ab9cfb9696e 100644 --- a/packages/datadog-api-client-v2/models/ObjectSerializer.ts +++ b/packages/datadog-api-client-v2/models/ObjectSerializer.ts @@ -102,6 +102,15 @@ import { AlertEventAttributes } from "./AlertEventAttributes"; import { AlertEventAttributesLinksItem } from "./AlertEventAttributesLinksItem"; import { AlertEventCustomAttributes } from "./AlertEventCustomAttributes"; import { AlertEventCustomAttributesLinksItems } from "./AlertEventCustomAttributesLinksItems"; +import { Allocation } from "./Allocation"; +import { AllocationDataRequest } from "./AllocationDataRequest"; +import { AllocationDataResponse } from "./AllocationDataResponse"; +import { AllocationExposureGuardrailTrigger } from "./AllocationExposureGuardrailTrigger"; +import { AllocationExposureRolloutStep } from "./AllocationExposureRolloutStep"; +import { AllocationExposureSchedule } from "./AllocationExposureSchedule"; +import { AllocationExposureScheduleData } from "./AllocationExposureScheduleData"; +import { AllocationExposureScheduleResponse } from "./AllocationExposureScheduleResponse"; +import { AllocationResponse } from "./AllocationResponse"; import { Annotation } from "./Annotation"; import { AnnotationDisplay } from "./AnnotationDisplay"; import { AnnotationDisplayBounds } from "./AnnotationDisplayBounds"; @@ -555,6 +564,8 @@ import { ComponentGrid } from "./ComponentGrid"; import { ComponentGridProperties } from "./ComponentGridProperties"; import { ComponentProperties } from "./ComponentProperties"; import { ComponentRecommendation } from "./ComponentRecommendation"; +import { Condition } from "./Condition"; +import { ConditionRequest } from "./ConditionRequest"; import { ConfigCatIntegration } from "./ConfigCatIntegration"; import { ConfigCatIntegrationUpdate } from "./ConfigCatIntegrationUpdate"; import { ConfigCatSDKKey } from "./ConfigCatSDKKey"; @@ -628,6 +639,7 @@ import { CoverageSummaryServiceStats } from "./CoverageSummaryServiceStats"; import { Cpu } from "./Cpu"; import { CreateActionConnectionRequest } from "./CreateActionConnectionRequest"; import { CreateActionConnectionResponse } from "./CreateActionConnectionResponse"; +import { CreateAllocationsRequest } from "./CreateAllocationsRequest"; import { CreateAppRequest } from "./CreateAppRequest"; import { CreateAppRequestData } from "./CreateAppRequestData"; import { CreateAppRequestDataAttributes } from "./CreateAppRequestDataAttributes"; @@ -1157,6 +1169,8 @@ import { EventsScalarQuery } from "./EventsScalarQuery"; import { EventsSearch } from "./EventsSearch"; import { EventsTimeseriesQuery } from "./EventsTimeseriesQuery"; import { EventsWarning } from "./EventsWarning"; +import { ExposureRolloutStepRequest } from "./ExposureRolloutStepRequest"; +import { ExposureScheduleRequest } from "./ExposureScheduleRequest"; import { FacetInfoRequest } from "./FacetInfoRequest"; import { FacetInfoRequestData } from "./FacetInfoRequestData"; import { FacetInfoRequestDataAttributes } from "./FacetInfoRequestDataAttributes"; @@ -1399,6 +1413,8 @@ import { GreyNoiseAPIKeyUpdate } from "./GreyNoiseAPIKeyUpdate"; import { GreyNoiseIntegration } from "./GreyNoiseIntegration"; import { GreyNoiseIntegrationUpdate } from "./GreyNoiseIntegrationUpdate"; import { GroupScalarColumn } from "./GroupScalarColumn"; +import { GuardrailMetric } from "./GuardrailMetric"; +import { GuardrailMetricRequest } from "./GuardrailMetricRequest"; import { HTTPBody } from "./HTTPBody"; import { HTTPCDGatesBadRequestResponse } from "./HTTPCDGatesBadRequestResponse"; import { HTTPCDGatesNotFoundResponse } from "./HTTPCDGatesNotFoundResponse"; @@ -1783,6 +1799,7 @@ import { ListAPIsResponseData } from "./ListAPIsResponseData"; import { ListAPIsResponseDataAttributes } from "./ListAPIsResponseDataAttributes"; import { ListAPIsResponseMeta } from "./ListAPIsResponseMeta"; import { ListAPIsResponseMetaPagination } from "./ListAPIsResponseMetaPagination"; +import { ListAllocationsResponse } from "./ListAllocationsResponse"; import { ListAppKeyRegistrationsResponse } from "./ListAppKeyRegistrationsResponse"; import { ListAppKeyRegistrationsResponseMeta } from "./ListAppKeyRegistrationsResponseMeta"; import { ListApplicationKeysResponse } from "./ListApplicationKeysResponse"; @@ -2297,6 +2314,7 @@ import { OutcomesResponseIncludedRuleAttributes } from "./OutcomesResponseInclud import { OutcomesResponseLinks } from "./OutcomesResponseLinks"; import { OutputSchema } from "./OutputSchema"; import { OutputSchemaParameters } from "./OutputSchemaParameters"; +import { OverwriteAllocationsRequest } from "./OverwriteAllocationsRequest"; import { Pagination } from "./Pagination"; import { PaginationMeta } from "./PaginationMeta"; import { PaginationMetaPage } from "./PaginationMetaPage"; @@ -2637,6 +2655,8 @@ import { RoleUpdateRequest } from "./RoleUpdateRequest"; import { RoleUpdateResponse } from "./RoleUpdateResponse"; import { RoleUpdateResponseData } from "./RoleUpdateResponseData"; import { RolesResponse } from "./RolesResponse"; +import { RolloutOptions } from "./RolloutOptions"; +import { RolloutOptionsRequest } from "./RolloutOptionsRequest"; import { RoutingRule } from "./RoutingRule"; import { RoutingRuleAttributes } from "./RoutingRuleAttributes"; import { RoutingRuleRelationships } from "./RoutingRuleRelationships"; @@ -3274,6 +3294,8 @@ import { TableRowResourceArray } from "./TableRowResourceArray"; import { TableRowResourceData } from "./TableRowResourceData"; import { TableRowResourceDataAttributes } from "./TableRowResourceDataAttributes"; import { TableRowResourceIdentifier } from "./TableRowResourceIdentifier"; +import { TargetingRule } from "./TargetingRule"; +import { TargetingRuleRequest } from "./TargetingRuleRequest"; import { Team } from "./Team"; import { TeamAttributes } from "./TeamAttributes"; import { TeamConnection } from "./TeamConnection"; @@ -3496,6 +3518,7 @@ import { UpdateTenancyConfigDataAttributesRegionsConfig } from "./UpdateTenancyC import { UpdateTenancyConfigRequest } from "./UpdateTenancyConfigRequest"; import { UpdateWorkflowRequest } from "./UpdateWorkflowRequest"; import { UpdateWorkflowResponse } from "./UpdateWorkflowResponse"; +import { UpsertAllocationRequest } from "./UpsertAllocationRequest"; import { UpsertCatalogEntityResponse } from "./UpsertCatalogEntityResponse"; import { UpsertCatalogKindResponse } from "./UpsertCatalogKindResponse"; import { UrlParam } from "./UrlParam"; @@ -3549,6 +3572,8 @@ import { ValidationError } from "./ValidationError"; import { ValidationErrorMeta } from "./ValidationErrorMeta"; import { ValidationResponse } from "./ValidationResponse"; import { Variant } from "./Variant"; +import { VariantWeight } from "./VariantWeight"; +import { VariantWeightRequest } from "./VariantWeightRequest"; import { VersionHistoryUpdate } from "./VersionHistoryUpdate"; import { ViewershipHistorySessionArray } from "./ViewershipHistorySessionArray"; import { ViewershipHistorySessionData } from "./ViewershipHistorySessionData"; @@ -3678,6 +3703,9 @@ const enumsMap: { [key: string]: any[] } = { ], AlertEventCustomAttributesPriority: ["1", "2", "3", "4", "5"], AlertEventCustomAttributesStatus: ["warn", "error", "ok"], + AllocationDataType: ["allocations"], + AllocationExposureScheduleDataType: ["allocation_exposure_schedules"], + AllocationType: ["FEATURE_GATE", "CANARY"], AnthropicAPIKeyType: ["AnthropicAPIKey"], AnthropicIntegrationType: ["Anthropic"], ApmRetentionFilterType: ["apm_retention_filter"], @@ -3958,6 +3986,18 @@ const enumsMap: { [key: string]: any[] } = { "container", "calloutValue", ], + ConditionOperator: [ + "LT", + "LTE", + "GT", + "GTE", + "MATCHES", + "NOT_MATCHES", + "ONE_OF", + "NOT_ONE_OF", + "IS_NULL", + "EQUALS", + ], ConfigCatIntegrationType: ["ConfigCat"], ConfigCatSDKKeyType: ["ConfigCatSDKKey"], ConfiguredScheduleTargetType: ["schedule_target"], @@ -4271,6 +4311,7 @@ const enumsMap: { [key: string]: any[] } = { GoogleChatOrganizationHandleType: ["google-chat-organization-handle"], GreyNoiseAPIKeyType: ["GreyNoiseAPIKey"], GreyNoiseIntegrationType: ["GreyNoise"], + GuardrailTriggerAction: ["PAUSE", "ABORT"], HTTPIntegrationType: ["HTTP"], HTTPTokenAuthType: ["HTTPTokenAuth"], HamrOrgConnectionStatus: [0, 1, 2, 3, 4, 5], @@ -4990,6 +5031,7 @@ const enumsMap: { [key: string]: any[] } = { "-user_count", ], RolesType: ["roles"], + RolloutStrategy: ["UNIFORM_INTERVALS", "NO_ROLLOUT"], RoutingRuleRelationshipsPolicyDataType: ["policies"], RoutingRuleType: ["team_routing_rules"], RuleSeverity: ["critical", "high", "medium", "low", "unknown", "info"], @@ -5835,6 +5877,15 @@ const typeMap: { [index: string]: any } = { AlertEventAttributesLinksItem: AlertEventAttributesLinksItem, AlertEventCustomAttributes: AlertEventCustomAttributes, AlertEventCustomAttributesLinksItems: AlertEventCustomAttributesLinksItems, + Allocation: Allocation, + AllocationDataRequest: AllocationDataRequest, + AllocationDataResponse: AllocationDataResponse, + AllocationExposureGuardrailTrigger: AllocationExposureGuardrailTrigger, + AllocationExposureRolloutStep: AllocationExposureRolloutStep, + AllocationExposureSchedule: AllocationExposureSchedule, + AllocationExposureScheduleData: AllocationExposureScheduleData, + AllocationExposureScheduleResponse: AllocationExposureScheduleResponse, + AllocationResponse: AllocationResponse, Annotation: Annotation, AnnotationDisplay: AnnotationDisplay, AnnotationDisplayBounds: AnnotationDisplayBounds, @@ -6388,6 +6439,8 @@ const typeMap: { [index: string]: any } = { ComponentGridProperties: ComponentGridProperties, ComponentProperties: ComponentProperties, ComponentRecommendation: ComponentRecommendation, + Condition: Condition, + ConditionRequest: ConditionRequest, ConfigCatIntegration: ConfigCatIntegration, ConfigCatIntegrationUpdate: ConfigCatIntegrationUpdate, ConfigCatSDKKey: ConfigCatSDKKey, @@ -6465,6 +6518,7 @@ const typeMap: { [index: string]: any } = { Cpu: Cpu, CreateActionConnectionRequest: CreateActionConnectionRequest, CreateActionConnectionResponse: CreateActionConnectionResponse, + CreateAllocationsRequest: CreateAllocationsRequest, CreateAppRequest: CreateAppRequest, CreateAppRequestData: CreateAppRequestData, CreateAppRequestDataAttributes: CreateAppRequestDataAttributes, @@ -7109,6 +7163,8 @@ const typeMap: { [index: string]: any } = { EventsSearch: EventsSearch, EventsTimeseriesQuery: EventsTimeseriesQuery, EventsWarning: EventsWarning, + ExposureRolloutStepRequest: ExposureRolloutStepRequest, + ExposureScheduleRequest: ExposureScheduleRequest, FacetInfoRequest: FacetInfoRequest, FacetInfoRequestData: FacetInfoRequestData, FacetInfoRequestDataAttributes: FacetInfoRequestDataAttributes, @@ -7381,6 +7437,8 @@ const typeMap: { [index: string]: any } = { GreyNoiseIntegration: GreyNoiseIntegration, GreyNoiseIntegrationUpdate: GreyNoiseIntegrationUpdate, GroupScalarColumn: GroupScalarColumn, + GuardrailMetric: GuardrailMetric, + GuardrailMetricRequest: GuardrailMetricRequest, HTTPBody: HTTPBody, HTTPCDGatesBadRequestResponse: HTTPCDGatesBadRequestResponse, HTTPCDGatesNotFoundResponse: HTTPCDGatesNotFoundResponse, @@ -7811,6 +7869,7 @@ const typeMap: { [index: string]: any } = { ListAPIsResponseDataAttributes: ListAPIsResponseDataAttributes, ListAPIsResponseMeta: ListAPIsResponseMeta, ListAPIsResponseMetaPagination: ListAPIsResponseMetaPagination, + ListAllocationsResponse: ListAllocationsResponse, ListAppKeyRegistrationsResponse: ListAppKeyRegistrationsResponse, ListAppKeyRegistrationsResponseMeta: ListAppKeyRegistrationsResponseMeta, ListApplicationKeysResponse: ListApplicationKeysResponse, @@ -8491,6 +8550,7 @@ const typeMap: { [index: string]: any } = { OutcomesResponseLinks: OutcomesResponseLinks, OutputSchema: OutputSchema, OutputSchemaParameters: OutputSchemaParameters, + OverwriteAllocationsRequest: OverwriteAllocationsRequest, Pagination: Pagination, PaginationMeta: PaginationMeta, PaginationMetaPage: PaginationMetaPage, @@ -8873,6 +8933,8 @@ const typeMap: { [index: string]: any } = { RoleUpdateResponse: RoleUpdateResponse, RoleUpdateResponseData: RoleUpdateResponseData, RolesResponse: RolesResponse, + RolloutOptions: RolloutOptions, + RolloutOptionsRequest: RolloutOptionsRequest, RoutingRule: RoutingRule, RoutingRuleAttributes: RoutingRuleAttributes, RoutingRuleRelationships: RoutingRuleRelationships, @@ -9683,6 +9745,8 @@ const typeMap: { [index: string]: any } = { TableRowResourceData: TableRowResourceData, TableRowResourceDataAttributes: TableRowResourceDataAttributes, TableRowResourceIdentifier: TableRowResourceIdentifier, + TargetingRule: TargetingRule, + TargetingRuleRequest: TargetingRuleRequest, Team: Team, TeamAttributes: TeamAttributes, TeamConnection: TeamConnection, @@ -9950,6 +10014,7 @@ const typeMap: { [index: string]: any } = { UpdateTenancyConfigRequest: UpdateTenancyConfigRequest, UpdateWorkflowRequest: UpdateWorkflowRequest, UpdateWorkflowResponse: UpdateWorkflowResponse, + UpsertAllocationRequest: UpsertAllocationRequest, UpsertCatalogEntityResponse: UpsertCatalogEntityResponse, UpsertCatalogKindResponse: UpsertCatalogKindResponse, UrlParam: UrlParam, @@ -10004,6 +10069,8 @@ const typeMap: { [index: string]: any } = { ValidationErrorMeta: ValidationErrorMeta, ValidationResponse: ValidationResponse, Variant: Variant, + VariantWeight: VariantWeight, + VariantWeightRequest: VariantWeightRequest, VersionHistoryUpdate: VersionHistoryUpdate, ViewershipHistorySessionArray: ViewershipHistorySessionArray, ViewershipHistorySessionData: ViewershipHistorySessionData, diff --git a/packages/datadog-api-client-v2/models/OverwriteAllocationsRequest.ts b/packages/datadog-api-client-v2/models/OverwriteAllocationsRequest.ts new file mode 100644 index 000000000000..b74e99229483 --- /dev/null +++ b/packages/datadog-api-client-v2/models/OverwriteAllocationsRequest.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationDataRequest } from "./AllocationDataRequest"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Request to overwrite targeting rules (allocations) for a feature flag in an environment. + */ +export class OverwriteAllocationsRequest { + /** + * Targeting rules (allocations) to replace existing ones with. + */ + "data": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + data: { + baseName: "data", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return OverwriteAllocationsRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RolloutOptions.ts b/packages/datadog-api-client-v2/models/RolloutOptions.ts new file mode 100644 index 000000000000..1ef740ed9342 --- /dev/null +++ b/packages/datadog-api-client-v2/models/RolloutOptions.ts @@ -0,0 +1,73 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { RolloutStrategy } from "./RolloutStrategy"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Applied progression options for a progressive rollout. + */ +export class RolloutOptions { + /** + * Whether the schedule starts automatically. + */ + "autostart": boolean; + /** + * Interval in milliseconds for uniform interval strategies. + */ + "selectionIntervalMs": number; + /** + * The progression strategy used by a progressive rollout. + */ + "strategy": RolloutStrategy; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + autostart: { + baseName: "autostart", + type: "boolean", + required: true, + }, + selectionIntervalMs: { + baseName: "selection_interval_ms", + type: "number", + required: true, + format: "int64", + }, + strategy: { + baseName: "strategy", + type: "RolloutStrategy", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RolloutOptions.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RolloutOptionsRequest.ts b/packages/datadog-api-client-v2/models/RolloutOptionsRequest.ts new file mode 100644 index 000000000000..94869251f28c --- /dev/null +++ b/packages/datadog-api-client-v2/models/RolloutOptionsRequest.ts @@ -0,0 +1,71 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { RolloutStrategy } from "./RolloutStrategy"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Rollout options request payload. + */ +export class RolloutOptionsRequest { + /** + * Whether the schedule should begin automatically. + */ + "autostart"?: boolean; + /** + * Interval in milliseconds for uniform interval strategies. + */ + "selectionIntervalMs"?: number; + /** + * The progression strategy used by a progressive rollout. + */ + "strategy": RolloutStrategy; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + autostart: { + baseName: "autostart", + type: "boolean", + }, + selectionIntervalMs: { + baseName: "selection_interval_ms", + type: "number", + format: "int64", + }, + strategy: { + baseName: "strategy", + type: "RolloutStrategy", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return RolloutOptionsRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/RolloutStrategy.ts b/packages/datadog-api-client-v2/models/RolloutStrategy.ts new file mode 100644 index 000000000000..3a82aaba3e3a --- /dev/null +++ b/packages/datadog-api-client-v2/models/RolloutStrategy.ts @@ -0,0 +1,18 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { UnparsedObject } from "../../datadog-api-client-common/util"; + +/** + * The progression strategy used by a progressive rollout. + */ + +export type RolloutStrategy = + | typeof UNIFORM_INTERVALS + | typeof NO_ROLLOUT + | UnparsedObject; +export const UNIFORM_INTERVALS = "UNIFORM_INTERVALS"; +export const NO_ROLLOUT = "NO_ROLLOUT"; diff --git a/packages/datadog-api-client-v2/models/TargetingRule.ts b/packages/datadog-api-client-v2/models/TargetingRule.ts new file mode 100644 index 000000000000..45e83c96111e --- /dev/null +++ b/packages/datadog-api-client-v2/models/TargetingRule.ts @@ -0,0 +1,84 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { Condition } from "./Condition"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Targeting rule details. + */ +export class TargetingRule { + /** + * Conditions evaluated by this targeting rule. + */ + "conditions": Array; + /** + * The timestamp when the targeting rule was created. + */ + "createdAt": Date; + /** + * The unique identifier of the targeting rule. + */ + "id": string; + /** + * The timestamp when the targeting rule was last updated. + */ + "updatedAt": Date; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + conditions: { + baseName: "conditions", + type: "Array", + required: true, + }, + createdAt: { + baseName: "created_at", + type: "Date", + required: true, + format: "date-time", + }, + id: { + baseName: "id", + type: "string", + required: true, + format: "uuid", + }, + updatedAt: { + baseName: "updated_at", + type: "Date", + required: true, + format: "date-time", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TargetingRule.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/TargetingRuleRequest.ts b/packages/datadog-api-client-v2/models/TargetingRuleRequest.ts new file mode 100644 index 000000000000..a9d4f6d42260 --- /dev/null +++ b/packages/datadog-api-client-v2/models/TargetingRuleRequest.ts @@ -0,0 +1,54 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { ConditionRequest } from "./ConditionRequest"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Targeting rule request payload. + */ +export class TargetingRuleRequest { + /** + * Conditions that must match for this rule. + */ + "conditions": Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + conditions: { + baseName: "conditions", + type: "Array", + required: true, + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return TargetingRuleRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/UpsertAllocationRequest.ts b/packages/datadog-api-client-v2/models/UpsertAllocationRequest.ts new file mode 100644 index 000000000000..7f2f22e07d10 --- /dev/null +++ b/packages/datadog-api-client-v2/models/UpsertAllocationRequest.ts @@ -0,0 +1,125 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { AllocationType } from "./AllocationType"; +import { ExposureScheduleRequest } from "./ExposureScheduleRequest"; +import { GuardrailMetricRequest } from "./GuardrailMetricRequest"; +import { TargetingRuleRequest } from "./TargetingRuleRequest"; +import { VariantWeightRequest } from "./VariantWeightRequest"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Request to create or update a targeting rule (allocation) for a feature flag environment. + */ +export class UpsertAllocationRequest { + /** + * The experiment ID for experiment-linked allocations. + */ + "experimentId"?: string; + /** + * Progressive release request payload. + */ + "exposureSchedule"?: ExposureScheduleRequest; + /** + * Guardrail metrics used to monitor and auto-pause or abort. + */ + "guardrailMetrics"?: Array; + /** + * The unique identifier of the targeting rule allocation. + */ + "id"?: string; + /** + * The unique key of the targeting rule allocation. + */ + "key": string; + /** + * The display name of the targeting rule. + */ + "name": string; + /** + * Targeting rules that determine audience eligibility. + */ + "targetingRules"?: Array; + /** + * The type of targeting rule (called allocation in the API model). + */ + "type": AllocationType; + /** + * Variant distribution weights. + */ + "variantWeights"?: Array; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + experimentId: { + baseName: "experiment_id", + type: "string", + }, + exposureSchedule: { + baseName: "exposure_schedule", + type: "ExposureScheduleRequest", + }, + guardrailMetrics: { + baseName: "guardrail_metrics", + type: "Array", + }, + id: { + baseName: "id", + type: "string", + format: "uuid", + }, + key: { + baseName: "key", + type: "string", + required: true, + }, + name: { + baseName: "name", + type: "string", + required: true, + }, + targetingRules: { + baseName: "targeting_rules", + type: "Array", + }, + type: { + baseName: "type", + type: "AllocationType", + required: true, + }, + variantWeights: { + baseName: "variant_weights", + type: "Array", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return UpsertAllocationRequest.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/VariantWeight.ts b/packages/datadog-api-client-v2/models/VariantWeight.ts new file mode 100644 index 000000000000..491a10e295f6 --- /dev/null +++ b/packages/datadog-api-client-v2/models/VariantWeight.ts @@ -0,0 +1,100 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ +import { Variant } from "./Variant"; + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Variant weight details. + */ +export class VariantWeight { + /** + * The timestamp when the variant weight was created. + */ + "createdAt"?: Date; + /** + * Unique identifier of the variant weight assignment. + */ + "id"?: string; + /** + * The timestamp when the variant weight was last updated. + */ + "updatedAt"?: Date; + /** + * The percentage weight for the variant. + */ + "value": number; + /** + * A variant of a feature flag. + */ + "variant"?: Variant; + /** + * The variant ID. + */ + "variantId": string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + createdAt: { + baseName: "created_at", + type: "Date", + format: "date-time", + }, + id: { + baseName: "id", + type: "string", + format: "uuid", + }, + updatedAt: { + baseName: "updated_at", + type: "Date", + format: "date-time", + }, + value: { + baseName: "value", + type: "number", + required: true, + format: "double", + }, + variant: { + baseName: "variant", + type: "Variant", + }, + variantId: { + baseName: "variant_id", + type: "string", + required: true, + format: "uuid", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return VariantWeight.attributeTypeMap; + } + + public constructor() {} +} diff --git a/packages/datadog-api-client-v2/models/VariantWeightRequest.ts b/packages/datadog-api-client-v2/models/VariantWeightRequest.ts new file mode 100644 index 000000000000..ba74ae8deb1b --- /dev/null +++ b/packages/datadog-api-client-v2/models/VariantWeightRequest.ts @@ -0,0 +1,71 @@ +/** + * Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + * This product includes software developed at Datadog (https://www.datadoghq.com/). + * Copyright 2020-Present Datadog, Inc. + */ + +import { AttributeTypeMap } from "../../datadog-api-client-common/util"; + +/** + * Variant weight request payload. + */ +export class VariantWeightRequest { + /** + * The percentage weight for this variant. + */ + "value": number; + /** + * The variant ID to assign weight to. + */ + "variantId"?: string; + /** + * The variant key to assign weight to. + */ + "variantKey"?: string; + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + "additionalProperties"?: { [key: string]: any }; + + /** + * @ignore + */ + "_unparsed"?: boolean; + + /** + * @ignore + */ + static readonly attributeTypeMap: AttributeTypeMap = { + value: { + baseName: "value", + type: "number", + required: true, + format: "double", + }, + variantId: { + baseName: "variant_id", + type: "string", + format: "uuid", + }, + variantKey: { + baseName: "variant_key", + type: "string", + }, + additionalProperties: { + baseName: "additionalProperties", + type: "{ [key: string]: any; }", + }, + }; + + /** + * @ignore + */ + static getAttributeTypeMap(): AttributeTypeMap { + return VariantWeightRequest.attributeTypeMap; + } + + public constructor() {} +}