Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 111 additions & 21 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28217,7 +28217,7 @@ components:
- data
type: object
CreateVariant:
description: Request to create a variant.
description: Attributes for creating a variant.
properties:
key:
description: The unique key of the variant.
Expand All @@ -28236,6 +28236,25 @@ components:
- name
- value
type: object
CreateVariantData:
description: Data for adding a variant to a feature flag.
properties:
attributes:
$ref: "#/components/schemas/CreateVariant"
type:
$ref: "#/components/schemas/VariantDataType"
required:
- type
- attributes
type: object
CreateVariantRequest:
description: Request to add a variant to a feature flag.
properties:
data:
$ref: "#/components/schemas/CreateVariantData"
required:
- data
type: object
CreateWorkflowRequest:
description: A request object for creating a new workflow.
example:
Expand Down Expand Up @@ -141665,8 +141684,8 @@ components:
required:
- data
type: object
UpdateVariantRequest:
description: Request to update an existing variant's name and value.
UpdateVariantAttributes:
description: Attributes for updating a variant.
properties:
name:
description: The display name of the variant.
Expand All @@ -141677,6 +141696,30 @@ components:
example: "new_value"
type: string
type: object
UpdateVariantData:
description: Data for updating a variant.
properties:
attributes:
$ref: "#/components/schemas/UpdateVariantAttributes"
id:
description: The ID of the variant. If you include it, use the same value as the `variant_id` path parameter.
example: "550e8400-e29b-41d4-a716-446655440002"
format: uuid
type: string
type:
$ref: "#/components/schemas/VariantDataType"
required:
- type
- attributes
type: object
UpdateVariantRequest:
description: Request to update an existing variant's name and value.
properties:
data:
$ref: "#/components/schemas/UpdateVariantData"
required:
- data
type: object
UpdateWorkflowRequest:
description: A request object for updating an existing workflow.
example:
Expand Down Expand Up @@ -143625,6 +143668,69 @@ components:
- name
- value
type: object
VariantDataType:
description: The resource type for variants.
enum:
- "variants"
example: "variants"
type: string
x-enum-varnames:
- VARIANTS
VariantResponse:
description: Response containing a variant.
properties:
data:
$ref: "#/components/schemas/VariantResponseData"
required:
- data
type: object
VariantResponseAttributes:
description: Attributes of a variant.
properties:
created_at:
description: The timestamp when the variant was created.
example: "2023-01-01T00:00:00Z"
format: date-time
type: string
key:
description: The unique key of the variant.
example: "variant-abc123"
type: string
name:
description: The name of the variant.
example: "Variant ABC123"
type: string
updated_at:
description: The timestamp when the variant was last updated.
example: "2023-01-01T00:00:00Z"
format: date-time
type: string
value:
description: The value of the variant as a string.
example: "true"
type: string
required:
- key
- name
- value
type: object
VariantResponseData:
description: A variant resource.
properties:
attributes:
$ref: "#/components/schemas/VariantResponseAttributes"
id:
description: The unique identifier of the variant.
example: "550e8400-e29b-41d4-a716-446655440002"
format: uuid
type: string
type:
$ref: "#/components/schemas/VariantDataType"
required:
- id
- type
- attributes
type: object
VariantWeight:
description: Variant weight details.
properties:
Expand Down Expand Up @@ -177827,7 +177933,7 @@ paths:
value: dark
type: variants
schema:
$ref: "#/components/schemas/CreateVariant"
$ref: "#/components/schemas/CreateVariantRequest"
required: true
responses:
"201":
Expand All @@ -177846,7 +177952,7 @@ paths:
id: "550e8400-e29b-41d4-a716-446655440002"
type: variants
schema:
$ref: "#/components/schemas/Variant"
$ref: "#/components/schemas/VariantResponse"
description: Created
"400":
content:
Expand Down Expand Up @@ -177963,22 +178069,6 @@ paths:
required: true
responses:
"200":
content:
application/json:
examples:
default:
value:
data:
attributes:
created_at: "2024-01-01T00:00:00+00:00"
key: dark
name: Dark Theme Updated
updated_at: "2024-06-01T00:00:00+00:00"
value: dark_v2
id: "550e8400-e29b-41d4-a716-446655440002"
type: variants
schema:
$ref: "#/components/schemas/Variant"
description: OK
"400":
content:
Expand Down
13 changes: 9 additions & 4 deletions examples/v2/feature-flags/CreateVariantForFeatureFlag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@
end
api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new

