Class: DatadogAPIClient::V2::BitsSecurityAnalystAPI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of BitsSecurityAnalystAPI.



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

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

Instance Attribute Details

#api_client ⇒ Object

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Instance Method Details

#count_security_agent_investigations(field, opts = {}) ⇒ Object

Count Bits Security Analyst investigations.



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

def count_security_agent_investigations(field, opts = {})
  data, _status_code, _headers = count_security_agent_investigations_with_http_info(field, opts)
  data
end

#count_security_agent_investigations_with_http_info(field, opts = {}) ⇒ Array<(SecurityAgentInvestigationCountsResponse, Integer, Hash)>

Count Bits Security Analyst investigations.

Count completed Bits Security Analyst investigations by the values of one field. Buckets are sorted by ascending count. With field=entity or field=signal_source, an investigation counts in the bucket of each of its entities or sources.

Parameters:

Options Hash (opts):

  • :filter_title (String) —

    Only investigations whose signal title contains this text, case-insensitive.

  • :filter_from (String) —

    Only investigations last updated at or after this time, as RFC 3339 or milliseconds since the epoch.

  • :filter_to (String) —

    Only investigations last updated at or before this time, as RFC 3339 or milliseconds since the epoch.

  • :filter_verdict (String) —

    Only investigations with one of these verdicts: benign, suspicious, or malicious. Comma-separated values; an investigation matches any of them.

  • :filter_rule_id (String) —

    Only investigations of signals from one of these detection rule IDs. Comma-separated values; an investigation matches any of them.

  • :filter_rule_type (String) —

    Only investigations of signals from detection rules of one of these types, as returned by the count with field=rule_type. Comma-separated values; an investigation matches any of them.

  • :filter_signal_severity (String) —

    Only investigations of signals with one of these severities: info, low, medium, high, or critical. Comma-separated values; an investigation matches any of them.

  • :filter_signal_source (String) —

    Only investigations of signals from one of these sources, as returned by the count with field=signal_source. Comma-separated values; an investigation matches any of them.

  • :filter_tags (String) —

    Only investigations whose signal has all of these tags, written key:value. Comma-separated values; an investigation must have every one of them.

  • :filter_entity (String) —

    Only investigations whose signal has all of these entities. Write each entity as attribute:value, matching the values returned by the count endpoint with field=entity. Comma-separated values; an investigation must have every one of them.

Returns:



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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/datadog_api_client/v2/api/bits_security_analyst_api.rb', line 53

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BitsSecurityAnalystAPI.count_security_agent_investigations ...'
  end
  # verify the required parameter 'field' is set
  if @api_client.config.client_side_validation && field.nil?
    fail ArgumentError, "Missing the required parameter 'field' when calling BitsSecurityAnalystAPI.count_security_agent_investigations"
  end
  # verify enum value
  allowable_values = ['verdict', 'rule_type', 'signal_source', 'entity']
  if @api_client.config.client_side_validation && !allowable_values.include?(field)
    fail ArgumentError, "invalid value for \"field\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/v2/security_monitoring/security_agent/investigations/count'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'field'] = field
  query_params[:'filter[title]'] = opts[:'filter_title'] if !opts[:'filter_title'].nil?
  query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?
  query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil?
  query_params[:'filter[verdict]'] = opts[:'filter_verdict'] if !opts[:'filter_verdict'].nil?
  query_params[:'filter[rule_id]'] = opts[:'filter_rule_id'] if !opts[:'filter_rule_id'].nil?
  query_params[:'filter[rule_type]'] = opts[:'filter_rule_type'] if !opts[:'filter_rule_type'].nil?
  query_params[:'filter[signal_severity]'] = opts[:'filter_signal_severity'] if !opts[:'filter_signal_severity'].nil?
  query_params[:'filter[signal_source]'] = opts[:'filter_signal_source'] if !opts[:'filter_signal_source'].nil?
  query_params[:'filter[tags]'] = opts[:'filter_tags'] if !opts[:'filter_tags'].nil?
  query_params[:'filter[entity]'] = opts[:'filter_entity'] if !opts[:'filter_entity'].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] || 'SecurityAgentInvestigationCountsResponse'

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

  new_options = opts.merge(
    :operation => :count_security_agent_investigations,
    :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"
  )

  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: BitsSecurityAnalystAPI#count_security_agent_investigations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_security_agent_investigation(investigation_id, opts = {}) ⇒ Object

