Class: DatadogAPIClient::V2::EntityRiskScoresAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_api_client/v2/api/entity_risk_scores_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = DatadogAPIClient::APIClient.default) ⇒ EntityRiskScoresAPI

Returns a new instance of EntityRiskScoresAPI.



22
23
24
# File 'lib/datadog_api_client/v2/api/entity_risk_scores_api.rb', line 22

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



20
21
22
# File 'lib/datadog_api_client/v2/api/entity_risk_scores_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

#list_entity_risk_scores(opts = {}) ⇒ Object

List Entity Risk Scores.



29
30
31
32
# File 'lib/datadog_api_client/v2/api/entity_risk_scores_api.rb', line 29

def list_entity_risk_scores(opts = {})
  data, _status_code, _headers = list_entity_risk_scores_with_http_info(opts)
  data
end

#list_entity_risk_scores_with_http_info(opts = {}) ⇒ Array<(SecurityEntityRiskScoresResponse, Integer, Hash)>

List Entity Risk Scores.

Get a list of entity risk scores for your organization. Entity risk scores provide security risk assessment for entities like cloud resources, identities, or services based on detected signals, misconfigurations, and identity risks.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :from (Integer)

    Start time for the query in Unix timestamp (milliseconds). Defaults to 2 weeks ago.

  • :to (Integer)

    End time for the query in Unix timestamp (milliseconds). Defaults to now.

  • :page_size (Integer)

    Size of the page to return. Maximum is 1000.

  • :page_number (Integer)

    Page number to return (1-indexed).

  • :page_query_id (String)

    Query ID for pagination consistency.

  • :filter_sort (String)

    Sort order for results. Format: field:direction where direction is asc or desc. Supported fields: riskScore, lastDetected, firstDetected, entityName, signalsDetected.

  • :filter_query (String)

    Supports filtering by entity attributes, risk scores, severity, and more. Example: severity:critical AND entityType:aws_iam_user

  • :entity_type (Array<String>)

    Filter by entity type(s). Can specify multiple values.

Returns:



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/datadog_api_client/v2/api/entity_risk_scores_api.rb', line 48

def list_entity_risk_scores_with_http_info(opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.list_entity_risk_scores".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.list_entity_risk_scores")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.list_entity_risk_scores"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EntityRiskScoresAPI.list_entity_risk_scores ...'
  end
  # resource path
  local_var_path = '/api/v2/security-entities/risk-scores'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?
  query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?
  query_params[:'page[queryId]'] = opts[:'page_query_id'] if !opts[:'page_query_id'].nil?
  query_params[:'filter[sort]'] = opts[:'filter_sort'] if !opts[:'filter_sort'].nil?
  query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil?
  query_params[:'entityType'] = @api_client.build_collection_param(opts[:'entity_type'], :multi) if !opts[:'entity_type'].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] || 'SecurityEntityRiskScoresResponse'

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

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