Skip to content
Open
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
556 changes: 556 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions examples/v2/feature-flags/ExportFeatureFlagHistory.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Export feature flag change history returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new
p api_instance.export_feature_flag_history()
8 changes: 8 additions & 0 deletions examples/v2/feature-flags/ListFeatureFlagHistory.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# List feature flag change history returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::FeatureFlagsAPI.new
p api_instance.list_feature_flag_history()
20 changes: 20 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3869,6 +3869,26 @@
"v2.StopExposureSchedule" => {
"exposure_schedule_id" => "UUID",
},
"v2.ListFeatureFlagHistory" => {
"start_date" => "Time",
"end_date" => "Time",
"teams" => "Array<String>",
"tags" => "Array<String>",
"feature_flag_id" => "UUID",
"environment_id" => "UUID",
"include_suggestion_events" => "Boolean",
"page_limit" => "Integer",
"page_offset" => "Integer",
},
"v2.ExportFeatureFlagHistory" => {
"start_date" => "Time",
"end_date" => "Time",
"teams" => "Array<String>",
"tags" => "Array<String>",
"feature_flag_id" => "UUID",
"environment_id" => "UUID",
"include_suggestion_events" => "Boolean",
},
"v2.GetSavedFilter" => {
"saved_filter_id" => "UUID",
},
Expand Down
24 changes: 24 additions & 0 deletions features/v2/feature_flags.feature
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,18 @@ Feature: Feature Flags
When the request is sent
Then the response status is 200 OK

@generated @skip @team:ddoghq/feature-flags
Scenario: Export feature flag change history returns "Bad Request" response
Given new "ExportFeatureFlagHistory" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:ddoghq/feature-flags
Scenario: Export feature flag change history returns "OK" response
Given new "ExportFeatureFlagHistory" request
When the request is sent
Then the response status is 200 OK

@skip @team:ddoghq/feature-flags
Scenario: Get a feature flag returns "Not Found" response
Given new "GetFeatureFlag" request
Expand Down Expand Up @@ -360,6 +372,18 @@ Feature: Feature Flags
When the request is sent
Then the response status is 200 OK

@generated @skip @team:ddoghq/feature-flags
Scenario: List feature flag change history returns "Bad Request" response
Given new "ListFeatureFlagHistory" request
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:ddoghq/feature-flags
Scenario: List feature flag change history returns "OK" response
Given new "ListFeatureFlagHistory" request
When the request is sent
Then the response status is 200 OK