Get a Bits Security Analyst investigation.



128
129
130
131
# File 'lib/datadog_api_client/v2/api/bits_security_analyst_api.rb', line 128

def get_security_agent_investigation(investigation_id, opts = {})
  data, _status_code, _headers = get_security_agent_investigation_with_http_info(investigation_id, opts)
  data
end

#get_security_agent_investigation_with_http_info(investigation_id, opts = {}) ⇒ Array<(SecurityAgentInvestigationResponse, Integer, Hash)>

Get a Bits Security Analyst investigation.

Get a Bits Security Analyst investigation by its ID, with its verdict, conclusion, evidence, steps, and response suggestions. While the investigation is running, the response has a Retry-After header.

Parameters:

  • investigation_id (String) —

    The ID of the investigation, as returned by the list.

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

    the optional parameters

Options Hash (opts):

Returns:



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/datadog_api_client/v2/api/bits_security_analyst_api.rb', line 142

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BitsSecurityAnalystAPI.get_security_agent_investigation ...'
  end
  # verify the required parameter 'investigation_id' is set
  if @api_client.config.client_side_validation && investigation_id.nil?
    fail ArgumentError, "Missing the required parameter 'investigation_id' when calling BitsSecurityAnalystAPI.get_security_agent_investigation"
  end
  # resource path
  local_var_path = '/api/v2/security_monitoring/security_agent/investigations/{investigation_id}'.sub('{investigation_id}', CGI.escape(investigation_id.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'fields[investigations]'] = @api_client.build_collection_param(opts[:'fields_investigations'], :csv) if !opts[:'fields_investigations'].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] || 'SecurityAgentInvestigationResponse'

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

  new_options = opts.merge(
    :operation => :get_security_agent_investigation,
    :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"
  )

  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: BitsSecurityAnalystAPI#get_security_agent_investigation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_security_agent_investigations(opts = {}) ⇒ Object

List Bits Security Analyst investigations.



202
203
204
205
# File 'lib/datadog_api_client/v2/api/bits_security_analyst_api.rb', line 202

def list_security_agent_investigations(opts = {})
  data, _status_code, _headers = list_security_agent_investigations_with_http_info(opts)
  data
end

#list_security_agent_investigations_with_http_info(opts = {}) ⇒ Array<(SecurityAgentInvestigationsListResponse, Integer, Hash)>

List Bits Security Analyst investigations.

List Bits Security Analyst investigations.

