Class: DatadogAPIClient::V2::CSMOwnershipAPI

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of CSMOwnershipAPI.



22
23
24
# File 'lib/datadog_api_client/v2/api/csm_ownership_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/csm_ownership_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

#create_ownership_feedback(resource_id, owner_type, body, opts = {}) ⇒ Object

Submit feedback on an ownership inference.



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

def create_ownership_feedback(resource_id, owner_type, body, opts = {})
  data, _status_code, _headers = create_ownership_feedback_with_http_info(resource_id, owner_type, body, opts)
  data
end

#create_ownership_feedback_with_http_info(resource_id, owner_type, body, opts = {}) ⇒ Array<(OwnershipFeedbackResponse, Integer, Hash)>

Submit feedback on an ownership inference.

Submit feedback on the current ownership inference for a resource and owner type. Valid actions are confirm, reject, correct, and persist.

The request must include the current inference checksum in inference_checksum. If the checksum does not match the current inference state, the endpoint returns 409 Conflict.

When action is correct, corrected_owner_handle and corrected_owner_type are required.

Parameters:

  • resource_id (String)

    The identifier of the resource that the feedback applies to.

  • owner_type (OwnershipOwnerType)

    The type of owner that the feedback applies to.

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

    the optional parameters

Returns:

  • (Array<(OwnershipFeedbackResponse, Integer, Hash)>)

    OwnershipFeedbackResponse data, response status code and response headers