body = DatadogAPIClient::V2::CreateVariant.new({
key: "variant-abc123",
name: "Variant ABC123",
value: "true",
body = DatadogAPIClient::V2::CreateVariantRequest.new({
data: DatadogAPIClient::V2::CreateVariantData.new({
attributes: DatadogAPIClient::V2::CreateVariant.new({
key: "variant-abc123",
name: "Variant ABC123",
value: "true",
}),
type: DatadogAPIClient::V2::VariantDataType::VARIANTS,
}),
})
p api_instance.create_variant_for_feature_flag("550e8400-e29b-41d4-a716-446655440000", body)
10 changes: 8 additions & 2 deletions examples/v2/feature-flags/UpdateVariantForFeatureFlag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@
api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new

body = DatadogAPIClient::V2::UpdateVariantRequest.new({
name: "Variant ABC123 Updated",
value: "new_value",
data: DatadogAPIClient::V2::UpdateVariantData.new({
attributes: DatadogAPIClient::V2::UpdateVariantAttributes.new({
name: "Variant ABC123 Updated",
value: "new_value",
}),
id: "550e8400-e29b-41d4-a716-446655440002",
type: DatadogAPIClient::V2::VariantDataType::VARIANTS,
}),
})
p api_instance.update_variant_for_feature_flag("550e8400-e29b-41d4-a716-446655440000", "550e8400-e29b-41d4-a716-446655440002", body)
2 changes: 1 addition & 1 deletion features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3918,7 +3918,7 @@
},
"v2.CreateVariantForFeatureFlag" => {
"feature_flag_id" => "UUID",
"body" => "CreateVariant",
"body" => "CreateVariantRequest",
},
"v2.DeleteVariantFromFeatureFlag" => {
"feature_flag_id" => "UUID",
Expand Down
16 changes: 8 additions & 8 deletions features/v2/feature_flags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,31 @@ Feature: Feature Flags
Scenario: Add a variant to a feature flag returns "Bad Request" response
Given new "CreateVariantForFeatureFlag" request
And request contains "feature_flag_id" parameter from "REPLACE.ME"
And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}
And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:ddoghq/feature-flags
Scenario: Add a variant to a feature flag returns "Conflict - A variant with this key already exists on the flag." response
Given new "CreateVariantForFeatureFlag" request
And request contains "feature_flag_id" parameter from "REPLACE.ME"
And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}
And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}}
When the request is sent
Then the response status is 409 Conflict - A variant with this key already exists on the flag.

@generated @skip @team:ddoghq/feature-flags
Scenario: Add a variant to a feature flag returns "Created" response
Given new "CreateVariantForFeatureFlag" request
And request contains "feature_flag_id" parameter from "REPLACE.ME"
And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}
And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}}
When the request is sent
Then the response status is 201 Created

@generated @skip @team:ddoghq/feature-flags
Scenario: Add a variant to a feature flag returns "Not Found" response
Given new "CreateVariantForFeatureFlag" request
And request contains "feature_flag_id" parameter from "REPLACE.ME"
And body with value {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}
And body with value {"data": {"attributes": {"key": "variant-abc123", "name": "Variant ABC123", "value": "true"}, "type": "variants"}}
When the request is sent
Then the response status is 404 Not Found

Expand Down Expand Up @@ -1092,7 +1092,7 @@ Feature: Feature Flags
Given new "UpdateVariantForFeatureFlag" request
And request contains "feature_flag_id" parameter from "REPLACE.ME"
And request contains "variant_id" parameter from "REPLACE.ME"
And body with value {"name": "Variant ABC123 Updated", "value": "new_value"}
And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}}
When the request is sent
Then the response status is 400 Bad Request

Expand All @@ -1101,7 +1101,7 @@ Feature: Feature Flags
Given new "UpdateVariantForFeatureFlag" request
And request contains "feature_flag_id" parameter from "REPLACE.ME"
And request contains "variant_id" parameter from "REPLACE.ME"
And body with value {"name": "Variant ABC123 Updated", "value": "new_value"}
And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}}
When the request is sent
Then the response status is 409 Conflict - A pending suggestion already exists for this property.

Expand All @@ -1110,7 +1110,7 @@ Feature: Feature Flags
Given new "UpdateVariantForFeatureFlag" request
And request contains "feature_flag_id" parameter from "REPLACE.ME"
And request contains "variant_id" parameter from "REPLACE.ME"
And body with value {"name": "Variant ABC123 Updated", "value": "new_value"}
And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}}
When the request is sent
Then the response status is 404 Not Found

