From f432d3b0f64eaecf73ebd6fb2b19056f21a68251 Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Thu, 2 Apr 2026 18:53:02 +0000 Subject: [PATCH] Regenerate client from commit 3935ca0 of spec repo --- .generator/schemas/v2/openapi.yaml | 1224 +++++++++++++++++ ...llocationsForFeatureFlagInEnvironment.java | 104 ++ ...orFeatureFlagInEnvironment_3662093014.java | 74 + .../feature-flags/PauseExposureSchedule.java | 27 + .../feature-flags/ResumeExposureSchedule.java | 27 + .../feature-flags/StartExposureSchedule.java | 27 + .../feature-flags/StopExposureSchedule.java | 26 + ...llocationsForFeatureFlagInEnvironment.java | 108 ++ ...orFeatureFlagInEnvironment_3789036209.java | 104 ++ .../api/client/v2/api/FeatureFlagsApi.java | 1086 ++++++++++++++- .../api/client/v2/model/Allocation.java | 549 ++++++++ .../v2/model/AllocationDataRequest.java | 181 +++ .../v2/model/AllocationDataResponse.java | 209 +++ .../client/v2/model/AllocationDataType.java | 54 + .../AllocationExposureGuardrailTrigger.java | 334 +++++ .../model/AllocationExposureRolloutStep.java | 400 ++++++ .../v2/model/AllocationExposureSchedule.java | 471 +++++++ .../model/AllocationExposureScheduleData.java | 213 +++ .../AllocationExposureScheduleDataType.java | 59 + .../AllocationExposureScheduleResponse.java | 148 ++ .../client/v2/model/AllocationResponse.java | 145 ++ .../api/client/v2/model/AllocationType.java | 55 + .../api/client/v2/model/Condition.java | 299 ++++ .../client/v2/model/ConditionOperator.java | 74 + .../api/client/v2/model/ConditionRequest.java | 213 +++ .../v2/model/CreateAllocationsRequest.java | 145 ++ .../v2/model/ExposureRolloutStepRequest.java | 270 ++++ .../v2/model/ExposureScheduleRequest.java | 336 +++++ .../v2/model/FeatureFlagAttributes.java | 36 + .../v2/model/FeatureFlagEnvironment.java | 36 + .../api/client/v2/model/GuardrailMetric.java | 217 +++ .../v2/model/GuardrailMetricRequest.java | 179 +++ .../v2/model/GuardrailTriggerAction.java | 57 + .../v2/model/ListAllocationsResponse.java | 155 +++ .../v2/model/OverwriteAllocationsRequest.java | 155 +++ .../api/client/v2/model/RolloutOptions.java | 209 +++ .../v2/model/RolloutOptionsRequest.java | 217 +++ .../api/client/v2/model/RolloutStrategy.java | 55 + .../api/client/v2/model/TargetingRule.java | 242 ++++ .../client/v2/model/TargetingRuleRequest.java | 155 +++ .../v2/model/UpsertAllocationRequest.java | 430 ++++++ .../api/client/v2/model/VariantWeight.java | 284 ++++ .../client/v2/model/VariantWeightRequest.java | 200 +++ ...nvironment_returns_Created_response.freeze | 1 + ..._environment_returns_Created_response.json | 139 ++ ..._an_environment_returns_OK_response.freeze | 1 + ...in_an_environment_returns_OK_response.json | 139 ++ .../api/client/v2/api/feature_flags.feature | 224 +++ .../com/datadog/api/client/v2/api/given.json | 21 + .../com/datadog/api/client/v2/api/undo.json | 36 + 50 files changed, 10109 insertions(+), 41 deletions(-) create mode 100644 examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.java create mode 100644 examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.java create mode 100644 examples/v2/feature-flags/PauseExposureSchedule.java create mode 100644 examples/v2/feature-flags/ResumeExposureSchedule.java create mode 100644 examples/v2/feature-flags/StartExposureSchedule.java create mode 100644 examples/v2/feature-flags/StopExposureSchedule.java create mode 100644 examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.java create mode 100644 examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/Allocation.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationDataRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationDataResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationDataType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationExposureGuardrailTrigger.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationExposureRolloutStep.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationExposureSchedule.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleData.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleDataType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/AllocationType.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/Condition.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ConditionOperator.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ConditionRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/CreateAllocationsRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ExposureRolloutStepRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ExposureScheduleRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GuardrailMetric.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GuardrailMetricRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/GuardrailTriggerAction.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/ListAllocationsResponse.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/OverwriteAllocationsRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RolloutOptions.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RolloutOptionsRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/RolloutStrategy.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TargetingRule.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/TargetingRuleRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/UpsertAllocationRequest.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/VariantWeight.java create mode 100644 src/main/java/com/datadog/api/client/v2/model/VariantWeightRequest.java create mode 100644 src/test/resources/cassettes/features/v2/Create_allocation_for_a_flag_in_an_environment_returns_Created_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Create_allocation_for_a_flag_in_an_environment_returns_Created_response.json create mode 100644 src/test/resources/cassettes/features/v2/Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response.freeze create mode 100644 src/test/resources/cassettes/features/v2/Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response.json diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 45672b441bd..e83df8269e5 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/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.java b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.java new file mode 100644 index 00000000000..ba79c235ada --- /dev/null +++ b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.java @@ -0,0 +1,104 @@ +// Create targeting rules for a flag env returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.AllocationDataRequest; +import com.datadog.api.client.v2.model.AllocationDataType; +import com.datadog.api.client.v2.model.AllocationResponse; +import com.datadog.api.client.v2.model.AllocationType; +import com.datadog.api.client.v2.model.ConditionOperator; +import com.datadog.api.client.v2.model.ConditionRequest; +import com.datadog.api.client.v2.model.CreateAllocationsRequest; +import com.datadog.api.client.v2.model.ExposureRolloutStepRequest; +import com.datadog.api.client.v2.model.ExposureScheduleRequest; +import com.datadog.api.client.v2.model.GuardrailMetricRequest; +import com.datadog.api.client.v2.model.GuardrailTriggerAction; +import com.datadog.api.client.v2.model.RolloutOptionsRequest; +import com.datadog.api.client.v2.model.RolloutStrategy; +import com.datadog.api.client.v2.model.TargetingRuleRequest; +import com.datadog.api.client.v2.model.UpsertAllocationRequest; +import com.datadog.api.client.v2.model.VariantWeightRequest; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + CreateAllocationsRequest body = + new CreateAllocationsRequest() + .data( + new AllocationDataRequest() + .attributes( + new UpsertAllocationRequest() + .experimentId("550e8400-e29b-41d4-a716-446655440030") + .exposureSchedule( + new ExposureScheduleRequest() + .absoluteStartTime(OffsetDateTime.parse("2025-06-13T12:00:00Z")) + .controlVariantId("550e8400-e29b-41d4-a716-446655440012") + .controlVariantKey("control") + .id(UUID.fromString("550e8400-e29b-41d4-a716-446655440010")) + .rolloutOptions( + new RolloutOptionsRequest() + .autostart(false) + .selectionIntervalMs(3600000L) + .strategy(RolloutStrategy.UNIFORM_INTERVALS)) + .rolloutSteps( + Collections.singletonList( + new ExposureRolloutStepRequest() + .exposureRatio(0.5) + .groupedStepIndex(1L) + .id( + UUID.fromString( + "550e8400-e29b-41d4-a716-446655440040")) + .intervalMs(3600000L) + .isPauseRecord(false)))) + .guardrailMetrics( + Collections.singletonList( + new GuardrailMetricRequest() + .metricId("metric-error-rate") + .triggerAction(GuardrailTriggerAction.PAUSE))) + .id(UUID.fromString("550e8400-e29b-41d4-a716-446655440020")) + .key("prod-rollout") + .name("Production Rollout") + .targetingRules( + Collections.singletonList( + new TargetingRuleRequest() + .conditions( + Collections.singletonList( + new ConditionRequest() + .attribute("user_tier") + .operator(ConditionOperator.ONE_OF) + .value( + Arrays.asList("premium", "enterprise")))))) + .type(AllocationType.FEATURE_GATE) + .variantWeights( + Collections.singletonList( + new VariantWeightRequest() + .value(50.0) + .variantId( + UUID.fromString("550e8400-e29b-41d4-a716-446655440001")) + .variantKey("control")))) + .type(AllocationDataType.ALLOCATIONS)); + + try { + AllocationResponse result = + apiInstance.createAllocationsForFeatureFlagInEnvironment( + UUID.fromString("550e8400-e29b-41d4-a716-446655440000"), + UUID.fromString("550e8400-e29b-41d4-a716-446655440001"), + body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling FeatureFlagsApi#createAllocationsForFeatureFlagInEnvironment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.java b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.java new file mode 100644 index 00000000000..ec62aca52d6 --- /dev/null +++ b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.java @@ -0,0 +1,74 @@ +// Create allocation for a flag in an environment returns "Created" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.AllocationDataRequest; +import com.datadog.api.client.v2.model.AllocationDataType; +import com.datadog.api.client.v2.model.AllocationResponse; +import com.datadog.api.client.v2.model.AllocationType; +import com.datadog.api.client.v2.model.CreateAllocationsRequest; +import com.datadog.api.client.v2.model.UpsertAllocationRequest; +import com.datadog.api.client.v2.model.VariantWeightRequest; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + // there is a valid "feature_flag" in the system + UUID FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID = null; + try { + FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID = + UUID.fromString(System.getenv("FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + UUID FEATURE_FLAG_DATA_ID = null; + try { + FEATURE_FLAG_DATA_ID = UUID.fromString(System.getenv("FEATURE_FLAG_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + // there is a valid "environment" in the system + UUID ENVIRONMENT_DATA_ID = null; + try { + ENVIRONMENT_DATA_ID = UUID.fromString(System.getenv("ENVIRONMENT_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + CreateAllocationsRequest body = + new CreateAllocationsRequest() + .data( + new AllocationDataRequest() + .type(AllocationDataType.ALLOCATIONS) + .attributes( + new UpsertAllocationRequest() + .name("New targeting rule Example-Feature-Flag") + .key("new-targeting-rule-example-feature-flag") + .variantWeights( + Collections.singletonList( + new VariantWeightRequest() + .variantId(FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID) + .value(100.0))) + .type(AllocationType.CANARY))); + + try { + AllocationResponse result = + apiInstance.createAllocationsForFeatureFlagInEnvironment( + FEATURE_FLAG_DATA_ID, ENVIRONMENT_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling FeatureFlagsApi#createAllocationsForFeatureFlagInEnvironment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/PauseExposureSchedule.java b/examples/v2/feature-flags/PauseExposureSchedule.java new file mode 100644 index 00000000000..36ad16dc700 --- /dev/null +++ b/examples/v2/feature-flags/PauseExposureSchedule.java @@ -0,0 +1,27 @@ +// Pause a progressive rollout returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.AllocationExposureScheduleResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + try { + AllocationExposureScheduleResponse result = + apiInstance.pauseExposureSchedule( + UUID.fromString("550e8400-e29b-41d4-a716-446655440010")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#pauseExposureSchedule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/ResumeExposureSchedule.java b/examples/v2/feature-flags/ResumeExposureSchedule.java new file mode 100644 index 00000000000..09b25499c3f --- /dev/null +++ b/examples/v2/feature-flags/ResumeExposureSchedule.java @@ -0,0 +1,27 @@ +// Resume a progressive rollout returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.AllocationExposureScheduleResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + try { + AllocationExposureScheduleResponse result = + apiInstance.resumeExposureSchedule( + UUID.fromString("550e8400-e29b-41d4-a716-446655440010")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#resumeExposureSchedule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/StartExposureSchedule.java b/examples/v2/feature-flags/StartExposureSchedule.java new file mode 100644 index 00000000000..e96c77ef568 --- /dev/null +++ b/examples/v2/feature-flags/StartExposureSchedule.java @@ -0,0 +1,27 @@ +// Start a progressive rollout returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.AllocationExposureScheduleResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + try { + AllocationExposureScheduleResponse result = + apiInstance.startExposureSchedule( + UUID.fromString("550e8400-e29b-41d4-a716-446655440010")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#startExposureSchedule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/StopExposureSchedule.java b/examples/v2/feature-flags/StopExposureSchedule.java new file mode 100644 index 00000000000..be8b1ecce8a --- /dev/null +++ b/examples/v2/feature-flags/StopExposureSchedule.java @@ -0,0 +1,26 @@ +// Stop a progressive rollout returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.AllocationExposureScheduleResponse; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + try { + AllocationExposureScheduleResponse result = + apiInstance.stopExposureSchedule(UUID.fromString("550e8400-e29b-41d4-a716-446655440010")); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FeatureFlagsApi#stopExposureSchedule"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.java b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.java new file mode 100644 index 00000000000..eb0d514fc58 --- /dev/null +++ b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.java @@ -0,0 +1,108 @@ +// Update targeting rules for a flag returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.AllocationDataRequest; +import com.datadog.api.client.v2.model.AllocationDataType; +import com.datadog.api.client.v2.model.AllocationType; +import com.datadog.api.client.v2.model.ConditionOperator; +import com.datadog.api.client.v2.model.ConditionRequest; +import com.datadog.api.client.v2.model.ExposureRolloutStepRequest; +import com.datadog.api.client.v2.model.ExposureScheduleRequest; +import com.datadog.api.client.v2.model.GuardrailMetricRequest; +import com.datadog.api.client.v2.model.GuardrailTriggerAction; +import com.datadog.api.client.v2.model.ListAllocationsResponse; +import com.datadog.api.client.v2.model.OverwriteAllocationsRequest; +import com.datadog.api.client.v2.model.RolloutOptionsRequest; +import com.datadog.api.client.v2.model.RolloutStrategy; +import com.datadog.api.client.v2.model.TargetingRuleRequest; +import com.datadog.api.client.v2.model.UpsertAllocationRequest; +import com.datadog.api.client.v2.model.VariantWeightRequest; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + OverwriteAllocationsRequest body = + new OverwriteAllocationsRequest() + .data( + Collections.singletonList( + new AllocationDataRequest() + .attributes( + new UpsertAllocationRequest() + .experimentId("550e8400-e29b-41d4-a716-446655440030") + .exposureSchedule( + new ExposureScheduleRequest() + .absoluteStartTime( + OffsetDateTime.parse("2025-06-13T12:00:00Z")) + .controlVariantId("550e8400-e29b-41d4-a716-446655440012") + .controlVariantKey("control") + .id(UUID.fromString("550e8400-e29b-41d4-a716-446655440010")) + .rolloutOptions( + new RolloutOptionsRequest() + .autostart(false) + .selectionIntervalMs(3600000L) + .strategy(RolloutStrategy.UNIFORM_INTERVALS)) + .rolloutSteps( + Collections.singletonList( + new ExposureRolloutStepRequest() + .exposureRatio(0.5) + .groupedStepIndex(1L) + .id( + UUID.fromString( + "550e8400-e29b-41d4-a716-446655440040")) + .intervalMs(3600000L) + .isPauseRecord(false)))) + .guardrailMetrics( + Collections.singletonList( + new GuardrailMetricRequest() + .metricId("metric-error-rate") + .triggerAction(GuardrailTriggerAction.PAUSE))) + .id(UUID.fromString("550e8400-e29b-41d4-a716-446655440020")) + .key("prod-rollout") + .name("Production Rollout") + .targetingRules( + Collections.singletonList( + new TargetingRuleRequest() + .conditions( + Collections.singletonList( + new ConditionRequest() + .attribute("user_tier") + .operator(ConditionOperator.ONE_OF) + .value( + Arrays.asList( + "premium", "enterprise")))))) + .type(AllocationType.FEATURE_GATE) + .variantWeights( + Collections.singletonList( + new VariantWeightRequest() + .value(50.0) + .variantId( + UUID.fromString( + "550e8400-e29b-41d4-a716-446655440001")) + .variantKey("control")))) + .type(AllocationDataType.ALLOCATIONS))); + + try { + ListAllocationsResponse result = + apiInstance.updateAllocationsForFeatureFlagInEnvironment( + UUID.fromString("550e8400-e29b-41d4-a716-446655440000"), + UUID.fromString("550e8400-e29b-41d4-a716-446655440001"), + body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling FeatureFlagsApi#updateAllocationsForFeatureFlagInEnvironment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.java b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.java new file mode 100644 index 00000000000..c3dff560e3f --- /dev/null +++ b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.java @@ -0,0 +1,104 @@ +// Update targeting rules for a flag in an environment returns "OK" response + +import com.datadog.api.client.ApiClient; +import com.datadog.api.client.ApiException; +import com.datadog.api.client.v2.api.FeatureFlagsApi; +import com.datadog.api.client.v2.model.AllocationDataRequest; +import com.datadog.api.client.v2.model.AllocationDataType; +import com.datadog.api.client.v2.model.AllocationType; +import com.datadog.api.client.v2.model.ExposureRolloutStepRequest; +import com.datadog.api.client.v2.model.ExposureScheduleRequest; +import com.datadog.api.client.v2.model.ListAllocationsResponse; +import com.datadog.api.client.v2.model.OverwriteAllocationsRequest; +import com.datadog.api.client.v2.model.RolloutOptionsRequest; +import com.datadog.api.client.v2.model.RolloutStrategy; +import com.datadog.api.client.v2.model.UpsertAllocationRequest; +import com.datadog.api.client.v2.model.VariantWeightRequest; +import java.util.Arrays; +import java.util.Collections; +import java.util.UUID; + +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = ApiClient.getDefaultApiClient(); + FeatureFlagsApi apiInstance = new FeatureFlagsApi(defaultClient); + + // there is a valid "feature_flag" in the system + UUID FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID = null; + try { + FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID = + UUID.fromString(System.getenv("FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + UUID FEATURE_FLAG_DATA_ID = null; + try { + FEATURE_FLAG_DATA_ID = UUID.fromString(System.getenv("FEATURE_FLAG_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + // there is a valid "environment" in the system + UUID ENVIRONMENT_DATA_ID = null; + try { + ENVIRONMENT_DATA_ID = UUID.fromString(System.getenv("ENVIRONMENT_DATA_ID")); + } catch (IllegalArgumentException e) { + System.err.println("Error parsing UUID: " + e.getMessage()); + } + + OverwriteAllocationsRequest body = + new OverwriteAllocationsRequest() + .data( + Collections.singletonList( + new AllocationDataRequest() + .type(AllocationDataType.ALLOCATIONS) + .attributes( + new UpsertAllocationRequest() + .key("overwrite-allocation-example-feature-flag") + .name("New targeting rule Example-Feature-Flag") + .variantWeights( + Collections.singletonList( + new VariantWeightRequest() + .variantId(FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID) + .value(100.0))) + .exposureSchedule( + new ExposureScheduleRequest() + .rolloutOptions( + new RolloutOptionsRequest() + .strategy(RolloutStrategy.UNIFORM_INTERVALS) + .autostart(false) + .selectionIntervalMs(86400000L)) + .rolloutSteps( + Arrays.asList( + new ExposureRolloutStepRequest() + .exposureRatio(0.05) + .intervalMs(null) + .isPauseRecord(false) + .groupedStepIndex(0L), + new ExposureRolloutStepRequest() + .exposureRatio(0.25) + .intervalMs(null) + .isPauseRecord(false) + .groupedStepIndex(1L), + new ExposureRolloutStepRequest() + .exposureRatio(1.0) + .intervalMs(null) + .isPauseRecord(false) + .groupedStepIndex(2L)))) + .type(AllocationType.CANARY)))); + + try { + ListAllocationsResponse result = + apiInstance.updateAllocationsForFeatureFlagInEnvironment( + FEATURE_FLAG_DATA_ID, ENVIRONMENT_DATA_ID, body); + System.out.println(result); + } catch (ApiException e) { + System.err.println( + "Exception when calling FeatureFlagsApi#updateAllocationsForFeatureFlagInEnvironment"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } +} diff --git a/src/main/java/com/datadog/api/client/v2/api/FeatureFlagsApi.java b/src/main/java/com/datadog/api/client/v2/api/FeatureFlagsApi.java index 584eea42813..de2b1ca737d 100644 --- a/src/main/java/com/datadog/api/client/v2/api/FeatureFlagsApi.java +++ b/src/main/java/com/datadog/api/client/v2/api/FeatureFlagsApi.java @@ -4,12 +4,17 @@ import com.datadog.api.client.ApiException; import com.datadog.api.client.ApiResponse; import com.datadog.api.client.Pair; +import com.datadog.api.client.v2.model.AllocationExposureScheduleResponse; +import com.datadog.api.client.v2.model.AllocationResponse; +import com.datadog.api.client.v2.model.CreateAllocationsRequest; import com.datadog.api.client.v2.model.CreateEnvironmentRequest; import com.datadog.api.client.v2.model.CreateFeatureFlagRequest; import com.datadog.api.client.v2.model.EnvironmentResponse; import com.datadog.api.client.v2.model.FeatureFlagResponse; +import com.datadog.api.client.v2.model.ListAllocationsResponse; import com.datadog.api.client.v2.model.ListEnvironmentsResponse; import com.datadog.api.client.v2.model.ListFeatureFlagsResponse; +import com.datadog.api.client.v2.model.OverwriteAllocationsRequest; import com.datadog.api.client.v2.model.UpdateEnvironmentRequest; import com.datadog.api.client.v2.model.UpdateFeatureFlagRequest; import jakarta.ws.rs.client.Invocation; @@ -194,6 +199,207 @@ public CompletableFuture> archiveFeatureFlagWit new GenericType() {}); } + /** + * Create targeting rules for a flag env. + * + *

