|
| 1 | +=begin |
| 2 | +#Datadog API V2 Collection |
| 3 | +
|
| 4 | +#Collection of all Datadog Public endpoints. |
| 5 | +
|
| 6 | +The version of the OpenAPI document: 1.0 |
| 7 | +Contact: support@datadoghq.com |
| 8 | +Generated by: https://github.com/DataDog/datadog-api-client-ruby/tree/master/.generator |
| 9 | +
|
| 10 | + Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. |
| 11 | + This product includes software developed at Datadog (https://www.datadoghq.com/). |
| 12 | + Copyright 2020-Present Datadog, Inc. |
| 13 | +
|
| 14 | +=end |
| 15 | + |
| 16 | +require 'cgi' |
| 17 | + |
| 18 | +module DatadogAPIClient::V2 |
| 19 | + class GovernanceInsightsAPI |
| 20 | + attr_accessor :api_client |
| 21 | + |
| 22 | + def initialize(api_client = DatadogAPIClient::APIClient.default) |
| 23 | + @api_client = api_client |
| 24 | + end |
| 25 | + |
| 26 | + # List governance insights. |
| 27 | + # |
| 28 | + # @see #list_governance_insights_with_http_info |
| 29 | + def list_governance_insights(opts = {}) |
| 30 | + data, _status_code, _headers = list_governance_insights_with_http_info(opts) |
| 31 | + data |
| 32 | + end |
| 33 | + |
| 34 | + # List governance insights. |
| 35 | + # |
| 36 | + # Retrieve the list of governance insights available to the organization. By default, only |
| 37 | + # insight metadata is returned; pass `withValues=true` to also compute and include each |
| 38 | + # insight's current and previous values. Insights can be filtered by product. |
| 39 | + # |
| 40 | + # @param opts [Hash] the optional parameters |
| 41 | + # @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. |
| 42 | + # @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. |
| 43 | + # @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. |
| 44 | + # @return [Array<(GovernanceInsightsResponse, Integer, Hash)>] GovernanceInsightsResponse data, response status code and response headers |
| 45 | + def list_governance_insights_with_http_info(opts = {}) |
| 46 | + unstable_enabled = @api_client.config.unstable_operations["v2.list_governance_insights".to_sym] |
| 47 | + if unstable_enabled |
| 48 | + @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_governance_insights") |
| 49 | + else |
| 50 | + raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_governance_insights")) |
| 51 | + end |
| 52 | + |
| 53 | + if @api_client.config.debugging |
| 54 | + @api_client.config.logger.debug 'Calling API: GovernanceInsightsAPI.list_governance_insights ...' |
| 55 | + end |
| 56 | + # resource path |
| 57 | + local_var_path = '/api/v2/governance/insights' |
| 58 | + |
| 59 | + # query parameters |
| 60 | + query_params = opts[:query_params] || {} |
| 61 | + query_params[:'withValues'] = opts[:'with_values'] if !opts[:'with_values'].nil? |
| 62 | + query_params[:'orgUuid'] = opts[:'org_uuid'] if !opts[:'org_uuid'].nil? |
| 63 | + query_params[:'filter[product]'] = @api_client.build_collection_param(opts[:'filter_product'], :multi) if !opts[:'filter_product'].nil? |
| 64 | + |
| 65 | + # header parameters |
| 66 | + header_params = opts[:header_params] || {} |
| 67 | + # HTTP header 'Accept' (if needed) |
| 68 | + header_params['Accept'] = @api_client.select_header_accept(['application/json']) |
| 69 | + |
| 70 | + # form parameters |
| 71 | + form_params = opts[:form_params] || {} |
| 72 | + |
| 73 | + # http body (model) |
| 74 | + post_body = opts[:debug_body] |
| 75 | + |
| 76 | + # return_type |
| 77 | + return_type = opts[:debug_return_type] || 'GovernanceInsightsResponse' |
| 78 | + |
| 79 | + # auth_names |
| 80 | + auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] |
| 81 | + |
| 82 | + new_options = opts.merge( |
| 83 | + :operation => :list_governance_insights, |
| 84 | + :header_params => header_params, |
| 85 | + :query_params => query_params, |
| 86 | + :form_params => form_params, |
| 87 | + :body => post_body, |
| 88 | + :auth_names => auth_names, |
| 89 | + :return_type => return_type, |
| 90 | + :api_version => "V2" |
| 91 | + ) |
| 92 | + new_options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER |
| 93 | + |
| 94 | + data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) |
| 95 | + if @api_client.config.debugging |
| 96 | + @api_client.config.logger.debug "API called: GovernanceInsightsAPI#list_governance_insights\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" |
| 97 | + end |
| 98 | + return data, status_code, headers |
| 99 | + end |
| 100 | + end |
| 101 | +end |
0 commit comments