From 6c0102cf871f4117ce2dbb3d5a27ace4d1aa215c Mon Sep 17 00:00:00 2001 From: "ci.datadog-api-spec" Date: Fri, 3 Apr 2026 22:06:37 +0000 Subject: [PATCH] Regenerate client from commit c758880 of spec repo --- .generator/schemas/v2/openapi.yaml | 1224 +++++++++++++++++ ...nvironment-returns-Created-response.frozen | 1 + ...n-environment-returns-Created-response.yml | 134 ++ ...-an-environment-returns-OK-response.frozen | 1 + ...-in-an-environment-returns-OK-response.yml | 134 ++ ...eAllocationsForFeatureFlagInEnvironment.rb | 65 + ...sForFeatureFlagInEnvironment_3662093014.rb | 31 + .../v2/feature-flags/PauseExposureSchedule.rb | 5 + .../feature-flags/ResumeExposureSchedule.rb | 5 + .../v2/feature-flags/StartExposureSchedule.rb | 5 + .../v2/feature-flags/StopExposureSchedule.rb | 5 + ...eAllocationsForFeatureFlagInEnvironment.rb | 67 + ...sForFeatureFlagInEnvironment_3789036209.rb | 60 + features/scenarios_model_mapping.rb | 22 + features/v2/feature_flags.feature | 224 +++ features/v2/given.json | 21 + features/v2/undo.json | 36 + lib/datadog_api_client/inflector.rb | 31 + .../v2/api/feature_flags_api.rb | 415 ++++++ .../v2/models/allocation.rb | 358 +++++ .../v2/models/allocation_data_request.rb | 144 ++ .../v2/models/allocation_data_response.rb | 165 +++ .../v2/models/allocation_data_type.rb | 26 + .../allocation_exposure_guardrail_trigger.rb | 249 ++++ .../allocation_exposure_rollout_step.rb | 300 ++++ .../v2/models/allocation_exposure_schedule.rb | 282 ++++ .../allocation_exposure_schedule_data.rb | 165 +++ .../allocation_exposure_schedule_data_type.rb | 26 + .../allocation_exposure_schedule_response.rb | 123 ++ .../v2/models/allocation_response.rb | 123 ++ .../v2/models/allocation_type.rb | 27 + lib/datadog_api_client/v2/models/condition.rb | 230 ++++ .../v2/models/condition_operator.rb | 35 + .../v2/models/condition_request.rb | 167 +++ .../v2/models/create_allocations_request.rb | 123 ++ .../models/exposure_rollout_step_request.rb | 205 +++ .../v2/models/exposure_schedule_request.rb | 200 +++ .../v2/models/feature_flag_attributes.rb | 14 +- .../v2/models/feature_flag_environment.rb | 14 +- .../v2/models/guardrail_metric.rb | 162 +++ .../v2/models/guardrail_metric_request.rb | 144 ++ .../v2/models/guardrail_trigger_action.rb | 27 + .../v2/models/list_allocations_response.rb | 125 ++ .../models/overwrite_allocations_request.rb | 125 ++ .../v2/models/rollout_options.rb | 165 +++ .../v2/models/rollout_options_request.rb | 151 ++ .../v2/models/rollout_strategy.rb | 27 + .../v2/models/targeting_rule.rb | 188 +++ .../v2/models/targeting_rule_request.rb | 129 ++ .../v2/models/upsert_allocation_request.rb | 239 ++++ .../v2/models/variant_weight.rb | 184 +++ .../v2/models/variant_weight_request.rb | 143 ++ 52 files changed, 7269 insertions(+), 2 deletions(-) create mode 100644 cassettes/features/v2/feature_flags/Create-allocation-for-a-flag-in-an-environment-returns-Created-response.frozen create mode 100644 cassettes/features/v2/feature_flags/Create-allocation-for-a-flag-in-an-environment-returns-Created-response.yml create mode 100644 cassettes/features/v2/feature_flags/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response.frozen create mode 100644 cassettes/features/v2/feature_flags/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response.yml create mode 100644 examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.rb create mode 100644 examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.rb create mode 100644 examples/v2/feature-flags/PauseExposureSchedule.rb create mode 100644 examples/v2/feature-flags/ResumeExposureSchedule.rb create mode 100644 examples/v2/feature-flags/StartExposureSchedule.rb create mode 100644 examples/v2/feature-flags/StopExposureSchedule.rb create mode 100644 examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.rb create mode 100644 examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.rb create mode 100644 lib/datadog_api_client/v2/models/allocation.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_data_request.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_data_response.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_exposure_guardrail_trigger.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_exposure_rollout_step.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_exposure_schedule.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_exposure_schedule_data.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_exposure_schedule_data_type.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_exposure_schedule_response.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_response.rb create mode 100644 lib/datadog_api_client/v2/models/allocation_type.rb create mode 100644 lib/datadog_api_client/v2/models/condition.rb create mode 100644 lib/datadog_api_client/v2/models/condition_operator.rb create mode 100644 lib/datadog_api_client/v2/models/condition_request.rb create mode 100644 lib/datadog_api_client/v2/models/create_allocations_request.rb create mode 100644 lib/datadog_api_client/v2/models/exposure_rollout_step_request.rb create mode 100644 lib/datadog_api_client/v2/models/exposure_schedule_request.rb create mode 100644 lib/datadog_api_client/v2/models/guardrail_metric.rb create mode 100644 lib/datadog_api_client/v2/models/guardrail_metric_request.rb create mode 100644 lib/datadog_api_client/v2/models/guardrail_trigger_action.rb create mode 100644 lib/datadog_api_client/v2/models/list_allocations_response.rb create mode 100644 lib/datadog_api_client/v2/models/overwrite_allocations_request.rb create mode 100644 lib/datadog_api_client/v2/models/rollout_options.rb create mode 100644 lib/datadog_api_client/v2/models/rollout_options_request.rb create mode 100644 lib/datadog_api_client/v2/models/rollout_strategy.rb create mode 100644 lib/datadog_api_client/v2/models/targeting_rule.rb create mode 100644 lib/datadog_api_client/v2/models/targeting_rule_request.rb create mode 100644 lib/datadog_api_client/v2/models/upsert_allocation_request.rb create mode 100644 lib/datadog_api_client/v2/models/variant_weight.rb create mode 100644 lib/datadog_api_client/v2/models/variant_weight_request.rb diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 45672b441bd8..e83df8269e5f 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -1277,6 +1277,15 @@ components: example: "550e8400-e29b-41d4-a716-446655440001" format: uuid type: string + exposure_schedule_id: + description: The ID of the exposure schedule. + in: path + name: exposure_schedule_id + required: true + schema: + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string feature_flag_id: description: The ID of the feature flag. in: path @@ -3348,6 +3357,334 @@ components: - WARN - ERROR - OK + Allocation: + description: Targeting rule (allocation) details for a feature flag environment. + properties: + created_at: + description: The timestamp when the targeting rule allocation was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + environment_ids: + description: Environment IDs associated with this targeting rule allocation. + example: + - "550e8400-e29b-41d4-a716-446655440001" + items: + description: Environment ID linked to this targeting rule allocation. + format: uuid + type: string + type: array + experiment_id: + description: The experiment ID linked to this targeting rule allocation. + example: "550e8400-e29b-41d4-a716-446655440030" + nullable: true + type: string + exposure_schedule: + $ref: "#/components/schemas/AllocationExposureSchedule" + guardrail_metrics: + description: Guardrail metrics associated with this targeting rule allocation. + items: + $ref: "#/components/schemas/GuardrailMetric" + type: array + id: + description: The unique identifier of the targeting rule allocation. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + key: + description: The unique key of the targeting rule allocation. + example: "prod-rollout" + type: string + name: + description: The display name of the targeting rule. + example: "Production Rollout" + type: string + order_position: + description: Sort order position within the environment. + example: 0 + format: int64 + type: integer + targeting_rules: + description: Conditions associated with this targeting rule allocation. + items: + $ref: "#/components/schemas/TargetingRule" + type: array + type: + $ref: "#/components/schemas/AllocationType" + updated_at: + description: The timestamp when the targeting rule allocation was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + variant_weights: + description: Weighted variant assignments for this targeting rule allocation. + items: + $ref: "#/components/schemas/VariantWeight" + type: array + required: + - name + - key + - targeting_rules + - variant_weights + - order_position + - environment_ids + - type + - guardrail_metrics + - created_at + - updated_at + type: object + AllocationDataRequest: + description: Data wrapper for allocation request payloads. + properties: + attributes: + $ref: "#/components/schemas/UpsertAllocationRequest" + type: + $ref: "#/components/schemas/AllocationDataType" + required: + - type + - attributes + type: object + AllocationDataResponse: + description: Data wrapper for targeting rule allocation responses. + properties: + attributes: + $ref: "#/components/schemas/Allocation" + id: + description: The unique identifier of the targeting rule allocation. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + type: + $ref: "#/components/schemas/AllocationDataType" + required: + - id + - type + - attributes + type: object + AllocationDataType: + description: The resource type. + enum: + - "allocations" + example: "allocations" + type: string + x-enum-varnames: + - ALLOCATIONS + AllocationExposureGuardrailTrigger: + description: Guardrail trigger details for a progressive rollout. + properties: + allocation_exposure_schedule_id: + description: The progressive rollout ID this trigger belongs to. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + created_at: + description: The timestamp when this trigger was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + flagging_variant_id: + description: The variant ID that triggered this event. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + id: + description: The unique identifier of the guardrail trigger. + example: "550e8400-e29b-41d4-a716-446655440080" + format: uuid + type: string + metric_id: + description: The metric ID associated with the trigger. + example: "metric-error-rate" + type: string + triggered_action: + description: The action that was triggered. + example: "PAUSE" + type: string + updated_at: + description: The timestamp when this trigger was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + required: + - id + - allocation_exposure_schedule_id + - flagging_variant_id + - metric_id + - triggered_action + - created_at + - updated_at + type: object + AllocationExposureRolloutStep: + description: Exposure progression step details. + properties: + allocation_exposure_schedule_id: + description: The progressive rollout ID this step belongs to. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + created_at: + description: The timestamp when the progression step was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + exposure_ratio: + description: The exposure ratio for this step. + example: 0.1 + format: double + maximum: 1 + minimum: 0 + type: number + grouped_step_index: + description: Logical index grouping related steps. + example: 0 + format: int64 + minimum: 0 + type: integer + id: + description: The unique identifier of the progression step. + example: "550e8400-e29b-41d4-a716-446655440040" + format: uuid + type: string + interval_ms: + description: Step duration in milliseconds. + example: 3600000 + format: int64 + nullable: true + type: integer + is_pause_record: + description: Whether this step represents a pause record. + example: false + type: boolean + order_position: + description: Sort order for the progression step. + example: 0 + format: int64 + type: integer + updated_at: + description: The timestamp when the progression step was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + required: + - id + - allocation_exposure_schedule_id + - order_position + - exposure_ratio + - is_pause_record + - grouped_step_index + - created_at + - updated_at + type: object + AllocationExposureSchedule: + description: Progressive release details for a targeting rule allocation. + properties: + absolute_start_time: + description: The absolute UTC start time for this schedule. + example: "2025-06-13T12:00:00Z" + format: date-time + nullable: true + type: string + allocation_id: + description: The targeting rule allocation ID this progressive rollout belongs to. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + control_variant_id: + description: The control variant ID used for experiment comparisons. + example: "550e8400-e29b-41d4-a716-446655440012" + nullable: true + type: string + created_at: + description: The timestamp when the schedule was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + guardrail_triggered_action: + description: Last guardrail action triggered for this schedule. + example: "PAUSE" + nullable: true + type: string + guardrail_triggers: + description: Guardrail trigger records for this schedule. + items: + $ref: "#/components/schemas/AllocationExposureGuardrailTrigger" + type: array + id: + description: The unique identifier of the progressive rollout. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + rollout_options: + $ref: "#/components/schemas/RolloutOptions" + rollout_steps: + description: Ordered progression steps for exposure. + items: + $ref: "#/components/schemas/AllocationExposureRolloutStep" + type: array + updated_at: + description: The timestamp when the schedule was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + required: + - allocation_id + - rollout_options + - rollout_steps + - guardrail_triggers + - created_at + - updated_at + type: object + AllocationExposureScheduleData: + description: Data wrapper for progressive rollout schedule responses. + properties: + attributes: + $ref: "#/components/schemas/AllocationExposureSchedule" + id: + description: The unique identifier of the progressive rollout. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + type: + $ref: "#/components/schemas/AllocationExposureScheduleDataType" + required: + - id + - type + - attributes + type: object + AllocationExposureScheduleDataType: + description: The resource type for progressive rollout schedules. + enum: + - "allocation_exposure_schedules" + example: "allocation_exposure_schedules" + type: string + x-enum-varnames: + - ALLOCATION_EXPOSURE_SCHEDULES + AllocationExposureScheduleResponse: + description: Response containing a progressive rollout schedule. + properties: + data: + $ref: "#/components/schemas/AllocationExposureScheduleData" + required: + - data + type: object + AllocationResponse: + description: Response containing a single targeting rule (allocation). + properties: + data: + $ref: "#/components/schemas/AllocationDataResponse" + required: + - data + type: object + AllocationType: + description: The type of targeting rule (called allocation in the API model). + enum: + - FEATURE_GATE + - CANARY + example: "FEATURE_GATE" + type: string + x-enum-varnames: + - FEATURE_GATE + - CANARY Annotation: description: "A list of annotations used in the workflow. These are like sticky notes for your workflow!" properties: @@ -12764,6 +13101,92 @@ components: - SEARCH - CONTAINER - CALLOUTVALUE + Condition: + description: Targeting condition details. + properties: + attribute: + description: The user or request attribute to evaluate. + example: "country" + type: string + created_at: + description: The timestamp when the condition was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + id: + description: The unique identifier of the condition. + example: "550e8400-e29b-41d4-a716-446655440070" + format: uuid + type: string + operator: + $ref: "#/components/schemas/ConditionOperator" + updated_at: + description: The timestamp when the condition was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + value: + description: Values used by the selected operator. + example: ["US", "CA"] + items: + description: Target value for the selected operator. + type: string + type: array + required: + - id + - operator + - attribute + - value + - created_at + - updated_at + type: object + ConditionOperator: + description: The operator used in a targeting condition. + enum: + - LT + - LTE + - GT + - GTE + - MATCHES + - NOT_MATCHES + - ONE_OF + - NOT_ONE_OF + - IS_NULL + - EQUALS + example: "ONE_OF" + type: string + x-enum-varnames: + - LT + - LTE + - GT + - GTE + - MATCHES + - NOT_MATCHES + - ONE_OF + - NOT_ONE_OF + - IS_NULL + - EQUALS + ConditionRequest: + description: Condition request payload for targeting rules. + properties: + attribute: + description: The user or request attribute to evaluate. + example: "user_tier" + type: string + operator: + $ref: "#/components/schemas/ConditionOperator" + value: + description: Values used by the selected operator. + example: ["premium", "enterprise"] + items: + description: Target value for the selected operator. + type: string + type: array + required: + - operator + - attribute + - value + type: object ConfigCatCredentials: description: The definition of the `ConfigCatCredentials` object. oneOf: @@ -14190,6 +14613,14 @@ components: data: $ref: "#/components/schemas/ActionConnectionData" type: object + CreateAllocationsRequest: + description: Request to create targeting rules (allocations) for a feature flag in an environment. + properties: + data: + $ref: "#/components/schemas/AllocationDataRequest" + required: + - data + type: object CreateAppRequest: description: A request object for creating a new app. example: @@ -24613,6 +25044,78 @@ components: example: "One or several indexes are missing or invalid. Results hold data from the other indexes." type: string type: object + ExposureRolloutStepRequest: + description: Rollout step request payload. + properties: + exposure_ratio: + description: The exposure ratio for this step. + example: 0.5 + format: double + maximum: 1 + minimum: 0 + type: number + grouped_step_index: + description: Logical index grouping related steps. + example: 1 + format: int64 + minimum: 0 + type: integer + id: + description: The unique identifier of the progression step. + example: "550e8400-e29b-41d4-a716-446655440040" + format: uuid + type: string + interval_ms: + description: Step duration in milliseconds. + example: 3600000 + format: int64 + nullable: true + type: integer + is_pause_record: + description: Whether this step represents a pause record. + example: false + type: boolean + required: + - exposure_ratio + - is_pause_record + - grouped_step_index + type: object + ExposureScheduleRequest: + description: Progressive release request payload. + properties: + absolute_start_time: + description: The absolute UTC start time for this schedule. + example: "2025-06-13T12:00:00Z" + format: date-time + nullable: true + type: string + control_variant_id: + description: The control variant ID used for experiment comparisons. + example: "550e8400-e29b-41d4-a716-446655440012" + nullable: true + type: string + control_variant_key: + description: The control variant key used during creation workflows. + example: "control" + nullable: true + type: string + id: + description: The unique identifier of the progressive rollout. + example: "550e8400-e29b-41d4-a716-446655440010" + format: uuid + type: string + rollout_options: + $ref: "#/components/schemas/RolloutOptionsRequest" + rollout_steps: + description: Ordered progression steps for exposure. + items: + $ref: "#/components/schemas/ExposureRolloutStepRequest" + minItems: 1 + type: array + required: + - rollout_options + - rollout_steps + type: object FacetInfoRequest: description: Request body for retrieving facet value information for a specified attribute with optional filtering. example: @@ -25109,6 +25612,12 @@ components: description: Indicates whether this feature flag requires approval for changes. example: false type: boolean + tags: + description: Tags associated with the feature flag. + example: [] + items: + type: string + type: array updated_at: description: The timestamp when the feature flag was last updated. example: "2023-01-01T00:00:00Z" @@ -25154,6 +25663,14 @@ components: description: The name of the environment. example: "env-search-term" type: string + environment_queries: + description: Queries that target this environment. + example: + - "test-feature-flag" + - "env-search-term" + items: + type: string + type: array is_production: description: Indicates whether the environment is production. example: false @@ -29346,6 +29863,47 @@ components: example: "env:production" type: string type: array + GuardrailMetric: + description: Guardrail metric details. + properties: + metric_id: + description: The metric ID to monitor. + example: "metric-error-rate" + type: string + trigger_action: + $ref: "#/components/schemas/GuardrailTriggerAction" + triggered_by: + description: The signal or system that triggered the action. + example: "guardrail_monitor" + nullable: true + type: string + required: + - metric_id + - trigger_action + type: object + GuardrailMetricRequest: + description: Guardrail metric request payload. + properties: + metric_id: + description: The metric ID to monitor. + example: "metric-error-rate" + type: string + trigger_action: + $ref: "#/components/schemas/GuardrailTriggerAction" + required: + - metric_id + - trigger_action + type: object + GuardrailTriggerAction: + description: Action to perform when a guardrail threshold is triggered. + enum: + - PAUSE + - ABORT + example: "PAUSE" + type: string + x-enum-varnames: + - PAUSE + - ABORT HTTPBody: description: The definition of `HTTPBody` object. properties: @@ -36653,6 +37211,18 @@ components: format: int64 type: integer type: object + ListAllocationsResponse: + description: Response containing a list of targeting rules (allocations). + properties: + data: + description: List of targeting rules (allocations). + items: + $ref: "#/components/schemas/AllocationDataResponse" + description: Allocation item. + type: array + required: + - data + type: object ListAppKeyRegistrationsResponse: description: A paginated list of app key registrations. properties: @@ -47881,6 +48451,17 @@ components: - ARRAY_NUMBER - ARRAY_BOOLEAN - ARRAY_OBJECT + OverwriteAllocationsRequest: + description: Request to overwrite targeting rules (allocations) for a feature flag in an environment. + properties: + data: + description: Targeting rules (allocations) to replace existing ones with. + items: + $ref: "#/components/schemas/AllocationDataRequest" + type: array + required: + - data + type: object PageUrgency: default: high description: On-Call Page urgency level. @@ -53648,6 +54229,53 @@ components: type: string x-enum-varnames: - ROLES + RolloutOptions: + description: Applied progression options for a progressive rollout. + properties: + autostart: + description: Whether the schedule starts automatically. + example: false + type: boolean + selection_interval_ms: + description: Interval in milliseconds for uniform interval strategies. + example: 3600000 + format: int64 + type: integer + strategy: + $ref: "#/components/schemas/RolloutStrategy" + required: + - strategy + - autostart + - selection_interval_ms + type: object + RolloutOptionsRequest: + description: Rollout options request payload. + properties: + autostart: + description: Whether the schedule should begin automatically. + example: false + nullable: true + type: boolean + selection_interval_ms: + description: Interval in milliseconds for uniform interval strategies. + example: 3600000 + format: int64 + type: integer + strategy: + $ref: "#/components/schemas/RolloutStrategy" + required: + - strategy + type: object + RolloutStrategy: + description: The progression strategy used by a progressive rollout. + enum: + - UNIFORM_INTERVALS + - NO_ROLLOUT + example: "UNIFORM_INTERVALS" + type: string + x-enum-varnames: + - UNIFORM_INTERVALS + - NO_ROLLOUT RoutingRule: description: Represents a routing rule, including its attributes, relationships, and unique identifier. properties: @@ -67088,6 +67716,47 @@ components: description: Tag associated with your event. type: string type: array + TargetingRule: + description: Targeting rule details. + properties: + conditions: + description: Conditions evaluated by this targeting rule. + items: + $ref: "#/components/schemas/Condition" + type: array + created_at: + description: The timestamp when the targeting rule was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + id: + description: The unique identifier of the targeting rule. + example: "550e8400-e29b-41d4-a716-446655440060" + format: uuid + type: string + updated_at: + description: The timestamp when the targeting rule was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + required: + - id + - conditions + - created_at + - updated_at + type: object + TargetingRuleRequest: + description: Targeting rule request payload. + properties: + conditions: + description: Conditions that must match for this rule. + items: + $ref: "#/components/schemas/ConditionRequest" + minItems: 1 + type: array + required: + - conditions + type: object Targets: description: |- List of recipients to notify when a notification rule is triggered. Many different target types are supported, @@ -71274,6 +71943,51 @@ components: data: $ref: "#/components/schemas/WorkflowDataUpdate" type: object + UpsertAllocationRequest: + description: Request to create or update a targeting rule (allocation) for a feature flag environment. + properties: + experiment_id: + description: The experiment ID for experiment-linked allocations. + example: "550e8400-e29b-41d4-a716-446655440030" + nullable: true + type: string + exposure_schedule: + $ref: "#/components/schemas/ExposureScheduleRequest" + guardrail_metrics: + description: Guardrail metrics used to monitor and auto-pause or abort. + items: + $ref: "#/components/schemas/GuardrailMetricRequest" + type: array + id: + description: The unique identifier of the targeting rule allocation. + example: "550e8400-e29b-41d4-a716-446655440020" + format: uuid + type: string + key: + description: The unique key of the targeting rule allocation. + example: "prod-rollout" + type: string + name: + description: The display name of the targeting rule. + example: "Production Rollout" + type: string + targeting_rules: + description: Targeting rules that determine audience eligibility. + items: + $ref: "#/components/schemas/TargetingRuleRequest" + type: array + type: + $ref: "#/components/schemas/AllocationType" + variant_weights: + description: Variant distribution weights. + items: + $ref: "#/components/schemas/VariantWeightRequest" + type: array + required: + - name + - key + - type + type: object UpsertCatalogEntityRequest: description: Create or update entity request. oneOf: @@ -72168,6 +72882,60 @@ components: - name - value type: object + VariantWeight: + description: Variant weight details. + properties: + created_at: + description: The timestamp when the variant weight was created. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + id: + description: Unique identifier of the variant weight assignment. + example: "59061199-e2ff-46e9-8b40-2193e3b21687" + format: uuid + type: string + updated_at: + description: The timestamp when the variant weight was last updated. + example: "2024-01-01T12:00:00Z" + format: date-time + type: string + value: + description: The percentage weight for the variant. + example: 50 + format: double + type: number + variant: + $ref: "#/components/schemas/Variant" + variant_id: + description: The variant ID. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + required: + - variant_id + - value + type: object + VariantWeightRequest: + description: Variant weight request payload. + properties: + value: + description: The percentage weight for this variant. + example: 50 + format: double + type: number + variant_id: + description: The variant ID to assign weight to. + example: "550e8400-e29b-41d4-a716-446655440001" + format: uuid + type: string + variant_key: + description: The variant key to assign weight to. + example: "control" + type: string + required: + - value + type: object Version: description: Version of the notification rule. It is updated when the rule is modified. example: 1 @@ -84899,6 +85667,270 @@ paths: operator: AND permissions: - feature_flag_environment_config_write + /api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/pause: + post: + description: |- + Pauses a progressive rollout while preserving rollout state. + operationId: PauseExposureSchedule + parameters: + - $ref: "#/components/parameters/exposure_schedule_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + absolute_start_time: "2025-06-13T12:00:00Z" + allocation_id: "550e8400-e29b-41d4-a716-446655440020" + control_variant_id: "550e8400-e29b-41d4-a716-446655440012" + created_at: "2024-01-01T12:00:00Z" + guardrail_triggered_action: + guardrail_triggers: [] + id: "550e8400-e29b-41d4-a716-446655440010" + rollout_options: + autostart: false + selection_interval_ms: 3600000 + strategy: "UNIFORM_INTERVALS" + rollout_steps: [] + updated_at: "2024-01-01T12:00:00Z" + schema: + $ref: "#/components/schemas/AllocationExposureScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Pause a progressive rollout + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + /api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/resume: + post: + description: |- + Resumes progression for a previously paused progressive rollout. + operationId: ResumeExposureSchedule + parameters: + - $ref: "#/components/parameters/exposure_schedule_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + absolute_start_time: "2025-06-13T12:00:00Z" + allocation_id: "550e8400-e29b-41d4-a716-446655440020" + control_variant_id: "550e8400-e29b-41d4-a716-446655440012" + created_at: "2024-01-01T12:00:00Z" + guardrail_triggered_action: + guardrail_triggers: [] + id: "550e8400-e29b-41d4-a716-446655440010" + rollout_options: + autostart: false + selection_interval_ms: 3600000 + strategy: "UNIFORM_INTERVALS" + rollout_steps: [] + updated_at: "2024-01-01T12:00:00Z" + schema: + $ref: "#/components/schemas/AllocationExposureScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Resume a progressive rollout + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + /api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/start: + post: + description: |- + Starts a progressive rollout and begins progression. + operationId: StartExposureSchedule + parameters: + - $ref: "#/components/parameters/exposure_schedule_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + absolute_start_time: "2025-06-13T12:00:00Z" + allocation_id: "550e8400-e29b-41d4-a716-446655440020" + control_variant_id: "550e8400-e29b-41d4-a716-446655440012" + created_at: "2024-01-01T12:00:00Z" + guardrail_triggered_action: + guardrail_triggers: [] + id: "550e8400-e29b-41d4-a716-446655440010" + rollout_options: + autostart: false + selection_interval_ms: 3600000 + strategy: "UNIFORM_INTERVALS" + rollout_steps: [] + updated_at: "2024-01-01T12:00:00Z" + schema: + $ref: "#/components/schemas/AllocationExposureScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Start a progressive rollout + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + /api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/stop: + post: + description: |- + Stops a progressive rollout and marks it as aborted. + operationId: StopExposureSchedule + parameters: + - $ref: "#/components/parameters/exposure_schedule_id" + responses: + "200": + content: + application/json: + examples: + default: + value: + absolute_start_time: "2025-06-13T12:00:00Z" + allocation_id: "550e8400-e29b-41d4-a716-446655440020" + control_variant_id: "550e8400-e29b-41d4-a716-446655440012" + created_at: "2024-01-01T12:00:00Z" + guardrail_triggered_action: + guardrail_triggers: [] + id: "550e8400-e29b-41d4-a716-446655440010" + rollout_options: + autostart: false + selection_interval_ms: 3600000 + strategy: "UNIFORM_INTERVALS" + rollout_steps: [] + updated_at: "2024-01-01T12:00:00Z" + schema: + $ref: "#/components/schemas/AllocationExposureScheduleResponse" + description: OK + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Stop a progressive rollout + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write /api/v2/feature-flags/{feature_flag_id}: get: description: |- @@ -85042,6 +86074,198 @@ paths: permissions: - feature_flag_config_write - feature_flag_environment_config_read + /api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations: + post: + description: |- + Creates a new targeting rule (allocation) for a specific feature flag in a specific environment. + operationId: CreateAllocationsForFeatureFlagInEnvironment + parameters: + - $ref: "#/components/parameters/feature_flag_id" + - $ref: "#/components/parameters/environment_id" + requestBody: + content: + application/json: + example: + data: + attributes: + key: "prod-rollout" + name: "Production Rollout" + type: "FEATURE_GATE" + variant_weights: + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440001" + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440002" + type: "allocations" + schema: + $ref: "#/components/schemas/CreateAllocationsRequest" + required: true + responses: + "201": + content: + application/json: + examples: + default: + value: + data: + attributes: + created_at: "2024-01-01T12:00:00Z" + environment_ids: + - "550e8400-e29b-41d4-a716-446655440001" + guardrail_metrics: [] + id: "550e8400-e29b-41d4-a716-446655440020" + key: "prod-rollout" + name: "Production Rollout" + order_position: 0 + targeting_rules: [] + type: "FEATURE_GATE" + updated_at: "2024-01-01T12:00:00Z" + variant_weights: + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440001" + id: "550e8400-e29b-41d4-a716-446655440020" + type: "allocations" + schema: + $ref: "#/components/schemas/AllocationResponse" + description: Created + "202": + content: + application/json: + schema: + $ref: "#/components/schemas/AllocationResponse" + description: Accepted - Approval required for this change + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Create targeting rules for a flag env + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write + put: + description: |- + Updates targeting rules (allocations) for a specific feature flag in a specific environment. + This operation replaces the existing allocation set with the request payload. + operationId: UpdateAllocationsForFeatureFlagInEnvironment + parameters: + - $ref: "#/components/parameters/feature_flag_id" + - $ref: "#/components/parameters/environment_id" + requestBody: + content: + application/json: + example: + data: + - attributes: + key: "prod-rollout" + name: "Production Rollout" + type: "FEATURE_GATE" + variant_weights: + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440001" + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440002" + type: "allocations" + schema: + $ref: "#/components/schemas/OverwriteAllocationsRequest" + required: true + responses: + "200": + content: + application/json: + examples: + default: + value: + data: + - attributes: + created_at: "2024-01-01T12:00:00Z" + environment_ids: + - "550e8400-e29b-41d4-a716-446655440001" + guardrail_metrics: [] + id: "550e8400-e29b-41d4-a716-446655440020" + key: "prod-rollout" + name: "Production Rollout" + order_position: 0 + targeting_rules: [] + type: "FEATURE_GATE" + updated_at: "2024-01-01T12:00:00Z" + variant_weights: + - value: 50 + variant_id: "550e8400-e29b-41d4-a716-446655440001" + id: "550e8400-e29b-41d4-a716-446655440020" + type: "allocations" + schema: + $ref: "#/components/schemas/ListAllocationsResponse" + description: OK + "202": + content: + application/json: + schema: + $ref: "#/components/schemas/ListAllocationsResponse" + description: Accepted - Approval required for this change + "400": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Bad Request + "403": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Forbidden + "404": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Not Found + "409": + content: + application/json: + schema: + $ref: "#/components/schemas/APIErrorResponse" + description: Conflict + "429": + $ref: "#/components/responses/TooManyRequestsResponse" + security: + - apiKeyAuth: [] + appKeyAuth: [] + summary: Update targeting rules for a flag + tags: + - Feature Flags + x-permission: + operator: AND + permissions: + - feature_flag_config_write /api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/disable: post: description: |- diff --git a/cassettes/features/v2/feature_flags/Create-allocation-for-a-flag-in-an-environment-returns-Created-response.frozen b/cassettes/features/v2/feature_flags/Create-allocation-for-a-flag-in-an-environment-returns-Created-response.frozen new file mode 100644 index 000000000000..7f87fe7c2dac --- /dev/null +++ b/cassettes/features/v2/feature_flags/Create-allocation-for-a-flag-in-an-environment-returns-Created-response.frozen @@ -0,0 +1 @@ +2026-04-01T20:36:45.896Z \ No newline at end of file diff --git a/cassettes/features/v2/feature_flags/Create-allocation-for-a-flag-in-an-environment-returns-Created-response.yml b/cassettes/features/v2/feature_flags/Create-allocation-for-a-flag-in-an-environment-returns-Created-response.yml new file mode 100644 index 000000000000..e1f098dfd334 --- /dev/null +++ b/cassettes/features/v2/feature_flags/Create-allocation-for-a-flag-in-an-environment-returns-Created-response.yml @@ -0,0 +1,134 @@ +http_interactions: +- recorded_at: Wed, 01 Apr 2026 20:36:45 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/feature-flags + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 201 + message: Created +- recorded_at: Wed, 01 Apr 2026 20:36:45 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/feature-flags/environments + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 201 + message: Created +- recorded_at: Wed, 01 Apr 2026 20:36:45 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/feature-flags/449ff1d1-7a4f-416f-a6ce-be1abd3031c1/environments/927d4fe0-11f9-4a08-8859-ae044a4e04f0/allocations + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 201 + message: Created +- recorded_at: Wed, 01 Apr 2026 20:36:45 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/feature-flags/environments/927d4fe0-11f9-4a08-8859-ae044a4e04f0 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Wed, 01 Apr 2026 20:36:45 GMT + request: + body: null + headers: + Accept: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/feature-flags/449ff1d1-7a4f-416f-a6ce-be1abd3031c1/archive + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/cassettes/features/v2/feature_flags/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response.frozen b/cassettes/features/v2/feature_flags/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response.frozen new file mode 100644 index 000000000000..c59070e48be0 --- /dev/null +++ b/cassettes/features/v2/feature_flags/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response.frozen @@ -0,0 +1 @@ +2026-04-01T20:36:50.944Z \ No newline at end of file diff --git a/cassettes/features/v2/feature_flags/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response.yml b/cassettes/features/v2/feature_flags/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response.yml new file mode 100644 index 000000000000..8b589da3140c --- /dev/null +++ b/cassettes/features/v2/feature_flags/Update-targeting-rules-for-a-flag-in-an-environment-returns-OK-response.yml @@ -0,0 +1,134 @@ +http_interactions: +- recorded_at: Wed, 01 Apr 2026 20:36:50 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/feature-flags + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 201 + message: Created +- recorded_at: Wed, 01 Apr 2026 20:36:50 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/feature-flags/environments + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 201 + message: Created +- recorded_at: Wed, 01 Apr 2026 20:36:50 GMT + request: + body: + encoding: UTF-8 + string: '{"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: + Accept: + - application/json + Content-Type: + - application/json + method: PUT + uri: https://api.datadoghq.com/api/v2/feature-flags/ede225ed-3a62-4cb5-b678-73851d56c700/environments/73900c64-e4c9-46a3-ac5b-d5fa80be2b49/allocations + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 200 + message: OK +- recorded_at: Wed, 01 Apr 2026 20:36:50 GMT + request: + body: null + headers: + Accept: + - '*/*' + method: DELETE + uri: https://api.datadoghq.com/api/v2/feature-flags/environments/73900c64-e4c9-46a3-ac5b-d5fa80be2b49 + response: + body: + encoding: UTF-8 + string: '' + headers: {} + status: + code: 204 + message: No Content +- recorded_at: Wed, 01 Apr 2026 20:36:50 GMT + request: + body: null + headers: + Accept: + - application/json + method: POST + uri: https://api.datadoghq.com/api/v2/feature-flags/ede225ed-3a62-4cb5-b678-73851d56c700/archive + response: + body: + encoding: UTF-8 + string: '{"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 + status: + code: 200 + message: OK +recorded_with: VCR 6.0.0 diff --git a/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.rb b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.rb new file mode 100644 index 000000000000..87ecc035c698 --- /dev/null +++ b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment.rb @@ -0,0 +1,65 @@ +# Create targeting rules for a flag env returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new + +body = DatadogAPIClient::V2::CreateAllocationsRequest.new({ + data: DatadogAPIClient::V2::AllocationDataRequest.new({ + attributes: DatadogAPIClient::V2::UpsertAllocationRequest.new({ + experiment_id: "550e8400-e29b-41d4-a716-446655440030", + exposure_schedule: DatadogAPIClient::V2::ExposureScheduleRequest.new({ + 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: DatadogAPIClient::V2::RolloutOptionsRequest.new({ + autostart: false, + selection_interval_ms: 3600000, + strategy: DatadogAPIClient::V2::RolloutStrategy::UNIFORM_INTERVALS, + }), + rollout_steps: [ + DatadogAPIClient::V2::ExposureRolloutStepRequest.new({ + exposure_ratio: 0.5, + grouped_step_index: 1, + id: "550e8400-e29b-41d4-a716-446655440040", + interval_ms: 3600000, + is_pause_record: false, + }), + ], + }), + guardrail_metrics: [ + DatadogAPIClient::V2::GuardrailMetricRequest.new({ + metric_id: "metric-error-rate", + trigger_action: DatadogAPIClient::V2::GuardrailTriggerAction::PAUSE, + }), + ], + id: "550e8400-e29b-41d4-a716-446655440020", + key: "prod-rollout", + name: "Production Rollout", + targeting_rules: [ + DatadogAPIClient::V2::TargetingRuleRequest.new({ + conditions: [ + DatadogAPIClient::V2::ConditionRequest.new({ + attribute: "user_tier", + operator: DatadogAPIClient::V2::ConditionOperator::ONE_OF, + value: [ + "premium", + "enterprise", + ], + }), + ], + }), + ], + type: DatadogAPIClient::V2::AllocationType::FEATURE_GATE, + variant_weights: [ + DatadogAPIClient::V2::VariantWeightRequest.new({ + value: 50, + variant_id: "550e8400-e29b-41d4-a716-446655440001", + variant_key: "control", + }), + ], + }), + type: DatadogAPIClient::V2::AllocationDataType::ALLOCATIONS, + }), +}) +p api_instance.create_allocations_for_feature_flag_in_environment("550e8400-e29b-41d4-a716-446655440000", "550e8400-e29b-41d4-a716-446655440001", body) diff --git a/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.rb b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.rb new file mode 100644 index 000000000000..f03fcf3a0e66 --- /dev/null +++ b/examples/v2/feature-flags/CreateAllocationsForFeatureFlagInEnvironment_3662093014.rb @@ -0,0 +1,31 @@ +# Create allocation for a flag in an environment returns "Created" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new + +# there is a valid "feature_flag" in the system +FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID = ENV["FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID"] +FEATURE_FLAG_DATA_ID = ENV["FEATURE_FLAG_DATA_ID"] + +# there is a valid "environment" in the system +ENVIRONMENT_DATA_ID = ENV["ENVIRONMENT_DATA_ID"] + +body = DatadogAPIClient::V2::CreateAllocationsRequest.new({ + data: DatadogAPIClient::V2::AllocationDataRequest.new({ + type: DatadogAPIClient::V2::AllocationDataType::ALLOCATIONS, + attributes: DatadogAPIClient::V2::UpsertAllocationRequest.new({ + name: "New targeting rule Example-Feature-Flag", + key: "new-targeting-rule-example-feature-flag", + targeting_rules: [], + variant_weights: [ + DatadogAPIClient::V2::VariantWeightRequest.new({ + variant_id: FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID, + value: 100, + }), + ], + guardrail_metrics: [], + type: DatadogAPIClient::V2::AllocationType::CANARY, + }), + }), +}) +p api_instance.create_allocations_for_feature_flag_in_environment(FEATURE_FLAG_DATA_ID, ENVIRONMENT_DATA_ID, body) diff --git a/examples/v2/feature-flags/PauseExposureSchedule.rb b/examples/v2/feature-flags/PauseExposureSchedule.rb new file mode 100644 index 000000000000..b210025a38f5 --- /dev/null +++ b/examples/v2/feature-flags/PauseExposureSchedule.rb @@ -0,0 +1,5 @@ +# Pause a progressive rollout returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new +p api_instance.pause_exposure_schedule("550e8400-e29b-41d4-a716-446655440010") diff --git a/examples/v2/feature-flags/ResumeExposureSchedule.rb b/examples/v2/feature-flags/ResumeExposureSchedule.rb new file mode 100644 index 000000000000..4ffb0df71509 --- /dev/null +++ b/examples/v2/feature-flags/ResumeExposureSchedule.rb @@ -0,0 +1,5 @@ +# Resume a progressive rollout returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new +p api_instance.resume_exposure_schedule("550e8400-e29b-41d4-a716-446655440010") diff --git a/examples/v2/feature-flags/StartExposureSchedule.rb b/examples/v2/feature-flags/StartExposureSchedule.rb new file mode 100644 index 000000000000..54910a7ae3a8 --- /dev/null +++ b/examples/v2/feature-flags/StartExposureSchedule.rb @@ -0,0 +1,5 @@ +# Start a progressive rollout returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new +p api_instance.start_exposure_schedule("550e8400-e29b-41d4-a716-446655440010") diff --git a/examples/v2/feature-flags/StopExposureSchedule.rb b/examples/v2/feature-flags/StopExposureSchedule.rb new file mode 100644 index 000000000000..75e374315651 --- /dev/null +++ b/examples/v2/feature-flags/StopExposureSchedule.rb @@ -0,0 +1,5 @@ +# Stop a progressive rollout returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new +p api_instance.stop_exposure_schedule("550e8400-e29b-41d4-a716-446655440010") diff --git a/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.rb b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.rb new file mode 100644 index 000000000000..8e2755919002 --- /dev/null +++ b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment.rb @@ -0,0 +1,67 @@ +# Update targeting rules for a flag returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new + +body = DatadogAPIClient::V2::OverwriteAllocationsRequest.new({ + data: [ + DatadogAPIClient::V2::AllocationDataRequest.new({ + attributes: DatadogAPIClient::V2::UpsertAllocationRequest.new({ + experiment_id: "550e8400-e29b-41d4-a716-446655440030", + exposure_schedule: DatadogAPIClient::V2::ExposureScheduleRequest.new({ + 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: DatadogAPIClient::V2::RolloutOptionsRequest.new({ + autostart: false, + selection_interval_ms: 3600000, + strategy: DatadogAPIClient::V2::RolloutStrategy::UNIFORM_INTERVALS, + }), + rollout_steps: [ + DatadogAPIClient::V2::ExposureRolloutStepRequest.new({ + exposure_ratio: 0.5, + grouped_step_index: 1, + id: "550e8400-e29b-41d4-a716-446655440040", + interval_ms: 3600000, + is_pause_record: false, + }), + ], + }), + guardrail_metrics: [ + DatadogAPIClient::V2::GuardrailMetricRequest.new({ + metric_id: "metric-error-rate", + trigger_action: DatadogAPIClient::V2::GuardrailTriggerAction::PAUSE, + }), + ], + id: "550e8400-e29b-41d4-a716-446655440020", + key: "prod-rollout", + name: "Production Rollout", + targeting_rules: [ + DatadogAPIClient::V2::TargetingRuleRequest.new({ + conditions: [ + DatadogAPIClient::V2::ConditionRequest.new({ + attribute: "user_tier", + operator: DatadogAPIClient::V2::ConditionOperator::ONE_OF, + value: [ + "premium", + "enterprise", + ], + }), + ], + }), + ], + type: DatadogAPIClient::V2::AllocationType::FEATURE_GATE, + variant_weights: [ + DatadogAPIClient::V2::VariantWeightRequest.new({ + value: 50, + variant_id: "550e8400-e29b-41d4-a716-446655440001", + variant_key: "control", + }), + ], + }), + type: DatadogAPIClient::V2::AllocationDataType::ALLOCATIONS, + }), + ], +}) +p api_instance.update_allocations_for_feature_flag_in_environment("550e8400-e29b-41d4-a716-446655440000", "550e8400-e29b-41d4-a716-446655440001", body) diff --git a/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.rb b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.rb new file mode 100644 index 000000000000..86fdb6604814 --- /dev/null +++ b/examples/v2/feature-flags/UpdateAllocationsForFeatureFlagInEnvironment_3789036209.rb @@ -0,0 +1,60 @@ +# Update targeting rules for a flag in an environment returns "OK" response + +require "datadog_api_client" +api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new + +# there is a valid "feature_flag" in the system +FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID = ENV["FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID"] +FEATURE_FLAG_DATA_ID = ENV["FEATURE_FLAG_DATA_ID"] + +# there is a valid "environment" in the system +ENVIRONMENT_DATA_ID = ENV["ENVIRONMENT_DATA_ID"] + +body = DatadogAPIClient::V2::OverwriteAllocationsRequest.new({ + data: [ + DatadogAPIClient::V2::AllocationDataRequest.new({ + type: DatadogAPIClient::V2::AllocationDataType::ALLOCATIONS, + attributes: DatadogAPIClient::V2::UpsertAllocationRequest.new({ + key: "overwrite-allocation-example-feature-flag", + name: "New targeting rule Example-Feature-Flag", + targeting_rules: [], + variant_weights: [ + DatadogAPIClient::V2::VariantWeightRequest.new({ + variant_id: FEATURE_FLAG_DATA_ATTRIBUTES_VARIANTS_0_ID, + value: 100, + }), + ], + exposure_schedule: DatadogAPIClient::V2::ExposureScheduleRequest.new({ + rollout_options: DatadogAPIClient::V2::RolloutOptionsRequest.new({ + strategy: DatadogAPIClient::V2::RolloutStrategy::UNIFORM_INTERVALS, + autostart: false, + selection_interval_ms: 86400000, + }), + rollout_steps: [ + DatadogAPIClient::V2::ExposureRolloutStepRequest.new({ + exposure_ratio: 0.05, + interval_ms: nil, + is_pause_record: false, + grouped_step_index: 0, + }), + DatadogAPIClient::V2::ExposureRolloutStepRequest.new({ + exposure_ratio: 0.25, + interval_ms: nil, + is_pause_record: false, + grouped_step_index: 1, + }), + DatadogAPIClient::V2::ExposureRolloutStepRequest.new({ + exposure_ratio: 1, + interval_ms: nil, + is_pause_record: false, + grouped_step_index: 2, + }), + ], + }), + guardrail_metrics: [], + type: DatadogAPIClient::V2::AllocationType::CANARY, + }), + }), + ], +}) +p api_instance.update_allocations_for_feature_flag_in_environment(FEATURE_FLAG_DATA_ID, ENVIRONMENT_DATA_ID, body) diff --git a/features/scenarios_model_mapping.rb b/features/scenarios_model_mapping.rb index 864c22a81beb..9c7dbfe9962b 100644 --- a/features/scenarios_model_mapping.rb +++ b/features/scenarios_model_mapping.rb @@ -2213,6 +2213,18 @@ "environment_id" => "UUID", "body" => "UpdateEnvironmentRequest", }, + "v2.PauseExposureSchedule" => { + "exposure_schedule_id" => "UUID", + }, + "v2.ResumeExposureSchedule" => { + "exposure_schedule_id" => "UUID", + }, + "v2.StartExposureSchedule" => { + "exposure_schedule_id" => "UUID", + }, + "v2.StopExposureSchedule" => { + "exposure_schedule_id" => "UUID", + }, "v2.GetFeatureFlag" => { "feature_flag_id" => "UUID", }, @@ -2223,6 +2235,16 @@ "v2.ArchiveFeatureFlag" => { "feature_flag_id" => "UUID", }, + "v2.CreateAllocationsForFeatureFlagInEnvironment" => { + "feature_flag_id" => "UUID", + "environment_id" => "UUID", + "body" => "CreateAllocationsRequest", + }, + "v2.UpdateAllocationsForFeatureFlagInEnvironment" => { + "feature_flag_id" => "UUID", + "environment_id" => "UUID", + "body" => "OverwriteAllocationsRequest", + }, "v2.DisableFeatureFlagEnvironment" => { "feature_flag_id" => "UUID", "environment_id" => "UUID", diff --git a/features/v2/feature_flags.feature b/features/v2/feature_flags.feature index fcf9045b9d94..fd2ff16520c5 100644 --- a/features/v2/feature_flags.feature +++ b/features/v2/feature_flags.feature @@ -53,6 +53,17 @@ Feature: Feature Flags And the response "data.attributes.name" is equal to "Test Feature Flag {{ unique }}" And the response "data.attributes.value_type" is equal to "BOOLEAN" + @team:DataDog/feature-flags + Scenario: Create allocation for a flag in an environment returns "Created" response + Given there is a valid "feature_flag" in the system + And there is a valid "environment" in the system + And new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "feature_flag.data.id" + And request contains "environment_id" parameter from "environment.data.id" + And body with value {"data":{"type":"allocations","attributes":{"name":"New targeting rule {{ unique }}","key":"new-targeting-rule-{{ unique_lower }}","targeting_rules":[],"variant_weights":[{"variant_id":"{{ feature_flag.data.attributes.variants[0].id }}","value":100}],"guardrail_metrics":[],"type":"CANARY"}}} + When the request is sent + Then the response status is 201 Created + @skip @team:DataDog/feature-flags Scenario: Create an environment returns "Bad Request" response Given new "CreateFeatureFlagsEnvironment" request @@ -74,6 +85,51 @@ Feature: Feature Flags When the request is sent Then the response status is 201 Created + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Accepted - Approval required for this change" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 202 Accepted - Approval required for this change + + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Bad Request" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Conflict" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Created" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 201 Created + + @generated @skip @team:DataDog/feature-flags + Scenario: Create targeting rules for a flag env returns "Not Found" response + Given new "CreateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": {"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}} + When the request is sent + Then the response status is 404 Not Found + @skip @team:DataDog/feature-flags Scenario: Delete an environment returns "No Content" response Given there is a valid "environment" in the system @@ -190,6 +246,118 @@ Feature: Feature Flags When the request is sent Then the response status is 200 OK + @generated @skip @team:DataDog/feature-flags + Scenario: Pause a progressive rollout returns "Bad Request" response + Given new "PauseExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Pause a progressive rollout returns "Conflict" response + Given new "PauseExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Pause a progressive rollout returns "Not Found" response + Given new "PauseExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Pause a progressive rollout returns "OK" response + Given new "PauseExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/feature-flags + Scenario: Resume a progressive rollout returns "Bad Request" response + Given new "ResumeExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Resume a progressive rollout returns "Conflict" response + Given new "ResumeExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Resume a progressive rollout returns "Not Found" response + Given new "ResumeExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Resume a progressive rollout returns "OK" response + Given new "ResumeExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/feature-flags + Scenario: Start a progressive rollout returns "Bad Request" response + Given new "StartExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Start a progressive rollout returns "Conflict" response + Given new "StartExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Start a progressive rollout returns "Not Found" response + Given new "StartExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Start a progressive rollout returns "OK" response + Given new "StartExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/feature-flags + Scenario: Stop a progressive rollout returns "Bad Request" response + Given new "StopExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Stop a progressive rollout returns "Conflict" response + Given new "StopExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Stop a progressive rollout returns "Not Found" response + Given new "StopExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Stop a progressive rollout returns "OK" response + Given new "StopExposureSchedule" request + And request contains "exposure_schedule_id" parameter from "REPLACE.ME" + When the request is sent + Then the response status is 200 OK + @skip @team:DataDog/feature-flags Scenario: Unarchive a feature flag returns "Bad Request" response Given new "UnarchiveFeatureFlag" request @@ -263,3 +431,59 @@ Feature: Feature Flags And body with value {"data": {"type": "environments", "attributes": {"name": "Updated Test Environment {{ unique }}", "queries": ["updated-{{ unique }}", "live-{{ unique }}"]}}} When the request is sent Then the response status is 200 OK + + @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag in an environment returns "OK" response + Given there is a valid "feature_flag" in the system + And there is a valid "environment" in the system + And new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "feature_flag.data.id" + And request contains "environment_id" parameter from "environment.data.id" + And body with value {"data":[{"type":"allocations","attributes":{"key":"overwrite-allocation-{{ unique_lower }}","name":"New targeting rule {{ unique }}","targeting_rules":[],"variant_weights":[{"variant_id":"{{ feature_flag.data.attributes.variants[0].id }}","value":100}],"exposure_schedule":{"rollout_options":{"strategy":"UNIFORM_INTERVALS","autostart":false,"selection_interval_ms":86400000},"rollout_steps":[{"exposure_ratio":0.05,"interval_ms":null,"is_pause_record":false,"grouped_step_index":0},{"exposure_ratio":0.25,"interval_ms":null,"is_pause_record":false,"grouped_step_index":1},{"exposure_ratio":1,"interval_ms":null,"is_pause_record":false,"grouped_step_index":2}]},"guardrail_metrics":[],"type":"CANARY"}}]} + When the request is sent + Then the response status is 200 OK + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "Accepted - Approval required for this change" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 202 Accepted - Approval required for this change + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "Bad Request" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 400 Bad Request + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "Conflict" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 409 Conflict + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "Not Found" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 404 Not Found + + @generated @skip @team:DataDog/feature-flags + Scenario: Update targeting rules for a flag returns "OK" response + Given new "UpdateAllocationsForFeatureFlagInEnvironment" request + And request contains "feature_flag_id" parameter from "REPLACE.ME" + And request contains "environment_id" parameter from "REPLACE.ME" + And body with value {"data": [{"attributes": {"experiment_id": "550e8400-e29b-41d4-a716-446655440030", "exposure_schedule": {"absolute_start_time": "2025-06-13T12:00:00Z", "control_variant_id": "550e8400-e29b-41d4-a716-446655440012", "control_variant_key": "control", "id": "550e8400-e29b-41d4-a716-446655440010", "rollout_options": {"autostart": false, "selection_interval_ms": 3600000, "strategy": "UNIFORM_INTERVALS"}, "rollout_steps": [{"exposure_ratio": 0.5, "grouped_step_index": 1, "id": "550e8400-e29b-41d4-a716-446655440040", "interval_ms": 3600000, "is_pause_record": false}]}, "guardrail_metrics": [{"metric_id": "metric-error-rate", "trigger_action": "PAUSE"}], "id": "550e8400-e29b-41d4-a716-446655440020", "key": "prod-rollout", "name": "Production Rollout", "targeting_rules": [{"conditions": [{"attribute": "user_tier", "operator": "ONE_OF", "value": ["premium", "enterprise"]}]}], "type": "FEATURE_GATE", "variant_weights": [{"value": 50, "variant_id": "550e8400-e29b-41d4-a716-446655440001", "variant_key": "control"}]}, "type": "allocations"}]} + When the request is sent + Then the response status is 200 OK diff --git a/features/v2/given.json b/features/v2/given.json index 8413be265af8..12e386bd8f73 100644 --- a/features/v2/given.json +++ b/features/v2/given.json @@ -465,6 +465,27 @@ "tag": "Feature Flags", "operationId": "CreateFeatureFlagsEnvironment" }, + { + "parameters": [ + { + "name": "feature_flag_id", + "source": "feature_flag.data.id" + }, + { + "name": "environment_id", + "source": "environment.data.id" + }, + { + "name": "body", + "value": "{\"data\":[{\"type\":\"allocations\",\"attributes\":{\"name\":\"Exposure Schedule Allocation {{ unique }}\",\"key\":\"exposure-schedule-allocation-{{ unique_lower }}\",\"type\":\"CANARY\",\"targeting_rules\":[],\"variant_weights\":[{\"variant_id\":\"{{ feature_flag.data.attributes.variants[0].id }}\",\"value\":100}],\"exposure_schedule\":{\"rollout_options\":{\"strategy\":\"UNIFORM_INTERVALS\",\"autostart\":false,\"selection_interval_ms\":86400000},\"rollout_steps\":[{\"exposure_ratio\":0.5,\"interval_ms\":null,\"is_pause_record\":false,\"grouped_step_index\":0},{\"exposure_ratio\":1,\"interval_ms\":null,\"is_pause_record\":false,\"grouped_step_index\":1}]},\"guardrail_metrics\":[]}}]}" + } + ], + "source": "data[0].attributes.exposure_schedule", + "step": "there is a valid \"exposure_schedule\" in the system", + "key": "exposure_schedule", + "tag": "Feature Flags", + "operationId": "UpdateAllocationsForFeatureFlagInEnvironment" + }, { "parameters": [ { diff --git a/features/v2/undo.json b/features/v2/undo.json index 8b9940b568da..1f11ffb7e771 100644 --- a/features/v2/undo.json +++ b/features/v2/undo.json @@ -1841,6 +1841,30 @@ "type": "idempotent" } }, + "PauseExposureSchedule": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "ResumeExposureSchedule": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "StartExposureSchedule": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "StopExposureSchedule": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, "GetFeatureFlag": { "tag": "Feature Flags", "undo": { @@ -1866,6 +1890,18 @@ "type": "unsafe" } }, + "CreateAllocationsForFeatureFlagInEnvironment": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, + "UpdateAllocationsForFeatureFlagInEnvironment": { + "tag": "Feature Flags", + "undo": { + "type": "idempotent" + } + }, "DisableFeatureFlagEnvironment": { "tag": "Feature Flags", "undo": { diff --git a/lib/datadog_api_client/inflector.rb b/lib/datadog_api_client/inflector.rb index 2ef96f9dbe3b..b38f547854a2 100644 --- a/lib/datadog_api_client/inflector.rb +++ b/lib/datadog_api_client/inflector.rb @@ -1075,6 +1075,18 @@ def overrides "v2.alert_event_custom_attributes_links_items_category" => "AlertEventCustomAttributesLinksItemsCategory", "v2.alert_event_custom_attributes_priority" => "AlertEventCustomAttributesPriority", "v2.alert_event_custom_attributes_status" => "AlertEventCustomAttributesStatus", + "v2.allocation" => "Allocation", + "v2.allocation_data_request" => "AllocationDataRequest", + "v2.allocation_data_response" => "AllocationDataResponse", + "v2.allocation_data_type" => "AllocationDataType", + "v2.allocation_exposure_guardrail_trigger" => "AllocationExposureGuardrailTrigger", + "v2.allocation_exposure_rollout_step" => "AllocationExposureRolloutStep", + "v2.allocation_exposure_schedule" => "AllocationExposureSchedule", + "v2.allocation_exposure_schedule_data" => "AllocationExposureScheduleData", + "v2.allocation_exposure_schedule_data_type" => "AllocationExposureScheduleDataType", + "v2.allocation_exposure_schedule_response" => "AllocationExposureScheduleResponse", + "v2.allocation_response" => "AllocationResponse", + "v2.allocation_type" => "AllocationType", "v2.annotation" => "Annotation", "v2.annotation_display" => "AnnotationDisplay", "v2.annotation_display_bounds" => "AnnotationDisplayBounds", @@ -1773,6 +1785,9 @@ def overrides "v2.component_properties_is_visible" => "ComponentPropertiesIsVisible", "v2.component_recommendation" => "ComponentRecommendation", "v2.component_type" => "ComponentType", + "v2.condition" => "Condition", + "v2.condition_operator" => "ConditionOperator", + "v2.condition_request" => "ConditionRequest", "v2.config_cat_credentials" => "ConfigCatCredentials", "v2.config_cat_credentials_update" => "ConfigCatCredentialsUpdate", "v2.config_cat_integration" => "ConfigCatIntegration", @@ -1869,6 +1884,7 @@ def overrides "v2.cpu" => "Cpu", "v2.create_action_connection_request" => "CreateActionConnectionRequest", "v2.create_action_connection_response" => "CreateActionConnectionResponse", + "v2.create_allocations_request" => "CreateAllocationsRequest", "v2.create_app_request" => "CreateAppRequest", "v2.create_app_request_data" => "CreateAppRequestData", "v2.create_app_request_data_attributes" => "CreateAppRequestDataAttributes", @@ -2533,6 +2549,8 @@ def overrides "v2.event_system_attributes_category" => "EventSystemAttributesCategory", "v2.event_system_attributes_integration_id" => "EventSystemAttributesIntegrationId", "v2.event_type" => "EventType", + "v2.exposure_rollout_step_request" => "ExposureRolloutStepRequest", + "v2.exposure_schedule_request" => "ExposureScheduleRequest", "v2.facet_info_request" => "FacetInfoRequest", "v2.facet_info_request_data" => "FacetInfoRequestData", "v2.facet_info_request_data_attributes" => "FacetInfoRequestDataAttributes", @@ -2843,6 +2861,9 @@ def overrides "v2.grey_noise_integration_type" => "GreyNoiseIntegrationType", "v2.grey_noise_integration_update" => "GreyNoiseIntegrationUpdate", "v2.group_scalar_column" => "GroupScalarColumn", + "v2.guardrail_metric" => "GuardrailMetric", + "v2.guardrail_metric_request" => "GuardrailMetricRequest", + "v2.guardrail_trigger_action" => "GuardrailTriggerAction", "v2.hamr_org_connection_attributes_request" => "HamrOrgConnectionAttributesRequest", "v2.hamr_org_connection_attributes_response" => "HamrOrgConnectionAttributesResponse", "v2.hamr_org_connection_data_request" => "HamrOrgConnectionDataRequest", @@ -3248,6 +3269,7 @@ def overrides "v2.leaked_key_type" => "LeakedKeyType", "v2.library" => "Library", "v2.links" => "Links", + "v2.list_allocations_response" => "ListAllocationsResponse", "v2.list_apis_response" => "ListAPIsResponse", "v2.list_apis_response_data" => "ListAPIsResponseData", "v2.list_apis_response_data_attributes" => "ListAPIsResponseDataAttributes", @@ -4088,6 +4110,7 @@ def overrides "v2.output_schema" => "OutputSchema", "v2.output_schema_parameters" => "OutputSchemaParameters", "v2.output_schema_parameters_type" => "OutputSchemaParametersType", + "v2.overwrite_allocations_request" => "OverwriteAllocationsRequest", "v2.page_urgency" => "PageUrgency", "v2.pagination" => "Pagination", "v2.pagination_meta" => "PaginationMeta", @@ -4447,6 +4470,9 @@ def overrides "v2.role_update_request" => "RoleUpdateRequest", "v2.role_update_response" => "RoleUpdateResponse", "v2.role_update_response_data" => "RoleUpdateResponseData", + "v2.rollout_options" => "RolloutOptions", + "v2.rollout_options_request" => "RolloutOptionsRequest", + "v2.rollout_strategy" => "RolloutStrategy", "v2.routing_rule" => "RoutingRule", "v2.routing_rule_action" => "RoutingRuleAction", "v2.routing_rule_attributes" => "RoutingRuleAttributes", @@ -5346,6 +5372,8 @@ def overrides "v2.table_row_resource_data_attributes" => "TableRowResourceDataAttributes", "v2.table_row_resource_data_type" => "TableRowResourceDataType", "v2.table_row_resource_identifier" => "TableRowResourceIdentifier", + "v2.targeting_rule" => "TargetingRule", + "v2.targeting_rule_request" => "TargetingRuleRequest", "v2.team" => "Team", "v2.team_attributes" => "TeamAttributes", "v2.team_connection" => "TeamConnection", @@ -5624,6 +5652,7 @@ def overrides "v2.update_tenancy_config_request" => "UpdateTenancyConfigRequest", "v2.update_workflow_request" => "UpdateWorkflowRequest", "v2.update_workflow_response" => "UpdateWorkflowResponse", + "v2.upsert_allocation_request" => "UpsertAllocationRequest", "v2.upsert_catalog_entity_request" => "UpsertCatalogEntityRequest", "v2.upsert_catalog_entity_response" => "UpsertCatalogEntityResponse", "v2.upsert_catalog_entity_response_included_item" => "UpsertCatalogEntityResponseIncludedItem", @@ -5697,6 +5726,8 @@ def overrides "v2.validation_response" => "ValidationResponse", "v2.value_type" => "ValueType", "v2.variant" => "Variant", + "v2.variant_weight" => "VariantWeight", + "v2.variant_weight_request" => "VariantWeightRequest", "v2.version_history_update" => "VersionHistoryUpdate", "v2.version_history_update_type" => "VersionHistoryUpdateType", "v2.viewership_history_session_array" => "ViewershipHistorySessionArray", diff --git a/lib/datadog_api_client/v2/api/feature_flags_api.rb b/lib/datadog_api_client/v2/api/feature_flags_api.rb index 367e4652f653..95979845b986 100644 --- a/lib/datadog_api_client/v2/api/feature_flags_api.rb +++ b/lib/datadog_api_client/v2/api/feature_flags_api.rb @@ -89,6 +89,83 @@ def archive_feature_flag_with_http_info(feature_flag_id, opts = {}) return data, status_code, headers end + # Create targeting rules for a flag env. + # + # @see #create_allocations_for_feature_flag_in_environment_with_http_info + def create_allocations_for_feature_flag_in_environment(feature_flag_id, environment_id, body, opts = {}) + data, _status_code, _headers = create_allocations_for_feature_flag_in_environment_with_http_info(feature_flag_id, environment_id, body, opts) + data + end + + # Create targeting rules for a flag env. + # + # Creates a new targeting rule (allocation) for a specific feature flag in a specific environment. + # + # @param feature_flag_id [UUID] The ID of the feature flag. + # @param environment_id [UUID] The ID of the environment. + # @param body [CreateAllocationsRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(AllocationResponse, Integer, Hash)>] AllocationResponse data, response status code and response headers + def create_allocations_for_feature_flag_in_environment_with_http_info(feature_flag_id, environment_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FeatureFlagsAPI.create_allocations_for_feature_flag_in_environment ...' + end + # verify the required parameter 'feature_flag_id' is set + if @api_client.config.client_side_validation && feature_flag_id.nil? + fail ArgumentError, "Missing the required parameter 'feature_flag_id' when calling FeatureFlagsAPI.create_allocations_for_feature_flag_in_environment" + end + # verify the required parameter 'environment_id' is set + if @api_client.config.client_side_validation && environment_id.nil? + fail ArgumentError, "Missing the required parameter 'environment_id' when calling FeatureFlagsAPI.create_allocations_for_feature_flag_in_environment" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FeatureFlagsAPI.create_allocations_for_feature_flag_in_environment" + end + # resource path + local_var_path = '/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations'.sub('{feature_flag_id}', CGI.escape(feature_flag_id.to_s).gsub('%2F', '/')).sub('{environment_id}', CGI.escape(environment_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'AllocationResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :create_allocations_for_feature_flag_in_environment, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FeatureFlagsAPI#create_allocations_for_feature_flag_in_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create a feature flag. # # @see #create_feature_flag_with_http_info @@ -715,6 +792,266 @@ def list_feature_flags_environments_with_http_info(opts = {}) return data, status_code, headers end + # Pause a progressive rollout. + # + # @see #pause_exposure_schedule_with_http_info + def pause_exposure_schedule(exposure_schedule_id, opts = {}) + data, _status_code, _headers = pause_exposure_schedule_with_http_info(exposure_schedule_id, opts) + data + end + + # Pause a progressive rollout. + # + # Pauses a progressive rollout while preserving rollout state. + # + # @param exposure_schedule_id [UUID] The ID of the exposure schedule. + # @param opts [Hash] the optional parameters + # @return [Array<(AllocationExposureScheduleResponse, Integer, Hash)>] AllocationExposureScheduleResponse data, response status code and response headers + def pause_exposure_schedule_with_http_info(exposure_schedule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FeatureFlagsAPI.pause_exposure_schedule ...' + end + # verify the required parameter 'exposure_schedule_id' is set + if @api_client.config.client_side_validation && exposure_schedule_id.nil? + fail ArgumentError, "Missing the required parameter 'exposure_schedule_id' when calling FeatureFlagsAPI.pause_exposure_schedule" + end + # resource path + local_var_path = '/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/pause'.sub('{exposure_schedule_id}', CGI.escape(exposure_schedule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AllocationExposureScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :pause_exposure_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FeatureFlagsAPI#pause_exposure_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Resume a progressive rollout. + # + # @see #resume_exposure_schedule_with_http_info + def resume_exposure_schedule(exposure_schedule_id, opts = {}) + data, _status_code, _headers = resume_exposure_schedule_with_http_info(exposure_schedule_id, opts) + data + end + + # Resume a progressive rollout. + # + # Resumes progression for a previously paused progressive rollout. + # + # @param exposure_schedule_id [UUID] The ID of the exposure schedule. + # @param opts [Hash] the optional parameters + # @return [Array<(AllocationExposureScheduleResponse, Integer, Hash)>] AllocationExposureScheduleResponse data, response status code and response headers + def resume_exposure_schedule_with_http_info(exposure_schedule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FeatureFlagsAPI.resume_exposure_schedule ...' + end + # verify the required parameter 'exposure_schedule_id' is set + if @api_client.config.client_side_validation && exposure_schedule_id.nil? + fail ArgumentError, "Missing the required parameter 'exposure_schedule_id' when calling FeatureFlagsAPI.resume_exposure_schedule" + end + # resource path + local_var_path = '/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/resume'.sub('{exposure_schedule_id}', CGI.escape(exposure_schedule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AllocationExposureScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :resume_exposure_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FeatureFlagsAPI#resume_exposure_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Start a progressive rollout. + # + # @see #start_exposure_schedule_with_http_info + def start_exposure_schedule(exposure_schedule_id, opts = {}) + data, _status_code, _headers = start_exposure_schedule_with_http_info(exposure_schedule_id, opts) + data + end + + # Start a progressive rollout. + # + # Starts a progressive rollout and begins progression. + # + # @param exposure_schedule_id [UUID] The ID of the exposure schedule. + # @param opts [Hash] the optional parameters + # @return [Array<(AllocationExposureScheduleResponse, Integer, Hash)>] AllocationExposureScheduleResponse data, response status code and response headers + def start_exposure_schedule_with_http_info(exposure_schedule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FeatureFlagsAPI.start_exposure_schedule ...' + end + # verify the required parameter 'exposure_schedule_id' is set + if @api_client.config.client_side_validation && exposure_schedule_id.nil? + fail ArgumentError, "Missing the required parameter 'exposure_schedule_id' when calling FeatureFlagsAPI.start_exposure_schedule" + end + # resource path + local_var_path = '/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/start'.sub('{exposure_schedule_id}', CGI.escape(exposure_schedule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AllocationExposureScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :start_exposure_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FeatureFlagsAPI#start_exposure_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # Stop a progressive rollout. + # + # @see #stop_exposure_schedule_with_http_info + def stop_exposure_schedule(exposure_schedule_id, opts = {}) + data, _status_code, _headers = stop_exposure_schedule_with_http_info(exposure_schedule_id, opts) + data + end + + # Stop a progressive rollout. + # + # Stops a progressive rollout and marks it as aborted. + # + # @param exposure_schedule_id [UUID] The ID of the exposure schedule. + # @param opts [Hash] the optional parameters + # @return [Array<(AllocationExposureScheduleResponse, Integer, Hash)>] AllocationExposureScheduleResponse data, response status code and response headers + def stop_exposure_schedule_with_http_info(exposure_schedule_id, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FeatureFlagsAPI.stop_exposure_schedule ...' + end + # verify the required parameter 'exposure_schedule_id' is set + if @api_client.config.client_side_validation && exposure_schedule_id.nil? + fail ArgumentError, "Missing the required parameter 'exposure_schedule_id' when calling FeatureFlagsAPI.stop_exposure_schedule" + end + # resource path + local_var_path = '/api/v2/feature-flags/exposure-schedules/{exposure_schedule_id}/stop'.sub('{exposure_schedule_id}', CGI.escape(exposure_schedule_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'AllocationExposureScheduleResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :stop_exposure_schedule, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FeatureFlagsAPI#stop_exposure_schedule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Unarchive a feature flag. # # @see #unarchive_feature_flag_with_http_info @@ -781,6 +1118,84 @@ def unarchive_feature_flag_with_http_info(feature_flag_id, opts = {}) return data, status_code, headers end + # Update targeting rules for a flag. + # + # @see #update_allocations_for_feature_flag_in_environment_with_http_info + def update_allocations_for_feature_flag_in_environment(feature_flag_id, environment_id, body, opts = {}) + data, _status_code, _headers = update_allocations_for_feature_flag_in_environment_with_http_info(feature_flag_id, environment_id, body, opts) + data + end + + # Update targeting rules for a flag. + # + # 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 feature_flag_id [UUID] The ID of the feature flag. + # @param environment_id [UUID] The ID of the environment. + # @param body [OverwriteAllocationsRequest] + # @param opts [Hash] the optional parameters + # @return [Array<(ListAllocationsResponse, Integer, Hash)>] ListAllocationsResponse data, response status code and response headers + def update_allocations_for_feature_flag_in_environment_with_http_info(feature_flag_id, environment_id, body, opts = {}) + + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: FeatureFlagsAPI.update_allocations_for_feature_flag_in_environment ...' + end + # verify the required parameter 'feature_flag_id' is set + if @api_client.config.client_side_validation && feature_flag_id.nil? + fail ArgumentError, "Missing the required parameter 'feature_flag_id' when calling FeatureFlagsAPI.update_allocations_for_feature_flag_in_environment" + end + # verify the required parameter 'environment_id' is set + if @api_client.config.client_side_validation && environment_id.nil? + fail ArgumentError, "Missing the required parameter 'environment_id' when calling FeatureFlagsAPI.update_allocations_for_feature_flag_in_environment" + end + # verify the required parameter 'body' is set + if @api_client.config.client_side_validation && body.nil? + fail ArgumentError, "Missing the required parameter 'body' when calling FeatureFlagsAPI.update_allocations_for_feature_flag_in_environment" + end + # resource path + local_var_path = '/api/v2/feature-flags/{feature_flag_id}/environments/{environment_id}/allocations'.sub('{feature_flag_id}', CGI.escape(feature_flag_id.to_s).gsub('%2F', '/')).sub('{environment_id}', CGI.escape(environment_id.to_s).gsub('%2F', '/')) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(body) + + # return_type + return_type = opts[:debug_return_type] || 'ListAllocationsResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] + + new_options = opts.merge( + :operation => :update_allocations_for_feature_flag_in_environment, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type, + :api_version => "V2" + ) + + data, status_code, headers = @api_client.call_api(Net::HTTP::Put, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FeatureFlagsAPI#update_allocations_for_feature_flag_in_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a feature flag. # # @see #update_feature_flag_with_http_info diff --git a/lib/datadog_api_client/v2/models/allocation.rb b/lib/datadog_api_client/v2/models/allocation.rb new file mode 100644 index 000000000000..ab412c697266 --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation.rb @@ -0,0 +1,358 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Targeting rule (allocation) details for a feature flag environment. + class Allocation + include BaseGenericModel + + # The timestamp when the targeting rule allocation was created. + attr_reader :created_at + + # Environment IDs associated with this targeting rule allocation. + attr_reader :environment_ids + + # The experiment ID linked to this targeting rule allocation. + attr_accessor :experiment_id + + # Progressive release details for a targeting rule allocation. + attr_accessor :exposure_schedule + + # Guardrail metrics associated with this targeting rule allocation. + attr_reader :guardrail_metrics + + # The unique identifier of the targeting rule allocation. + attr_accessor :id + + # The unique key of the targeting rule allocation. + attr_reader :key + + # The display name of the targeting rule. + attr_reader :name + + # Sort order position within the environment. + attr_reader :order_position + + # Conditions associated with this targeting rule allocation. + attr_reader :targeting_rules + + # The type of targeting rule (called allocation in the API model). + attr_reader :type + + # The timestamp when the targeting rule allocation was last updated. + attr_reader :updated_at + + # Weighted variant assignments for this targeting rule allocation. + attr_reader :variant_weights + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'environment_ids' => :'environment_ids', + :'experiment_id' => :'experiment_id', + :'exposure_schedule' => :'exposure_schedule', + :'guardrail_metrics' => :'guardrail_metrics', + :'id' => :'id', + :'key' => :'key', + :'name' => :'name', + :'order_position' => :'order_position', + :'targeting_rules' => :'targeting_rules', + :'type' => :'type', + :'updated_at' => :'updated_at', + :'variant_weights' => :'variant_weights' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'environment_ids' => :'Array', + :'experiment_id' => :'String', + :'exposure_schedule' => :'AllocationExposureSchedule', + :'guardrail_metrics' => :'Array', + :'id' => :'UUID', + :'key' => :'String', + :'name' => :'String', + :'order_position' => :'Integer', + :'targeting_rules' => :'Array', + :'type' => :'AllocationType', + :'updated_at' => :'Time', + :'variant_weights' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'experiment_id', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Allocation` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'environment_ids') + if (value = attributes[:'environment_ids']).is_a?(Array) + self.environment_ids = value + end + end + + if attributes.key?(:'experiment_id') + self.experiment_id = attributes[:'experiment_id'] + end + + if attributes.key?(:'exposure_schedule') + self.exposure_schedule = attributes[:'exposure_schedule'] + end + + if attributes.key?(:'guardrail_metrics') + if (value = attributes[:'guardrail_metrics']).is_a?(Array) + self.guardrail_metrics = value + end + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'order_position') + self.order_position = attributes[:'order_position'] + end + + if attributes.key?(:'targeting_rules') + if (value = attributes[:'targeting_rules']).is_a?(Array) + self.targeting_rules = value + end + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'variant_weights') + if (value = attributes[:'variant_weights']).is_a?(Array) + self.variant_weights = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @created_at.nil? + return false if @environment_ids.nil? + return false if @guardrail_metrics.nil? + return false if @key.nil? + return false if @name.nil? + return false if @order_position.nil? + return false if @targeting_rules.nil? + return false if @type.nil? + return false if @updated_at.nil? + return false if @variant_weights.nil? + true + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param environment_ids [Object] Object to be assigned + # @!visibility private + def environment_ids=(environment_ids) + if environment_ids.nil? + fail ArgumentError, 'invalid value for "environment_ids", environment_ids cannot be nil.' + end + @environment_ids = environment_ids + end + + # Custom attribute writer method with validation + # @param guardrail_metrics [Object] Object to be assigned + # @!visibility private + def guardrail_metrics=(guardrail_metrics) + if guardrail_metrics.nil? + fail ArgumentError, 'invalid value for "guardrail_metrics", guardrail_metrics cannot be nil.' + end + @guardrail_metrics = guardrail_metrics + end + + # Custom attribute writer method with validation + # @param key [Object] Object to be assigned + # @!visibility private + def key=(key) + if key.nil? + fail ArgumentError, 'invalid value for "key", key cannot be nil.' + end + @key = key + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param order_position [Object] Object to be assigned + # @!visibility private + def order_position=(order_position) + if order_position.nil? + fail ArgumentError, 'invalid value for "order_position", order_position cannot be nil.' + end + @order_position = order_position + end + + # Custom attribute writer method with validation + # @param targeting_rules [Object] Object to be assigned + # @!visibility private + def targeting_rules=(targeting_rules) + if targeting_rules.nil? + fail ArgumentError, 'invalid value for "targeting_rules", targeting_rules cannot be nil.' + end + @targeting_rules = targeting_rules + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Custom attribute writer method with validation + # @param variant_weights [Object] Object to be assigned + # @!visibility private + def variant_weights=(variant_weights) + if variant_weights.nil? + fail ArgumentError, 'invalid value for "variant_weights", variant_weights cannot be nil.' + end + @variant_weights = variant_weights + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + environment_ids == o.environment_ids && + experiment_id == o.experiment_id && + exposure_schedule == o.exposure_schedule && + guardrail_metrics == o.guardrail_metrics && + id == o.id && + key == o.key && + name == o.name && + order_position == o.order_position && + targeting_rules == o.targeting_rules && + type == o.type && + updated_at == o.updated_at && + variant_weights == o.variant_weights && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, environment_ids, experiment_id, exposure_schedule, guardrail_metrics, id, key, name, order_position, targeting_rules, type, updated_at, variant_weights, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_data_request.rb b/lib/datadog_api_client/v2/models/allocation_data_request.rb new file mode 100644 index 000000000000..3df2c06819c4 --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_data_request.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data wrapper for allocation request payloads. + class AllocationDataRequest + include BaseGenericModel + + # Request to create or update a targeting rule (allocation) for a feature flag environment. + attr_reader :attributes + + # The resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'UpsertAllocationRequest', + :'type' => :'AllocationDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AllocationDataRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_data_response.rb b/lib/datadog_api_client/v2/models/allocation_data_response.rb new file mode 100644 index 000000000000..fbc1a529bd81 --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_data_response.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data wrapper for targeting rule allocation responses. + class AllocationDataResponse + include BaseGenericModel + + # Targeting rule (allocation) details for a feature flag environment. + attr_reader :attributes + + # The unique identifier of the targeting rule allocation. + attr_reader :id + + # The resource type. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'Allocation', + :'id' => :'UUID', + :'type' => :'AllocationDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AllocationDataResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_data_type.rb b/lib/datadog_api_client/v2/models/allocation_data_type.rb new file mode 100644 index 000000000000..58422a0782b9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The resource type. + class AllocationDataType + include BaseEnumModel + + ALLOCATIONS = "allocations".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_exposure_guardrail_trigger.rb b/lib/datadog_api_client/v2/models/allocation_exposure_guardrail_trigger.rb new file mode 100644 index 000000000000..eff1084153a6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_exposure_guardrail_trigger.rb @@ -0,0 +1,249 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Guardrail trigger details for a progressive rollout. + class AllocationExposureGuardrailTrigger + include BaseGenericModel + + # The progressive rollout ID this trigger belongs to. + attr_reader :allocation_exposure_schedule_id + + # The timestamp when this trigger was created. + attr_reader :created_at + + # The variant ID that triggered this event. + attr_reader :flagging_variant_id + + # The unique identifier of the guardrail trigger. + attr_reader :id + + # The metric ID associated with the trigger. + attr_reader :metric_id + + # The action that was triggered. + attr_reader :triggered_action + + # The timestamp when this trigger was last updated. + attr_reader :updated_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'allocation_exposure_schedule_id' => :'allocation_exposure_schedule_id', + :'created_at' => :'created_at', + :'flagging_variant_id' => :'flagging_variant_id', + :'id' => :'id', + :'metric_id' => :'metric_id', + :'triggered_action' => :'triggered_action', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'allocation_exposure_schedule_id' => :'UUID', + :'created_at' => :'Time', + :'flagging_variant_id' => :'UUID', + :'id' => :'UUID', + :'metric_id' => :'String', + :'triggered_action' => :'String', + :'updated_at' => :'Time' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AllocationExposureGuardrailTrigger` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'allocation_exposure_schedule_id') + self.allocation_exposure_schedule_id = attributes[:'allocation_exposure_schedule_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'flagging_variant_id') + self.flagging_variant_id = attributes[:'flagging_variant_id'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'metric_id') + self.metric_id = attributes[:'metric_id'] + end + + if attributes.key?(:'triggered_action') + self.triggered_action = attributes[:'triggered_action'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @allocation_exposure_schedule_id.nil? + return false if @created_at.nil? + return false if @flagging_variant_id.nil? + return false if @id.nil? + return false if @metric_id.nil? + return false if @triggered_action.nil? + return false if @updated_at.nil? + true + end + + # Custom attribute writer method with validation + # @param allocation_exposure_schedule_id [Object] Object to be assigned + # @!visibility private + def allocation_exposure_schedule_id=(allocation_exposure_schedule_id) + if allocation_exposure_schedule_id.nil? + fail ArgumentError, 'invalid value for "allocation_exposure_schedule_id", allocation_exposure_schedule_id cannot be nil.' + end + @allocation_exposure_schedule_id = allocation_exposure_schedule_id + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param flagging_variant_id [Object] Object to be assigned + # @!visibility private + def flagging_variant_id=(flagging_variant_id) + if flagging_variant_id.nil? + fail ArgumentError, 'invalid value for "flagging_variant_id", flagging_variant_id cannot be nil.' + end + @flagging_variant_id = flagging_variant_id + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param metric_id [Object] Object to be assigned + # @!visibility private + def metric_id=(metric_id) + if metric_id.nil? + fail ArgumentError, 'invalid value for "metric_id", metric_id cannot be nil.' + end + @metric_id = metric_id + end + + # Custom attribute writer method with validation + # @param triggered_action [Object] Object to be assigned + # @!visibility private + def triggered_action=(triggered_action) + if triggered_action.nil? + fail ArgumentError, 'invalid value for "triggered_action", triggered_action cannot be nil.' + end + @triggered_action = triggered_action + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + allocation_exposure_schedule_id == o.allocation_exposure_schedule_id && + created_at == o.created_at && + flagging_variant_id == o.flagging_variant_id && + id == o.id && + metric_id == o.metric_id && + triggered_action == o.triggered_action && + updated_at == o.updated_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [allocation_exposure_schedule_id, created_at, flagging_variant_id, id, metric_id, triggered_action, updated_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_exposure_rollout_step.rb b/lib/datadog_api_client/v2/models/allocation_exposure_rollout_step.rb new file mode 100644 index 000000000000..4691042c41dd --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_exposure_rollout_step.rb @@ -0,0 +1,300 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Exposure progression step details. + class AllocationExposureRolloutStep + include BaseGenericModel + + # The progressive rollout ID this step belongs to. + attr_reader :allocation_exposure_schedule_id + + # The timestamp when the progression step was created. + attr_reader :created_at + + # The exposure ratio for this step. + attr_reader :exposure_ratio + + # Logical index grouping related steps. + attr_reader :grouped_step_index + + # The unique identifier of the progression step. + attr_reader :id + + # Step duration in milliseconds. + attr_accessor :interval_ms + + # Whether this step represents a pause record. + attr_reader :is_pause_record + + # Sort order for the progression step. + attr_reader :order_position + + # The timestamp when the progression step was last updated. + attr_reader :updated_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'allocation_exposure_schedule_id' => :'allocation_exposure_schedule_id', + :'created_at' => :'created_at', + :'exposure_ratio' => :'exposure_ratio', + :'grouped_step_index' => :'grouped_step_index', + :'id' => :'id', + :'interval_ms' => :'interval_ms', + :'is_pause_record' => :'is_pause_record', + :'order_position' => :'order_position', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'allocation_exposure_schedule_id' => :'UUID', + :'created_at' => :'Time', + :'exposure_ratio' => :'Float', + :'grouped_step_index' => :'Integer', + :'id' => :'UUID', + :'interval_ms' => :'Integer', + :'is_pause_record' => :'Boolean', + :'order_position' => :'Integer', + :'updated_at' => :'Time' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'interval_ms', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AllocationExposureRolloutStep` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'allocation_exposure_schedule_id') + self.allocation_exposure_schedule_id = attributes[:'allocation_exposure_schedule_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'exposure_ratio') + self.exposure_ratio = attributes[:'exposure_ratio'] + end + + if attributes.key?(:'grouped_step_index') + self.grouped_step_index = attributes[:'grouped_step_index'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'interval_ms') + self.interval_ms = attributes[:'interval_ms'] + end + + if attributes.key?(:'is_pause_record') + self.is_pause_record = attributes[:'is_pause_record'] + end + + if attributes.key?(:'order_position') + self.order_position = attributes[:'order_position'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @allocation_exposure_schedule_id.nil? + return false if @created_at.nil? + return false if @exposure_ratio.nil? + return false if @exposure_ratio > 1 + return false if @exposure_ratio < 0 + return false if @grouped_step_index.nil? + return false if @grouped_step_index < 0 + return false if @id.nil? + return false if @is_pause_record.nil? + return false if @order_position.nil? + return false if @updated_at.nil? + true + end + + # Custom attribute writer method with validation + # @param allocation_exposure_schedule_id [Object] Object to be assigned + # @!visibility private + def allocation_exposure_schedule_id=(allocation_exposure_schedule_id) + if allocation_exposure_schedule_id.nil? + fail ArgumentError, 'invalid value for "allocation_exposure_schedule_id", allocation_exposure_schedule_id cannot be nil.' + end + @allocation_exposure_schedule_id = allocation_exposure_schedule_id + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param exposure_ratio [Object] Object to be assigned + # @!visibility private + def exposure_ratio=(exposure_ratio) + if exposure_ratio.nil? + fail ArgumentError, 'invalid value for "exposure_ratio", exposure_ratio cannot be nil.' + end + if exposure_ratio > 1 + fail ArgumentError, 'invalid value for "exposure_ratio", must be smaller than or equal to 1.' + end + if exposure_ratio < 0 + fail ArgumentError, 'invalid value for "exposure_ratio", must be greater than or equal to 0.' + end + @exposure_ratio = exposure_ratio + end + + # Custom attribute writer method with validation + # @param grouped_step_index [Object] Object to be assigned + # @!visibility private + def grouped_step_index=(grouped_step_index) + if grouped_step_index.nil? + fail ArgumentError, 'invalid value for "grouped_step_index", grouped_step_index cannot be nil.' + end + if grouped_step_index < 0 + fail ArgumentError, 'invalid value for "grouped_step_index", must be greater than or equal to 0.' + end + @grouped_step_index = grouped_step_index + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param is_pause_record [Object] Object to be assigned + # @!visibility private + def is_pause_record=(is_pause_record) + if is_pause_record.nil? + fail ArgumentError, 'invalid value for "is_pause_record", is_pause_record cannot be nil.' + end + @is_pause_record = is_pause_record + end + + # Custom attribute writer method with validation + # @param order_position [Object] Object to be assigned + # @!visibility private + def order_position=(order_position) + if order_position.nil? + fail ArgumentError, 'invalid value for "order_position", order_position cannot be nil.' + end + @order_position = order_position + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + allocation_exposure_schedule_id == o.allocation_exposure_schedule_id && + created_at == o.created_at && + exposure_ratio == o.exposure_ratio && + grouped_step_index == o.grouped_step_index && + id == o.id && + interval_ms == o.interval_ms && + is_pause_record == o.is_pause_record && + order_position == o.order_position && + updated_at == o.updated_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [allocation_exposure_schedule_id, created_at, exposure_ratio, grouped_step_index, id, interval_ms, is_pause_record, order_position, updated_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_exposure_schedule.rb b/lib/datadog_api_client/v2/models/allocation_exposure_schedule.rb new file mode 100644 index 000000000000..40b90ef0c57d --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_exposure_schedule.rb @@ -0,0 +1,282 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Progressive release details for a targeting rule allocation. + class AllocationExposureSchedule + include BaseGenericModel + + # The absolute UTC start time for this schedule. + attr_accessor :absolute_start_time + + # The targeting rule allocation ID this progressive rollout belongs to. + attr_reader :allocation_id + + # The control variant ID used for experiment comparisons. + attr_accessor :control_variant_id + + # The timestamp when the schedule was created. + attr_reader :created_at + + # Last guardrail action triggered for this schedule. + attr_accessor :guardrail_triggered_action + + # Guardrail trigger records for this schedule. + attr_reader :guardrail_triggers + + # The unique identifier of the progressive rollout. + attr_accessor :id + + # Applied progression options for a progressive rollout. + attr_reader :rollout_options + + # Ordered progression steps for exposure. + attr_reader :rollout_steps + + # The timestamp when the schedule was last updated. + attr_reader :updated_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'absolute_start_time' => :'absolute_start_time', + :'allocation_id' => :'allocation_id', + :'control_variant_id' => :'control_variant_id', + :'created_at' => :'created_at', + :'guardrail_triggered_action' => :'guardrail_triggered_action', + :'guardrail_triggers' => :'guardrail_triggers', + :'id' => :'id', + :'rollout_options' => :'rollout_options', + :'rollout_steps' => :'rollout_steps', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'absolute_start_time' => :'Time', + :'allocation_id' => :'UUID', + :'control_variant_id' => :'String', + :'created_at' => :'Time', + :'guardrail_triggered_action' => :'String', + :'guardrail_triggers' => :'Array', + :'id' => :'UUID', + :'rollout_options' => :'RolloutOptions', + :'rollout_steps' => :'Array', + :'updated_at' => :'Time' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'absolute_start_time', + :'control_variant_id', + :'guardrail_triggered_action', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AllocationExposureSchedule` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'absolute_start_time') + self.absolute_start_time = attributes[:'absolute_start_time'] + end + + if attributes.key?(:'allocation_id') + self.allocation_id = attributes[:'allocation_id'] + end + + if attributes.key?(:'control_variant_id') + self.control_variant_id = attributes[:'control_variant_id'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'guardrail_triggered_action') + self.guardrail_triggered_action = attributes[:'guardrail_triggered_action'] + end + + if attributes.key?(:'guardrail_triggers') + if (value = attributes[:'guardrail_triggers']).is_a?(Array) + self.guardrail_triggers = value + end + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'rollout_options') + self.rollout_options = attributes[:'rollout_options'] + end + + if attributes.key?(:'rollout_steps') + if (value = attributes[:'rollout_steps']).is_a?(Array) + self.rollout_steps = value + end + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @allocation_id.nil? + return false if @created_at.nil? + return false if @guardrail_triggers.nil? + return false if @rollout_options.nil? + return false if @rollout_steps.nil? + return false if @updated_at.nil? + true + end + + # Custom attribute writer method with validation + # @param allocation_id [Object] Object to be assigned + # @!visibility private + def allocation_id=(allocation_id) + if allocation_id.nil? + fail ArgumentError, 'invalid value for "allocation_id", allocation_id cannot be nil.' + end + @allocation_id = allocation_id + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param guardrail_triggers [Object] Object to be assigned + # @!visibility private + def guardrail_triggers=(guardrail_triggers) + if guardrail_triggers.nil? + fail ArgumentError, 'invalid value for "guardrail_triggers", guardrail_triggers cannot be nil.' + end + @guardrail_triggers = guardrail_triggers + end + + # Custom attribute writer method with validation + # @param rollout_options [Object] Object to be assigned + # @!visibility private + def rollout_options=(rollout_options) + if rollout_options.nil? + fail ArgumentError, 'invalid value for "rollout_options", rollout_options cannot be nil.' + end + @rollout_options = rollout_options + end + + # Custom attribute writer method with validation + # @param rollout_steps [Object] Object to be assigned + # @!visibility private + def rollout_steps=(rollout_steps) + if rollout_steps.nil? + fail ArgumentError, 'invalid value for "rollout_steps", rollout_steps cannot be nil.' + end + @rollout_steps = rollout_steps + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + absolute_start_time == o.absolute_start_time && + allocation_id == o.allocation_id && + control_variant_id == o.control_variant_id && + created_at == o.created_at && + guardrail_triggered_action == o.guardrail_triggered_action && + guardrail_triggers == o.guardrail_triggers && + id == o.id && + rollout_options == o.rollout_options && + rollout_steps == o.rollout_steps && + updated_at == o.updated_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [absolute_start_time, allocation_id, control_variant_id, created_at, guardrail_triggered_action, guardrail_triggers, id, rollout_options, rollout_steps, updated_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_exposure_schedule_data.rb b/lib/datadog_api_client/v2/models/allocation_exposure_schedule_data.rb new file mode 100644 index 000000000000..a335b8f08841 --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_exposure_schedule_data.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Data wrapper for progressive rollout schedule responses. + class AllocationExposureScheduleData + include BaseGenericModel + + # Progressive release details for a targeting rule allocation. + attr_reader :attributes + + # The unique identifier of the progressive rollout. + attr_reader :id + + # The resource type for progressive rollout schedules. + attr_reader :type + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attributes' => :'attributes', + :'id' => :'id', + :'type' => :'type' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attributes' => :'AllocationExposureSchedule', + :'id' => :'UUID', + :'type' => :'AllocationExposureScheduleDataType' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AllocationExposureScheduleData` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attributes') + self.attributes = attributes[:'attributes'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attributes.nil? + return false if @id.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param attributes [Object] Object to be assigned + # @!visibility private + def attributes=(attributes) + if attributes.nil? + fail ArgumentError, 'invalid value for "attributes", attributes cannot be nil.' + end + @attributes = attributes + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attributes == o.attributes && + id == o.id && + type == o.type && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attributes, id, type, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_exposure_schedule_data_type.rb b/lib/datadog_api_client/v2/models/allocation_exposure_schedule_data_type.rb new file mode 100644 index 000000000000..0969d7894bcc --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_exposure_schedule_data_type.rb @@ -0,0 +1,26 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The resource type for progressive rollout schedules. + class AllocationExposureScheduleDataType + include BaseEnumModel + + ALLOCATION_EXPOSURE_SCHEDULES = "allocation_exposure_schedules".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_exposure_schedule_response.rb b/lib/datadog_api_client/v2/models/allocation_exposure_schedule_response.rb new file mode 100644 index 000000000000..1fc8e7d77f35 --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_exposure_schedule_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a progressive rollout schedule. + class AllocationExposureScheduleResponse + include BaseGenericModel + + # Data wrapper for progressive rollout schedule responses. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AllocationExposureScheduleData' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AllocationExposureScheduleResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_response.rb b/lib/datadog_api_client/v2/models/allocation_response.rb new file mode 100644 index 000000000000..812c4d2a7912 --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_response.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a single targeting rule (allocation). + class AllocationResponse + include BaseGenericModel + + # Data wrapper for targeting rule allocation responses. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AllocationDataResponse' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::AllocationResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/allocation_type.rb b/lib/datadog_api_client/v2/models/allocation_type.rb new file mode 100644 index 000000000000..5006ed808315 --- /dev/null +++ b/lib/datadog_api_client/v2/models/allocation_type.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The type of targeting rule (called allocation in the API model). + class AllocationType + include BaseEnumModel + + FEATURE_GATE = "FEATURE_GATE".freeze + CANARY = "CANARY".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/condition.rb b/lib/datadog_api_client/v2/models/condition.rb new file mode 100644 index 000000000000..f755b1cd887d --- /dev/null +++ b/lib/datadog_api_client/v2/models/condition.rb @@ -0,0 +1,230 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Targeting condition details. + class Condition + include BaseGenericModel + + # The user or request attribute to evaluate. + attr_reader :attribute + + # The timestamp when the condition was created. + attr_reader :created_at + + # The unique identifier of the condition. + attr_reader :id + + # The operator used in a targeting condition. + attr_reader :operator + + # The timestamp when the condition was last updated. + attr_reader :updated_at + + # Values used by the selected operator. + attr_reader :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attribute' => :'attribute', + :'created_at' => :'created_at', + :'id' => :'id', + :'operator' => :'operator', + :'updated_at' => :'updated_at', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attribute' => :'String', + :'created_at' => :'Time', + :'id' => :'UUID', + :'operator' => :'ConditionOperator', + :'updated_at' => :'Time', + :'value' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::Condition` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attribute') + self.attribute = attributes[:'attribute'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'operator') + self.operator = attributes[:'operator'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'value') + if (value = attributes[:'value']).is_a?(Array) + self.value = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attribute.nil? + return false if @created_at.nil? + return false if @id.nil? + return false if @operator.nil? + return false if @updated_at.nil? + return false if @value.nil? + true + end + + # Custom attribute writer method with validation + # @param attribute [Object] Object to be assigned + # @!visibility private + def attribute=(attribute) + if attribute.nil? + fail ArgumentError, 'invalid value for "attribute", attribute cannot be nil.' + end + @attribute = attribute + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param operator [Object] Object to be assigned + # @!visibility private + def operator=(operator) + if operator.nil? + fail ArgumentError, 'invalid value for "operator", operator cannot be nil.' + end + @operator = operator + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Custom attribute writer method with validation + # @param value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + @value = value + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attribute == o.attribute && + created_at == o.created_at && + id == o.id && + operator == o.operator && + updated_at == o.updated_at && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attribute, created_at, id, operator, updated_at, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/condition_operator.rb b/lib/datadog_api_client/v2/models/condition_operator.rb new file mode 100644 index 000000000000..5e348f35da8e --- /dev/null +++ b/lib/datadog_api_client/v2/models/condition_operator.rb @@ -0,0 +1,35 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The operator used in a targeting condition. + class ConditionOperator + include BaseEnumModel + + LT = "LT".freeze + LTE = "LTE".freeze + GT = "GT".freeze + GTE = "GTE".freeze + MATCHES = "MATCHES".freeze + NOT_MATCHES = "NOT_MATCHES".freeze + ONE_OF = "ONE_OF".freeze + NOT_ONE_OF = "NOT_ONE_OF".freeze + IS_NULL = "IS_NULL".freeze + EQUALS = "EQUALS".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/condition_request.rb b/lib/datadog_api_client/v2/models/condition_request.rb new file mode 100644 index 000000000000..fcfbf35eced8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/condition_request.rb @@ -0,0 +1,167 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Condition request payload for targeting rules. + class ConditionRequest + include BaseGenericModel + + # The user or request attribute to evaluate. + attr_reader :attribute + + # The operator used in a targeting condition. + attr_reader :operator + + # Values used by the selected operator. + attr_reader :value + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'attribute' => :'attribute', + :'operator' => :'operator', + :'value' => :'value' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'attribute' => :'String', + :'operator' => :'ConditionOperator', + :'value' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ConditionRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'attribute') + self.attribute = attributes[:'attribute'] + end + + if attributes.key?(:'operator') + self.operator = attributes[:'operator'] + end + + if attributes.key?(:'value') + if (value = attributes[:'value']).is_a?(Array) + self.value = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @attribute.nil? + return false if @operator.nil? + return false if @value.nil? + true + end + + # Custom attribute writer method with validation + # @param attribute [Object] Object to be assigned + # @!visibility private + def attribute=(attribute) + if attribute.nil? + fail ArgumentError, 'invalid value for "attribute", attribute cannot be nil.' + end + @attribute = attribute + end + + # Custom attribute writer method with validation + # @param operator [Object] Object to be assigned + # @!visibility private + def operator=(operator) + if operator.nil? + fail ArgumentError, 'invalid value for "operator", operator cannot be nil.' + end + @operator = operator + end + + # Custom attribute writer method with validation + # @param value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + @value = value + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + attribute == o.attribute && + operator == o.operator && + value == o.value && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [attribute, operator, value, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/create_allocations_request.rb b/lib/datadog_api_client/v2/models/create_allocations_request.rb new file mode 100644 index 000000000000..f6946a73e4f2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/create_allocations_request.rb @@ -0,0 +1,123 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to create targeting rules (allocations) for a feature flag in an environment. + class CreateAllocationsRequest + include BaseGenericModel + + # Data wrapper for allocation request payloads. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'AllocationDataRequest' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::CreateAllocationsRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + self.data = attributes[:'data'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/exposure_rollout_step_request.rb b/lib/datadog_api_client/v2/models/exposure_rollout_step_request.rb new file mode 100644 index 000000000000..169076ba0a0b --- /dev/null +++ b/lib/datadog_api_client/v2/models/exposure_rollout_step_request.rb @@ -0,0 +1,205 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Rollout step request payload. + class ExposureRolloutStepRequest + include BaseGenericModel + + # The exposure ratio for this step. + attr_reader :exposure_ratio + + # Logical index grouping related steps. + attr_reader :grouped_step_index + + # The unique identifier of the progression step. + attr_accessor :id + + # Step duration in milliseconds. + attr_accessor :interval_ms + + # Whether this step represents a pause record. + attr_reader :is_pause_record + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'exposure_ratio' => :'exposure_ratio', + :'grouped_step_index' => :'grouped_step_index', + :'id' => :'id', + :'interval_ms' => :'interval_ms', + :'is_pause_record' => :'is_pause_record' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'exposure_ratio' => :'Float', + :'grouped_step_index' => :'Integer', + :'id' => :'UUID', + :'interval_ms' => :'Integer', + :'is_pause_record' => :'Boolean' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'interval_ms', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ExposureRolloutStepRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'exposure_ratio') + self.exposure_ratio = attributes[:'exposure_ratio'] + end + + if attributes.key?(:'grouped_step_index') + self.grouped_step_index = attributes[:'grouped_step_index'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'interval_ms') + self.interval_ms = attributes[:'interval_ms'] + end + + if attributes.key?(:'is_pause_record') + self.is_pause_record = attributes[:'is_pause_record'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @exposure_ratio.nil? + return false if @exposure_ratio > 1 + return false if @exposure_ratio < 0 + return false if @grouped_step_index.nil? + return false if @grouped_step_index < 0 + return false if @is_pause_record.nil? + true + end + + # Custom attribute writer method with validation + # @param exposure_ratio [Object] Object to be assigned + # @!visibility private + def exposure_ratio=(exposure_ratio) + if exposure_ratio.nil? + fail ArgumentError, 'invalid value for "exposure_ratio", exposure_ratio cannot be nil.' + end + if exposure_ratio > 1 + fail ArgumentError, 'invalid value for "exposure_ratio", must be smaller than or equal to 1.' + end + if exposure_ratio < 0 + fail ArgumentError, 'invalid value for "exposure_ratio", must be greater than or equal to 0.' + end + @exposure_ratio = exposure_ratio + end + + # Custom attribute writer method with validation + # @param grouped_step_index [Object] Object to be assigned + # @!visibility private + def grouped_step_index=(grouped_step_index) + if grouped_step_index.nil? + fail ArgumentError, 'invalid value for "grouped_step_index", grouped_step_index cannot be nil.' + end + if grouped_step_index < 0 + fail ArgumentError, 'invalid value for "grouped_step_index", must be greater than or equal to 0.' + end + @grouped_step_index = grouped_step_index + end + + # Custom attribute writer method with validation + # @param is_pause_record [Object] Object to be assigned + # @!visibility private + def is_pause_record=(is_pause_record) + if is_pause_record.nil? + fail ArgumentError, 'invalid value for "is_pause_record", is_pause_record cannot be nil.' + end + @is_pause_record = is_pause_record + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + exposure_ratio == o.exposure_ratio && + grouped_step_index == o.grouped_step_index && + id == o.id && + interval_ms == o.interval_ms && + is_pause_record == o.is_pause_record && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [exposure_ratio, grouped_step_index, id, interval_ms, is_pause_record, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/exposure_schedule_request.rb b/lib/datadog_api_client/v2/models/exposure_schedule_request.rb new file mode 100644 index 000000000000..7d9293744467 --- /dev/null +++ b/lib/datadog_api_client/v2/models/exposure_schedule_request.rb @@ -0,0 +1,200 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Progressive release request payload. + class ExposureScheduleRequest + include BaseGenericModel + + # The absolute UTC start time for this schedule. + attr_accessor :absolute_start_time + + # The control variant ID used for experiment comparisons. + attr_accessor :control_variant_id + + # The control variant key used during creation workflows. + attr_accessor :control_variant_key + + # The unique identifier of the progressive rollout. + attr_accessor :id + + # Rollout options request payload. + attr_reader :rollout_options + + # Ordered progression steps for exposure. + attr_reader :rollout_steps + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'absolute_start_time' => :'absolute_start_time', + :'control_variant_id' => :'control_variant_id', + :'control_variant_key' => :'control_variant_key', + :'id' => :'id', + :'rollout_options' => :'rollout_options', + :'rollout_steps' => :'rollout_steps' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'absolute_start_time' => :'Time', + :'control_variant_id' => :'String', + :'control_variant_key' => :'String', + :'id' => :'UUID', + :'rollout_options' => :'RolloutOptionsRequest', + :'rollout_steps' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'absolute_start_time', + :'control_variant_id', + :'control_variant_key', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ExposureScheduleRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'absolute_start_time') + self.absolute_start_time = attributes[:'absolute_start_time'] + end + + if attributes.key?(:'control_variant_id') + self.control_variant_id = attributes[:'control_variant_id'] + end + + if attributes.key?(:'control_variant_key') + self.control_variant_key = attributes[:'control_variant_key'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'rollout_options') + self.rollout_options = attributes[:'rollout_options'] + end + + if attributes.key?(:'rollout_steps') + if (value = attributes[:'rollout_steps']).is_a?(Array) + self.rollout_steps = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @rollout_options.nil? + return false if @rollout_steps.nil? + return false if @rollout_steps.length < 1 + true + end + + # Custom attribute writer method with validation + # @param rollout_options [Object] Object to be assigned + # @!visibility private + def rollout_options=(rollout_options) + if rollout_options.nil? + fail ArgumentError, 'invalid value for "rollout_options", rollout_options cannot be nil.' + end + @rollout_options = rollout_options + end + + # Custom attribute writer method with validation + # @param rollout_steps [Object] Object to be assigned + # @!visibility private + def rollout_steps=(rollout_steps) + if rollout_steps.nil? + fail ArgumentError, 'invalid value for "rollout_steps", rollout_steps cannot be nil.' + end + if rollout_steps.length < 1 + fail ArgumentError, 'invalid value for "rollout_steps", number of items must be greater than or equal to 1.' + end + @rollout_steps = rollout_steps + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + absolute_start_time == o.absolute_start_time && + control_variant_id == o.control_variant_id && + control_variant_key == o.control_variant_key && + id == o.id && + rollout_options == o.rollout_options && + rollout_steps == o.rollout_steps && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [absolute_start_time, control_variant_id, control_variant_key, id, rollout_options, rollout_steps, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/feature_flag_attributes.rb b/lib/datadog_api_client/v2/models/feature_flag_attributes.rb index 71a26404a6ad..dee52060cd6a 100644 --- a/lib/datadog_api_client/v2/models/feature_flag_attributes.rb +++ b/lib/datadog_api_client/v2/models/feature_flag_attributes.rb @@ -54,6 +54,9 @@ class FeatureFlagAttributes # Indicates whether this feature flag requires approval for changes. attr_accessor :require_approval + # Tags associated with the feature flag. + attr_accessor :tags + # The timestamp when the feature flag was last updated. attr_accessor :updated_at @@ -80,6 +83,7 @@ def self.attribute_map :'last_updated_by' => :'last_updated_by', :'name' => :'name', :'require_approval' => :'require_approval', + :'tags' => :'tags', :'updated_at' => :'updated_at', :'value_type' => :'value_type', :'variants' => :'variants' @@ -101,6 +105,7 @@ def self.openapi_types :'last_updated_by' => :'UUID', :'name' => :'String', :'require_approval' => :'Boolean', + :'tags' => :'Array', :'updated_at' => :'Time', :'value_type' => :'ValueType', :'variants' => :'Array' @@ -180,6 +185,12 @@ def initialize(attributes = {}) self.require_approval = attributes[:'require_approval'] end + if attributes.key?(:'tags') + if (value = attributes[:'tags']).is_a?(Array) + self.tags = value + end + end + if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] end @@ -294,6 +305,7 @@ def ==(o) last_updated_by == o.last_updated_by && name == o.name && require_approval == o.require_approval && + tags == o.tags && updated_at == o.updated_at && value_type == o.value_type && variants == o.variants && @@ -304,7 +316,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [archived_at, created_at, created_by, description, distribution_channel, feature_flag_environments, json_schema, key, last_updated_by, name, require_approval, updated_at, value_type, variants, additional_properties].hash + [archived_at, created_at, created_by, description, distribution_channel, feature_flag_environments, json_schema, key, last_updated_by, name, require_approval, tags, updated_at, value_type, variants, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/feature_flag_environment.rb b/lib/datadog_api_client/v2/models/feature_flag_environment.rb index 4a005d1c7b93..2bea38893af1 100644 --- a/lib/datadog_api_client/v2/models/feature_flag_environment.rb +++ b/lib/datadog_api_client/v2/models/feature_flag_environment.rb @@ -36,6 +36,9 @@ class FeatureFlagEnvironment # The name of the environment. attr_accessor :environment_name + # Queries that target this environment. + attr_accessor :environment_queries + # Indicates whether the environment is production. attr_accessor :is_production @@ -71,6 +74,7 @@ def self.attribute_map :'default_variant_id' => :'default_variant_id', :'environment_id' => :'environment_id', :'environment_name' => :'environment_name', + :'environment_queries' => :'environment_queries', :'is_production' => :'is_production', :'override_allocation_key' => :'override_allocation_key', :'override_variant_id' => :'override_variant_id', @@ -91,6 +95,7 @@ def self.openapi_types :'default_variant_id' => :'String', :'environment_id' => :'UUID', :'environment_name' => :'String', + :'environment_queries' => :'Array', :'is_production' => :'Boolean', :'override_allocation_key' => :'String', :'override_variant_id' => :'String', @@ -151,6 +156,12 @@ def initialize(attributes = {}) self.environment_name = attributes[:'environment_name'] end + if attributes.key?(:'environment_queries') + if (value = attributes[:'environment_queries']).is_a?(Array) + self.environment_queries = value + end + end + if attributes.key?(:'is_production') self.is_production = attributes[:'is_production'] end @@ -261,6 +272,7 @@ def ==(o) default_variant_id == o.default_variant_id && environment_id == o.environment_id && environment_name == o.environment_name && + environment_queries == o.environment_queries && is_production == o.is_production && override_allocation_key == o.override_allocation_key && override_variant_id == o.override_variant_id && @@ -276,7 +288,7 @@ def ==(o) # @return [Integer] Hash code # @!visibility private def hash - [allocations, default_allocation_key, default_variant_id, environment_id, environment_name, is_production, override_allocation_key, override_variant_id, pending_suggestion_id, require_feature_flag_approval, rollout_percentage, rules, status, additional_properties].hash + [allocations, default_allocation_key, default_variant_id, environment_id, environment_name, environment_queries, is_production, override_allocation_key, override_variant_id, pending_suggestion_id, require_feature_flag_approval, rollout_percentage, rules, status, additional_properties].hash end end end diff --git a/lib/datadog_api_client/v2/models/guardrail_metric.rb b/lib/datadog_api_client/v2/models/guardrail_metric.rb new file mode 100644 index 000000000000..77c6eae38eb9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/guardrail_metric.rb @@ -0,0 +1,162 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Guardrail metric details. + class GuardrailMetric + include BaseGenericModel + + # The metric ID to monitor. + attr_reader :metric_id + + # Action to perform when a guardrail threshold is triggered. + attr_reader :trigger_action + + # The signal or system that triggered the action. + attr_accessor :triggered_by + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'metric_id' => :'metric_id', + :'trigger_action' => :'trigger_action', + :'triggered_by' => :'triggered_by' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'metric_id' => :'String', + :'trigger_action' => :'GuardrailTriggerAction', + :'triggered_by' => :'String' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'triggered_by', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GuardrailMetric` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'metric_id') + self.metric_id = attributes[:'metric_id'] + end + + if attributes.key?(:'trigger_action') + self.trigger_action = attributes[:'trigger_action'] + end + + if attributes.key?(:'triggered_by') + self.triggered_by = attributes[:'triggered_by'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @metric_id.nil? + return false if @trigger_action.nil? + true + end + + # Custom attribute writer method with validation + # @param metric_id [Object] Object to be assigned + # @!visibility private + def metric_id=(metric_id) + if metric_id.nil? + fail ArgumentError, 'invalid value for "metric_id", metric_id cannot be nil.' + end + @metric_id = metric_id + end + + # Custom attribute writer method with validation + # @param trigger_action [Object] Object to be assigned + # @!visibility private + def trigger_action=(trigger_action) + if trigger_action.nil? + fail ArgumentError, 'invalid value for "trigger_action", trigger_action cannot be nil.' + end + @trigger_action = trigger_action + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metric_id == o.metric_id && + trigger_action == o.trigger_action && + triggered_by == o.triggered_by && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [metric_id, trigger_action, triggered_by, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/guardrail_metric_request.rb b/lib/datadog_api_client/v2/models/guardrail_metric_request.rb new file mode 100644 index 000000000000..a5914f7b7afa --- /dev/null +++ b/lib/datadog_api_client/v2/models/guardrail_metric_request.rb @@ -0,0 +1,144 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Guardrail metric request payload. + class GuardrailMetricRequest + include BaseGenericModel + + # The metric ID to monitor. + attr_reader :metric_id + + # Action to perform when a guardrail threshold is triggered. + attr_reader :trigger_action + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'metric_id' => :'metric_id', + :'trigger_action' => :'trigger_action' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'metric_id' => :'String', + :'trigger_action' => :'GuardrailTriggerAction' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::GuardrailMetricRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'metric_id') + self.metric_id = attributes[:'metric_id'] + end + + if attributes.key?(:'trigger_action') + self.trigger_action = attributes[:'trigger_action'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @metric_id.nil? + return false if @trigger_action.nil? + true + end + + # Custom attribute writer method with validation + # @param metric_id [Object] Object to be assigned + # @!visibility private + def metric_id=(metric_id) + if metric_id.nil? + fail ArgumentError, 'invalid value for "metric_id", metric_id cannot be nil.' + end + @metric_id = metric_id + end + + # Custom attribute writer method with validation + # @param trigger_action [Object] Object to be assigned + # @!visibility private + def trigger_action=(trigger_action) + if trigger_action.nil? + fail ArgumentError, 'invalid value for "trigger_action", trigger_action cannot be nil.' + end + @trigger_action = trigger_action + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + metric_id == o.metric_id && + trigger_action == o.trigger_action && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [metric_id, trigger_action, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/guardrail_trigger_action.rb b/lib/datadog_api_client/v2/models/guardrail_trigger_action.rb new file mode 100644 index 000000000000..7ea5e588a8e9 --- /dev/null +++ b/lib/datadog_api_client/v2/models/guardrail_trigger_action.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Action to perform when a guardrail threshold is triggered. + class GuardrailTriggerAction + include BaseEnumModel + + PAUSE = "PAUSE".freeze + ABORT = "ABORT".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/list_allocations_response.rb b/lib/datadog_api_client/v2/models/list_allocations_response.rb new file mode 100644 index 000000000000..745e7d1cd245 --- /dev/null +++ b/lib/datadog_api_client/v2/models/list_allocations_response.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Response containing a list of targeting rules (allocations). + class ListAllocationsResponse + include BaseGenericModel + + # List of targeting rules (allocations). + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::ListAllocationsResponse` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/overwrite_allocations_request.rb b/lib/datadog_api_client/v2/models/overwrite_allocations_request.rb new file mode 100644 index 000000000000..ce584f852df6 --- /dev/null +++ b/lib/datadog_api_client/v2/models/overwrite_allocations_request.rb @@ -0,0 +1,125 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to overwrite targeting rules (allocations) for a feature flag in an environment. + class OverwriteAllocationsRequest + include BaseGenericModel + + # Targeting rules (allocations) to replace existing ones with. + attr_reader :data + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'data' => :'data' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'data' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::OverwriteAllocationsRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @data.nil? + true + end + + # Custom attribute writer method with validation + # @param data [Object] Object to be assigned + # @!visibility private + def data=(data) + if data.nil? + fail ArgumentError, 'invalid value for "data", data cannot be nil.' + end + @data = data + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + data == o.data && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [data, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rollout_options.rb b/lib/datadog_api_client/v2/models/rollout_options.rb new file mode 100644 index 000000000000..4230bf8100c5 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rollout_options.rb @@ -0,0 +1,165 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Applied progression options for a progressive rollout. + class RolloutOptions + include BaseGenericModel + + # Whether the schedule starts automatically. + attr_reader :autostart + + # Interval in milliseconds for uniform interval strategies. + attr_reader :selection_interval_ms + + # The progression strategy used by a progressive rollout. + attr_reader :strategy + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'autostart' => :'autostart', + :'selection_interval_ms' => :'selection_interval_ms', + :'strategy' => :'strategy' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'autostart' => :'Boolean', + :'selection_interval_ms' => :'Integer', + :'strategy' => :'RolloutStrategy' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RolloutOptions` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'autostart') + self.autostart = attributes[:'autostart'] + end + + if attributes.key?(:'selection_interval_ms') + self.selection_interval_ms = attributes[:'selection_interval_ms'] + end + + if attributes.key?(:'strategy') + self.strategy = attributes[:'strategy'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @autostart.nil? + return false if @selection_interval_ms.nil? + return false if @strategy.nil? + true + end + + # Custom attribute writer method with validation + # @param autostart [Object] Object to be assigned + # @!visibility private + def autostart=(autostart) + if autostart.nil? + fail ArgumentError, 'invalid value for "autostart", autostart cannot be nil.' + end + @autostart = autostart + end + + # Custom attribute writer method with validation + # @param selection_interval_ms [Object] Object to be assigned + # @!visibility private + def selection_interval_ms=(selection_interval_ms) + if selection_interval_ms.nil? + fail ArgumentError, 'invalid value for "selection_interval_ms", selection_interval_ms cannot be nil.' + end + @selection_interval_ms = selection_interval_ms + end + + # Custom attribute writer method with validation + # @param strategy [Object] Object to be assigned + # @!visibility private + def strategy=(strategy) + if strategy.nil? + fail ArgumentError, 'invalid value for "strategy", strategy cannot be nil.' + end + @strategy = strategy + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + autostart == o.autostart && + selection_interval_ms == o.selection_interval_ms && + strategy == o.strategy && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [autostart, selection_interval_ms, strategy, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rollout_options_request.rb b/lib/datadog_api_client/v2/models/rollout_options_request.rb new file mode 100644 index 000000000000..1ab65dbab1a2 --- /dev/null +++ b/lib/datadog_api_client/v2/models/rollout_options_request.rb @@ -0,0 +1,151 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Rollout options request payload. + class RolloutOptionsRequest + include BaseGenericModel + + # Whether the schedule should begin automatically. + attr_accessor :autostart + + # Interval in milliseconds for uniform interval strategies. + attr_accessor :selection_interval_ms + + # The progression strategy used by a progressive rollout. + attr_reader :strategy + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'autostart' => :'autostart', + :'selection_interval_ms' => :'selection_interval_ms', + :'strategy' => :'strategy' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'autostart' => :'Boolean', + :'selection_interval_ms' => :'Integer', + :'strategy' => :'RolloutStrategy' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'autostart', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::RolloutOptionsRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'autostart') + self.autostart = attributes[:'autostart'] + end + + if attributes.key?(:'selection_interval_ms') + self.selection_interval_ms = attributes[:'selection_interval_ms'] + end + + if attributes.key?(:'strategy') + self.strategy = attributes[:'strategy'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @strategy.nil? + true + end + + # Custom attribute writer method with validation + # @param strategy [Object] Object to be assigned + # @!visibility private + def strategy=(strategy) + if strategy.nil? + fail ArgumentError, 'invalid value for "strategy", strategy cannot be nil.' + end + @strategy = strategy + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + autostart == o.autostart && + selection_interval_ms == o.selection_interval_ms && + strategy == o.strategy && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [autostart, selection_interval_ms, strategy, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/rollout_strategy.rb b/lib/datadog_api_client/v2/models/rollout_strategy.rb new file mode 100644 index 000000000000..529706ea7a7c --- /dev/null +++ b/lib/datadog_api_client/v2/models/rollout_strategy.rb @@ -0,0 +1,27 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # The progression strategy used by a progressive rollout. + class RolloutStrategy + include BaseEnumModel + + UNIFORM_INTERVALS = "UNIFORM_INTERVALS".freeze + NO_ROLLOUT = "NO_ROLLOUT".freeze + end +end diff --git a/lib/datadog_api_client/v2/models/targeting_rule.rb b/lib/datadog_api_client/v2/models/targeting_rule.rb new file mode 100644 index 000000000000..6825d3a89d1a --- /dev/null +++ b/lib/datadog_api_client/v2/models/targeting_rule.rb @@ -0,0 +1,188 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Targeting rule details. + class TargetingRule + include BaseGenericModel + + # Conditions evaluated by this targeting rule. + attr_reader :conditions + + # The timestamp when the targeting rule was created. + attr_reader :created_at + + # The unique identifier of the targeting rule. + attr_reader :id + + # The timestamp when the targeting rule was last updated. + attr_reader :updated_at + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'conditions' => :'conditions', + :'created_at' => :'created_at', + :'id' => :'id', + :'updated_at' => :'updated_at' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'conditions' => :'Array', + :'created_at' => :'Time', + :'id' => :'UUID', + :'updated_at' => :'Time' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TargetingRule` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'conditions') + if (value = attributes[:'conditions']).is_a?(Array) + self.conditions = value + end + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @conditions.nil? + return false if @created_at.nil? + return false if @id.nil? + return false if @updated_at.nil? + true + end + + # Custom attribute writer method with validation + # @param conditions [Object] Object to be assigned + # @!visibility private + def conditions=(conditions) + if conditions.nil? + fail ArgumentError, 'invalid value for "conditions", conditions cannot be nil.' + end + @conditions = conditions + end + + # Custom attribute writer method with validation + # @param created_at [Object] Object to be assigned + # @!visibility private + def created_at=(created_at) + if created_at.nil? + fail ArgumentError, 'invalid value for "created_at", created_at cannot be nil.' + end + @created_at = created_at + end + + # Custom attribute writer method with validation + # @param id [Object] Object to be assigned + # @!visibility private + def id=(id) + if id.nil? + fail ArgumentError, 'invalid value for "id", id cannot be nil.' + end + @id = id + end + + # Custom attribute writer method with validation + # @param updated_at [Object] Object to be assigned + # @!visibility private + def updated_at=(updated_at) + if updated_at.nil? + fail ArgumentError, 'invalid value for "updated_at", updated_at cannot be nil.' + end + @updated_at = updated_at + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + created_at == o.created_at && + id == o.id && + updated_at == o.updated_at && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [conditions, created_at, id, updated_at, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/targeting_rule_request.rb b/lib/datadog_api_client/v2/models/targeting_rule_request.rb new file mode 100644 index 000000000000..2070d74063fd --- /dev/null +++ b/lib/datadog_api_client/v2/models/targeting_rule_request.rb @@ -0,0 +1,129 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Targeting rule request payload. + class TargetingRuleRequest + include BaseGenericModel + + # Conditions that must match for this rule. + attr_reader :conditions + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'conditions' => :'conditions' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'conditions' => :'Array' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TargetingRuleRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'conditions') + if (value = attributes[:'conditions']).is_a?(Array) + self.conditions = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @conditions.nil? + return false if @conditions.length < 1 + true + end + + # Custom attribute writer method with validation + # @param conditions [Object] Object to be assigned + # @!visibility private + def conditions=(conditions) + if conditions.nil? + fail ArgumentError, 'invalid value for "conditions", conditions cannot be nil.' + end + if conditions.length < 1 + fail ArgumentError, 'invalid value for "conditions", number of items must be greater than or equal to 1.' + end + @conditions = conditions + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + conditions == o.conditions && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [conditions, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/upsert_allocation_request.rb b/lib/datadog_api_client/v2/models/upsert_allocation_request.rb new file mode 100644 index 000000000000..4f19f60d283f --- /dev/null +++ b/lib/datadog_api_client/v2/models/upsert_allocation_request.rb @@ -0,0 +1,239 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Request to create or update a targeting rule (allocation) for a feature flag environment. + class UpsertAllocationRequest + include BaseGenericModel + + # The experiment ID for experiment-linked allocations. + attr_accessor :experiment_id + + # Progressive release request payload. + attr_accessor :exposure_schedule + + # Guardrail metrics used to monitor and auto-pause or abort. + attr_accessor :guardrail_metrics + + # The unique identifier of the targeting rule allocation. + attr_accessor :id + + # The unique key of the targeting rule allocation. + attr_reader :key + + # The display name of the targeting rule. + attr_reader :name + + # Targeting rules that determine audience eligibility. + attr_accessor :targeting_rules + + # The type of targeting rule (called allocation in the API model). + attr_reader :type + + # Variant distribution weights. + attr_accessor :variant_weights + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'experiment_id' => :'experiment_id', + :'exposure_schedule' => :'exposure_schedule', + :'guardrail_metrics' => :'guardrail_metrics', + :'id' => :'id', + :'key' => :'key', + :'name' => :'name', + :'targeting_rules' => :'targeting_rules', + :'type' => :'type', + :'variant_weights' => :'variant_weights' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'experiment_id' => :'String', + :'exposure_schedule' => :'ExposureScheduleRequest', + :'guardrail_metrics' => :'Array', + :'id' => :'UUID', + :'key' => :'String', + :'name' => :'String', + :'targeting_rules' => :'Array', + :'type' => :'AllocationType', + :'variant_weights' => :'Array' + } + end + + # List of attributes with nullable: true + # @!visibility private + def self.openapi_nullable + Set.new([ + :'experiment_id', + ]) + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::UpsertAllocationRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'experiment_id') + self.experiment_id = attributes[:'experiment_id'] + end + + if attributes.key?(:'exposure_schedule') + self.exposure_schedule = attributes[:'exposure_schedule'] + end + + if attributes.key?(:'guardrail_metrics') + if (value = attributes[:'guardrail_metrics']).is_a?(Array) + self.guardrail_metrics = value + end + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'key') + self.key = attributes[:'key'] + end + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'targeting_rules') + if (value = attributes[:'targeting_rules']).is_a?(Array) + self.targeting_rules = value + end + end + + if attributes.key?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'variant_weights') + if (value = attributes[:'variant_weights']).is_a?(Array) + self.variant_weights = value + end + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @key.nil? + return false if @name.nil? + return false if @type.nil? + true + end + + # Custom attribute writer method with validation + # @param key [Object] Object to be assigned + # @!visibility private + def key=(key) + if key.nil? + fail ArgumentError, 'invalid value for "key", key cannot be nil.' + end + @key = key + end + + # Custom attribute writer method with validation + # @param name [Object] Object to be assigned + # @!visibility private + def name=(name) + if name.nil? + fail ArgumentError, 'invalid value for "name", name cannot be nil.' + end + @name = name + end + + # Custom attribute writer method with validation + # @param type [Object] Object to be assigned + # @!visibility private + def type=(type) + if type.nil? + fail ArgumentError, 'invalid value for "type", type cannot be nil.' + end + @type = type + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + experiment_id == o.experiment_id && + exposure_schedule == o.exposure_schedule && + guardrail_metrics == o.guardrail_metrics && + id == o.id && + key == o.key && + name == o.name && + targeting_rules == o.targeting_rules && + type == o.type && + variant_weights == o.variant_weights && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [experiment_id, exposure_schedule, guardrail_metrics, id, key, name, targeting_rules, type, variant_weights, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/variant_weight.rb b/lib/datadog_api_client/v2/models/variant_weight.rb new file mode 100644 index 000000000000..2e669e8edf62 --- /dev/null +++ b/lib/datadog_api_client/v2/models/variant_weight.rb @@ -0,0 +1,184 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Variant weight details. + class VariantWeight + include BaseGenericModel + + # The timestamp when the variant weight was created. + attr_accessor :created_at + + # Unique identifier of the variant weight assignment. + attr_accessor :id + + # The timestamp when the variant weight was last updated. + attr_accessor :updated_at + + # The percentage weight for the variant. + attr_reader :value + + # A variant of a feature flag. + attr_accessor :variant + + # The variant ID. + attr_reader :variant_id + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'created_at' => :'created_at', + :'id' => :'id', + :'updated_at' => :'updated_at', + :'value' => :'value', + :'variant' => :'variant', + :'variant_id' => :'variant_id' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'created_at' => :'Time', + :'id' => :'UUID', + :'updated_at' => :'Time', + :'value' => :'Float', + :'variant' => :'Variant', + :'variant_id' => :'UUID' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::VariantWeight` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'updated_at') + self.updated_at = attributes[:'updated_at'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'variant') + self.variant = attributes[:'variant'] + end + + if attributes.key?(:'variant_id') + self.variant_id = attributes[:'variant_id'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @value.nil? + return false if @variant_id.nil? + true + end + + # Custom attribute writer method with validation + # @param value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + @value = value + end + + # Custom attribute writer method with validation + # @param variant_id [Object] Object to be assigned + # @!visibility private + def variant_id=(variant_id) + if variant_id.nil? + fail ArgumentError, 'invalid value for "variant_id", variant_id cannot be nil.' + end + @variant_id = variant_id + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + created_at == o.created_at && + id == o.id && + updated_at == o.updated_at && + value == o.value && + variant == o.variant && + variant_id == o.variant_id && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [created_at, id, updated_at, value, variant, variant_id, additional_properties].hash + end + end +end diff --git a/lib/datadog_api_client/v2/models/variant_weight_request.rb b/lib/datadog_api_client/v2/models/variant_weight_request.rb new file mode 100644 index 000000000000..f27691d95cd8 --- /dev/null +++ b/lib/datadog_api_client/v2/models/variant_weight_request.rb @@ -0,0 +1,143 @@ +=begin +#Datadog API V2 Collection + +#Collection of all Datadog Public endpoints. + +The version of the OpenAPI document: 1.0 +Contact: support@datadoghq.com +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator + + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. + This product includes software developed at Datadog (https://www.datadoghq.com/). + Copyright 2020-Present Datadog, Inc. + +=end + +require 'date' +require 'time' + +module DatadogAPIClient::V2 + # Variant weight request payload. + class VariantWeightRequest + include BaseGenericModel + + # The percentage weight for this variant. + attr_reader :value + + # The variant ID to assign weight to. + attr_accessor :variant_id + + # The variant key to assign weight to. + attr_accessor :variant_key + + attr_accessor :additional_properties + + # Attribute mapping from ruby-style variable name to JSON key. + # @!visibility private + def self.attribute_map + { + :'value' => :'value', + :'variant_id' => :'variant_id', + :'variant_key' => :'variant_key' + } + end + + # Attribute type mapping. + # @!visibility private + def self.openapi_types + { + :'value' => :'Float', + :'variant_id' => :'UUID', + :'variant_key' => :'String' + } + end + + # Initializes the object + # @param attributes [Hash] Model attributes in the form of hash + # @!visibility private + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::VariantWeightRequest` initialize method" + end + + self.additional_properties = {} + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + self.additional_properties[k.to_sym] = v + else + h[k.to_sym] = v + end + } + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + + if attributes.key?(:'variant_id') + self.variant_id = attributes[:'variant_id'] + end + + if attributes.key?(:'variant_key') + self.variant_key = attributes[:'variant_key'] + end + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + # @!visibility private + def valid? + return false if @value.nil? + true + end + + # Custom attribute writer method with validation + # @param value [Object] Object to be assigned + # @!visibility private + def value=(value) + if value.nil? + fail ArgumentError, 'invalid value for "value", value cannot be nil.' + end + @value = value + end + + # Returns the object in the form of hash, with additionalProperties support. + # @return [Hash] Returns the object in the form of hash + # @!visibility private + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + self.additional_properties.each_pair do |attr, value| + hash[attr] = value + end + hash + end + + # Checks equality by comparing each attribute. + # @param o [Object] Object to be compared + # @!visibility private + def ==(o) + return true if self.equal?(o) + self.class == o.class && + value == o.value && + variant_id == o.variant_id && + variant_key == o.variant_key && + additional_properties == o.additional_properties + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + # @!visibility private + def hash + [value, variant_id, variant_key, additional_properties].hash + end + end +end