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
519 changes: 519 additions & 0 deletions .generator/schemas/v2/openapi.yaml

Large diffs are not rendered by default.

135 changes: 135 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ group :development, :test do
gem 'webmock'
gem 'zstandard'
gem 'pry'
gem 'i18n', '~> 1.14.0'
end

group :docs do
Expand Down
8 changes: 8 additions & 0 deletions examples/v2/governance-insights/ListGovernanceInsights.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# List governance insights returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.unstable_operations["v2.list_governance_insights".to_sym] = true
end
api_instance = DatadogAPIClient::V2::GovernanceInsightsAPI.new
p api_instance.list_governance_insights()
5 changes: 5 additions & 0 deletions features/scenarios_model_mapping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3293,6 +3293,11 @@
"saml_config_uuid" => "String",
"body" => "SAMLConfigurationUpdateRequest",
},
"v2.ListGovernanceInsights" => {
"with_values" => "Boolean",
"org_uuid" => "String",
"filter_product" => "Array<String>",
},
"v2.CreateHamrOrgConnection" => {
"body" => "HamrOrgConnectionRequest",
},
Expand Down
24 changes: 24 additions & 0 deletions features/v2/governance_insights.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@endpoint(governance-insights) @endpoint(governance-insights-v2)
Feature: Governance Insights
Governance Insights surface key usage, configuration, and best-practice
signals for an organization within the Governance Console. Each insight
reports a current value (and, optionally, a previous value for comparison)
along with the query used to compute it, so that the Console can render
trends and highlight areas that need attention.

Background:
Given a valid "apiKeyAuth" key in the system
And a valid "appKeyAuth" key in the system
And an instance of "GovernanceInsights" API
And operation "ListGovernanceInsights" enabled
And new "ListGovernanceInsights" request

@generated @skip @team:DataDog/aaa-governance-console
Scenario: List governance insights returns "Bad Request" response
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/aaa-governance-console
Scenario: List governance insights returns "OK" response
When the request is sent
Then the response status is 200 OK
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2762,6 +2762,12 @@
"type": "safe"
}
},
"ListGovernanceInsights": {
"tag": "Governance Insights",
"undo": {
"type": "safe"
}
},
"GetHamrOrgConnection": {
"tag": "High Availability MultiRegion",
"undo": {
Expand Down
1 change: 1 addition & 0 deletions lib/datadog_api_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ def initialize
"v2.upsert_and_publish_form_version": false,
"v2.upsert_form_version": false,
"v2.update_org_saml_configurations": false,
"v2.list_governance_insights": false,
"v2.create_hamr_org_connection": false,
"v2.get_hamr_org_connection": false,
"v2.delete_entity_integration_config": false,
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 @@ -3508,6 +3508,19 @@ def overrides
"v2.google_chat_update_organization_handle_request_data" => "GoogleChatUpdateOrganizationHandleRequestData",
"v2.google_meet_configuration_reference" => "GoogleMeetConfigurationReference",
"v2.google_meet_configuration_reference_data" => "GoogleMeetConfigurationReferenceData",
"v2.governance_best_practice_definition" => "GovernanceBestPracticeDefinition",
"v2.governance_insight_attributes" => "GovernanceInsightAttributes",
"v2.governance_insight_audit_compute" => "GovernanceInsightAuditCompute",
"v2.governance_insight_audit_query" => "GovernanceInsightAuditQuery",
"v2.governance_insight_data" => "GovernanceInsightData",
"v2.governance_insight_event_compute" => "GovernanceInsightEventCompute",
"v2.governance_insight_event_query" => "GovernanceInsightEventQuery",
"v2.governance_insight_metric_query" => "GovernanceInsightMetricQuery",
"v2.governance_insight_percentage_query" => "GovernanceInsightPercentageQuery",
"v2.governance_insight_query_config" => "GovernanceInsightQueryConfig",
"v2.governance_insight_resource_type" => "GovernanceInsightResourceType",
"v2.governance_insights_response" => "GovernanceInsightsResponse",
"v2.governance_insight_usage_query" => "GovernanceInsightUsageQuery",
"v2.grey_noise_api_key" => "GreyNoiseAPIKey",
"v2.grey_noise_api_key_type" => "GreyNoiseAPIKeyType",
"v2.grey_noise_api_key_update" => "GreyNoiseAPIKeyUpdate",
Expand Down Expand Up @@ -7768,6 +7781,7 @@ def overrides
"v2.forms_api" => "FormsAPI",
"v2.gcp_integration_api" => "GCPIntegrationAPI",
"v2.google_chat_integration_api" => "GoogleChatIntegrationAPI",
"v2.governance_insights_api" => "GovernanceInsightsAPI",
"v2.high_availability_multi_region_api" => "HighAvailabilityMultiRegionAPI",
"v2.incidents_api" => "IncidentsAPI",
"v2.integrations_api" => "IntegrationsAPI",
Expand Down
101 changes: 101 additions & 0 deletions lib/datadog_api_client/v2/api/governance_insights_api.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
=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 'cgi'

module DatadogAPIClient::V2
class GovernanceInsightsAPI
attr_accessor :api_client

def initialize(api_client = DatadogAPIClient::APIClient.default)
@api_client = api_client
end

# List governance insights.
#
# @see #list_governance_insights_with_http_info
def list_governance_insights(opts = {})
data, _status_code, _headers = list_governance_insights_with_http_info(opts)
data
end

# List governance insights.
#
# Retrieve the list of governance insights available to the organization. By default, only
# insight metadata is returned; pass `withValues=true` to also compute and include each
# insight's current and previous values. Insights can be filtered by product.
#
# @param opts [Hash] the optional parameters
# @option opts [Boolean] :with_values Whether to compute and include the current and previous value of each insight. Defaults to `false`, in which case only insight metadata is returned.
# @option opts [String] :org_uuid The UUID of the organization to compute insights for. Defaults to the organization of the authenticated user. Used to retrieve insights for a child organization from a parent organization.
# @option opts [Array<String>] :filter_product Restrict the results to insights belonging to the given products. May be repeated to filter by multiple products. Matching is case-insensitive.
# @return [Array<(GovernanceInsightsResponse, Integer, Hash)>] GovernanceInsightsResponse data, response status code and response headers
def list_governance_insights_with_http_info(opts = {})
unstable_enabled = @api_client.config.unstable_operations["v2.list_governance_insights".to_sym]
if unstable_enabled
@api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_governance_insights")
else
raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_governance_insights"))
end

if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: GovernanceInsightsAPI.list_governance_insights ...'
end
# resource path
local_var_path = '/api/v2/governance/insights'

# query parameters
query_params = opts[:query_params] || {}
query_params[:'withValues'] = opts[:'with_values'] if !opts[:'with_values'].nil?
query_params[:'orgUuid'] = opts[:'org_uuid'] if !opts[:'org_uuid'].nil?
query_params[:'filter[product]'] = @api_client.build_collection_param(opts[:'filter_product'], :multi) if !opts[:'filter_product'].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] || 'GovernanceInsightsResponse'

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

new_options = opts.merge(
:operation => :list_governance_insights,
: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: GovernanceInsightsAPI#list_governance_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
end
end
Loading
Loading