See {@link #createAllocationsForFeatureFlagInEnvironmentWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @return AllocationResponse + * @throws ApiException if fails to make API call + */ + public AllocationResponse createAllocationsForFeatureFlagInEnvironment( + UUID featureFlagId, UUID environmentId, CreateAllocationsRequest body) throws ApiException { + return createAllocationsForFeatureFlagInEnvironmentWithHttpInfo( + featureFlagId, environmentId, body) + .getData(); + } + + /** + * Create targeting rules for a flag env. + * + *

See {@link #createAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @return CompletableFuture<AllocationResponse> + */ + public CompletableFuture createAllocationsForFeatureFlagInEnvironmentAsync( + UUID featureFlagId, UUID environmentId, CreateAllocationsRequest body) { + return createAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync( + featureFlagId, environmentId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Creates a new targeting rule (allocation) for a specific feature flag in a specific + * environment. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @return ApiResponse<AllocationResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
201 Created -
202 Accepted - Approval required for this change -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse createAllocationsForFeatureFlagInEnvironmentWithHttpInfo( + UUID featureFlagId, UUID environmentId, CreateAllocationsRequest body) throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'featureFlagId' is set + if (featureFlagId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'featureFlagId' when calling" + + " createAllocationsForFeatureFlagInEnvironment"); + } + + // verify the required parameter 'environmentId' is set + if (environmentId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'environmentId' when calling" + + " createAllocationsForFeatureFlagInEnvironment"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " createAllocationsForFeatureFlagInEnvironment"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", apiClient.escapeString(featureFlagId.toString())) + .replaceAll( + "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.createAllocationsForFeatureFlagInEnvironment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Create targeting rules for a flag env. + * + *

See {@link #createAllocationsForFeatureFlagInEnvironmentWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<AllocationResponse>> + */ + public CompletableFuture> + createAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync( + UUID featureFlagId, UUID environmentId, CreateAllocationsRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'featureFlagId' is set + if (featureFlagId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'featureFlagId' when calling" + + " createAllocationsForFeatureFlagInEnvironment")); + return result; + } + + // verify the required parameter 'environmentId' is set + if (environmentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'environmentId' when calling" + + " createAllocationsForFeatureFlagInEnvironment")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " createAllocationsForFeatureFlagInEnvironment")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", apiClient.escapeString(featureFlagId.toString())) + .replaceAll( + "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.createAllocationsForFeatureFlagInEnvironment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + /** * Create a feature flag. * @@ -1660,28 +1866,30 @@ public ApiResponse listFeatureFlagsEnvironmentsWithHtt } /** - * Unarchive a feature flag. + * Pause a progressive rollout. * - *

See {@link #unarchiveFeatureFlagWithHttpInfo}. + *

See {@link #pauseExposureScheduleWithHttpInfo}. * - * @param featureFlagId The ID of the feature flag. (required) - * @return FeatureFlagResponse + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return AllocationExposureScheduleResponse * @throws ApiException if fails to make API call */ - public FeatureFlagResponse unarchiveFeatureFlag(UUID featureFlagId) throws ApiException { - return unarchiveFeatureFlagWithHttpInfo(featureFlagId).getData(); + public AllocationExposureScheduleResponse pauseExposureSchedule(UUID exposureScheduleId) + throws ApiException { + return pauseExposureScheduleWithHttpInfo(exposureScheduleId).getData(); } /** - * Unarchive a feature flag. + * Pause a progressive rollout. * - *

See {@link #unarchiveFeatureFlagWithHttpInfoAsync}. + *

See {@link #pauseExposureScheduleWithHttpInfoAsync}. * - * @param featureFlagId The ID of the feature flag. (required) - * @return CompletableFuture<FeatureFlagResponse> + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return CompletableFuture<AllocationExposureScheduleResponse> */ - public CompletableFuture unarchiveFeatureFlagAsync(UUID featureFlagId) { - return unarchiveFeatureFlagWithHttpInfoAsync(featureFlagId) + public CompletableFuture pauseExposureScheduleAsync( + UUID exposureScheduleId) { + return pauseExposureScheduleWithHttpInfoAsync(exposureScheduleId) .thenApply( response -> { return response.getData(); @@ -1689,10 +1897,10 @@ public CompletableFuture unarchiveFeatureFlagAsync(UUID fea } /** - * Unarchives a previously archived feature flag, making it visible in the main list again. + * Pauses a progressive rollout while preserving rollout state. * - * @param featureFlagId The ID of the feature flag. (required) - * @return ApiResponse<FeatureFlagResponse> + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return ApiResponse<AllocationExposureScheduleResponse> * @throws ApiException if fails to make API call * @http.response.details * @@ -1702,30 +1910,32 @@ public CompletableFuture unarchiveFeatureFlagAsync(UUID fea * * * + * * *
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
*/ - public ApiResponse unarchiveFeatureFlagWithHttpInfo(UUID featureFlagId) - throws ApiException { + public ApiResponse pauseExposureScheduleWithHttpInfo( + UUID exposureScheduleId) throws ApiException { Object localVarPostBody = null; - // verify the required parameter 'featureFlagId' is set - if (featureFlagId == null) { + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { throw new ApiException( - 400, "Missing the required parameter 'featureFlagId' when calling unarchiveFeatureFlag"); + 400, + "Missing the required parameter 'exposureScheduleId' when calling pauseExposureSchedule"); } // create path and map variables String localVarPath = - "/api/v2/feature-flags/{feature_flag_id}/unarchive" + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/pause" .replaceAll( - "\\{" + "feature_flag_id" + "\\}", - apiClient.escapeString(featureFlagId.toString())); + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); Map localVarHeaderParams = new HashMap(); Invocation.Builder builder = apiClient.createBuilder( - "v2.FeatureFlagsApi.unarchiveFeatureFlag", + "v2.FeatureFlagsApi.pauseExposureSchedule", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1740,36 +1950,38 @@ public ApiResponse unarchiveFeatureFlagWithHttpInfo(UUID fe localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); } /** - * Unarchive a feature flag. + * Pause a progressive rollout. * - *

See {@link #unarchiveFeatureFlagWithHttpInfo}. + *

See {@link #pauseExposureScheduleWithHttpInfo}. * - * @param featureFlagId The ID of the feature flag. (required) - * @return CompletableFuture<ApiResponse<FeatureFlagResponse>> + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return CompletableFuture<ApiResponse<AllocationExposureScheduleResponse>> */ - public CompletableFuture> unarchiveFeatureFlagWithHttpInfoAsync( - UUID featureFlagId) { + public CompletableFuture> + pauseExposureScheduleWithHttpInfoAsync(UUID exposureScheduleId) { Object localVarPostBody = null; - // verify the required parameter 'featureFlagId' is set - if (featureFlagId == null) { - CompletableFuture> result = new CompletableFuture<>(); + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally( new ApiException( 400, - "Missing the required parameter 'featureFlagId' when calling unarchiveFeatureFlag")); + "Missing the required parameter 'exposureScheduleId' when calling" + + " pauseExposureSchedule")); return result; } // create path and map variables String localVarPath = - "/api/v2/feature-flags/{feature_flag_id}/unarchive" + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/pause" .replaceAll( - "\\{" + "feature_flag_id" + "\\}", - apiClient.escapeString(featureFlagId.toString())); + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); Map localVarHeaderParams = new HashMap(); @@ -1777,7 +1989,7 @@ public CompletableFuture> unarchiveFeatureFlagW try { builder = apiClient.createBuilder( - "v2.FeatureFlagsApi.unarchiveFeatureFlag", + "v2.FeatureFlagsApi.pauseExposureSchedule", localVarPath, new ArrayList(), localVarHeaderParams, @@ -1785,7 +1997,8 @@ public CompletableFuture> unarchiveFeatureFlagW new String[] {"application/json"}, new String[] {"apiKeyAuth", "appKeyAuth"}); } catch (ApiException ex) { - CompletableFuture> result = new CompletableFuture<>(); + CompletableFuture> result = + new CompletableFuture<>(); result.completeExceptionally(ex); return result; } @@ -1797,7 +2010,798 @@ public CompletableFuture> unarchiveFeatureFlagW localVarPostBody, new HashMap(), false, - new GenericType() {}); + new GenericType() {}); + } + + /** + * Resume a progressive rollout. + * + *

See {@link #resumeExposureScheduleWithHttpInfo}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return AllocationExposureScheduleResponse + * @throws ApiException if fails to make API call + */ + public AllocationExposureScheduleResponse resumeExposureSchedule(UUID exposureScheduleId) + throws ApiException { + return resumeExposureScheduleWithHttpInfo(exposureScheduleId).getData(); + } + + /** + * Resume a progressive rollout. + * + *

See {@link #resumeExposureScheduleWithHttpInfoAsync}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return CompletableFuture<AllocationExposureScheduleResponse> + */ + public CompletableFuture resumeExposureScheduleAsync( + UUID exposureScheduleId) { + return resumeExposureScheduleWithHttpInfoAsync(exposureScheduleId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Resumes progression for a previously paused progressive rollout. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return ApiResponse<AllocationExposureScheduleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse resumeExposureScheduleWithHttpInfo( + UUID exposureScheduleId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'exposureScheduleId' when calling" + + " resumeExposureSchedule"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/resume" + .replaceAll( + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.resumeExposureSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Resume a progressive rollout. + * + *

See {@link #resumeExposureScheduleWithHttpInfo}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return CompletableFuture<ApiResponse<AllocationExposureScheduleResponse>> + */ + public CompletableFuture> + resumeExposureScheduleWithHttpInfoAsync(UUID exposureScheduleId) { + Object localVarPostBody = null; + + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'exposureScheduleId' when calling" + + " resumeExposureSchedule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/resume" + .replaceAll( + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.resumeExposureSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Start a progressive rollout. + * + *

See {@link #startExposureScheduleWithHttpInfo}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return AllocationExposureScheduleResponse + * @throws ApiException if fails to make API call + */ + public AllocationExposureScheduleResponse startExposureSchedule(UUID exposureScheduleId) + throws ApiException { + return startExposureScheduleWithHttpInfo(exposureScheduleId).getData(); + } + + /** + * Start a progressive rollout. + * + *

See {@link #startExposureScheduleWithHttpInfoAsync}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return CompletableFuture<AllocationExposureScheduleResponse> + */ + public CompletableFuture startExposureScheduleAsync( + UUID exposureScheduleId) { + return startExposureScheduleWithHttpInfoAsync(exposureScheduleId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Starts a progressive rollout and begins progression. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return ApiResponse<AllocationExposureScheduleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse startExposureScheduleWithHttpInfo( + UUID exposureScheduleId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'exposureScheduleId' when calling startExposureSchedule"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/start" + .replaceAll( + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.startExposureSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Start a progressive rollout. + * + *

See {@link #startExposureScheduleWithHttpInfo}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return CompletableFuture<ApiResponse<AllocationExposureScheduleResponse>> + */ + public CompletableFuture> + startExposureScheduleWithHttpInfoAsync(UUID exposureScheduleId) { + Object localVarPostBody = null; + + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'exposureScheduleId' when calling" + + " startExposureSchedule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/start" + .replaceAll( + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.startExposureSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Stop a progressive rollout. + * + *

See {@link #stopExposureScheduleWithHttpInfo}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return AllocationExposureScheduleResponse + * @throws ApiException if fails to make API call + */ + public AllocationExposureScheduleResponse stopExposureSchedule(UUID exposureScheduleId) + throws ApiException { + return stopExposureScheduleWithHttpInfo(exposureScheduleId).getData(); + } + + /** + * Stop a progressive rollout. + * + *

See {@link #stopExposureScheduleWithHttpInfoAsync}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return CompletableFuture<AllocationExposureScheduleResponse> + */ + public CompletableFuture stopExposureScheduleAsync( + UUID exposureScheduleId) { + return stopExposureScheduleWithHttpInfoAsync(exposureScheduleId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Stops a progressive rollout and marks it as aborted. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return ApiResponse<AllocationExposureScheduleResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse stopExposureScheduleWithHttpInfo( + UUID exposureScheduleId) throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'exposureScheduleId' when calling stopExposureSchedule"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/stop" + .replaceAll( + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.stopExposureSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Stop a progressive rollout. + * + *

See {@link #stopExposureScheduleWithHttpInfo}. + * + * @param exposureScheduleId The ID of the exposure schedule. (required) + * @return CompletableFuture<ApiResponse<AllocationExposureScheduleResponse>> + */ + public CompletableFuture> + stopExposureScheduleWithHttpInfoAsync(UUID exposureScheduleId) { + Object localVarPostBody = null; + + // verify the required parameter 'exposureScheduleId' is set + if (exposureScheduleId == null) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'exposureScheduleId' when calling" + + " stopExposureSchedule")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/stop" + .replaceAll( + "\\{" + "exposure_schedule_id" + "\\}", + apiClient.escapeString(exposureScheduleId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.stopExposureSchedule", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = + new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Unarchive a feature flag. + * + *

See {@link #unarchiveFeatureFlagWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @return FeatureFlagResponse + * @throws ApiException if fails to make API call + */ + public FeatureFlagResponse unarchiveFeatureFlag(UUID featureFlagId) throws ApiException { + return unarchiveFeatureFlagWithHttpInfo(featureFlagId).getData(); + } + + /** + * Unarchive a feature flag. + * + *

See {@link #unarchiveFeatureFlagWithHttpInfoAsync}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @return CompletableFuture<FeatureFlagResponse> + */ + public CompletableFuture unarchiveFeatureFlagAsync(UUID featureFlagId) { + return unarchiveFeatureFlagWithHttpInfoAsync(featureFlagId) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * Unarchives a previously archived feature flag, making it visible in the main list again. + * + * @param featureFlagId The ID of the feature flag. (required) + * @return ApiResponse<FeatureFlagResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
400 Bad Request -
403 Forbidden -
404 Not Found -
429 Too many requests -
+ */ + public ApiResponse unarchiveFeatureFlagWithHttpInfo(UUID featureFlagId) + throws ApiException { + Object localVarPostBody = null; + + // verify the required parameter 'featureFlagId' is set + if (featureFlagId == null) { + throw new ApiException( + 400, "Missing the required parameter 'featureFlagId' when calling unarchiveFeatureFlag"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/unarchive" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", + apiClient.escapeString(featureFlagId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.unarchiveFeatureFlag", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Unarchive a feature flag. + * + *

See {@link #unarchiveFeatureFlagWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @return CompletableFuture<ApiResponse<FeatureFlagResponse>> + */ + public CompletableFuture> unarchiveFeatureFlagWithHttpInfoAsync( + UUID featureFlagId) { + Object localVarPostBody = null; + + // verify the required parameter 'featureFlagId' is set + if (featureFlagId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'featureFlagId' when calling unarchiveFeatureFlag")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/unarchive" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", + apiClient.escapeString(featureFlagId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.unarchiveFeatureFlag", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "POST", + builder, + localVarHeaderParams, + new String[] {}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update targeting rules for a flag. + * + *

See {@link #updateAllocationsForFeatureFlagInEnvironmentWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @return ListAllocationsResponse + * @throws ApiException if fails to make API call + */ + public ListAllocationsResponse updateAllocationsForFeatureFlagInEnvironment( + UUID featureFlagId, UUID environmentId, OverwriteAllocationsRequest body) + throws ApiException { + return updateAllocationsForFeatureFlagInEnvironmentWithHttpInfo( + featureFlagId, environmentId, body) + .getData(); + } + + /** + * Update targeting rules for a flag. + * + *

See {@link #updateAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @return CompletableFuture<ListAllocationsResponse> + */ + public CompletableFuture + updateAllocationsForFeatureFlagInEnvironmentAsync( + UUID featureFlagId, UUID environmentId, OverwriteAllocationsRequest body) { + return updateAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync( + featureFlagId, environmentId, body) + .thenApply( + response -> { + return response.getData(); + }); + } + + /** + * 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 featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @return ApiResponse<ListAllocationsResponse> + * @throws ApiException if fails to make API call + * @http.response.details + * + * + * + * + * + * + * + * + * + * + *
Response details
Status Code Description Response Headers
200 OK -
202 Accepted - Approval required for this change -
400 Bad Request -
403 Forbidden -
404 Not Found -
409 Conflict -
429 Too many requests -
+ */ + public ApiResponse + updateAllocationsForFeatureFlagInEnvironmentWithHttpInfo( + UUID featureFlagId, UUID environmentId, OverwriteAllocationsRequest body) + throws ApiException { + Object localVarPostBody = body; + + // verify the required parameter 'featureFlagId' is set + if (featureFlagId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'featureFlagId' when calling" + + " updateAllocationsForFeatureFlagInEnvironment"); + } + + // verify the required parameter 'environmentId' is set + if (environmentId == null) { + throw new ApiException( + 400, + "Missing the required parameter 'environmentId' when calling" + + " updateAllocationsForFeatureFlagInEnvironment"); + } + + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " updateAllocationsForFeatureFlagInEnvironment"); + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", apiClient.escapeString(featureFlagId.toString())) + .replaceAll( + "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.updateAllocationsForFeatureFlagInEnvironment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + return apiClient.invokeAPI( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); + } + + /** + * Update targeting rules for a flag. + * + *

See {@link #updateAllocationsForFeatureFlagInEnvironmentWithHttpInfo}. + * + * @param featureFlagId The ID of the feature flag. (required) + * @param environmentId The ID of the environment. (required) + * @param body (required) + * @return CompletableFuture<ApiResponse<ListAllocationsResponse>> + */ + public CompletableFuture> + updateAllocationsForFeatureFlagInEnvironmentWithHttpInfoAsync( + UUID featureFlagId, UUID environmentId, OverwriteAllocationsRequest body) { + Object localVarPostBody = body; + + // verify the required parameter 'featureFlagId' is set + if (featureFlagId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'featureFlagId' when calling" + + " updateAllocationsForFeatureFlagInEnvironment")); + return result; + } + + // verify the required parameter 'environmentId' is set + if (environmentId == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'environmentId' when calling" + + " updateAllocationsForFeatureFlagInEnvironment")); + return result; + } + + // verify the required parameter 'body' is set + if (body == null) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally( + new ApiException( + 400, + "Missing the required parameter 'body' when calling" + + " updateAllocationsForFeatureFlagInEnvironment")); + return result; + } + // create path and map variables + String localVarPath = + "/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations" + .replaceAll( + "\\{" + "feature_flag_id" + "\\}", apiClient.escapeString(featureFlagId.toString())) + .replaceAll( + "\\{" + "environment_id" + "\\}", apiClient.escapeString(environmentId.toString())); + + Map localVarHeaderParams = new HashMap(); + + Invocation.Builder builder; + try { + builder = + apiClient.createBuilder( + "v2.FeatureFlagsApi.updateAllocationsForFeatureFlagInEnvironment", + localVarPath, + new ArrayList(), + localVarHeaderParams, + new HashMap(), + new String[] {"application/json"}, + new String[] {"apiKeyAuth", "appKeyAuth"}); + } catch (ApiException ex) { + CompletableFuture> result = new CompletableFuture<>(); + result.completeExceptionally(ex); + return result; + } + return apiClient.invokeAPIAsync( + "PUT", + builder, + localVarHeaderParams, + new String[] {"application/json"}, + localVarPostBody, + new HashMap(), + false, + new GenericType() {}); } /** diff --git a/src/main/java/com/datadog/api/client/v2/model/Allocation.java b/src/main/java/com/datadog/api/client/v2/model/Allocation.java new file mode 100644 index 00000000000..ba14823556e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/Allocation.java @@ -0,0 +1,549 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Targeting rule (allocation) details for a feature flag environment. */ +@JsonPropertyOrder({ + Allocation.JSON_PROPERTY_CREATED_AT, + Allocation.JSON_PROPERTY_ENVIRONMENT_IDS, + Allocation.JSON_PROPERTY_EXPERIMENT_ID, + Allocation.JSON_PROPERTY_EXPOSURE_SCHEDULE, + Allocation.JSON_PROPERTY_GUARDRAIL_METRICS, + Allocation.JSON_PROPERTY_ID, + Allocation.JSON_PROPERTY_KEY, + Allocation.JSON_PROPERTY_NAME, + Allocation.JSON_PROPERTY_ORDER_POSITION, + Allocation.JSON_PROPERTY_TARGETING_RULES, + Allocation.JSON_PROPERTY_TYPE, + Allocation.JSON_PROPERTY_UPDATED_AT, + Allocation.JSON_PROPERTY_VARIANT_WEIGHTS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class Allocation { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_ENVIRONMENT_IDS = "environment_ids"; + private List environmentIds = new ArrayList<>(); + + public static final String JSON_PROPERTY_EXPERIMENT_ID = "experiment_id"; + private JsonNullable experimentId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_EXPOSURE_SCHEDULE = "exposure_schedule"; + private AllocationExposureSchedule exposureSchedule; + + public static final String JSON_PROPERTY_GUARDRAIL_METRICS = "guardrail_metrics"; + private List guardrailMetrics = new ArrayList<>(); + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_KEY = "key"; + private String key; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_ORDER_POSITION = "order_position"; + private Long orderPosition; + + public static final String JSON_PROPERTY_TARGETING_RULES = "targeting_rules"; + private List targetingRules = new ArrayList<>(); + + public static final String JSON_PROPERTY_TYPE = "type"; + private AllocationType type; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_VARIANT_WEIGHTS = "variant_weights"; + private List variantWeights = new ArrayList<>(); + + public Allocation() {} + + @JsonCreator + public Allocation( + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_ENVIRONMENT_IDS) + List environmentIds, + @JsonProperty(required = true, value = JSON_PROPERTY_GUARDRAIL_METRICS) + List guardrailMetrics, + @JsonProperty(required = true, value = JSON_PROPERTY_KEY) String key, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_ORDER_POSITION) Long orderPosition, + @JsonProperty(required = true, value = JSON_PROPERTY_TARGETING_RULES) + List targetingRules, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AllocationType type, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_VARIANT_WEIGHTS) + List variantWeights) { + this.createdAt = createdAt; + this.environmentIds = environmentIds; + this.guardrailMetrics = guardrailMetrics; + this.key = key; + this.name = name; + this.orderPosition = orderPosition; + this.targetingRules = targetingRules; + this.type = type; + this.unparsed |= !type.isValid(); + this.updatedAt = updatedAt; + this.variantWeights = variantWeights; + } + + public Allocation createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp when the targeting rule allocation was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public Allocation environmentIds(List environmentIds) { + this.environmentIds = environmentIds; + return this; + } + + public Allocation addEnvironmentIdsItem(UUID environmentIdsItem) { + this.environmentIds.add(environmentIdsItem); + return this; + } + + /** + * Environment IDs associated with this targeting rule allocation. + * + * @return environmentIds + */ + @JsonProperty(JSON_PROPERTY_ENVIRONMENT_IDS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getEnvironmentIds() { + return environmentIds; + } + + public void setEnvironmentIds(List environmentIds) { + this.environmentIds = environmentIds; + } + + public Allocation experimentId(String experimentId) { + this.experimentId = JsonNullable.of(experimentId); + return this; + } + + /** + * The experiment ID linked to this targeting rule allocation. + * + * @return experimentId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getExperimentId() { + return experimentId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXPERIMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getExperimentId_JsonNullable() { + return experimentId; + } + + @JsonProperty(JSON_PROPERTY_EXPERIMENT_ID) + public void setExperimentId_JsonNullable(JsonNullable experimentId) { + this.experimentId = experimentId; + } + + public void setExperimentId(String experimentId) { + this.experimentId = JsonNullable.of(experimentId); + } + + public Allocation exposureSchedule(AllocationExposureSchedule exposureSchedule) { + this.exposureSchedule = exposureSchedule; + this.unparsed |= exposureSchedule.unparsed; + return this; + } + + /** + * Progressive release details for a targeting rule allocation. + * + * @return exposureSchedule + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXPOSURE_SCHEDULE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public AllocationExposureSchedule getExposureSchedule() { + return exposureSchedule; + } + + public void setExposureSchedule(AllocationExposureSchedule exposureSchedule) { + this.exposureSchedule = exposureSchedule; + } + + public Allocation guardrailMetrics(List guardrailMetrics) { + this.guardrailMetrics = guardrailMetrics; + for (GuardrailMetric item : guardrailMetrics) { + this.unparsed |= item.unparsed; + } + return this; + } + + public Allocation addGuardrailMetricsItem(GuardrailMetric guardrailMetricsItem) { + this.guardrailMetrics.add(guardrailMetricsItem); + this.unparsed |= guardrailMetricsItem.unparsed; + return this; + } + + /** + * Guardrail metrics associated with this targeting rule allocation. + * + * @return guardrailMetrics + */ + @JsonProperty(JSON_PROPERTY_GUARDRAIL_METRICS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getGuardrailMetrics() { + return guardrailMetrics; + } + + public void setGuardrailMetrics(List guardrailMetrics) { + this.guardrailMetrics = guardrailMetrics; + } + + public Allocation id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the targeting rule allocation. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public Allocation key(String key) { + this.key = key; + return this; + } + + /** + * The unique key of the targeting rule allocation. + * + * @return key + */ + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public Allocation name(String name) { + this.name = name; + return this; + } + + /** + * The display name of the targeting rule. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Allocation orderPosition(Long orderPosition) { + this.orderPosition = orderPosition; + return this; + } + + /** + * Sort order position within the environment. + * + * @return orderPosition + */ + @JsonProperty(JSON_PROPERTY_ORDER_POSITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getOrderPosition() { + return orderPosition; + } + + public void setOrderPosition(Long orderPosition) { + this.orderPosition = orderPosition; + } + + public Allocation targetingRules(List targetingRules) { + this.targetingRules = targetingRules; + for (TargetingRule item : targetingRules) { + this.unparsed |= item.unparsed; + } + return this; + } + + public Allocation addTargetingRulesItem(TargetingRule targetingRulesItem) { + this.targetingRules.add(targetingRulesItem); + this.unparsed |= targetingRulesItem.unparsed; + return this; + } + + /** + * Conditions associated with this targeting rule allocation. + * + * @return targetingRules + */ + @JsonProperty(JSON_PROPERTY_TARGETING_RULES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getTargetingRules() { + return targetingRules; + } + + public void setTargetingRules(List targetingRules) { + this.targetingRules = targetingRules; + } + + public Allocation type(AllocationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of targeting rule (called allocation in the API model). + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AllocationType getType() { + return type; + } + + public void setType(AllocationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public Allocation updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when the targeting rule allocation was last updated. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public Allocation variantWeights(List variantWeights) { + this.variantWeights = variantWeights; + for (VariantWeight item : variantWeights) { + this.unparsed |= item.unparsed; + } + return this; + } + + public Allocation addVariantWeightsItem(VariantWeight variantWeightsItem) { + this.variantWeights.add(variantWeightsItem); + this.unparsed |= variantWeightsItem.unparsed; + return this; + } + + /** + * Weighted variant assignments for this targeting rule allocation. + * + * @return variantWeights + */ + @JsonProperty(JSON_PROPERTY_VARIANT_WEIGHTS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getVariantWeights() { + return variantWeights; + } + + public void setVariantWeights(List variantWeights) { + this.variantWeights = variantWeights; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return Allocation + */ + @JsonAnySetter + public Allocation putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this Allocation object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Allocation allocation = (Allocation) o; + return Objects.equals(this.createdAt, allocation.createdAt) + && Objects.equals(this.environmentIds, allocation.environmentIds) + && Objects.equals(this.experimentId, allocation.experimentId) + && Objects.equals(this.exposureSchedule, allocation.exposureSchedule) + && Objects.equals(this.guardrailMetrics, allocation.guardrailMetrics) + && Objects.equals(this.id, allocation.id) + && Objects.equals(this.key, allocation.key) + && Objects.equals(this.name, allocation.name) + && Objects.equals(this.orderPosition, allocation.orderPosition) + && Objects.equals(this.targetingRules, allocation.targetingRules) + && Objects.equals(this.type, allocation.type) + && Objects.equals(this.updatedAt, allocation.updatedAt) + && Objects.equals(this.variantWeights, allocation.variantWeights) + && Objects.equals(this.additionalProperties, allocation.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + createdAt, + environmentIds, + experimentId, + exposureSchedule, + guardrailMetrics, + id, + key, + name, + orderPosition, + targetingRules, + type, + updatedAt, + variantWeights, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Allocation {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" environmentIds: ").append(toIndentedString(environmentIds)).append("\n"); + sb.append(" experimentId: ").append(toIndentedString(experimentId)).append("\n"); + sb.append(" exposureSchedule: ").append(toIndentedString(exposureSchedule)).append("\n"); + sb.append(" guardrailMetrics: ").append(toIndentedString(guardrailMetrics)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" orderPosition: ").append(toIndentedString(orderPosition)).append("\n"); + sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" variantWeights: ").append(toIndentedString(variantWeights)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationDataRequest.java b/src/main/java/com/datadog/api/client/v2/model/AllocationDataRequest.java new file mode 100644 index 00000000000..c28ff6c2528 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationDataRequest.java @@ -0,0 +1,181 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Data wrapper for allocation request payloads. */ +@JsonPropertyOrder({ + AllocationDataRequest.JSON_PROPERTY_ATTRIBUTES, + AllocationDataRequest.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AllocationDataRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private UpsertAllocationRequest attributes; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AllocationDataType type; + + public AllocationDataRequest() {} + + @JsonCreator + public AllocationDataRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + UpsertAllocationRequest attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AllocationDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AllocationDataRequest attributes(UpsertAllocationRequest attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Request to create or update a targeting rule (allocation) for a feature flag environment. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UpsertAllocationRequest getAttributes() { + return attributes; + } + + public void setAttributes(UpsertAllocationRequest attributes) { + this.attributes = attributes; + } + + public AllocationDataRequest type(AllocationDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AllocationDataType getType() { + return type; + } + + public void setType(AllocationDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AllocationDataRequest + */ + @JsonAnySetter + public AllocationDataRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AllocationDataRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllocationDataRequest allocationDataRequest = (AllocationDataRequest) o; + return Objects.equals(this.attributes, allocationDataRequest.attributes) + && Objects.equals(this.type, allocationDataRequest.type) + && Objects.equals(this.additionalProperties, allocationDataRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllocationDataRequest {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationDataResponse.java b/src/main/java/com/datadog/api/client/v2/model/AllocationDataResponse.java new file mode 100644 index 00000000000..5f42f15e5f0 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationDataResponse.java @@ -0,0 +1,209 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Data wrapper for targeting rule allocation responses. */ +@JsonPropertyOrder({ + AllocationDataResponse.JSON_PROPERTY_ATTRIBUTES, + AllocationDataResponse.JSON_PROPERTY_ID, + AllocationDataResponse.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AllocationDataResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private Allocation attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AllocationDataType type; + + public AllocationDataResponse() {} + + @JsonCreator + public AllocationDataResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) Allocation attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AllocationDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AllocationDataResponse attributes(Allocation attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Targeting rule (allocation) details for a feature flag environment. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Allocation getAttributes() { + return attributes; + } + + public void setAttributes(Allocation attributes) { + this.attributes = attributes; + } + + public AllocationDataResponse id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the targeting rule allocation. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public AllocationDataResponse type(AllocationDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AllocationDataType getType() { + return type; + } + + public void setType(AllocationDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AllocationDataResponse + */ + @JsonAnySetter + public AllocationDataResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AllocationDataResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllocationDataResponse allocationDataResponse = (AllocationDataResponse) o; + return Objects.equals(this.attributes, allocationDataResponse.attributes) + && Objects.equals(this.id, allocationDataResponse.id) + && Objects.equals(this.type, allocationDataResponse.type) + && Objects.equals(this.additionalProperties, allocationDataResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllocationDataResponse {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationDataType.java b/src/main/java/com/datadog/api/client/v2/model/AllocationDataType.java new file mode 100644 index 00000000000..ebe6719107b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationDataType.java @@ -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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The resource type. */ +@JsonSerialize(using = AllocationDataType.AllocationDataTypeSerializer.class) +public class AllocationDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("allocations")); + + public static final AllocationDataType ALLOCATIONS = new AllocationDataType("allocations"); + + AllocationDataType(String value) { + super(value, allowedValues); + } + + public static class AllocationDataTypeSerializer extends StdSerializer { + public AllocationDataTypeSerializer(Class t) { + super(t); + } + + public AllocationDataTypeSerializer() { + this(null); + } + + @Override + public void serialize(AllocationDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AllocationDataType fromValue(String value) { + return new AllocationDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationExposureGuardrailTrigger.java b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureGuardrailTrigger.java new file mode 100644 index 00000000000..3d38f4e1c7e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureGuardrailTrigger.java @@ -0,0 +1,334 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Guardrail trigger details for a progressive rollout. */ +@JsonPropertyOrder({ + AllocationExposureGuardrailTrigger.JSON_PROPERTY_ALLOCATION_EXPOSURE_SCHEDULE_ID, + AllocationExposureGuardrailTrigger.JSON_PROPERTY_CREATED_AT, + AllocationExposureGuardrailTrigger.JSON_PROPERTY_FLAGGING_VARIANT_ID, + AllocationExposureGuardrailTrigger.JSON_PROPERTY_ID, + AllocationExposureGuardrailTrigger.JSON_PROPERTY_METRIC_ID, + AllocationExposureGuardrailTrigger.JSON_PROPERTY_TRIGGERED_ACTION, + AllocationExposureGuardrailTrigger.JSON_PROPERTY_UPDATED_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AllocationExposureGuardrailTrigger { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALLOCATION_EXPOSURE_SCHEDULE_ID = + "allocation_exposure_schedule_id"; + private UUID allocationExposureScheduleId; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_FLAGGING_VARIANT_ID = "flagging_variant_id"; + private UUID flaggingVariantId; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_METRIC_ID = "metric_id"; + private String metricId; + + public static final String JSON_PROPERTY_TRIGGERED_ACTION = "triggered_action"; + private String triggeredAction; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public AllocationExposureGuardrailTrigger() {} + + @JsonCreator + public AllocationExposureGuardrailTrigger( + @JsonProperty(required = true, value = JSON_PROPERTY_ALLOCATION_EXPOSURE_SCHEDULE_ID) + UUID allocationExposureScheduleId, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_FLAGGING_VARIANT_ID) + UUID flaggingVariantId, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_METRIC_ID) String metricId, + @JsonProperty(required = true, value = JSON_PROPERTY_TRIGGERED_ACTION) String triggeredAction, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt) { + this.allocationExposureScheduleId = allocationExposureScheduleId; + this.createdAt = createdAt; + this.flaggingVariantId = flaggingVariantId; + this.id = id; + this.metricId = metricId; + this.triggeredAction = triggeredAction; + this.updatedAt = updatedAt; + } + + public AllocationExposureGuardrailTrigger allocationExposureScheduleId( + UUID allocationExposureScheduleId) { + this.allocationExposureScheduleId = allocationExposureScheduleId; + return this; + } + + /** + * The progressive rollout ID this trigger belongs to. + * + * @return allocationExposureScheduleId + */ + @JsonProperty(JSON_PROPERTY_ALLOCATION_EXPOSURE_SCHEDULE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAllocationExposureScheduleId() { + return allocationExposureScheduleId; + } + + public void setAllocationExposureScheduleId(UUID allocationExposureScheduleId) { + this.allocationExposureScheduleId = allocationExposureScheduleId; + } + + public AllocationExposureGuardrailTrigger createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp when this trigger was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public AllocationExposureGuardrailTrigger flaggingVariantId(UUID flaggingVariantId) { + this.flaggingVariantId = flaggingVariantId; + return this; + } + + /** + * The variant ID that triggered this event. + * + * @return flaggingVariantId + */ + @JsonProperty(JSON_PROPERTY_FLAGGING_VARIANT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getFlaggingVariantId() { + return flaggingVariantId; + } + + public void setFlaggingVariantId(UUID flaggingVariantId) { + this.flaggingVariantId = flaggingVariantId; + } + + public AllocationExposureGuardrailTrigger id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the guardrail trigger. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public AllocationExposureGuardrailTrigger metricId(String metricId) { + this.metricId = metricId; + return this; + } + + /** + * The metric ID associated with the trigger. + * + * @return metricId + */ + @JsonProperty(JSON_PROPERTY_METRIC_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMetricId() { + return metricId; + } + + public void setMetricId(String metricId) { + this.metricId = metricId; + } + + public AllocationExposureGuardrailTrigger triggeredAction(String triggeredAction) { + this.triggeredAction = triggeredAction; + return this; + } + + /** + * The action that was triggered. + * + * @return triggeredAction + */ + @JsonProperty(JSON_PROPERTY_TRIGGERED_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getTriggeredAction() { + return triggeredAction; + } + + public void setTriggeredAction(String triggeredAction) { + this.triggeredAction = triggeredAction; + } + + public AllocationExposureGuardrailTrigger updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when this trigger was last updated. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AllocationExposureGuardrailTrigger + */ + @JsonAnySetter + public AllocationExposureGuardrailTrigger putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AllocationExposureGuardrailTrigger object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllocationExposureGuardrailTrigger allocationExposureGuardrailTrigger = + (AllocationExposureGuardrailTrigger) o; + return Objects.equals( + this.allocationExposureScheduleId, + allocationExposureGuardrailTrigger.allocationExposureScheduleId) + && Objects.equals(this.createdAt, allocationExposureGuardrailTrigger.createdAt) + && Objects.equals( + this.flaggingVariantId, allocationExposureGuardrailTrigger.flaggingVariantId) + && Objects.equals(this.id, allocationExposureGuardrailTrigger.id) + && Objects.equals(this.metricId, allocationExposureGuardrailTrigger.metricId) + && Objects.equals(this.triggeredAction, allocationExposureGuardrailTrigger.triggeredAction) + && Objects.equals(this.updatedAt, allocationExposureGuardrailTrigger.updatedAt) + && Objects.equals( + this.additionalProperties, allocationExposureGuardrailTrigger.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allocationExposureScheduleId, + createdAt, + flaggingVariantId, + id, + metricId, + triggeredAction, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllocationExposureGuardrailTrigger {\n"); + sb.append(" allocationExposureScheduleId: ") + .append(toIndentedString(allocationExposureScheduleId)) + .append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" flaggingVariantId: ").append(toIndentedString(flaggingVariantId)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" metricId: ").append(toIndentedString(metricId)).append("\n"); + sb.append(" triggeredAction: ").append(toIndentedString(triggeredAction)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationExposureRolloutStep.java b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureRolloutStep.java new file mode 100644 index 00000000000..2d5f686b789 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureRolloutStep.java @@ -0,0 +1,400 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Exposure progression step details. */ +@JsonPropertyOrder({ + AllocationExposureRolloutStep.JSON_PROPERTY_ALLOCATION_EXPOSURE_SCHEDULE_ID, + AllocationExposureRolloutStep.JSON_PROPERTY_CREATED_AT, + AllocationExposureRolloutStep.JSON_PROPERTY_EXPOSURE_RATIO, + AllocationExposureRolloutStep.JSON_PROPERTY_GROUPED_STEP_INDEX, + AllocationExposureRolloutStep.JSON_PROPERTY_ID, + AllocationExposureRolloutStep.JSON_PROPERTY_INTERVAL_MS, + AllocationExposureRolloutStep.JSON_PROPERTY_IS_PAUSE_RECORD, + AllocationExposureRolloutStep.JSON_PROPERTY_ORDER_POSITION, + AllocationExposureRolloutStep.JSON_PROPERTY_UPDATED_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AllocationExposureRolloutStep { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ALLOCATION_EXPOSURE_SCHEDULE_ID = + "allocation_exposure_schedule_id"; + private UUID allocationExposureScheduleId; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_EXPOSURE_RATIO = "exposure_ratio"; + private Double exposureRatio; + + public static final String JSON_PROPERTY_GROUPED_STEP_INDEX = "grouped_step_index"; + private Long groupedStepIndex; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_INTERVAL_MS = "interval_ms"; + private JsonNullable intervalMs = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_IS_PAUSE_RECORD = "is_pause_record"; + private Boolean isPauseRecord; + + public static final String JSON_PROPERTY_ORDER_POSITION = "order_position"; + private Long orderPosition; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public AllocationExposureRolloutStep() {} + + @JsonCreator + public AllocationExposureRolloutStep( + @JsonProperty(required = true, value = JSON_PROPERTY_ALLOCATION_EXPOSURE_SCHEDULE_ID) + UUID allocationExposureScheduleId, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_EXPOSURE_RATIO) Double exposureRatio, + @JsonProperty(required = true, value = JSON_PROPERTY_GROUPED_STEP_INDEX) + Long groupedStepIndex, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PAUSE_RECORD) Boolean isPauseRecord, + @JsonProperty(required = true, value = JSON_PROPERTY_ORDER_POSITION) Long orderPosition, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt) { + this.allocationExposureScheduleId = allocationExposureScheduleId; + this.createdAt = createdAt; + this.exposureRatio = exposureRatio; + this.groupedStepIndex = groupedStepIndex; + this.id = id; + this.isPauseRecord = isPauseRecord; + this.orderPosition = orderPosition; + this.updatedAt = updatedAt; + } + + public AllocationExposureRolloutStep allocationExposureScheduleId( + UUID allocationExposureScheduleId) { + this.allocationExposureScheduleId = allocationExposureScheduleId; + return this; + } + + /** + * The progressive rollout ID this step belongs to. + * + * @return allocationExposureScheduleId + */ + @JsonProperty(JSON_PROPERTY_ALLOCATION_EXPOSURE_SCHEDULE_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAllocationExposureScheduleId() { + return allocationExposureScheduleId; + } + + public void setAllocationExposureScheduleId(UUID allocationExposureScheduleId) { + this.allocationExposureScheduleId = allocationExposureScheduleId; + } + + public AllocationExposureRolloutStep createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp when the progression step was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public AllocationExposureRolloutStep exposureRatio(Double exposureRatio) { + this.exposureRatio = exposureRatio; + return this; + } + + /** + * The exposure ratio for this step. minimum: 0 maximum: 1 + * + * @return exposureRatio + */ + @JsonProperty(JSON_PROPERTY_EXPOSURE_RATIO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getExposureRatio() { + return exposureRatio; + } + + public void setExposureRatio(Double exposureRatio) { + this.exposureRatio = exposureRatio; + } + + public AllocationExposureRolloutStep groupedStepIndex(Long groupedStepIndex) { + this.groupedStepIndex = groupedStepIndex; + return this; + } + + /** + * Logical index grouping related steps. minimum: 0 + * + * @return groupedStepIndex + */ + @JsonProperty(JSON_PROPERTY_GROUPED_STEP_INDEX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getGroupedStepIndex() { + return groupedStepIndex; + } + + public void setGroupedStepIndex(Long groupedStepIndex) { + this.groupedStepIndex = groupedStepIndex; + } + + public AllocationExposureRolloutStep id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the progression step. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public AllocationExposureRolloutStep intervalMs(Long intervalMs) { + this.intervalMs = JsonNullable.of(intervalMs); + return this; + } + + /** + * Step duration in milliseconds. + * + * @return intervalMs + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getIntervalMs() { + return intervalMs.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTERVAL_MS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getIntervalMs_JsonNullable() { + return intervalMs; + } + + @JsonProperty(JSON_PROPERTY_INTERVAL_MS) + public void setIntervalMs_JsonNullable(JsonNullable intervalMs) { + this.intervalMs = intervalMs; + } + + public void setIntervalMs(Long intervalMs) { + this.intervalMs = JsonNullable.of(intervalMs); + } + + public AllocationExposureRolloutStep isPauseRecord(Boolean isPauseRecord) { + this.isPauseRecord = isPauseRecord; + return this; + } + + /** + * Whether this step represents a pause record. + * + * @return isPauseRecord + */ + @JsonProperty(JSON_PROPERTY_IS_PAUSE_RECORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsPauseRecord() { + return isPauseRecord; + } + + public void setIsPauseRecord(Boolean isPauseRecord) { + this.isPauseRecord = isPauseRecord; + } + + public AllocationExposureRolloutStep orderPosition(Long orderPosition) { + this.orderPosition = orderPosition; + return this; + } + + /** + * Sort order for the progression step. + * + * @return orderPosition + */ + @JsonProperty(JSON_PROPERTY_ORDER_POSITION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getOrderPosition() { + return orderPosition; + } + + public void setOrderPosition(Long orderPosition) { + this.orderPosition = orderPosition; + } + + public AllocationExposureRolloutStep updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when the progression step was last updated. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AllocationExposureRolloutStep + */ + @JsonAnySetter + public AllocationExposureRolloutStep putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AllocationExposureRolloutStep object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllocationExposureRolloutStep allocationExposureRolloutStep = (AllocationExposureRolloutStep) o; + return Objects.equals( + this.allocationExposureScheduleId, + allocationExposureRolloutStep.allocationExposureScheduleId) + && Objects.equals(this.createdAt, allocationExposureRolloutStep.createdAt) + && Objects.equals(this.exposureRatio, allocationExposureRolloutStep.exposureRatio) + && Objects.equals(this.groupedStepIndex, allocationExposureRolloutStep.groupedStepIndex) + && Objects.equals(this.id, allocationExposureRolloutStep.id) + && Objects.equals(this.intervalMs, allocationExposureRolloutStep.intervalMs) + && Objects.equals(this.isPauseRecord, allocationExposureRolloutStep.isPauseRecord) + && Objects.equals(this.orderPosition, allocationExposureRolloutStep.orderPosition) + && Objects.equals(this.updatedAt, allocationExposureRolloutStep.updatedAt) + && Objects.equals( + this.additionalProperties, allocationExposureRolloutStep.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + allocationExposureScheduleId, + createdAt, + exposureRatio, + groupedStepIndex, + id, + intervalMs, + isPauseRecord, + orderPosition, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllocationExposureRolloutStep {\n"); + sb.append(" allocationExposureScheduleId: ") + .append(toIndentedString(allocationExposureScheduleId)) + .append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" exposureRatio: ").append(toIndentedString(exposureRatio)).append("\n"); + sb.append(" groupedStepIndex: ").append(toIndentedString(groupedStepIndex)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" intervalMs: ").append(toIndentedString(intervalMs)).append("\n"); + sb.append(" isPauseRecord: ").append(toIndentedString(isPauseRecord)).append("\n"); + sb.append(" orderPosition: ").append(toIndentedString(orderPosition)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationExposureSchedule.java b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureSchedule.java new file mode 100644 index 00000000000..ee07b873d2e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureSchedule.java @@ -0,0 +1,471 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Progressive release details for a targeting rule allocation. */ +@JsonPropertyOrder({ + AllocationExposureSchedule.JSON_PROPERTY_ABSOLUTE_START_TIME, + AllocationExposureSchedule.JSON_PROPERTY_ALLOCATION_ID, + AllocationExposureSchedule.JSON_PROPERTY_CONTROL_VARIANT_ID, + AllocationExposureSchedule.JSON_PROPERTY_CREATED_AT, + AllocationExposureSchedule.JSON_PROPERTY_GUARDRAIL_TRIGGERED_ACTION, + AllocationExposureSchedule.JSON_PROPERTY_GUARDRAIL_TRIGGERS, + AllocationExposureSchedule.JSON_PROPERTY_ID, + AllocationExposureSchedule.JSON_PROPERTY_ROLLOUT_OPTIONS, + AllocationExposureSchedule.JSON_PROPERTY_ROLLOUT_STEPS, + AllocationExposureSchedule.JSON_PROPERTY_UPDATED_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AllocationExposureSchedule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ABSOLUTE_START_TIME = "absolute_start_time"; + private JsonNullable absoluteStartTime = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ALLOCATION_ID = "allocation_id"; + private UUID allocationId; + + public static final String JSON_PROPERTY_CONTROL_VARIANT_ID = "control_variant_id"; + private JsonNullable controlVariantId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_GUARDRAIL_TRIGGERED_ACTION = + "guardrail_triggered_action"; + private JsonNullable guardrailTriggeredAction = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_GUARDRAIL_TRIGGERS = "guardrail_triggers"; + private List guardrailTriggers = new ArrayList<>(); + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_ROLLOUT_OPTIONS = "rollout_options"; + private RolloutOptions rolloutOptions; + + public static final String JSON_PROPERTY_ROLLOUT_STEPS = "rollout_steps"; + private List rolloutSteps = new ArrayList<>(); + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public AllocationExposureSchedule() {} + + @JsonCreator + public AllocationExposureSchedule( + @JsonProperty(required = true, value = JSON_PROPERTY_ALLOCATION_ID) UUID allocationId, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_GUARDRAIL_TRIGGERS) + List guardrailTriggers, + @JsonProperty(required = true, value = JSON_PROPERTY_ROLLOUT_OPTIONS) + RolloutOptions rolloutOptions, + @JsonProperty(required = true, value = JSON_PROPERTY_ROLLOUT_STEPS) + List rolloutSteps, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt) { + this.allocationId = allocationId; + this.createdAt = createdAt; + this.guardrailTriggers = guardrailTriggers; + this.rolloutOptions = rolloutOptions; + this.unparsed |= rolloutOptions.unparsed; + this.rolloutSteps = rolloutSteps; + this.updatedAt = updatedAt; + } + + public AllocationExposureSchedule absoluteStartTime(OffsetDateTime absoluteStartTime) { + this.absoluteStartTime = JsonNullable.of(absoluteStartTime); + return this; + } + + /** + * The absolute UTC start time for this schedule. + * + * @return absoluteStartTime + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getAbsoluteStartTime() { + return absoluteStartTime.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ABSOLUTE_START_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getAbsoluteStartTime_JsonNullable() { + return absoluteStartTime; + } + + @JsonProperty(JSON_PROPERTY_ABSOLUTE_START_TIME) + public void setAbsoluteStartTime_JsonNullable(JsonNullable absoluteStartTime) { + this.absoluteStartTime = absoluteStartTime; + } + + public void setAbsoluteStartTime(OffsetDateTime absoluteStartTime) { + this.absoluteStartTime = JsonNullable.of(absoluteStartTime); + } + + public AllocationExposureSchedule allocationId(UUID allocationId) { + this.allocationId = allocationId; + return this; + } + + /** + * The targeting rule allocation ID this progressive rollout belongs to. + * + * @return allocationId + */ + @JsonProperty(JSON_PROPERTY_ALLOCATION_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getAllocationId() { + return allocationId; + } + + public void setAllocationId(UUID allocationId) { + this.allocationId = allocationId; + } + + public AllocationExposureSchedule controlVariantId(String controlVariantId) { + this.controlVariantId = JsonNullable.of(controlVariantId); + return this; + } + + /** + * The control variant ID used for experiment comparisons. + * + * @return controlVariantId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getControlVariantId() { + return controlVariantId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CONTROL_VARIANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getControlVariantId_JsonNullable() { + return controlVariantId; + } + + @JsonProperty(JSON_PROPERTY_CONTROL_VARIANT_ID) + public void setControlVariantId_JsonNullable(JsonNullable controlVariantId) { + this.controlVariantId = controlVariantId; + } + + public void setControlVariantId(String controlVariantId) { + this.controlVariantId = JsonNullable.of(controlVariantId); + } + + public AllocationExposureSchedule createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp when the schedule was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public AllocationExposureSchedule guardrailTriggeredAction(String guardrailTriggeredAction) { + this.guardrailTriggeredAction = JsonNullable.of(guardrailTriggeredAction); + return this; + } + + /** + * Last guardrail action triggered for this schedule. + * + * @return guardrailTriggeredAction + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getGuardrailTriggeredAction() { + return guardrailTriggeredAction.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_GUARDRAIL_TRIGGERED_ACTION) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getGuardrailTriggeredAction_JsonNullable() { + return guardrailTriggeredAction; + } + + @JsonProperty(JSON_PROPERTY_GUARDRAIL_TRIGGERED_ACTION) + public void setGuardrailTriggeredAction_JsonNullable( + JsonNullable guardrailTriggeredAction) { + this.guardrailTriggeredAction = guardrailTriggeredAction; + } + + public void setGuardrailTriggeredAction(String guardrailTriggeredAction) { + this.guardrailTriggeredAction = JsonNullable.of(guardrailTriggeredAction); + } + + public AllocationExposureSchedule guardrailTriggers( + List guardrailTriggers) { + this.guardrailTriggers = guardrailTriggers; + for (AllocationExposureGuardrailTrigger item : guardrailTriggers) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AllocationExposureSchedule addGuardrailTriggersItem( + AllocationExposureGuardrailTrigger guardrailTriggersItem) { + this.guardrailTriggers.add(guardrailTriggersItem); + this.unparsed |= guardrailTriggersItem.unparsed; + return this; + } + + /** + * Guardrail trigger records for this schedule. + * + * @return guardrailTriggers + */ + @JsonProperty(JSON_PROPERTY_GUARDRAIL_TRIGGERS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getGuardrailTriggers() { + return guardrailTriggers; + } + + public void setGuardrailTriggers(List guardrailTriggers) { + this.guardrailTriggers = guardrailTriggers; + } + + public AllocationExposureSchedule id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the progressive rollout. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public AllocationExposureSchedule rolloutOptions(RolloutOptions rolloutOptions) { + this.rolloutOptions = rolloutOptions; + this.unparsed |= rolloutOptions.unparsed; + return this; + } + + /** + * Applied progression options for a progressive rollout. + * + * @return rolloutOptions + */ + @JsonProperty(JSON_PROPERTY_ROLLOUT_OPTIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RolloutOptions getRolloutOptions() { + return rolloutOptions; + } + + public void setRolloutOptions(RolloutOptions rolloutOptions) { + this.rolloutOptions = rolloutOptions; + } + + public AllocationExposureSchedule rolloutSteps(List rolloutSteps) { + this.rolloutSteps = rolloutSteps; + for (AllocationExposureRolloutStep item : rolloutSteps) { + this.unparsed |= item.unparsed; + } + return this; + } + + public AllocationExposureSchedule addRolloutStepsItem( + AllocationExposureRolloutStep rolloutStepsItem) { + this.rolloutSteps.add(rolloutStepsItem); + this.unparsed |= rolloutStepsItem.unparsed; + return this; + } + + /** + * Ordered progression steps for exposure. + * + * @return rolloutSteps + */ + @JsonProperty(JSON_PROPERTY_ROLLOUT_STEPS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRolloutSteps() { + return rolloutSteps; + } + + public void setRolloutSteps(List rolloutSteps) { + this.rolloutSteps = rolloutSteps; + } + + public AllocationExposureSchedule updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when the schedule was last updated. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AllocationExposureSchedule + */ + @JsonAnySetter + public AllocationExposureSchedule putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AllocationExposureSchedule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllocationExposureSchedule allocationExposureSchedule = (AllocationExposureSchedule) o; + return Objects.equals(this.absoluteStartTime, allocationExposureSchedule.absoluteStartTime) + && Objects.equals(this.allocationId, allocationExposureSchedule.allocationId) + && Objects.equals(this.controlVariantId, allocationExposureSchedule.controlVariantId) + && Objects.equals(this.createdAt, allocationExposureSchedule.createdAt) + && Objects.equals( + this.guardrailTriggeredAction, allocationExposureSchedule.guardrailTriggeredAction) + && Objects.equals(this.guardrailTriggers, allocationExposureSchedule.guardrailTriggers) + && Objects.equals(this.id, allocationExposureSchedule.id) + && Objects.equals(this.rolloutOptions, allocationExposureSchedule.rolloutOptions) + && Objects.equals(this.rolloutSteps, allocationExposureSchedule.rolloutSteps) + && Objects.equals(this.updatedAt, allocationExposureSchedule.updatedAt) + && Objects.equals( + this.additionalProperties, allocationExposureSchedule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + absoluteStartTime, + allocationId, + controlVariantId, + createdAt, + guardrailTriggeredAction, + guardrailTriggers, + id, + rolloutOptions, + rolloutSteps, + updatedAt, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllocationExposureSchedule {\n"); + sb.append(" absoluteStartTime: ").append(toIndentedString(absoluteStartTime)).append("\n"); + sb.append(" allocationId: ").append(toIndentedString(allocationId)).append("\n"); + sb.append(" controlVariantId: ").append(toIndentedString(controlVariantId)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" guardrailTriggeredAction: ") + .append(toIndentedString(guardrailTriggeredAction)) + .append("\n"); + sb.append(" guardrailTriggers: ").append(toIndentedString(guardrailTriggers)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" rolloutOptions: ").append(toIndentedString(rolloutOptions)).append("\n"); + sb.append(" rolloutSteps: ").append(toIndentedString(rolloutSteps)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleData.java b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleData.java new file mode 100644 index 00000000000..4236491b3f3 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleData.java @@ -0,0 +1,213 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Data wrapper for progressive rollout schedule responses. */ +@JsonPropertyOrder({ + AllocationExposureScheduleData.JSON_PROPERTY_ATTRIBUTES, + AllocationExposureScheduleData.JSON_PROPERTY_ID, + AllocationExposureScheduleData.JSON_PROPERTY_TYPE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AllocationExposureScheduleData { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTES = "attributes"; + private AllocationExposureSchedule attributes; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AllocationExposureScheduleDataType type; + + public AllocationExposureScheduleData() {} + + @JsonCreator + public AllocationExposureScheduleData( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTES) + AllocationExposureSchedule attributes, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) + AllocationExposureScheduleDataType type) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + this.id = id; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public AllocationExposureScheduleData attributes(AllocationExposureSchedule attributes) { + this.attributes = attributes; + this.unparsed |= attributes.unparsed; + return this; + } + + /** + * Progressive release details for a targeting rule allocation. + * + * @return attributes + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTES) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AllocationExposureSchedule getAttributes() { + return attributes; + } + + public void setAttributes(AllocationExposureSchedule attributes) { + this.attributes = attributes; + } + + public AllocationExposureScheduleData id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the progressive rollout. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public AllocationExposureScheduleData type(AllocationExposureScheduleDataType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The resource type for progressive rollout schedules. + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AllocationExposureScheduleDataType getType() { + return type; + } + + public void setType(AllocationExposureScheduleDataType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AllocationExposureScheduleData + */ + @JsonAnySetter + public AllocationExposureScheduleData putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AllocationExposureScheduleData object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllocationExposureScheduleData allocationExposureScheduleData = + (AllocationExposureScheduleData) o; + return Objects.equals(this.attributes, allocationExposureScheduleData.attributes) + && Objects.equals(this.id, allocationExposureScheduleData.id) + && Objects.equals(this.type, allocationExposureScheduleData.type) + && Objects.equals( + this.additionalProperties, allocationExposureScheduleData.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attributes, id, type, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllocationExposureScheduleData {\n"); + sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleDataType.java b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleDataType.java new file mode 100644 index 00000000000..1984dde9aa8 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleDataType.java @@ -0,0 +1,59 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The resource type for progressive rollout schedules. */ +@JsonSerialize( + using = AllocationExposureScheduleDataType.AllocationExposureScheduleDataTypeSerializer.class) +public class AllocationExposureScheduleDataType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("allocation_exposure_schedules")); + + public static final AllocationExposureScheduleDataType ALLOCATION_EXPOSURE_SCHEDULES = + new AllocationExposureScheduleDataType("allocation_exposure_schedules"); + + AllocationExposureScheduleDataType(String value) { + super(value, allowedValues); + } + + public static class AllocationExposureScheduleDataTypeSerializer + extends StdSerializer { + public AllocationExposureScheduleDataTypeSerializer( + Class t) { + super(t); + } + + public AllocationExposureScheduleDataTypeSerializer() { + this(null); + } + + @Override + public void serialize( + AllocationExposureScheduleDataType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AllocationExposureScheduleDataType fromValue(String value) { + return new AllocationExposureScheduleDataType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleResponse.java b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleResponse.java new file mode 100644 index 00000000000..be9a95b5d2a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationExposureScheduleResponse.java @@ -0,0 +1,148 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing a progressive rollout schedule. */ +@JsonPropertyOrder({AllocationExposureScheduleResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AllocationExposureScheduleResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AllocationExposureScheduleData data; + + public AllocationExposureScheduleResponse() {} + + @JsonCreator + public AllocationExposureScheduleResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + AllocationExposureScheduleData data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AllocationExposureScheduleResponse data(AllocationExposureScheduleData data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data wrapper for progressive rollout schedule responses. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AllocationExposureScheduleData getData() { + return data; + } + + public void setData(AllocationExposureScheduleData data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AllocationExposureScheduleResponse + */ + @JsonAnySetter + public AllocationExposureScheduleResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AllocationExposureScheduleResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllocationExposureScheduleResponse allocationExposureScheduleResponse = + (AllocationExposureScheduleResponse) o; + return Objects.equals(this.data, allocationExposureScheduleResponse.data) + && Objects.equals( + this.additionalProperties, allocationExposureScheduleResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllocationExposureScheduleResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationResponse.java b/src/main/java/com/datadog/api/client/v2/model/AllocationResponse.java new file mode 100644 index 00000000000..58bbb807bc7 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationResponse.java @@ -0,0 +1,145 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Response containing a single targeting rule (allocation). */ +@JsonPropertyOrder({AllocationResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class AllocationResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AllocationDataResponse data; + + public AllocationResponse() {} + + @JsonCreator + public AllocationResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AllocationDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public AllocationResponse data(AllocationDataResponse data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data wrapper for targeting rule allocation responses. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AllocationDataResponse getData() { + return data; + } + + public void setData(AllocationDataResponse data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return AllocationResponse + */ + @JsonAnySetter + public AllocationResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this AllocationResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllocationResponse allocationResponse = (AllocationResponse) o; + return Objects.equals(this.data, allocationResponse.data) + && Objects.equals(this.additionalProperties, allocationResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AllocationResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/AllocationType.java b/src/main/java/com/datadog/api/client/v2/model/AllocationType.java new file mode 100644 index 00000000000..83d1062ef56 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/AllocationType.java @@ -0,0 +1,55 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The type of targeting rule (called allocation in the API model). */ +@JsonSerialize(using = AllocationType.AllocationTypeSerializer.class) +public class AllocationType extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("FEATURE_GATE", "CANARY")); + + public static final AllocationType FEATURE_GATE = new AllocationType("FEATURE_GATE"); + public static final AllocationType CANARY = new AllocationType("CANARY"); + + AllocationType(String value) { + super(value, allowedValues); + } + + public static class AllocationTypeSerializer extends StdSerializer { + public AllocationTypeSerializer(Class t) { + super(t); + } + + public AllocationTypeSerializer() { + this(null); + } + + @Override + public void serialize(AllocationType value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static AllocationType fromValue(String value) { + return new AllocationType(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/Condition.java b/src/main/java/com/datadog/api/client/v2/model/Condition.java new file mode 100644 index 00000000000..b473d63a07b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/Condition.java @@ -0,0 +1,299 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Targeting condition details. */ +@JsonPropertyOrder({ + Condition.JSON_PROPERTY_ATTRIBUTE, + Condition.JSON_PROPERTY_CREATED_AT, + Condition.JSON_PROPERTY_ID, + Condition.JSON_PROPERTY_OPERATOR, + Condition.JSON_PROPERTY_UPDATED_AT, + Condition.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class Condition { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTE = "attribute"; + private String attribute; + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_OPERATOR = "operator"; + private ConditionOperator operator; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_VALUE = "value"; + private List value = new ArrayList<>(); + + public Condition() {} + + @JsonCreator + public Condition( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTE) String attribute, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_OPERATOR) ConditionOperator operator, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) List value) { + this.attribute = attribute; + this.createdAt = createdAt; + this.id = id; + this.operator = operator; + this.unparsed |= !operator.isValid(); + this.updatedAt = updatedAt; + this.value = value; + } + + public Condition attribute(String attribute) { + this.attribute = attribute; + return this; + } + + /** + * The user or request attribute to evaluate. + * + * @return attribute + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public Condition createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp when the condition was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public Condition id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the condition. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public Condition operator(ConditionOperator operator) { + this.operator = operator; + this.unparsed |= !operator.isValid(); + return this; + } + + /** + * The operator used in a targeting condition. + * + * @return operator + */ + @JsonProperty(JSON_PROPERTY_OPERATOR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ConditionOperator getOperator() { + return operator; + } + + public void setOperator(ConditionOperator operator) { + if (!operator.isValid()) { + this.unparsed = true; + } + this.operator = operator; + } + + public Condition updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when the condition was last updated. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public Condition value(List value) { + this.value = value; + return this; + } + + public Condition addValueItem(String valueItem) { + this.value.add(valueItem); + return this; + } + + /** + * Values used by the selected operator. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValue() { + return value; + } + + public void setValue(List value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return Condition + */ + @JsonAnySetter + public Condition putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this Condition object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Condition condition = (Condition) o; + return Objects.equals(this.attribute, condition.attribute) + && Objects.equals(this.createdAt, condition.createdAt) + && Objects.equals(this.id, condition.id) + && Objects.equals(this.operator, condition.operator) + && Objects.equals(this.updatedAt, condition.updatedAt) + && Objects.equals(this.value, condition.value) + && Objects.equals(this.additionalProperties, condition.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attribute, createdAt, id, operator, updatedAt, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Condition {\n"); + sb.append(" attribute: ").append(toIndentedString(attribute)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConditionOperator.java b/src/main/java/com/datadog/api/client/v2/model/ConditionOperator.java new file mode 100644 index 00000000000..cf12bcf5a2a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConditionOperator.java @@ -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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The operator used in a targeting condition. */ +@JsonSerialize(using = ConditionOperator.ConditionOperatorSerializer.class) +public class ConditionOperator extends ModelEnum { + + private static final Set allowedValues = + new HashSet( + Arrays.asList( + "LT", + "LTE", + "GT", + "GTE", + "MATCHES", + "NOT_MATCHES", + "ONE_OF", + "NOT_ONE_OF", + "IS_NULL", + "EQUALS")); + + public static final ConditionOperator LT = new ConditionOperator("LT"); + public static final ConditionOperator LTE = new ConditionOperator("LTE"); + public static final ConditionOperator GT = new ConditionOperator("GT"); + public static final ConditionOperator GTE = new ConditionOperator("GTE"); + public static final ConditionOperator MATCHES = new ConditionOperator("MATCHES"); + public static final ConditionOperator NOT_MATCHES = new ConditionOperator("NOT_MATCHES"); + public static final ConditionOperator ONE_OF = new ConditionOperator("ONE_OF"); + public static final ConditionOperator NOT_ONE_OF = new ConditionOperator("NOT_ONE_OF"); + public static final ConditionOperator IS_NULL = new ConditionOperator("IS_NULL"); + public static final ConditionOperator EQUALS = new ConditionOperator("EQUALS"); + + ConditionOperator(String value) { + super(value, allowedValues); + } + + public static class ConditionOperatorSerializer extends StdSerializer { + public ConditionOperatorSerializer(Class t) { + super(t); + } + + public ConditionOperatorSerializer() { + this(null); + } + + @Override + public void serialize(ConditionOperator value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static ConditionOperator fromValue(String value) { + return new ConditionOperator(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ConditionRequest.java b/src/main/java/com/datadog/api/client/v2/model/ConditionRequest.java new file mode 100644 index 00000000000..2b2641dd83a --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ConditionRequest.java @@ -0,0 +1,213 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Condition request payload for targeting rules. */ +@JsonPropertyOrder({ + ConditionRequest.JSON_PROPERTY_ATTRIBUTE, + ConditionRequest.JSON_PROPERTY_OPERATOR, + ConditionRequest.JSON_PROPERTY_VALUE +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ConditionRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ATTRIBUTE = "attribute"; + private String attribute; + + public static final String JSON_PROPERTY_OPERATOR = "operator"; + private ConditionOperator operator; + + public static final String JSON_PROPERTY_VALUE = "value"; + private List value = new ArrayList<>(); + + public ConditionRequest() {} + + @JsonCreator + public ConditionRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ATTRIBUTE) String attribute, + @JsonProperty(required = true, value = JSON_PROPERTY_OPERATOR) ConditionOperator operator, + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) List value) { + this.attribute = attribute; + this.operator = operator; + this.unparsed |= !operator.isValid(); + this.value = value; + } + + public ConditionRequest attribute(String attribute) { + this.attribute = attribute; + return this; + } + + /** + * The user or request attribute to evaluate. + * + * @return attribute + */ + @JsonProperty(JSON_PROPERTY_ATTRIBUTE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + } + + public ConditionRequest operator(ConditionOperator operator) { + this.operator = operator; + this.unparsed |= !operator.isValid(); + return this; + } + + /** + * The operator used in a targeting condition. + * + * @return operator + */ + @JsonProperty(JSON_PROPERTY_OPERATOR) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public ConditionOperator getOperator() { + return operator; + } + + public void setOperator(ConditionOperator operator) { + if (!operator.isValid()) { + this.unparsed = true; + } + this.operator = operator; + } + + public ConditionRequest value(List value) { + this.value = value; + return this; + } + + public ConditionRequest addValueItem(String valueItem) { + this.value.add(valueItem); + return this; + } + + /** + * Values used by the selected operator. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getValue() { + return value; + } + + public void setValue(List value) { + this.value = value; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ConditionRequest + */ + @JsonAnySetter + public ConditionRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ConditionRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConditionRequest conditionRequest = (ConditionRequest) o; + return Objects.equals(this.attribute, conditionRequest.attribute) + && Objects.equals(this.operator, conditionRequest.operator) + && Objects.equals(this.value, conditionRequest.value) + && Objects.equals(this.additionalProperties, conditionRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(attribute, operator, value, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ConditionRequest {\n"); + sb.append(" attribute: ").append(toIndentedString(attribute)).append("\n"); + sb.append(" operator: ").append(toIndentedString(operator)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/CreateAllocationsRequest.java b/src/main/java/com/datadog/api/client/v2/model/CreateAllocationsRequest.java new file mode 100644 index 00000000000..7e46475ed3e --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/CreateAllocationsRequest.java @@ -0,0 +1,145 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Request to create targeting rules (allocations) for a feature flag in an environment. */ +@JsonPropertyOrder({CreateAllocationsRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class CreateAllocationsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private AllocationDataRequest data; + + public CreateAllocationsRequest() {} + + @JsonCreator + public CreateAllocationsRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) AllocationDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + } + + public CreateAllocationsRequest data(AllocationDataRequest data) { + this.data = data; + this.unparsed |= data.unparsed; + return this; + } + + /** + * Data wrapper for allocation request payloads. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AllocationDataRequest getData() { + return data; + } + + public void setData(AllocationDataRequest data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return CreateAllocationsRequest + */ + @JsonAnySetter + public CreateAllocationsRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this CreateAllocationsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAllocationsRequest createAllocationsRequest = (CreateAllocationsRequest) o; + return Objects.equals(this.data, createAllocationsRequest.data) + && Objects.equals(this.additionalProperties, createAllocationsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAllocationsRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ExposureRolloutStepRequest.java b/src/main/java/com/datadog/api/client/v2/model/ExposureRolloutStepRequest.java new file mode 100644 index 00000000000..437f956784c --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ExposureRolloutStepRequest.java @@ -0,0 +1,270 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Rollout step request payload. */ +@JsonPropertyOrder({ + ExposureRolloutStepRequest.JSON_PROPERTY_EXPOSURE_RATIO, + ExposureRolloutStepRequest.JSON_PROPERTY_GROUPED_STEP_INDEX, + ExposureRolloutStepRequest.JSON_PROPERTY_ID, + ExposureRolloutStepRequest.JSON_PROPERTY_INTERVAL_MS, + ExposureRolloutStepRequest.JSON_PROPERTY_IS_PAUSE_RECORD +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ExposureRolloutStepRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EXPOSURE_RATIO = "exposure_ratio"; + private Double exposureRatio; + + public static final String JSON_PROPERTY_GROUPED_STEP_INDEX = "grouped_step_index"; + private Long groupedStepIndex; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_INTERVAL_MS = "interval_ms"; + private JsonNullable intervalMs = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_IS_PAUSE_RECORD = "is_pause_record"; + private Boolean isPauseRecord; + + public ExposureRolloutStepRequest() {} + + @JsonCreator + public ExposureRolloutStepRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_EXPOSURE_RATIO) Double exposureRatio, + @JsonProperty(required = true, value = JSON_PROPERTY_GROUPED_STEP_INDEX) + Long groupedStepIndex, + @JsonProperty(required = true, value = JSON_PROPERTY_IS_PAUSE_RECORD) Boolean isPauseRecord) { + this.exposureRatio = exposureRatio; + this.groupedStepIndex = groupedStepIndex; + this.isPauseRecord = isPauseRecord; + } + + public ExposureRolloutStepRequest exposureRatio(Double exposureRatio) { + this.exposureRatio = exposureRatio; + return this; + } + + /** + * The exposure ratio for this step. minimum: 0 maximum: 1 + * + * @return exposureRatio + */ + @JsonProperty(JSON_PROPERTY_EXPOSURE_RATIO) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getExposureRatio() { + return exposureRatio; + } + + public void setExposureRatio(Double exposureRatio) { + this.exposureRatio = exposureRatio; + } + + public ExposureRolloutStepRequest groupedStepIndex(Long groupedStepIndex) { + this.groupedStepIndex = groupedStepIndex; + return this; + } + + /** + * Logical index grouping related steps. minimum: 0 + * + * @return groupedStepIndex + */ + @JsonProperty(JSON_PROPERTY_GROUPED_STEP_INDEX) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getGroupedStepIndex() { + return groupedStepIndex; + } + + public void setGroupedStepIndex(Long groupedStepIndex) { + this.groupedStepIndex = groupedStepIndex; + } + + public ExposureRolloutStepRequest id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the progression step. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public ExposureRolloutStepRequest intervalMs(Long intervalMs) { + this.intervalMs = JsonNullable.of(intervalMs); + return this; + } + + /** + * Step duration in milliseconds. + * + * @return intervalMs + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Long getIntervalMs() { + return intervalMs.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_INTERVAL_MS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getIntervalMs_JsonNullable() { + return intervalMs; + } + + @JsonProperty(JSON_PROPERTY_INTERVAL_MS) + public void setIntervalMs_JsonNullable(JsonNullable intervalMs) { + this.intervalMs = intervalMs; + } + + public void setIntervalMs(Long intervalMs) { + this.intervalMs = JsonNullable.of(intervalMs); + } + + public ExposureRolloutStepRequest isPauseRecord(Boolean isPauseRecord) { + this.isPauseRecord = isPauseRecord; + return this; + } + + /** + * Whether this step represents a pause record. + * + * @return isPauseRecord + */ + @JsonProperty(JSON_PROPERTY_IS_PAUSE_RECORD) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getIsPauseRecord() { + return isPauseRecord; + } + + public void setIsPauseRecord(Boolean isPauseRecord) { + this.isPauseRecord = isPauseRecord; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ExposureRolloutStepRequest + */ + @JsonAnySetter + public ExposureRolloutStepRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ExposureRolloutStepRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExposureRolloutStepRequest exposureRolloutStepRequest = (ExposureRolloutStepRequest) o; + return Objects.equals(this.exposureRatio, exposureRolloutStepRequest.exposureRatio) + && Objects.equals(this.groupedStepIndex, exposureRolloutStepRequest.groupedStepIndex) + && Objects.equals(this.id, exposureRolloutStepRequest.id) + && Objects.equals(this.intervalMs, exposureRolloutStepRequest.intervalMs) + && Objects.equals(this.isPauseRecord, exposureRolloutStepRequest.isPauseRecord) + && Objects.equals( + this.additionalProperties, exposureRolloutStepRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + exposureRatio, groupedStepIndex, id, intervalMs, isPauseRecord, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExposureRolloutStepRequest {\n"); + sb.append(" exposureRatio: ").append(toIndentedString(exposureRatio)).append("\n"); + sb.append(" groupedStepIndex: ").append(toIndentedString(groupedStepIndex)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" intervalMs: ").append(toIndentedString(intervalMs)).append("\n"); + sb.append(" isPauseRecord: ").append(toIndentedString(isPauseRecord)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ExposureScheduleRequest.java b/src/main/java/com/datadog/api/client/v2/model/ExposureScheduleRequest.java new file mode 100644 index 00000000000..167e8756708 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ExposureScheduleRequest.java @@ -0,0 +1,336 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Progressive release request payload. */ +@JsonPropertyOrder({ + ExposureScheduleRequest.JSON_PROPERTY_ABSOLUTE_START_TIME, + ExposureScheduleRequest.JSON_PROPERTY_CONTROL_VARIANT_ID, + ExposureScheduleRequest.JSON_PROPERTY_CONTROL_VARIANT_KEY, + ExposureScheduleRequest.JSON_PROPERTY_ID, + ExposureScheduleRequest.JSON_PROPERTY_ROLLOUT_OPTIONS, + ExposureScheduleRequest.JSON_PROPERTY_ROLLOUT_STEPS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ExposureScheduleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_ABSOLUTE_START_TIME = "absolute_start_time"; + private JsonNullable absoluteStartTime = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CONTROL_VARIANT_ID = "control_variant_id"; + private JsonNullable controlVariantId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_CONTROL_VARIANT_KEY = "control_variant_key"; + private JsonNullable controlVariantKey = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_ROLLOUT_OPTIONS = "rollout_options"; + private RolloutOptionsRequest rolloutOptions; + + public static final String JSON_PROPERTY_ROLLOUT_STEPS = "rollout_steps"; + private List rolloutSteps = new ArrayList<>(); + + public ExposureScheduleRequest() {} + + @JsonCreator + public ExposureScheduleRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_ROLLOUT_OPTIONS) + RolloutOptionsRequest rolloutOptions, + @JsonProperty(required = true, value = JSON_PROPERTY_ROLLOUT_STEPS) + List rolloutSteps) { + this.rolloutOptions = rolloutOptions; + this.unparsed |= rolloutOptions.unparsed; + this.rolloutSteps = rolloutSteps; + } + + public ExposureScheduleRequest absoluteStartTime(OffsetDateTime absoluteStartTime) { + this.absoluteStartTime = JsonNullable.of(absoluteStartTime); + return this; + } + + /** + * The absolute UTC start time for this schedule. + * + * @return absoluteStartTime + */ + @jakarta.annotation.Nullable + @JsonIgnore + public OffsetDateTime getAbsoluteStartTime() { + return absoluteStartTime.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_ABSOLUTE_START_TIME) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getAbsoluteStartTime_JsonNullable() { + return absoluteStartTime; + } + + @JsonProperty(JSON_PROPERTY_ABSOLUTE_START_TIME) + public void setAbsoluteStartTime_JsonNullable(JsonNullable absoluteStartTime) { + this.absoluteStartTime = absoluteStartTime; + } + + public void setAbsoluteStartTime(OffsetDateTime absoluteStartTime) { + this.absoluteStartTime = JsonNullable.of(absoluteStartTime); + } + + public ExposureScheduleRequest controlVariantId(String controlVariantId) { + this.controlVariantId = JsonNullable.of(controlVariantId); + return this; + } + + /** + * The control variant ID used for experiment comparisons. + * + * @return controlVariantId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getControlVariantId() { + return controlVariantId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CONTROL_VARIANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getControlVariantId_JsonNullable() { + return controlVariantId; + } + + @JsonProperty(JSON_PROPERTY_CONTROL_VARIANT_ID) + public void setControlVariantId_JsonNullable(JsonNullable controlVariantId) { + this.controlVariantId = controlVariantId; + } + + public void setControlVariantId(String controlVariantId) { + this.controlVariantId = JsonNullable.of(controlVariantId); + } + + public ExposureScheduleRequest controlVariantKey(String controlVariantKey) { + this.controlVariantKey = JsonNullable.of(controlVariantKey); + return this; + } + + /** + * The control variant key used during creation workflows. + * + * @return controlVariantKey + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getControlVariantKey() { + return controlVariantKey.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_CONTROL_VARIANT_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getControlVariantKey_JsonNullable() { + return controlVariantKey; + } + + @JsonProperty(JSON_PROPERTY_CONTROL_VARIANT_KEY) + public void setControlVariantKey_JsonNullable(JsonNullable controlVariantKey) { + this.controlVariantKey = controlVariantKey; + } + + public void setControlVariantKey(String controlVariantKey) { + this.controlVariantKey = JsonNullable.of(controlVariantKey); + } + + public ExposureScheduleRequest id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the progressive rollout. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public ExposureScheduleRequest rolloutOptions(RolloutOptionsRequest rolloutOptions) { + this.rolloutOptions = rolloutOptions; + this.unparsed |= rolloutOptions.unparsed; + return this; + } + + /** + * Rollout options request payload. + * + * @return rolloutOptions + */ + @JsonProperty(JSON_PROPERTY_ROLLOUT_OPTIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RolloutOptionsRequest getRolloutOptions() { + return rolloutOptions; + } + + public void setRolloutOptions(RolloutOptionsRequest rolloutOptions) { + this.rolloutOptions = rolloutOptions; + } + + public ExposureScheduleRequest rolloutSteps(List rolloutSteps) { + this.rolloutSteps = rolloutSteps; + for (ExposureRolloutStepRequest item : rolloutSteps) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ExposureScheduleRequest addRolloutStepsItem(ExposureRolloutStepRequest rolloutStepsItem) { + this.rolloutSteps.add(rolloutStepsItem); + this.unparsed |= rolloutStepsItem.unparsed; + return this; + } + + /** + * Ordered progression steps for exposure. + * + * @return rolloutSteps + */ + @JsonProperty(JSON_PROPERTY_ROLLOUT_STEPS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getRolloutSteps() { + return rolloutSteps; + } + + public void setRolloutSteps(List rolloutSteps) { + this.rolloutSteps = rolloutSteps; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ExposureScheduleRequest + */ + @JsonAnySetter + public ExposureScheduleRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ExposureScheduleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ExposureScheduleRequest exposureScheduleRequest = (ExposureScheduleRequest) o; + return Objects.equals(this.absoluteStartTime, exposureScheduleRequest.absoluteStartTime) + && Objects.equals(this.controlVariantId, exposureScheduleRequest.controlVariantId) + && Objects.equals(this.controlVariantKey, exposureScheduleRequest.controlVariantKey) + && Objects.equals(this.id, exposureScheduleRequest.id) + && Objects.equals(this.rolloutOptions, exposureScheduleRequest.rolloutOptions) + && Objects.equals(this.rolloutSteps, exposureScheduleRequest.rolloutSteps) + && Objects.equals(this.additionalProperties, exposureScheduleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + absoluteStartTime, + controlVariantId, + controlVariantKey, + id, + rolloutOptions, + rolloutSteps, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ExposureScheduleRequest {\n"); + sb.append(" absoluteStartTime: ").append(toIndentedString(absoluteStartTime)).append("\n"); + sb.append(" controlVariantId: ").append(toIndentedString(controlVariantId)).append("\n"); + sb.append(" controlVariantKey: ").append(toIndentedString(controlVariantKey)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" rolloutOptions: ").append(toIndentedString(rolloutOptions)).append("\n"); + sb.append(" rolloutSteps: ").append(toIndentedString(rolloutSteps)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagAttributes.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagAttributes.java index b6b5e67534b..bb8f99e48b6 100644 --- a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagAttributes.java +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagAttributes.java @@ -35,6 +35,7 @@ FeatureFlagAttributes.JSON_PROPERTY_LAST_UPDATED_BY, FeatureFlagAttributes.JSON_PROPERTY_NAME, FeatureFlagAttributes.JSON_PROPERTY_REQUIRE_APPROVAL, + FeatureFlagAttributes.JSON_PROPERTY_TAGS, FeatureFlagAttributes.JSON_PROPERTY_UPDATED_AT, FeatureFlagAttributes.JSON_PROPERTY_VALUE_TYPE, FeatureFlagAttributes.JSON_PROPERTY_VARIANTS @@ -76,6 +77,9 @@ public class FeatureFlagAttributes { public static final String JSON_PROPERTY_REQUIRE_APPROVAL = "require_approval"; private Boolean requireApproval; + public static final String JSON_PROPERTY_TAGS = "tags"; + private List tags = null; + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; private OffsetDateTime updatedAt; @@ -364,6 +368,35 @@ public void setRequireApproval(Boolean requireApproval) { this.requireApproval = requireApproval; } + public FeatureFlagAttributes tags(List tags) { + this.tags = tags; + return this; + } + + public FeatureFlagAttributes addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Tags associated with the feature flag. + * + * @return tags + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TAGS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + public FeatureFlagAttributes updatedAt(OffsetDateTime updatedAt) { this.updatedAt = updatedAt; return this; @@ -506,6 +539,7 @@ public boolean equals(Object o) { && Objects.equals(this.lastUpdatedBy, featureFlagAttributes.lastUpdatedBy) && Objects.equals(this.name, featureFlagAttributes.name) && Objects.equals(this.requireApproval, featureFlagAttributes.requireApproval) + && Objects.equals(this.tags, featureFlagAttributes.tags) && Objects.equals(this.updatedAt, featureFlagAttributes.updatedAt) && Objects.equals(this.valueType, featureFlagAttributes.valueType) && Objects.equals(this.variants, featureFlagAttributes.variants) @@ -526,6 +560,7 @@ public int hashCode() { lastUpdatedBy, name, requireApproval, + tags, updatedAt, valueType, variants, @@ -551,6 +586,7 @@ public String toString() { sb.append(" lastUpdatedBy: ").append(toIndentedString(lastUpdatedBy)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" requireApproval: ").append(toIndentedString(requireApproval)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); sb.append(" valueType: ").append(toIndentedString(valueType)).append("\n"); sb.append(" variants: ").append(toIndentedString(variants)).append("\n"); diff --git a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagEnvironment.java b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagEnvironment.java index 9280e4966c7..a158aa1a702 100644 --- a/src/main/java/com/datadog/api/client/v2/model/FeatureFlagEnvironment.java +++ b/src/main/java/com/datadog/api/client/v2/model/FeatureFlagEnvironment.java @@ -28,6 +28,7 @@ FeatureFlagEnvironment.JSON_PROPERTY_DEFAULT_VARIANT_ID, FeatureFlagEnvironment.JSON_PROPERTY_ENVIRONMENT_ID, FeatureFlagEnvironment.JSON_PROPERTY_ENVIRONMENT_NAME, + FeatureFlagEnvironment.JSON_PROPERTY_ENVIRONMENT_QUERIES, FeatureFlagEnvironment.JSON_PROPERTY_IS_PRODUCTION, FeatureFlagEnvironment.JSON_PROPERTY_OVERRIDE_ALLOCATION_KEY, FeatureFlagEnvironment.JSON_PROPERTY_OVERRIDE_VARIANT_ID, @@ -57,6 +58,9 @@ public class FeatureFlagEnvironment { public static final String JSON_PROPERTY_ENVIRONMENT_NAME = "environment_name"; private String environmentName; + public static final String JSON_PROPERTY_ENVIRONMENT_QUERIES = "environment_queries"; + private List environmentQueries = null; + public static final String JSON_PROPERTY_IS_PRODUCTION = "is_production"; private Boolean isProduction; @@ -229,6 +233,35 @@ public void setEnvironmentName(String environmentName) { this.environmentName = environmentName; } + public FeatureFlagEnvironment environmentQueries(List environmentQueries) { + this.environmentQueries = environmentQueries; + return this; + } + + public FeatureFlagEnvironment addEnvironmentQueriesItem(String environmentQueriesItem) { + if (this.environmentQueries == null) { + this.environmentQueries = new ArrayList<>(); + } + this.environmentQueries.add(environmentQueriesItem); + return this; + } + + /** + * Queries that target this environment. + * + * @return environmentQueries + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ENVIRONMENT_QUERIES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getEnvironmentQueries() { + return environmentQueries; + } + + public void setEnvironmentQueries(List environmentQueries) { + this.environmentQueries = environmentQueries; + } + public FeatureFlagEnvironment isProduction(Boolean isProduction) { this.isProduction = isProduction; return this; @@ -489,6 +522,7 @@ public boolean equals(Object o) { && Objects.equals(this.defaultVariantId, featureFlagEnvironment.defaultVariantId) && Objects.equals(this.environmentId, featureFlagEnvironment.environmentId) && Objects.equals(this.environmentName, featureFlagEnvironment.environmentName) + && Objects.equals(this.environmentQueries, featureFlagEnvironment.environmentQueries) && Objects.equals(this.isProduction, featureFlagEnvironment.isProduction) && Objects.equals(this.overrideAllocationKey, featureFlagEnvironment.overrideAllocationKey) && Objects.equals(this.overrideVariantId, featureFlagEnvironment.overrideVariantId) @@ -509,6 +543,7 @@ public int hashCode() { defaultVariantId, environmentId, environmentName, + environmentQueries, isProduction, overrideAllocationKey, overrideVariantId, @@ -531,6 +566,7 @@ public String toString() { sb.append(" defaultVariantId: ").append(toIndentedString(defaultVariantId)).append("\n"); sb.append(" environmentId: ").append(toIndentedString(environmentId)).append("\n"); sb.append(" environmentName: ").append(toIndentedString(environmentName)).append("\n"); + sb.append(" environmentQueries: ").append(toIndentedString(environmentQueries)).append("\n"); sb.append(" isProduction: ").append(toIndentedString(isProduction)).append("\n"); sb.append(" overrideAllocationKey: ") .append(toIndentedString(overrideAllocationKey)) diff --git a/src/main/java/com/datadog/api/client/v2/model/GuardrailMetric.java b/src/main/java/com/datadog/api/client/v2/model/GuardrailMetric.java new file mode 100644 index 00000000000..0e0e3874676 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GuardrailMetric.java @@ -0,0 +1,217 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Guardrail metric details. */ +@JsonPropertyOrder({ + GuardrailMetric.JSON_PROPERTY_METRIC_ID, + GuardrailMetric.JSON_PROPERTY_TRIGGER_ACTION, + GuardrailMetric.JSON_PROPERTY_TRIGGERED_BY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuardrailMetric { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_METRIC_ID = "metric_id"; + private String metricId; + + public static final String JSON_PROPERTY_TRIGGER_ACTION = "trigger_action"; + private GuardrailTriggerAction triggerAction; + + public static final String JSON_PROPERTY_TRIGGERED_BY = "triggered_by"; + private JsonNullable triggeredBy = JsonNullable.undefined(); + + public GuardrailMetric() {} + + @JsonCreator + public GuardrailMetric( + @JsonProperty(required = true, value = JSON_PROPERTY_METRIC_ID) String metricId, + @JsonProperty(required = true, value = JSON_PROPERTY_TRIGGER_ACTION) + GuardrailTriggerAction triggerAction) { + this.metricId = metricId; + this.triggerAction = triggerAction; + this.unparsed |= !triggerAction.isValid(); + } + + public GuardrailMetric metricId(String metricId) { + this.metricId = metricId; + return this; + } + + /** + * The metric ID to monitor. + * + * @return metricId + */ + @JsonProperty(JSON_PROPERTY_METRIC_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMetricId() { + return metricId; + } + + public void setMetricId(String metricId) { + this.metricId = metricId; + } + + public GuardrailMetric triggerAction(GuardrailTriggerAction triggerAction) { + this.triggerAction = triggerAction; + this.unparsed |= !triggerAction.isValid(); + return this; + } + + /** + * Action to perform when a guardrail threshold is triggered. + * + * @return triggerAction + */ + @JsonProperty(JSON_PROPERTY_TRIGGER_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuardrailTriggerAction getTriggerAction() { + return triggerAction; + } + + public void setTriggerAction(GuardrailTriggerAction triggerAction) { + if (!triggerAction.isValid()) { + this.unparsed = true; + } + this.triggerAction = triggerAction; + } + + public GuardrailMetric triggeredBy(String triggeredBy) { + this.triggeredBy = JsonNullable.of(triggeredBy); + return this; + } + + /** + * The signal or system that triggered the action. + * + * @return triggeredBy + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getTriggeredBy() { + return triggeredBy.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_TRIGGERED_BY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getTriggeredBy_JsonNullable() { + return triggeredBy; + } + + @JsonProperty(JSON_PROPERTY_TRIGGERED_BY) + public void setTriggeredBy_JsonNullable(JsonNullable triggeredBy) { + this.triggeredBy = triggeredBy; + } + + public void setTriggeredBy(String triggeredBy) { + this.triggeredBy = JsonNullable.of(triggeredBy); + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GuardrailMetric + */ + @JsonAnySetter + public GuardrailMetric putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GuardrailMetric object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuardrailMetric guardrailMetric = (GuardrailMetric) o; + return Objects.equals(this.metricId, guardrailMetric.metricId) + && Objects.equals(this.triggerAction, guardrailMetric.triggerAction) + && Objects.equals(this.triggeredBy, guardrailMetric.triggeredBy) + && Objects.equals(this.additionalProperties, guardrailMetric.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(metricId, triggerAction, triggeredBy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuardrailMetric {\n"); + sb.append(" metricId: ").append(toIndentedString(metricId)).append("\n"); + sb.append(" triggerAction: ").append(toIndentedString(triggerAction)).append("\n"); + sb.append(" triggeredBy: ").append(toIndentedString(triggeredBy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GuardrailMetricRequest.java b/src/main/java/com/datadog/api/client/v2/model/GuardrailMetricRequest.java new file mode 100644 index 00000000000..cd7dc65851b --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GuardrailMetricRequest.java @@ -0,0 +1,179 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Guardrail metric request payload. */ +@JsonPropertyOrder({ + GuardrailMetricRequest.JSON_PROPERTY_METRIC_ID, + GuardrailMetricRequest.JSON_PROPERTY_TRIGGER_ACTION +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class GuardrailMetricRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_METRIC_ID = "metric_id"; + private String metricId; + + public static final String JSON_PROPERTY_TRIGGER_ACTION = "trigger_action"; + private GuardrailTriggerAction triggerAction; + + public GuardrailMetricRequest() {} + + @JsonCreator + public GuardrailMetricRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_METRIC_ID) String metricId, + @JsonProperty(required = true, value = JSON_PROPERTY_TRIGGER_ACTION) + GuardrailTriggerAction triggerAction) { + this.metricId = metricId; + this.triggerAction = triggerAction; + this.unparsed |= !triggerAction.isValid(); + } + + public GuardrailMetricRequest metricId(String metricId) { + this.metricId = metricId; + return this; + } + + /** + * The metric ID to monitor. + * + * @return metricId + */ + @JsonProperty(JSON_PROPERTY_METRIC_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getMetricId() { + return metricId; + } + + public void setMetricId(String metricId) { + this.metricId = metricId; + } + + public GuardrailMetricRequest triggerAction(GuardrailTriggerAction triggerAction) { + this.triggerAction = triggerAction; + this.unparsed |= !triggerAction.isValid(); + return this; + } + + /** + * Action to perform when a guardrail threshold is triggered. + * + * @return triggerAction + */ + @JsonProperty(JSON_PROPERTY_TRIGGER_ACTION) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public GuardrailTriggerAction getTriggerAction() { + return triggerAction; + } + + public void setTriggerAction(GuardrailTriggerAction triggerAction) { + if (!triggerAction.isValid()) { + this.unparsed = true; + } + this.triggerAction = triggerAction; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return GuardrailMetricRequest + */ + @JsonAnySetter + public GuardrailMetricRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this GuardrailMetricRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GuardrailMetricRequest guardrailMetricRequest = (GuardrailMetricRequest) o; + return Objects.equals(this.metricId, guardrailMetricRequest.metricId) + && Objects.equals(this.triggerAction, guardrailMetricRequest.triggerAction) + && Objects.equals(this.additionalProperties, guardrailMetricRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(metricId, triggerAction, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class GuardrailMetricRequest {\n"); + sb.append(" metricId: ").append(toIndentedString(metricId)).append("\n"); + sb.append(" triggerAction: ").append(toIndentedString(triggerAction)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/GuardrailTriggerAction.java b/src/main/java/com/datadog/api/client/v2/model/GuardrailTriggerAction.java new file mode 100644 index 00000000000..591b0030168 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/GuardrailTriggerAction.java @@ -0,0 +1,57 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** Action to perform when a guardrail threshold is triggered. */ +@JsonSerialize(using = GuardrailTriggerAction.GuardrailTriggerActionSerializer.class) +public class GuardrailTriggerAction extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("PAUSE", "ABORT")); + + public static final GuardrailTriggerAction PAUSE = new GuardrailTriggerAction("PAUSE"); + public static final GuardrailTriggerAction ABORT = new GuardrailTriggerAction("ABORT"); + + GuardrailTriggerAction(String value) { + super(value, allowedValues); + } + + public static class GuardrailTriggerActionSerializer + extends StdSerializer { + public GuardrailTriggerActionSerializer(Class t) { + super(t); + } + + public GuardrailTriggerActionSerializer() { + this(null); + } + + @Override + public void serialize( + GuardrailTriggerAction value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static GuardrailTriggerAction fromValue(String value) { + return new GuardrailTriggerAction(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/ListAllocationsResponse.java b/src/main/java/com/datadog/api/client/v2/model/ListAllocationsResponse.java new file mode 100644 index 00000000000..fa91c4e5b82 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/ListAllocationsResponse.java @@ -0,0 +1,155 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Response containing a list of targeting rules (allocations). */ +@JsonPropertyOrder({ListAllocationsResponse.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class ListAllocationsResponse { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public ListAllocationsResponse() {} + + @JsonCreator + public ListAllocationsResponse( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) + List data) { + this.data = data; + } + + public ListAllocationsResponse data(List data) { + this.data = data; + for (AllocationDataResponse item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public ListAllocationsResponse addDataItem(AllocationDataResponse dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * List of targeting rules (allocations). + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return ListAllocationsResponse + */ + @JsonAnySetter + public ListAllocationsResponse putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this ListAllocationsResponse object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ListAllocationsResponse listAllocationsResponse = (ListAllocationsResponse) o; + return Objects.equals(this.data, listAllocationsResponse.data) + && Objects.equals(this.additionalProperties, listAllocationsResponse.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ListAllocationsResponse {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/OverwriteAllocationsRequest.java b/src/main/java/com/datadog/api/client/v2/model/OverwriteAllocationsRequest.java new file mode 100644 index 00000000000..ed23b4341ff --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/OverwriteAllocationsRequest.java @@ -0,0 +1,155 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Request to overwrite targeting rules (allocations) for a feature flag in an environment. */ +@JsonPropertyOrder({OverwriteAllocationsRequest.JSON_PROPERTY_DATA}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class OverwriteAllocationsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_DATA = "data"; + private List data = new ArrayList<>(); + + public OverwriteAllocationsRequest() {} + + @JsonCreator + public OverwriteAllocationsRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_DATA) List data) { + this.data = data; + } + + public OverwriteAllocationsRequest data(List data) { + this.data = data; + for (AllocationDataRequest item : data) { + this.unparsed |= item.unparsed; + } + return this; + } + + public OverwriteAllocationsRequest addDataItem(AllocationDataRequest dataItem) { + this.data.add(dataItem); + this.unparsed |= dataItem.unparsed; + return this; + } + + /** + * Targeting rules (allocations) to replace existing ones with. + * + * @return data + */ + @JsonProperty(JSON_PROPERTY_DATA) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return OverwriteAllocationsRequest + */ + @JsonAnySetter + public OverwriteAllocationsRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this OverwriteAllocationsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OverwriteAllocationsRequest overwriteAllocationsRequest = (OverwriteAllocationsRequest) o; + return Objects.equals(this.data, overwriteAllocationsRequest.data) + && Objects.equals( + this.additionalProperties, overwriteAllocationsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(data, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OverwriteAllocationsRequest {\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RolloutOptions.java b/src/main/java/com/datadog/api/client/v2/model/RolloutOptions.java new file mode 100644 index 00000000000..95f0e1bff70 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RolloutOptions.java @@ -0,0 +1,209 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Applied progression options for a progressive rollout. */ +@JsonPropertyOrder({ + RolloutOptions.JSON_PROPERTY_AUTOSTART, + RolloutOptions.JSON_PROPERTY_SELECTION_INTERVAL_MS, + RolloutOptions.JSON_PROPERTY_STRATEGY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RolloutOptions { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTOSTART = "autostart"; + private Boolean autostart; + + public static final String JSON_PROPERTY_SELECTION_INTERVAL_MS = "selection_interval_ms"; + private Long selectionIntervalMs; + + public static final String JSON_PROPERTY_STRATEGY = "strategy"; + private RolloutStrategy strategy; + + public RolloutOptions() {} + + @JsonCreator + public RolloutOptions( + @JsonProperty(required = true, value = JSON_PROPERTY_AUTOSTART) Boolean autostart, + @JsonProperty(required = true, value = JSON_PROPERTY_SELECTION_INTERVAL_MS) + Long selectionIntervalMs, + @JsonProperty(required = true, value = JSON_PROPERTY_STRATEGY) RolloutStrategy strategy) { + this.autostart = autostart; + this.selectionIntervalMs = selectionIntervalMs; + this.strategy = strategy; + this.unparsed |= !strategy.isValid(); + } + + public RolloutOptions autostart(Boolean autostart) { + this.autostart = autostart; + return this; + } + + /** + * Whether the schedule starts automatically. + * + * @return autostart + */ + @JsonProperty(JSON_PROPERTY_AUTOSTART) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Boolean getAutostart() { + return autostart; + } + + public void setAutostart(Boolean autostart) { + this.autostart = autostart; + } + + public RolloutOptions selectionIntervalMs(Long selectionIntervalMs) { + this.selectionIntervalMs = selectionIntervalMs; + return this; + } + + /** + * Interval in milliseconds for uniform interval strategies. + * + * @return selectionIntervalMs + */ + @JsonProperty(JSON_PROPERTY_SELECTION_INTERVAL_MS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Long getSelectionIntervalMs() { + return selectionIntervalMs; + } + + public void setSelectionIntervalMs(Long selectionIntervalMs) { + this.selectionIntervalMs = selectionIntervalMs; + } + + public RolloutOptions strategy(RolloutStrategy strategy) { + this.strategy = strategy; + this.unparsed |= !strategy.isValid(); + return this; + } + + /** + * The progression strategy used by a progressive rollout. + * + * @return strategy + */ + @JsonProperty(JSON_PROPERTY_STRATEGY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RolloutStrategy getStrategy() { + return strategy; + } + + public void setStrategy(RolloutStrategy strategy) { + if (!strategy.isValid()) { + this.unparsed = true; + } + this.strategy = strategy; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RolloutOptions + */ + @JsonAnySetter + public RolloutOptions putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RolloutOptions object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RolloutOptions rolloutOptions = (RolloutOptions) o; + return Objects.equals(this.autostart, rolloutOptions.autostart) + && Objects.equals(this.selectionIntervalMs, rolloutOptions.selectionIntervalMs) + && Objects.equals(this.strategy, rolloutOptions.strategy) + && Objects.equals(this.additionalProperties, rolloutOptions.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(autostart, selectionIntervalMs, strategy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RolloutOptions {\n"); + sb.append(" autostart: ").append(toIndentedString(autostart)).append("\n"); + sb.append(" selectionIntervalMs: ") + .append(toIndentedString(selectionIntervalMs)) + .append("\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RolloutOptionsRequest.java b/src/main/java/com/datadog/api/client/v2/model/RolloutOptionsRequest.java new file mode 100644 index 00000000000..b188ddd7ded --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RolloutOptionsRequest.java @@ -0,0 +1,217 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Rollout options request payload. */ +@JsonPropertyOrder({ + RolloutOptionsRequest.JSON_PROPERTY_AUTOSTART, + RolloutOptionsRequest.JSON_PROPERTY_SELECTION_INTERVAL_MS, + RolloutOptionsRequest.JSON_PROPERTY_STRATEGY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class RolloutOptionsRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_AUTOSTART = "autostart"; + private JsonNullable autostart = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_SELECTION_INTERVAL_MS = "selection_interval_ms"; + private Long selectionIntervalMs; + + public static final String JSON_PROPERTY_STRATEGY = "strategy"; + private RolloutStrategy strategy; + + public RolloutOptionsRequest() {} + + @JsonCreator + public RolloutOptionsRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_STRATEGY) RolloutStrategy strategy) { + this.strategy = strategy; + this.unparsed |= !strategy.isValid(); + } + + public RolloutOptionsRequest autostart(Boolean autostart) { + this.autostart = JsonNullable.of(autostart); + return this; + } + + /** + * Whether the schedule should begin automatically. + * + * @return autostart + */ + @jakarta.annotation.Nullable + @JsonIgnore + public Boolean getAutostart() { + return autostart.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_AUTOSTART) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getAutostart_JsonNullable() { + return autostart; + } + + @JsonProperty(JSON_PROPERTY_AUTOSTART) + public void setAutostart_JsonNullable(JsonNullable autostart) { + this.autostart = autostart; + } + + public void setAutostart(Boolean autostart) { + this.autostart = JsonNullable.of(autostart); + } + + public RolloutOptionsRequest selectionIntervalMs(Long selectionIntervalMs) { + this.selectionIntervalMs = selectionIntervalMs; + return this; + } + + /** + * Interval in milliseconds for uniform interval strategies. + * + * @return selectionIntervalMs + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_SELECTION_INTERVAL_MS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Long getSelectionIntervalMs() { + return selectionIntervalMs; + } + + public void setSelectionIntervalMs(Long selectionIntervalMs) { + this.selectionIntervalMs = selectionIntervalMs; + } + + public RolloutOptionsRequest strategy(RolloutStrategy strategy) { + this.strategy = strategy; + this.unparsed |= !strategy.isValid(); + return this; + } + + /** + * The progression strategy used by a progressive rollout. + * + * @return strategy + */ + @JsonProperty(JSON_PROPERTY_STRATEGY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public RolloutStrategy getStrategy() { + return strategy; + } + + public void setStrategy(RolloutStrategy strategy) { + if (!strategy.isValid()) { + this.unparsed = true; + } + this.strategy = strategy; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return RolloutOptionsRequest + */ + @JsonAnySetter + public RolloutOptionsRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this RolloutOptionsRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RolloutOptionsRequest rolloutOptionsRequest = (RolloutOptionsRequest) o; + return Objects.equals(this.autostart, rolloutOptionsRequest.autostart) + && Objects.equals(this.selectionIntervalMs, rolloutOptionsRequest.selectionIntervalMs) + && Objects.equals(this.strategy, rolloutOptionsRequest.strategy) + && Objects.equals(this.additionalProperties, rolloutOptionsRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(autostart, selectionIntervalMs, strategy, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RolloutOptionsRequest {\n"); + sb.append(" autostart: ").append(toIndentedString(autostart)).append("\n"); + sb.append(" selectionIntervalMs: ") + .append(toIndentedString(selectionIntervalMs)) + .append("\n"); + sb.append(" strategy: ").append(toIndentedString(strategy)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/RolloutStrategy.java b/src/main/java/com/datadog/api/client/v2/model/RolloutStrategy.java new file mode 100644 index 00000000000..d12294ba132 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/RolloutStrategy.java @@ -0,0 +1,55 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.datadog.api.client.ModelEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.StdSerializer; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +/** The progression strategy used by a progressive rollout. */ +@JsonSerialize(using = RolloutStrategy.RolloutStrategySerializer.class) +public class RolloutStrategy extends ModelEnum { + + private static final Set allowedValues = + new HashSet(Arrays.asList("UNIFORM_INTERVALS", "NO_ROLLOUT")); + + public static final RolloutStrategy UNIFORM_INTERVALS = new RolloutStrategy("UNIFORM_INTERVALS"); + public static final RolloutStrategy NO_ROLLOUT = new RolloutStrategy("NO_ROLLOUT"); + + RolloutStrategy(String value) { + super(value, allowedValues); + } + + public static class RolloutStrategySerializer extends StdSerializer { + public RolloutStrategySerializer(Class t) { + super(t); + } + + public RolloutStrategySerializer() { + this(null); + } + + @Override + public void serialize(RolloutStrategy value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { + jgen.writeObject(value.value); + } + } + + @JsonCreator + public static RolloutStrategy fromValue(String value) { + return new RolloutStrategy(value); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TargetingRule.java b/src/main/java/com/datadog/api/client/v2/model/TargetingRule.java new file mode 100644 index 00000000000..ab65e3b1005 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TargetingRule.java @@ -0,0 +1,242 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Targeting rule details. */ +@JsonPropertyOrder({ + TargetingRule.JSON_PROPERTY_CONDITIONS, + TargetingRule.JSON_PROPERTY_CREATED_AT, + TargetingRule.JSON_PROPERTY_ID, + TargetingRule.JSON_PROPERTY_UPDATED_AT +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TargetingRule { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONDITIONS = "conditions"; + private List conditions = new ArrayList<>(); + + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public TargetingRule() {} + + @JsonCreator + public TargetingRule( + @JsonProperty(required = true, value = JSON_PROPERTY_CONDITIONS) List conditions, + @JsonProperty(required = true, value = JSON_PROPERTY_CREATED_AT) OffsetDateTime createdAt, + @JsonProperty(required = true, value = JSON_PROPERTY_ID) UUID id, + @JsonProperty(required = true, value = JSON_PROPERTY_UPDATED_AT) OffsetDateTime updatedAt) { + this.conditions = conditions; + this.createdAt = createdAt; + this.id = id; + this.updatedAt = updatedAt; + } + + public TargetingRule conditions(List conditions) { + this.conditions = conditions; + for (Condition item : conditions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TargetingRule addConditionsItem(Condition conditionsItem) { + this.conditions.add(conditionsItem); + this.unparsed |= conditionsItem.unparsed; + return this; + } + + /** + * Conditions evaluated by this targeting rule. + * + * @return conditions + */ + @JsonProperty(JSON_PROPERTY_CONDITIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getConditions() { + return conditions; + } + + public void setConditions(List conditions) { + this.conditions = conditions; + } + + public TargetingRule createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp when the targeting rule was created. + * + * @return createdAt + */ + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public TargetingRule id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the targeting rule. + * + * @return id + */ + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public TargetingRule updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when the targeting rule was last updated. + * + * @return updatedAt + */ + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return TargetingRule + */ + @JsonAnySetter + public TargetingRule putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this TargetingRule object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TargetingRule targetingRule = (TargetingRule) o; + return Objects.equals(this.conditions, targetingRule.conditions) + && Objects.equals(this.createdAt, targetingRule.createdAt) + && Objects.equals(this.id, targetingRule.id) + && Objects.equals(this.updatedAt, targetingRule.updatedAt) + && Objects.equals(this.additionalProperties, targetingRule.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(conditions, createdAt, id, updatedAt, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TargetingRule {\n"); + sb.append(" conditions: ").append(toIndentedString(conditions)).append("\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/TargetingRuleRequest.java b/src/main/java/com/datadog/api/client/v2/model/TargetingRuleRequest.java new file mode 100644 index 00000000000..5b2795b4e38 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/TargetingRuleRequest.java @@ -0,0 +1,155 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** Targeting rule request payload. */ +@JsonPropertyOrder({TargetingRuleRequest.JSON_PROPERTY_CONDITIONS}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class TargetingRuleRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CONDITIONS = "conditions"; + private List conditions = new ArrayList<>(); + + public TargetingRuleRequest() {} + + @JsonCreator + public TargetingRuleRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_CONDITIONS) + List conditions) { + this.conditions = conditions; + } + + public TargetingRuleRequest conditions(List conditions) { + this.conditions = conditions; + for (ConditionRequest item : conditions) { + this.unparsed |= item.unparsed; + } + return this; + } + + public TargetingRuleRequest addConditionsItem(ConditionRequest conditionsItem) { + this.conditions.add(conditionsItem); + this.unparsed |= conditionsItem.unparsed; + return this; + } + + /** + * Conditions that must match for this rule. + * + * @return conditions + */ + @JsonProperty(JSON_PROPERTY_CONDITIONS) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public List getConditions() { + return conditions; + } + + public void setConditions(List conditions) { + this.conditions = conditions; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return TargetingRuleRequest + */ + @JsonAnySetter + public TargetingRuleRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this TargetingRuleRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TargetingRuleRequest targetingRuleRequest = (TargetingRuleRequest) o; + return Objects.equals(this.conditions, targetingRuleRequest.conditions) + && Objects.equals(this.additionalProperties, targetingRuleRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(conditions, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TargetingRuleRequest {\n"); + sb.append(" conditions: ").append(toIndentedString(conditions)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/UpsertAllocationRequest.java b/src/main/java/com/datadog/api/client/v2/model/UpsertAllocationRequest.java new file mode 100644 index 00000000000..71fe8568430 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/UpsertAllocationRequest.java @@ -0,0 +1,430 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; +import org.openapitools.jackson.nullable.JsonNullable; + +/** Request to create or update a targeting rule (allocation) for a feature flag environment. */ +@JsonPropertyOrder({ + UpsertAllocationRequest.JSON_PROPERTY_EXPERIMENT_ID, + UpsertAllocationRequest.JSON_PROPERTY_EXPOSURE_SCHEDULE, + UpsertAllocationRequest.JSON_PROPERTY_GUARDRAIL_METRICS, + UpsertAllocationRequest.JSON_PROPERTY_ID, + UpsertAllocationRequest.JSON_PROPERTY_KEY, + UpsertAllocationRequest.JSON_PROPERTY_NAME, + UpsertAllocationRequest.JSON_PROPERTY_TARGETING_RULES, + UpsertAllocationRequest.JSON_PROPERTY_TYPE, + UpsertAllocationRequest.JSON_PROPERTY_VARIANT_WEIGHTS +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class UpsertAllocationRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_EXPERIMENT_ID = "experiment_id"; + private JsonNullable experimentId = JsonNullable.undefined(); + + public static final String JSON_PROPERTY_EXPOSURE_SCHEDULE = "exposure_schedule"; + private ExposureScheduleRequest exposureSchedule; + + public static final String JSON_PROPERTY_GUARDRAIL_METRICS = "guardrail_metrics"; + private List guardrailMetrics = null; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_KEY = "key"; + private String key; + + public static final String JSON_PROPERTY_NAME = "name"; + private String name; + + public static final String JSON_PROPERTY_TARGETING_RULES = "targeting_rules"; + private List targetingRules = null; + + public static final String JSON_PROPERTY_TYPE = "type"; + private AllocationType type; + + public static final String JSON_PROPERTY_VARIANT_WEIGHTS = "variant_weights"; + private List variantWeights = null; + + public UpsertAllocationRequest() {} + + @JsonCreator + public UpsertAllocationRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_KEY) String key, + @JsonProperty(required = true, value = JSON_PROPERTY_NAME) String name, + @JsonProperty(required = true, value = JSON_PROPERTY_TYPE) AllocationType type) { + this.key = key; + this.name = name; + this.type = type; + this.unparsed |= !type.isValid(); + } + + public UpsertAllocationRequest experimentId(String experimentId) { + this.experimentId = JsonNullable.of(experimentId); + return this; + } + + /** + * The experiment ID for experiment-linked allocations. + * + * @return experimentId + */ + @jakarta.annotation.Nullable + @JsonIgnore + public String getExperimentId() { + return experimentId.orElse(null); + } + + @JsonProperty(JSON_PROPERTY_EXPERIMENT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public JsonNullable getExperimentId_JsonNullable() { + return experimentId; + } + + @JsonProperty(JSON_PROPERTY_EXPERIMENT_ID) + public void setExperimentId_JsonNullable(JsonNullable experimentId) { + this.experimentId = experimentId; + } + + public void setExperimentId(String experimentId) { + this.experimentId = JsonNullable.of(experimentId); + } + + public UpsertAllocationRequest exposureSchedule(ExposureScheduleRequest exposureSchedule) { + this.exposureSchedule = exposureSchedule; + this.unparsed |= exposureSchedule.unparsed; + return this; + } + + /** + * Progressive release request payload. + * + * @return exposureSchedule + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_EXPOSURE_SCHEDULE) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public ExposureScheduleRequest getExposureSchedule() { + return exposureSchedule; + } + + public void setExposureSchedule(ExposureScheduleRequest exposureSchedule) { + this.exposureSchedule = exposureSchedule; + } + + public UpsertAllocationRequest guardrailMetrics(List guardrailMetrics) { + this.guardrailMetrics = guardrailMetrics; + for (GuardrailMetricRequest item : guardrailMetrics) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UpsertAllocationRequest addGuardrailMetricsItem( + GuardrailMetricRequest guardrailMetricsItem) { + if (this.guardrailMetrics == null) { + this.guardrailMetrics = new ArrayList<>(); + } + this.guardrailMetrics.add(guardrailMetricsItem); + this.unparsed |= guardrailMetricsItem.unparsed; + return this; + } + + /** + * Guardrail metrics used to monitor and auto-pause or abort. + * + * @return guardrailMetrics + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_GUARDRAIL_METRICS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getGuardrailMetrics() { + return guardrailMetrics; + } + + public void setGuardrailMetrics(List guardrailMetrics) { + this.guardrailMetrics = guardrailMetrics; + } + + public UpsertAllocationRequest id(UUID id) { + this.id = id; + return this; + } + + /** + * The unique identifier of the targeting rule allocation. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public UpsertAllocationRequest key(String key) { + this.key = key; + return this; + } + + /** + * The unique key of the targeting rule allocation. + * + * @return key + */ + @JsonProperty(JSON_PROPERTY_KEY) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public UpsertAllocationRequest name(String name) { + this.name = name; + return this; + } + + /** + * The display name of the targeting rule. + * + * @return name + */ + @JsonProperty(JSON_PROPERTY_NAME) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public UpsertAllocationRequest targetingRules(List targetingRules) { + this.targetingRules = targetingRules; + for (TargetingRuleRequest item : targetingRules) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UpsertAllocationRequest addTargetingRulesItem(TargetingRuleRequest targetingRulesItem) { + if (this.targetingRules == null) { + this.targetingRules = new ArrayList<>(); + } + this.targetingRules.add(targetingRulesItem); + this.unparsed |= targetingRulesItem.unparsed; + return this; + } + + /** + * Targeting rules that determine audience eligibility. + * + * @return targetingRules + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_TARGETING_RULES) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getTargetingRules() { + return targetingRules; + } + + public void setTargetingRules(List targetingRules) { + this.targetingRules = targetingRules; + } + + public UpsertAllocationRequest type(AllocationType type) { + this.type = type; + this.unparsed |= !type.isValid(); + return this; + } + + /** + * The type of targeting rule (called allocation in the API model). + * + * @return type + */ + @JsonProperty(JSON_PROPERTY_TYPE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public AllocationType getType() { + return type; + } + + public void setType(AllocationType type) { + if (!type.isValid()) { + this.unparsed = true; + } + this.type = type; + } + + public UpsertAllocationRequest variantWeights(List variantWeights) { + this.variantWeights = variantWeights; + for (VariantWeightRequest item : variantWeights) { + this.unparsed |= item.unparsed; + } + return this; + } + + public UpsertAllocationRequest addVariantWeightsItem(VariantWeightRequest variantWeightsItem) { + if (this.variantWeights == null) { + this.variantWeights = new ArrayList<>(); + } + this.variantWeights.add(variantWeightsItem); + this.unparsed |= variantWeightsItem.unparsed; + return this; + } + + /** + * Variant distribution weights. + * + * @return variantWeights + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VARIANT_WEIGHTS) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public List getVariantWeights() { + return variantWeights; + } + + public void setVariantWeights(List variantWeights) { + this.variantWeights = variantWeights; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return UpsertAllocationRequest + */ + @JsonAnySetter + public UpsertAllocationRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this UpsertAllocationRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpsertAllocationRequest upsertAllocationRequest = (UpsertAllocationRequest) o; + return Objects.equals(this.experimentId, upsertAllocationRequest.experimentId) + && Objects.equals(this.exposureSchedule, upsertAllocationRequest.exposureSchedule) + && Objects.equals(this.guardrailMetrics, upsertAllocationRequest.guardrailMetrics) + && Objects.equals(this.id, upsertAllocationRequest.id) + && Objects.equals(this.key, upsertAllocationRequest.key) + && Objects.equals(this.name, upsertAllocationRequest.name) + && Objects.equals(this.targetingRules, upsertAllocationRequest.targetingRules) + && Objects.equals(this.type, upsertAllocationRequest.type) + && Objects.equals(this.variantWeights, upsertAllocationRequest.variantWeights) + && Objects.equals(this.additionalProperties, upsertAllocationRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash( + experimentId, + exposureSchedule, + guardrailMetrics, + id, + key, + name, + targetingRules, + type, + variantWeights, + additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertAllocationRequest {\n"); + sb.append(" experimentId: ").append(toIndentedString(experimentId)).append("\n"); + sb.append(" exposureSchedule: ").append(toIndentedString(exposureSchedule)).append("\n"); + sb.append(" guardrailMetrics: ").append(toIndentedString(guardrailMetrics)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" targetingRules: ").append(toIndentedString(targetingRules)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" variantWeights: ").append(toIndentedString(variantWeights)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VariantWeight.java b/src/main/java/com/datadog/api/client/v2/model/VariantWeight.java new file mode 100644 index 00000000000..e92ae09f399 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VariantWeight.java @@ -0,0 +1,284 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Variant weight details. */ +@JsonPropertyOrder({ + VariantWeight.JSON_PROPERTY_CREATED_AT, + VariantWeight.JSON_PROPERTY_ID, + VariantWeight.JSON_PROPERTY_UPDATED_AT, + VariantWeight.JSON_PROPERTY_VALUE, + VariantWeight.JSON_PROPERTY_VARIANT, + VariantWeight.JSON_PROPERTY_VARIANT_ID +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class VariantWeight { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + private OffsetDateTime createdAt; + + public static final String JSON_PROPERTY_ID = "id"; + private UUID id; + + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + private OffsetDateTime updatedAt; + + public static final String JSON_PROPERTY_VALUE = "value"; + private Double value; + + public static final String JSON_PROPERTY_VARIANT = "variant"; + private Variant variant; + + public static final String JSON_PROPERTY_VARIANT_ID = "variant_id"; + private UUID variantId; + + public VariantWeight() {} + + @JsonCreator + public VariantWeight( + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) Double value, + @JsonProperty(required = true, value = JSON_PROPERTY_VARIANT_ID) UUID variantId) { + this.value = value; + this.variantId = variantId; + } + + public VariantWeight createdAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * The timestamp when the variant weight was created. + * + * @return createdAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + } + + public VariantWeight id(UUID id) { + this.id = id; + return this; + } + + /** + * Unique identifier of the variant weight assignment. + * + * @return id + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getId() { + return id; + } + + public void setId(UUID id) { + this.id = id; + } + + public VariantWeight updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + * The timestamp when the variant weight was last updated. + * + * @return updatedAt + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(OffsetDateTime updatedAt) { + this.updatedAt = updatedAt; + } + + public VariantWeight value(Double value) { + this.value = value; + return this; + } + + /** + * The percentage weight for the variant. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getValue() { + return value; + } + + public void setValue(Double value) { + this.value = value; + } + + public VariantWeight variant(Variant variant) { + this.variant = variant; + this.unparsed |= variant.unparsed; + return this; + } + + /** + * A variant of a feature flag. + * + * @return variant + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VARIANT) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public Variant getVariant() { + return variant; + } + + public void setVariant(Variant variant) { + this.variant = variant; + } + + public VariantWeight variantId(UUID variantId) { + this.variantId = variantId; + return this; + } + + /** + * The variant ID. + * + * @return variantId + */ + @JsonProperty(JSON_PROPERTY_VARIANT_ID) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public UUID getVariantId() { + return variantId; + } + + public void setVariantId(UUID variantId) { + this.variantId = variantId; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return VariantWeight + */ + @JsonAnySetter + public VariantWeight putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this VariantWeight object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VariantWeight variantWeight = (VariantWeight) o; + return Objects.equals(this.createdAt, variantWeight.createdAt) + && Objects.equals(this.id, variantWeight.id) + && Objects.equals(this.updatedAt, variantWeight.updatedAt) + && Objects.equals(this.value, variantWeight.value) + && Objects.equals(this.variant, variantWeight.variant) + && Objects.equals(this.variantId, variantWeight.variantId) + && Objects.equals(this.additionalProperties, variantWeight.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(createdAt, id, updatedAt, value, variant, variantId, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VariantWeight {\n"); + sb.append(" createdAt: ").append(toIndentedString(createdAt)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" updatedAt: ").append(toIndentedString(updatedAt)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" variant: ").append(toIndentedString(variant)).append("\n"); + sb.append(" variantId: ").append(toIndentedString(variantId)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/main/java/com/datadog/api/client/v2/model/VariantWeightRequest.java b/src/main/java/com/datadog/api/client/v2/model/VariantWeightRequest.java new file mode 100644 index 00000000000..b6dbfee31d6 --- /dev/null +++ b/src/main/java/com/datadog/api/client/v2/model/VariantWeightRequest.java @@ -0,0 +1,200 @@ +/* + * 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 2019-Present Datadog, Inc. + */ + +package com.datadog.api.client.v2.model; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.UUID; + +/** Variant weight request payload. */ +@JsonPropertyOrder({ + VariantWeightRequest.JSON_PROPERTY_VALUE, + VariantWeightRequest.JSON_PROPERTY_VARIANT_ID, + VariantWeightRequest.JSON_PROPERTY_VARIANT_KEY +}) +@jakarta.annotation.Generated( + value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator") +public class VariantWeightRequest { + @JsonIgnore public boolean unparsed = false; + public static final String JSON_PROPERTY_VALUE = "value"; + private Double value; + + public static final String JSON_PROPERTY_VARIANT_ID = "variant_id"; + private UUID variantId; + + public static final String JSON_PROPERTY_VARIANT_KEY = "variant_key"; + private String variantKey; + + public VariantWeightRequest() {} + + @JsonCreator + public VariantWeightRequest( + @JsonProperty(required = true, value = JSON_PROPERTY_VALUE) Double value) { + this.value = value; + } + + public VariantWeightRequest value(Double value) { + this.value = value; + return this; + } + + /** + * The percentage weight for this variant. + * + * @return value + */ + @JsonProperty(JSON_PROPERTY_VALUE) + @JsonInclude(value = JsonInclude.Include.ALWAYS) + public Double getValue() { + return value; + } + + public void setValue(Double value) { + this.value = value; + } + + public VariantWeightRequest variantId(UUID variantId) { + this.variantId = variantId; + return this; + } + + /** + * The variant ID to assign weight to. + * + * @return variantId + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VARIANT_ID) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public UUID getVariantId() { + return variantId; + } + + public void setVariantId(UUID variantId) { + this.variantId = variantId; + } + + public VariantWeightRequest variantKey(String variantKey) { + this.variantKey = variantKey; + return this; + } + + /** + * The variant key to assign weight to. + * + * @return variantKey + */ + @jakarta.annotation.Nullable + @JsonProperty(JSON_PROPERTY_VARIANT_KEY) + @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + public String getVariantKey() { + return variantKey; + } + + public void setVariantKey(String variantKey) { + this.variantKey = variantKey; + } + + /** + * A container for additional, undeclared properties. This is a holder for any undeclared + * properties as specified with the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. If the property + * does not already exist, create it otherwise replace it. + * + * @param key The arbitrary key to set + * @param value The associated value + * @return VariantWeightRequest + */ + @JsonAnySetter + public VariantWeightRequest putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return The additional properties + */ + @JsonAnyGetter + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key The arbitrary key to get + * @return The specific additional property for the given key + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + /** Return true if this VariantWeightRequest object is equal to o. */ + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + VariantWeightRequest variantWeightRequest = (VariantWeightRequest) o; + return Objects.equals(this.value, variantWeightRequest.value) + && Objects.equals(this.variantId, variantWeightRequest.variantId) + && Objects.equals(this.variantKey, variantWeightRequest.variantKey) + && Objects.equals(this.additionalProperties, variantWeightRequest.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(value, variantId, variantKey, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class VariantWeightRequest {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" variantId: ").append(toIndentedString(variantId)).append("\n"); + sb.append(" variantKey: ").append(toIndentedString(variantKey)).append("\n"); + sb.append(" additionalProperties: ") + .append(toIndentedString(additionalProperties)) + .append("\n"); + sb.append('}'); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/src/test/resources/cassettes/features/v2/Create_allocation_for_a_flag_in_an_environment_returns_Created_response.freeze b/src/test/resources/cassettes/features/v2/Create_allocation_for_a_flag_in_an_environment_returns_Created_response.freeze new file mode 100644 index 00000000000..7f87fe7c2da --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_allocation_for_a_flag_in_an_environment_returns_Created_response.freeze @@ -0,0 +1 @@ +2026-04-01T20:36:45.896Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Create_allocation_for_a_flag_in_an_environment_returns_Created_response.json b/src/test/resources/cassettes/features/v2/Create_allocation_for_a_flag_in_an_environment_returns_Created_response.json new file mode 100644 index 00000000000..b781fa5ed86 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Create_allocation_for_a_flag_in_an_environment_returns_Created_response.json @@ -0,0 +1,139 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/feature-flags", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "2000f9fc-f1b8-bbb8-e80e-3146f211cc6a" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/feature-flags/environments", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "b4aa4587-5896-6e2f-1514-42bc6eeff4e5" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/feature-flags/449ff1d1-7a4f-416f-a6ce-be1abd3031c1/environments/927d4fe0-11f9-4a08-8859-ae044a4e04f0/allocations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "77f01765-e879-a29c-75cc-ffebb4fbb0f2" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/feature-flags/environments/927d4fe0-11f9-4a08-8859-ae044a4e04f0", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "cabbc9b0-15b2-d2e2-efca-19cbffb11dbb" + }, + { + "httpRequest": { + "headers": {}, + "method": "POST", + "path": "/api/v2/feature-flags/449ff1d1-7a4f-416f-a6ce-be1abd3031c1/archive", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "25927ec7-4991-91bf-eaad-b4db17455be8" + } +] \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response.freeze b/src/test/resources/cassettes/features/v2/Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response.freeze new file mode 100644 index 00000000000..c59070e48be --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response.freeze @@ -0,0 +1 @@ +2026-04-01T20:36:50.944Z \ No newline at end of file diff --git a/src/test/resources/cassettes/features/v2/Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response.json b/src/test/resources/cassettes/features/v2/Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response.json new file mode 100644 index 00000000000..0e21746d8a2 --- /dev/null +++ b/src/test/resources/cassettes/features/v2/Update_targeting_rules_for_a_flag_in_an_environment_returns_OK_response.json @@ -0,0 +1,139 @@ +[ + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/feature-flags", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "9d154a2b-58f5-3c20-0baa-0e2df1de278b" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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\"}}" + }, + "headers": {}, + "method": "POST", + "path": "/api/v2/feature-flags/environments", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 201, + "reasonPhrase": "Created" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "a7ca2f07-611c-7488-65fb-c0ebde5766e9" + }, + { + "httpRequest": { + "body": { + "type": "JSON", + "json": "{\"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\"}]}" + }, + "headers": {}, + "method": "PUT", + "path": "/api/v2/feature-flags/ede225ed-3a62-4cb5-b678-73851d56c700/environments/73900c64-e4c9-46a3-ac5b-d5fa80be2b49/allocations", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}}]}}]}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "1679883d-48e3-e848-f306-c3c57f7dca71" + }, + { + "httpRequest": { + "headers": {}, + "method": "DELETE", + "path": "/api/v2/feature-flags/environments/73900c64-e4c9-46a3-ac5b-d5fa80be2b49", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "headers": {}, + "statusCode": 204, + "reasonPhrase": "No Content" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "5a04f781-dad0-3221-b852-fe7e9cb52d36" + }, + { + "httpRequest": { + "headers": {}, + "method": "POST", + "path": "/api/v2/feature-flags/ede225ed-3a62-4cb5-b678-73851d56c700/archive", + "keepAlive": false, + "secure": true + }, + "httpResponse": { + "body": "{\"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\"}]}}}", + "headers": { + "Content-Type": [ + "application/vnd.api+json" + ] + }, + "statusCode": 200, + "reasonPhrase": "OK" + }, + "times": { + "remainingTimes": 1 + }, + "timeToLive": { + "unlimited": true + }, + "id": "fbd767df-53ce-9f01-b6b7-5f3cf7a6f602" + } +] \ No newline at end of file diff --git a/src/test/resources/com/datadog/api/client/v2/api/feature_flags.feature b/src/test/resources/com/datadog/api/client/v2/api/feature_flags.feature index fcf9045b9d9..fd2ff16520c 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/feature_flags.feature +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/given.json b/src/test/resources/com/datadog/api/client/v2/api/given.json index 8413be265af..12e386bd8f7 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/given.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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/src/test/resources/com/datadog/api/client/v2/api/undo.json b/src/test/resources/com/datadog/api/client/v2/api/undo.json index 8b9940b568d..1f11ffb7e77 100644 --- a/src/test/resources/com/datadog/api/client/v2/api/undo.json +++ b/src/test/resources/com/datadog/api/client/v2/api/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": {