Without filter[signal_id], returns the latest investigation of each signal, filtered, sorted, and paginated. With filter[signal_id], returns every investigation of that signal, newest first. When the signal has no investigation, the first page carries meta.reason, which says why.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :filter_signal_id (String) —

    List every investigation of this signal, newest first. Accepts the signal ID in its V1 form, which starts with AQ, or in its longer V3 form, which starts with Aw. Investigations carry the V1 form, so their signal_id can differ from the ID you pass. Can't be combined with other filters or with sort.

  • :filter_title (String) —

    Only investigations whose signal title contains this text, case-insensitive.

  • :filter_from (String) —

    Only investigations last updated at or after this time, as RFC 3339 or milliseconds since the epoch.

  • :filter_to (String) —

    Only investigations last updated at or before this time, as RFC 3339 or milliseconds since the epoch.

  • :filter_verdict (String) —

    Only investigations with one of these verdicts: benign, suspicious, or malicious. Comma-separated values; an investigation matches any of them.

  • :filter_state (String) —

    Only investigations in one of these states: investigating or completed. Investigations reported as failed match investigating. Comma-separated values; an investigation matches any of them.

  • :filter_rule_id (String) —

    Only investigations of signals from one of these detection rule IDs. Comma-separated values; an investigation matches any of them.

  • :filter_rule_type (String) —

    Only investigations of signals from detection rules of one of these types, as returned by the count with field=rule_type. Comma-separated values; an investigation matches any of them.

  • :filter_signal_severity (String) —

    Only investigations of signals with one of these severities: info, low, medium, high, or critical. Comma-separated values; an investigation matches any of them.

  • :filter_signal_source (String) —

    Only investigations of signals from one of these sources, as returned by the count with field=signal_source. Comma-separated values; an investigation matches any of them.

  • :filter_tags (String) —

    Only investigations whose signal has all of these tags, written key:value. Comma-separated values; an investigation must have every one of them.

  • :filter_entity (String) —

    Only investigations whose signal has all of these entities. Write each entity as attribute:value, matching the values returned by the count endpoint with field=entity. Comma-separated values; an investigation must have every one of them.

  • :sort (String) —

    Sort field, prefixed with - for descending: updated_at, severity, verdict, rule_id, or signal_title. Defaults to -updated_at. verdict sorts by severity (benign, suspicious, malicious), so -verdict puts malicious first.

  • :page_number (Integer) —

    Page number, starting at 1.

  • :page_size (Integer) —

    Number of investigations per page.

Returns:



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/datadog_api_client/v2/api/bits_security_analyst_api.rb', line 232

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BitsSecurityAnalystAPI.list_security_agent_investigations ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page_number'].nil? && opts[:'page_number'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_number"]" when calling BitsSecurityAnalystAPI.list_security_agent_investigations, must be greater than or equal to 1.'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling BitsSecurityAnalystAPI.list_security_agent_investigations, must be smaller than or equal to 100.'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling BitsSecurityAnalystAPI.list_security_agent_investigations, must be greater than or equal to 1.'
  end
  # resource path
  local_var_path = '/api/v2/security_monitoring/security_agent/investigations'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'filter[signal_id]'] = opts[:'filter_signal_id'] if !opts[:'filter_signal_id'].nil?
  query_params[:'filter[title]'] = opts[:'filter_title'] if !opts[:'filter_title'].nil?
  query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil?
  query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil?
  query_params[:'filter[verdict]'] = opts[:'filter_verdict'] if !opts[:'filter_verdict'].nil?
  query_params[:'filter[state]'] = opts[:'filter_state'] if !opts[:'filter_state'].nil?
  query_params[:'filter[rule_id]'] = opts[:'filter_rule_id'] if !opts[:'filter_rule_id'].nil?
  query_params[:'filter[rule_type]'] = opts[:'filter_rule_type'] if !opts[:'filter_rule_type'].nil?
  query_params[:'filter[signal_severity]'] = opts[:'filter_signal_severity'] if !opts[:'filter_signal_severity'].nil?
  query_params[:'filter[signal_source]'] = opts[:'filter_signal_source'] if !opts[:'filter_signal_source'].nil?
  query_params[:'filter[tags]'] = opts[:'filter_tags'] if !opts[:'filter_tags'].nil?
  query_params[:'filter[entity]'] = opts[:'filter_entity'] if !opts[:'filter_entity'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'page[number]'] = opts[:'page_number'] if !opts[:'page_number'].nil?
  query_params[:'page[size]'] = opts[:'page_size'] if !opts[:'page_size'].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] || 'SecurityAgentInvestigationsListResponse'

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

  new_options = opts.merge(
    :operation => :list_security_agent_investigations,
    :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"
  )

  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: BitsSecurityAnalystAPI#list_security_agent_investigations\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end