47
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
108
109
110
111
112
113
114
115
116
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 47

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.create_ownership_feedback ...'
  end
  # verify the required parameter 'resource_id' is set
  if @api_client.config.client_side_validation && resource_id.nil?
    fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.create_ownership_feedback"
  end
  # verify the required parameter 'owner_type' is set
  if @api_client.config.client_side_validation && owner_type.nil?
    fail ArgumentError, "Missing the required parameter 'owner_type' when calling CSMOwnershipAPI.create_ownership_feedback"
  end
  # verify enum value
  allowable_values = ['user', 'team', 'service', 'unknown']
  if @api_client.config.client_side_validation && !allowable_values.include?(owner_type)
    fail ArgumentError, "invalid value for \"owner_type\", must be one of #{allowable_values}"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling CSMOwnershipAPI.create_ownership_feedback"
  end
  # resource path
  local_var_path = '/api/v2/csm/ownership/{resource_id}/{owner_type}/feedback'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')).sub('{owner_type}', CGI.escape(owner_type.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type] || 'OwnershipFeedbackResponse'

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

  new_options = opts.merge(
    :operation => :create_ownership_feedback,
    :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::Post, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CSMOwnershipAPI#create_ownership_feedback\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_ownership_evidence(resource_id, owner_type, opts = {}) ⇒ Object

Get the evidence for an ownership inference.



121
122
123
124
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 121

def get_ownership_evidence(resource_id, owner_type, opts = {})
  data, _status_code, _headers = get_ownership_evidence_with_http_info(resource_id, owner_type, opts)
  data
end

#get_ownership_evidence_with_http_info(resource_id, owner_type, opts = {}) ⇒ Array<(OwnershipEvidenceResponse, Integer, Hash)>

Get the evidence for an ownership inference.

Get the evidence versions backing the current ownership inference for a resource and owner type.

This endpoint supports weak ETag caching. Pass the previously returned ETag value in the If-None-Match request header to receive a 304 Not Modified response when the evidence has not changed.

Parameters:

  • resource_id (String)

    The identifier of the resource to retrieve evidence for.

  • owner_type (OwnershipOwnerType)

    The owner type of the inference to retrieve evidence for.

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

    the optional parameters

Options Hash (opts):

  • :if_none_match (String)

    A previously returned weak ETag value. When supplied and the evidence has not changed, the endpoint returns 304 Not Modified.

Returns:

  • (Array<(OwnershipEvidenceResponse, Integer, Hash)>)

    OwnershipEvidenceResponse data, response status code and response headers



137
138
139
140
141
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
198
199
200
201
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 137

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.get_ownership_evidence ...'
  end
  # verify the required parameter 'resource_id' is set
  if @api_client.config.client_side_validation && resource_id.nil?
    fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.get_ownership_evidence"
  end
  # verify the required parameter 'owner_type' is set
  if @api_client.config.client_side_validation && owner_type.nil?
    fail ArgumentError, "Missing the required parameter 'owner_type' when calling CSMOwnershipAPI.get_ownership_evidence"
  end
  # verify enum value
  allowable_values = ['user', 'team', 'service', 'unknown']
  if @api_client.config.client_side_validation && !allowable_values.include?(owner_type)
    fail ArgumentError, "invalid value for \"owner_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/v2/csm/ownership/{resource_id}/{owner_type}/evidence'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')).sub('{owner_type}', CGI.escape(owner_type.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params['If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OwnershipEvidenceResponse'

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

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

#get_ownership_inference(resource_id, owner_type, opts = {}) ⇒ Object

Get an ownership inference by owner type.



206
207
208
209
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 206

def get_ownership_inference(resource_id, owner_type, opts = {})
  data, _status_code, _headers = get_ownership_inference_with_http_info(resource_id, owner_type, opts)
  data
end

#get_ownership_inference_with_http_info(resource_id, owner_type, opts = {}) ⇒ Array<(OwnershipInferenceResponse, Integer, Hash)>

Get an ownership inference by owner type.

Get the current ownership inference for a resource for a specific owner type.

This endpoint supports ETag-based caching. Pass the previously returned ETag value in the If-None-Match request header to receive a 304 Not Modified response when the inference has not changed.

Parameters:

  • resource_id (String)

    The identifier of the resource to retrieve the ownership inference for.

  • owner_type (OwnershipOwnerType)

    The owner type of the inference to retrieve.

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

    the optional parameters

Options Hash (opts):

  • :if_none_match (String)

    A previously returned ETag value. When supplied and the resource has not changed, the endpoint returns 304 Not Modified.

Returns:

  • (Array<(OwnershipInferenceResponse, Integer, Hash)>)

    OwnershipInferenceResponse data, response status code and response headers



222
223
224
225
226
227
228
229
230
231
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
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 222

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.get_ownership_inference ...'
  end
  # verify the required parameter 'resource_id' is set
  if @api_client.config.client_side_validation && resource_id.nil?
    fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.get_ownership_inference"
  end
  # verify the required parameter 'owner_type' is set
  if @api_client.config.client_side_validation && owner_type.nil?
    fail ArgumentError, "Missing the required parameter 'owner_type' when calling CSMOwnershipAPI.get_ownership_inference"
  end
  # verify enum value
  allowable_values = ['user', 'team', 'service', 'unknown']
  if @api_client.config.client_side_validation && !allowable_values.include?(owner_type)
    fail ArgumentError, "invalid value for \"owner_type\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/api/v2/csm/ownership/{resource_id}/{owner_type}'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')).sub('{owner_type}', CGI.escape(owner_type.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params['If-None-Match'] = opts[:'if_none_match'] if !opts[:'if_none_match'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OwnershipInferenceResponse'

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

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

#list_ownership_history(resource_id, opts = {}) ⇒ Object

List ownership inference history for a resource.



291
292
293
294
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 291

def list_ownership_history(resource_id, opts = {})
  data, _status_code, _headers = list_ownership_history_with_http_info(resource_id, opts)
  data
end

#list_ownership_history_by_owner_type(resource_id, owner_type, opts = {}) ⇒ Object

List ownership history by owner type.



372
373
374
375
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 372

def list_ownership_history_by_owner_type(resource_id, owner_type, opts = {})
  data, _status_code, _headers = list_ownership_history_by_owner_type_with_http_info(resource_id, owner_type, opts)
  data
end

#list_ownership_history_by_owner_type_with_http_info(resource_id, owner_type, opts = {}) ⇒ Array<(OwnershipHistoryResponse, Integer, Hash)>

List ownership history by owner type.

List inference history entries for a resource filtered by owner type, ordered from most recent to oldest. Uses cursor-based pagination.

Parameters:

  • resource_id (String)

    The identifier of the resource to retrieve inference history for.

  • owner_type (OwnershipOwnerType)

    The owner type to filter history by.

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

    the optional parameters

Options Hash (opts):

  • :cursor (String)

    An opaque, base64-encoded cursor token returned by a previous call in pagination.next_cursor. Omit to fetch the first page.

  • :limit (Integer)

    The maximum number of history entries to return per page.

Returns:

  • (Array<(OwnershipHistoryResponse, Integer, Hash)>)

    OwnershipHistoryResponse data, response status code and response headers



387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 387

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.list_ownership_history_by_owner_type ...'
  end
  # verify the required parameter 'resource_id' is set
  if @api_client.config.client_side_validation && resource_id.nil?
    fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.list_ownership_history_by_owner_type"
  end
  # verify the required parameter 'owner_type' is set
  if @api_client.config.client_side_validation && owner_type.nil?
    fail ArgumentError, "Missing the required parameter 'owner_type' when calling CSMOwnershipAPI.list_ownership_history_by_owner_type"
  end
  # verify enum value
  allowable_values = ['user', 'team', 'service', 'unknown']
  if @api_client.config.client_side_validation && !allowable_values.include?(owner_type)
    fail ArgumentError, "invalid value for \"owner_type\", must be one of #{allowable_values}"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CSMOwnershipAPI.list_ownership_history_by_owner_type, must be smaller than or equal to 100.'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CSMOwnershipAPI.list_ownership_history_by_owner_type, must be greater than or equal to 1.'
  end
  # resource path
  local_var_path = '/api/v2/csm/ownership/{resource_id}/{owner_type}/history'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/')).sub('{owner_type}', CGI.escape(owner_type.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'OwnershipHistoryResponse'

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

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

#list_ownership_history_with_http_info(resource_id, opts = {}) ⇒ Array<(OwnershipHistoryResponse, Integer, Hash)>

List ownership inference history for a resource.

List inference history entries for a resource across all owner types, ordered from most recent to oldest. Uses cursor-based pagination.

Parameters:

  • resource_id (String)

    The identifier of the resource to retrieve inference history for.

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

    the optional parameters

Options Hash (opts):

  • :cursor (String)

    An opaque, base64-encoded cursor token returned by a previous call in pagination.next_cursor. Omit to fetch the first page.

  • :limit (Integer)

    The maximum number of history entries to return per page.

Returns:

  • (Array<(OwnershipHistoryResponse, Integer, Hash)>)

    OwnershipHistoryResponse data, response status code and response headers



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 305

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

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CSMOwnershipAPI.list_ownership_history ...'
  end
  # verify the required parameter 'resource_id' is set
  if @api_client.config.client_side_validation && resource_id.nil?
    fail ArgumentError, "Missing the required parameter 'resource_id' when calling CSMOwnershipAPI.list_ownership_history"
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CSMOwnershipAPI.list_ownership_history, must be smaller than or equal to 100.'
  end
  if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1
    fail ArgumentError, 'invalid value for "opts[:"limit"]" when calling CSMOwnershipAPI.list_ownership_history, must be greater than or equal to 1.'
  end
  # resource path
  local_var_path = '/api/v2/csm/ownership/{resource_id}/history'.sub('{resource_id}', CGI.escape(resource_id.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].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] || 'OwnershipHistoryResponse'

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

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

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

#list_ownership_inferences(resource_id, opts = {}) ⇒ Object

List ownership inferences for a resource.



463
464
465
466
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 463

def list_ownership_inferences(resource_id, opts = {})
  data, _status_code, _headers = list_ownership_inferences_with_http_info(resource_id, opts)
  data
end

#list_ownership_inferences_with_http_info(resource_id, opts = {}) ⇒ Array<(OwnershipInferenceListResponse, Integer, Hash)>

List ownership inferences for a resource.

Get all current ownership inferences for a resource, one per owner type (user, team, service, unknown).

Parameters:

  • resource_id (String)

    The identifier of the resource to retrieve ownership inferences for.

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

    the optional parameters

Returns:



475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
# File 'lib/datadog_api_client/v2/api/csm_ownership_api.rb', line 475

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

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

  # query parameters
  query_params = opts[:query_params] || {}

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

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

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