@team:ddoghq/feature-flags
Scenario: List feature flags applies default pagination
Given new "ListFeatureFlags" request
Expand Down
12 changes: 12 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3221,6 +3221,18 @@
"type": "idempotent"
}
},
"ListFeatureFlagHistory": {
"tag": "Feature Flags",
"undo": {
"type": "safe"
}
},
"ExportFeatureFlagHistory": {
"tag": "Feature Flags",
"undo": {
"type": "safe"
}
},
"GetSavedFilter": {
"tag": "Feature Flags",
"undo": {
Expand Down
14 changes: 14 additions & 0 deletions lib/datadog_api_client/inflector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3901,9 +3901,22 @@ def overrides
"v2.fastly_service_type" => "FastlyServiceType",
"v2.feature_flag" => "FeatureFlag",
"v2.feature_flag_attributes" => "FeatureFlagAttributes",
"v2.feature_flag_change_event" => "FeatureFlagChangeEvent",
"v2.feature_flag_change_event_action" => "FeatureFlagChangeEventAction",
"v2.feature_flag_change_event_attributes" => "FeatureFlagChangeEventAttributes",
"v2.feature_flag_change_event_creation_source" => "FeatureFlagChangeEventCreationSource",
"v2.feature_flag_change_event_environment" => "FeatureFlagChangeEventEnvironment",
"v2.feature_flag_change_event_flag" => "FeatureFlagChangeEventFlag",
"v2.feature_flag_change_event_property" => "FeatureFlagChangeEventProperty",
"v2.feature_flag_change_event_suggestion_lifecycle_status" => "FeatureFlagChangeEventSuggestionLifecycleStatus",
"v2.feature_flag_change_event_suggestion_review" => "FeatureFlagChangeEventSuggestionReview",
"v2.feature_flag_change_event_suggestion_status" => "FeatureFlagChangeEventSuggestionStatus",
"v2.feature_flag_change_event_type" => "FeatureFlagChangeEventType",
"v2.feature_flag_distribution_channel" => "FeatureFlagDistributionChannel",
"v2.feature_flag_environment" => "FeatureFlagEnvironment",
"v2.feature_flag_environment_list_item" => "FeatureFlagEnvironmentListItem",
"v2.feature_flag_history_pagination_meta" => "FeatureFlagHistoryPaginationMeta",
"v2.feature_flag_history_pagination_meta_page" => "FeatureFlagHistoryPaginationMetaPage",
"v2.feature_flag_list_item" => "FeatureFlagListItem",
"v2.feature_flag_list_item_attributes" => "FeatureFlagListItemAttributes",
"v2.feature_flag_production_status" => "FeatureFlagProductionStatus",
Expand Down Expand Up @@ -5077,6 +5090,7 @@ def overrides
"v2.list_entity_catalog_response_included_item" => "ListEntityCatalogResponseIncludedItem",
"v2.list_entity_catalog_response_links" => "ListEntityCatalogResponseLinks",
"v2.list_environments_response" => "ListEnvironmentsResponse",
"v2.list_feature_flag_history_response" => "ListFeatureFlagHistoryResponse",
"v2.list_feature_flags_response" => "ListFeatureFlagsResponse",
"v2.list_findings_meta" => "ListFindingsMeta",
"v2.list_findings_page" => "ListFindingsPage",
Expand Down
173 changes: 173 additions & 0 deletions lib/datadog_api_client/v2/api/feature_flags_api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,88 @@ def enable_feature_flag_environment_with_http_info(feature_flag_id, environment_
return data, status_code, headers
end

# Export feature flag change history.
#
# @see #export_feature_flag_history_with_http_info
def export_feature_flag_history(opts = {})
data, _status_code, _headers = export_feature_flag_history_with_http_info(opts)
data
end

# Export feature flag change history.
#
# Exports the organization's feature flag change events as a CSV file, newest first, without pagination.
# It accepts the same filters as the List feature flag change history endpoint, and its columns match the CSV export on the flag history page:
# Flag Version, Flag Name, Flag Key, Flag UUID, Action, User Name, User Email, User Type, Environment, and Timestamp.
#
# If an export fails before the file starts, the response is a JSON:API error. Large exports stream as they are read.
# If an export fails after streaming starts, the connection closes before the file ends, so the download fails instead of
# returning a file with missing rows. An export must finish within the 60-second request timeout. If an export times out,
# narrow the date range.
#
# @param opts [Hash] the optional parameters
# @option opts [Time] :start_date Only include changes made after this time, for example `2026-01-01T00:00:00Z`. Omit for no lower bound.
# @option opts [Time] :end_date Only include changes made before this time, for example `2026-02-01T00:00:00Z`. Omit for no upper bound. Must be after `start_date` when both are set.
# @option opts [Array<String>] :teams Only include changes to flags that belong to at least one of these teams. Use team handles without the `team:` prefix, as repeated parameters, such as `teams=checkout&teams=payments`. Handles from `teams` and `team:<handle>` values from `tags` are treated as one set. Handles that are empty, have surrounding white space, or include the `team:` prefix return a `400 Bad Request` error.
# @option opts [Array<String>] :tags Only include changes to flags that have all of these exact tags, as repeated parameters, such as `tags=env:prod&tags=tier:1`. Values of the form `team:<handle>` match any selected team and are combined with `teams`. Empty values are ignored.
# @option opts [UUID] :feature_flag_id Only include changes to this feature flag.
# @option opts [UUID] :environment_id Only include changes to this environment. Changes to the flag itself, which have no environment, are always included.
# @option opts [Boolean] :include_suggestion_events Also include review events for change requests that needed approval: rejected requests and requests still pending review. Applies only to organizations with flag approvals enabled.
# @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
def export_feature_flag_history_with_http_info(opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FeatureFlagsAPI.export_feature_flag_history ...'
end
# resource path
local_var_path = '/api/v2/feature-flags/history/export'

# query parameters
query_params = opts[:query_params] || {}
query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
query_params[:'teams'] = @api_client.build_collection_param(opts[:'teams'], :multi) if !opts[:'teams'].nil?
query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if !opts[:'tags'].nil?
query_params[:'feature_flag_id'] = opts[:'feature_flag_id'] if !opts[:'feature_flag_id'].nil?
query_params[:'environment_id'] = opts[:'environment_id'] if !opts[:'environment_id'].nil?
query_params[:'include_suggestion_events'] = opts[:'include_suggestion_events'] if !opts[:'include_suggestion_events'].nil?

# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['text/csv', '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] || 'String'

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

new_options = opts.merge(
:operation => :export_feature_flag_history,
: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"
)
new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: FeatureFlagsAPI#export_feature_flag_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# Get a feature flag.
#
# @see #get_feature_flag_with_http_info
Expand Down Expand Up @@ -855,6 +937,97 @@ def get_saved_filter_with_http_info(saved_filter_id, opts = {})
return data, status_code, headers
end

# List feature flag change history.
#
# @see #list_feature_flag_history_with_http_info
def list_feature_flag_history(opts = {})
data, _status_code, _headers = list_feature_flag_history_with_http_info(opts)
data
end

# List feature flag change history.
#
# Returns the organization's feature flag change events, newest first.
# Each event includes a readable description of the change.
# All filters are optional, and events must match every filter you set. Without a date range, the whole history is listed.
# Results are paginated with `page[limit]` and `page[offset]`; follow `links.next` to read further back.
#
# @param opts [Hash] the optional parameters
# @option opts [Time] :start_date Only include changes made after this time, for example `2026-01-01T00:00:00Z`. Omit for no lower bound.
# @option opts [Time] :end_date Only include changes made before this time, for example `2026-02-01T00:00:00Z`. Omit for no upper bound. Must be after `start_date` when both are set.
# @option opts [Array<String>] :teams Only include changes to flags that belong to at least one of these teams. Use team handles without the `team:` prefix, as repeated parameters, such as `teams=checkout&teams=payments`. Handles from `teams` and `team:<handle>` values from `tags` are treated as one set. Handles that are empty, have surrounding white space, or include the `team:` prefix return a `400 Bad Request` error.
# @option opts [Array<String>] :tags Only include changes to flags that have all of these exact tags, as repeated parameters, such as `tags=env:prod&tags=tier:1`. Values of the form `team:<handle>` match any selected team and are combined with `teams`. Empty values are ignored.
# @option opts [UUID] :feature_flag_id Only include changes to this feature flag.
# @option opts [UUID] :environment_id Only include changes to this environment. Changes to the flag itself, which have no environment, are always included.
# @option opts [Boolean] :include_suggestion_events Also include review events for change requests that needed approval: rejected requests and requests still pending review. Applies only to organizations with flag approvals enabled.
# @option opts [Integer] :page_limit Maximum number of events to return. Defaults to `25`. Values above `50` return `50` events. Non-positive or empty values use the default. A non-integer value returns a `400 Bad Request` error.
# @option opts [Integer] :page_offset Number of matching events to skip before returning results. Defaults to `0`. Negative or empty values are set to `0`. A non-integer value returns a `400 Bad Request` error.
# @return [Array<(ListFeatureFlagHistoryResponse, Integer, Hash)>] ListFeatureFlagHistoryResponse data, response status code and response headers
def list_feature_flag_history_with_http_info(opts = {})

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: FeatureFlagsAPI.list_feature_flag_history ...'
end
if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 50
fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling FeatureFlagsAPI.list_feature_flag_history, must be smaller than or equal to 50.'
end
if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] < 1
fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling FeatureFlagsAPI.list_feature_flag_history, must be greater than or equal to 1.'
end
if @api_client.config.client_side_validation && !opts[:'page_offset'].nil? && opts[:'page_offset'] < 0
fail ArgumentError, 'invalid value for "opts[:"page_offset"]" when calling FeatureFlagsAPI.list_feature_flag_history, must be greater than or equal to 0.'
end
# resource path
local_var_path = '/api/v2/feature-flags/history'

# query parameters
query_params = opts[:query_params] || {}
query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
query_params[:'teams'] = @api_client.build_collection_param(opts[:'teams'], :multi) if !opts[:'teams'].nil?
query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if !opts[:'tags'].nil?
query_params[:'feature_flag_id'] = opts[:'feature_flag_id'] if !opts[:'feature_flag_id'].nil?
query_params[:'environment_id'] = opts[:'environment_id'] if !opts[:'environment_id'].nil?
query_params[:'include_suggestion_events'] = opts[:'include_suggestion_events'] if !opts[:'include_suggestion_events'].nil?
query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil?
query_params[:'page[offset]'] = opts[:'page_offset'] if !opts[:'page_offset'].nil?

# 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] || 'ListFeatureFlagHistoryResponse'

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

new_options = opts.merge(
:operation => :list_feature_flag_history,
: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"
)
new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER

data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: FeatureFlagsAPI#list_feature_flag_history\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end

# List feature flags.
#
# @see #list_feature_flags_with_http_info
Expand Down
Loading
Loading