Expand All @@ -1119,7 +1119,7 @@ Feature: Feature Flags
Given new "UpdateVariantForFeatureFlag" request
And request contains "feature_flag_id" parameter from "REPLACE.ME"
And request contains "variant_id" parameter from "REPLACE.ME"
And body with value {"name": "Variant ABC123 Updated", "value": "new_value"}
And body with value {"data": {"attributes": {"name": "Variant ABC123 Updated", "value": "new_value"}, "id": "550e8400-e29b-41d4-a716-446655440002", "type": "variants"}}
When the request is sent
Then the response status is 200 OK

Expand Down
8 changes: 8 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2742,6 +2742,8 @@ def overrides
"v2.create_upload_response_data_type" => "CreateUploadResponseDataType",
"v2.create_user_notification_channel_request" => "CreateUserNotificationChannelRequest",
"v2.create_variant" => "CreateVariant",
"v2.create_variant_data" => "CreateVariantData",
"v2.create_variant_request" => "CreateVariantRequest",
"v2.create_workflow_request" => "CreateWorkflowRequest",
"v2.create_workflow_response" => "CreateWorkflowResponse",
"v2.creator" => "Creator",
Expand Down Expand Up @@ -9600,6 +9602,8 @@ def overrides
"v2.update_tenancy_config_data_type" => "UpdateTenancyConfigDataType",
"v2.update_tenancy_config_request" => "UpdateTenancyConfigRequest",
"v2.update_user_identity_providers_request" => "UpdateUserIdentityProvidersRequest",
"v2.update_variant_attributes" => "UpdateVariantAttributes",
"v2.update_variant_data" => "UpdateVariantData",
"v2.update_variant_request" => "UpdateVariantRequest",
"v2.update_workflow_request" => "UpdateWorkflowRequest",
"v2.update_workflow_response" => "UpdateWorkflowResponse",
Expand Down Expand Up @@ -9739,6 +9743,10 @@ def overrides
"v2.validation_response" => "ValidationResponse",
"v2.value_type" => "ValueType",
"v2.variant" => "Variant",
"v2.variant_data_type" => "VariantDataType",
"v2.variant_response" => "VariantResponse",
"v2.variant_response_attributes" => "VariantResponseAttributes",
"v2.variant_response_data" => "VariantResponseData",
"v2.variant_weight" => "VariantWeight",
"v2.variant_weight_request" => "VariantWeightRequest",
"v2.version_history_update" => "VersionHistoryUpdate",
Expand Down
16 changes: 8 additions & 8 deletions lib/datadog_api_client/v2/api/feature_flags_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ def create_variant_for_feature_flag(feature_flag_id, body, opts = {})
# the new variant in subsequent allocation syncs.
#
# @param feature_flag_id [UUID] The ID of the feature flag.
# @param body [CreateVariant]
# @param body [CreateVariantRequest]
# @param opts [Hash] the optional parameters
# @return [Array<(Variant, Integer, Hash)>] Variant data, response status code and response headers
# @return [Array<(VariantResponse, Integer, Hash)>] VariantResponse data, response status code and response headers
def create_variant_for_feature_flag_with_http_info(feature_flag_id, body, opts = {})

if @api_client.config.debugging
Expand Down Expand Up @@ -355,7 +355,7 @@ def create_variant_for_feature_flag_with_http_info(feature_flag_id, body, opts =
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

# return_type
return_type = opts[:debug_return_type] || 'Variant'
return_type = opts[:debug_return_type] || 'VariantResponse'

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
Expand Down Expand Up @@ -1696,8 +1696,8 @@ def update_saved_filter_attributes_with_http_info(saved_filter_id, body, opts =
#
# @see #update_variant_for_feature_flag_with_http_info
def update_variant_for_feature_flag(feature_flag_id, variant_id, body, opts = {})
data, _status_code, _headers = update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id, body, opts)
data
update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id, body, opts)
nil
end

# Update a variant.
Expand All @@ -1710,7 +1710,7 @@ def update_variant_for_feature_flag(feature_flag_id, variant_id, body, opts = {}
# @param variant_id [UUID] The ID of the variant.
# @param body [UpdateVariantRequest]
# @param opts [Hash] the optional parameters
# @return [Array<(Variant, Integer, Hash)>] Variant data, response status code and response headers
# @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
def update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id, body, opts = {})

if @api_client.config.debugging
Expand All @@ -1737,7 +1737,7 @@ def update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id,
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
header_params['Accept'] = @api_client.select_header_accept(['*/*'])
# HTTP header 'Content-Type'
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

Expand All @@ -1748,7 +1748,7 @@ def update_variant_for_feature_flag_with_http_info(feature_flag_id, variant_id,
post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

# return_type
return_type = opts[:debug_return_type] || 'Variant'
return_type = opts[:debug_return_type]

# auth_names
auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]
Expand Down
Loading
Loading